-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMiningScreenLocalAggregatorBoard.json
199 lines (199 loc) · 29.3 KB
/
MiningScreenLocalAggregatorBoard.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
{
"slots": {
"0": {
"name": "Screen",
"type": {
"events": [],
"methods": []
}
},
"1": {
"name": "Memory",
"type": {
"events": [],
"methods": []
}
},
"2": {
"name": "Receiver",
"type": {
"events": [],
"methods": []
}
},
"3": {
"name": "Emitter",
"type": {
"events": [],
"methods": []
}
},
"4": {
"name": "slot5",
"type": {
"events": [],
"methods": []
}
},
"5": {
"name": "slot6",
"type": {
"events": [],
"methods": []
}
},
"6": {
"name": "slot7",
"type": {
"events": [],
"methods": []
}
},
"7": {
"name": "slot8",
"type": {
"events": [],
"methods": []
}
},
"8": {
"name": "slot9",
"type": {
"events": [],
"methods": []
}
},
"9": {
"name": "slot10",
"type": {
"events": [],
"methods": []
}
},
"-1": {
"name": "unit",
"type": {
"events": [],
"methods": []
}
},
"-3": {
"name": "player",
"type": {
"events": [],
"methods": []
}
},
"-2": {
"name": "construct",
"type": {
"events": [],
"methods": []
}
},
"-4": {
"name": "system",
"type": {
"events": [],
"methods": []
}
},
"-5": {
"name": "library",
"type": {
"events": [],
"methods": []
}
}
},
"handlers": [
{
"code": "CurrentConstructID = Screen.getScriptOutput()\n\nfor key,value in pairs(MasterTable) do\n if value.ConstructID == CurrentConstructID then\n system.setWaypoint(value.PosString, true)\n end\nend",
"filter": {
"args": [
{
"variable": "*"
}
],
"signature": "onOutputChanged(output)",
"slotKey": "0"
},
"key": "0"
},
{
"code": "system.print(\"Received\")\nsystem.print(channel)\nsystem.print(message)\n\nif channel == \"MiningScreen\" then\n UpdateMemory(message)\nend\n\nif not Emitter then\n if channel == \"ChunkCount\" then\n ChunkCount = tonumber(message);\n Received = \"\";\n CurrentChunk = 0;\n end\n\n if (channel == \"Chunks\" and ChunkCount > 0) then\n CurrentChunk = CurrentChunk + 1;\n Received = Received .. message;\n end\n\n if (ChunkCount == CurrentChunk) and ChunkCount then\n ChunkCount = 0\n Memory.setStringValue(\"MasterTable\",Received)\n end\nend",
"filter": {
"args": [
{
"variable": "*"
},
{
"variable": "*"
}
],
"signature": "onReceived(channel,message)",
"slotKey": "2"
},
"key": "1"
},
{
"code": "-- Splits String at Delimiter --\nfunction mysplit(inputstr, sep)\n if sep == nil then\n sep = \"%s\"\n end\n local t={}\n for str in string.gmatch(inputstr, \"([^\"..sep..\"]+)\") do\n table.insert(t, str)\n end\n return t\nend\n\n-- Rounds Number to Precision --\nfunction round(num, numDecimalPlaces)\n local mult = 10^(numDecimalPlaces or 0)\n return math.floor(num * mult + 0.5) / mult\nend\n\n-- Update Memory --\nfunction UpdateMemory(Payload)\n if Payload ~= nil and Payload ~= '' then\n\n PayloadType = mysplit(Payload, \"&\") \n\n Info = mysplit(PayloadType[1], \"$\")\n StorageTime = tonumber(Info[1])\n Vol = tonumber(Info[2])\n Mass = tonumber(Info[3])\n CalibrationTime = tonumber(Info[4])\n CDTime = Info[5]\n ConstructName = Info[6]\n ConstructPos = Info[7]\n ReceivedTime = tonumber(Info[8])\n ConstructID = Info[9]\n\n system.print(\"Payload\")\n system.print(tostring(PayloadType[1]))\n\n if PayloadType[2] ~= nil and PayloadType[2] ~= '' then\n\n DataRows = mysplit(PayloadType[2], \"#\") \n DataTable = {}\n for idx, v in ipairs(DataRows) do\n CurrentRow = mysplit(v, \"$\") \n DataTable[CurrentRow[1]] = tonumber(CurrentRow[2])\n end\n\n end\n\n Memory.clearValue(ConstructID)\n\n CurrentDataTable = '#'\n for ore,value in pairs(DataTable) do\n CurrentDataTable = CurrentDataTable .. '@' .. ore .. '$' .. value\n end\n\n CurrentRow = StorageTime .. '$' ..\n Vol .. '$' ..\n Mass .. '$' ..\n CalibrationTime .. '$' ..\n CDTime .. '$' ..\n ConstructName .. '$' ..\n ConstructPos .. '$' ..\n tostring(ReceivedTime) ..\n CurrentDataTable\n \n Memory.setStringValue(ConstructID,CurrentRow) \n\n end\nend\n\n-- Loads TableX --\ntablex = require(\"pl/tablex\")\n\n-- Load Master Table --\nfunction LoadMasterTable()\n \n if Memory.hasKey(\"MasterTable\") == 1 then\n MasterTable = {}\n MasterTable = json.decode(Memory.getStringValue(\"MasterTable\"))\n \n else\n MasterTable = {}\n KeyCount = Memory.getNbKeys()\n\n if KeyCount ~= nil and KeyCount > 0 then\n\n Keys = Memory.getKeyList()\n\n --system.print(json.encode(Keys))\n\n for ii = 1,KeyCount do\n\n if Keys[ii] ~= nil and Keys[ii] ~= '' then\n\n data = Memory.getStringValue(Keys[ii]) \n\n --system.print(data)\n\n local DataType = mysplit(data, \"#\") \n local DataTable = {}\n local OreType = mysplit(DataType[2],'@')\n\n for oreidx, oredata in ipairs(OreType) do\n CurrentOre = mysplit(oredata,'$')\n DataTable[CurrentOre[1]] = tonumber(CurrentOre[2])\n end\n\n local DataSplit = mysplit(DataType[1], \"$\") \n\n MasterTable[ii] = {\n ConstructID = Keys[ii],\n ConstructName = DataSplit[6],\n Mass = tonumber(DataSplit[3]), \n Vol = tonumber(DataSplit[2]), \n StorageTime = tonumber(DataSplit[1]), \n CalibrationTime = tonumber(DataSplit[4]),\n CDTime = tonumber(DataSplit[5]),\n PosString = \"::pos{0,0,\" .. DataSplit[7] .. \"}\",\n LastUpdated = tonumber(DataSplit[8]),\n DataTable = DataTable\n }\n\n end\n\n end\n\n end\n\n end\n\nend\n\nunit.setTimer('Update',1)",
"filter": {
"args": [],
"signature": "onStart()",
"slotKey": "-1"
},
"key": "2"
},
{
"code": "unit.setTimer('Update',5)\nLoadMasterTable()\n\n--system.print(\"MasterTable\")\n--system.print(json.encode(MasterTable))\n\nSortTable = {}\nOreDataTable = {}\n\nfor k,v in ipairs(MasterTable) do\n \n SortTable[k] = tonumber(v.CalibrationTime)\n --math.min(tonumber(v.StorageTime), tonumber(v.CalibrationTime), tonumber(v.CDTime))\n \n for ore, rate in pairs(v.DataTable) do\n Old = OreDataTable[ore] or 0\n OreDataTable[ore] = Old + rate\n end\n \nend\n\nConstructsText = ''\nfor k,v in tablex.sortv(SortTable) do\n \n StorageEstimate = round(tonumber(MasterTable[k].StorageTime)\n - (system.getArkTime()-tonumber(MasterTable[k].LastUpdated))/60/60,2)\n \n CalibrationEstimate = round(tonumber(MasterTable[k].CalibrationTime)\n - (system.getArkTime()-tonumber(MasterTable[k].LastUpdated))/24/60/60,2)\n \n CooldownEstimate = round(tonumber(MasterTable[k].CDTime)\n - (system.getArkTime()-tonumber(MasterTable[k].LastUpdated))/60/60,2)\n \n MassRate = 0\n VolumeRate = 0\n \n for ore, rate in pairs(MasterTable[k].DataTable) do\n \n VolumeRate = VolumeRate + rate\n \n OreStats = system.getItem(ore)\n MassRate = MassRate + rate*OreStats.unitMass\n \n end\n \n MassEstimate = round(tonumber(MasterTable[k].Mass)\n + MassRate*(system.getArkTime()-tonumber(MasterTable[k].LastUpdated))/60/60,2)\n \n VolEstimate = round(tonumber(MasterTable[k].Vol)\n + VolumeRate*(system.getArkTime()-tonumber(MasterTable[k].LastUpdated))/60/60,2)\n \n CurrentRow = \"#\" .. \n \"$\" .. MasterTable[k].ConstructName ..\n \"$\" .. MassEstimate ..\n \"$\" .. VolEstimate ..\n \"$\" .. StorageEstimate ..\n \"$\" .. CalibrationEstimate ..\n \"$\" .. CooldownEstimate ..\n \"$\" .. MasterTable[k].ConstructID\n \n ConstructsText = ConstructsText .. CurrentRow\nend \n\nOreText = '' \nfor k,v in pairs(OreDataTable) do\n CurrentRow = \"#\" .. \n \"$\" .. k ..\n \"$\" .. OreDataTable[k]\n\n OreText = OreText .. CurrentRow\nend \n\nMessage = ConstructsText .. \"&\" .. OreText\nScreen.setScriptInput(Message)",
"filter": {
"args": [
{
"value": "Update"
}
],
"signature": "onTimer(tag)",
"slotKey": "-1"
},
"key": "3"
},
{
"code": "ChunkIndex = ChunkIndex + 1;\nCurrentChunk = EmitterMessage:sub((ChunkIndex-1)*500 + 1, ChunkIndex*500);\nEmitter.send(\"Chunks\",CurrentChunk);\nif ChunkIndex == ChunkCount then\n unit.stopTimer(\"Send\");\nend\n",
"filter": {
"args": [
{
"value": "Send"
}
],
"signature": "onTimer(tag)",
"slotKey": "-1"
},
"key": "4"
},
{
"code": "Screen.setRenderScript([[\n--------------------------------------------------- Creates the Screen Background Effects ----------------------------------------------------(1)\nlocal function Background(Logo,Aura0,Aura1,r,g,b,ar,ag,ab)\n \n local rx, ry = getResolution()\n local vw = rx/100\n local vh = ry/100\n\n --- Main Color ---\n local r = r or 0\n local g = g or 0.2\n local b = b or 0.8\n \n --- Accent Color ---\n local ar = ar or 0\n local ag = ag or 0.4\n local ab = ab or 0.8\n\n setBackgroundColor(0.05*r,0.05*g,0.05*b)\n\n for ii = 3,165,8 do\n setNextStrokeColor(Aura0,r,g,b,0.05)\n setNextStrokeWidth(Aura0,0.05*vh)\n addLine(Aura0,ii*vh,0,ii*vh,ry)\n end\n\n for ii = 6,98,8 do\n setNextStrokeColor(Aura0,r,g,b,0.05) \n setNextStrokeWidth(Aura0,0.05*vh)\n addLine(Aura0,0,ii*vh,rx,ii*vh)\n end\n\n local PX = {0,1}\n local PY = {0.03,0.03}\n\n for ii = 1,#PX-1,1 do\n setNextStrokeColor(Aura1,ar,ag,ab, 1) \n addLine(Aura1, PX[ii]*rx, PY[ii]*ry, PX[ii+1]*rx, PY[ii+1]*ry) \n end\n\n for ii = 1,#PX-1,1 do\n setNextStrokeColor(Aura1,ar,ag,ab, 1) \n addLine(Aura1, PX[ii]*rx, ry-PY[ii]*ry, PX[ii+1]*rx, ry-PY[ii+1]*ry) \n end\n\nend\n\n--------------------------------------------------- Horizontal Bar Chart for Ore Output ----------------------------------------------------(1)\n\nfunction BarChart(layer,Font,X,Y,Data,n,r,g,b,sx,sy)\n \n local rx, ry = getResolution()\n local vw = rx/100\n local vh = ry/100\n \n local xwidth = sx/n\n local xmargin = xwidth*0.1\n \n local ywidth = sy/#Data\n local ymargin = ywidth*0.1 \n\n for ii = 1,#Data,1 do \n \n local r,g,b = table.unpack(OreTable[ OreTierOrder[ii] ].color)\n \n local Height = math.ceil(n*Data[ii]/TotalOut)\n\n for jj = 1,Height,1 do\n setNextFillColor(layer,r/255,g/255,b/255,1)\n addQuad(layer, \n X + (jj-1)*xwidth + xmargin,\n Y + (ii-1)*ywidth + ymargin, \n X + jj*xwidth - xmargin,\n Y + (ii-1)*ywidth + ymargin, \n X + jj*xwidth - xmargin,\n Y + ii*ywidth - ymargin, \n X + (jj-1)*xwidth + xmargin,\n Y + ii*ywidth - ymargin\n )\n end\n \n for jj = math.max(Height,1),n,1 do\n \n if Height == 0 then\n setNextFillColor(layer,r/255,g/255,b/255,0.05)\n else\n setNextFillColor(layer,r/255,g/255,b/255,0.1)\n end\n \n addQuad(layer, \n X + (jj-1)*xwidth + xmargin,\n Y + (ii-1)*ywidth + ymargin, \n X + jj*xwidth - xmargin,\n Y + (ii-1)*ywidth + ymargin, \n X + jj*xwidth - xmargin,\n Y + ii*ywidth - ymargin, \n X + (jj-1)*xwidth + xmargin,\n Y + ii*ywidth - ymargin\n )\n end\n \n setNextTextAlign(layer, AlignH_Left, AlignV_Middle)\n if Height == 0 then\n setNextFillColor(layer,r/255,g/255,b/255,0.1)\n else\n setNextFillColor(layer,r/255,g/255,b/255,1)\n end\n setFontSize(Font,3*vh)\n addText(layer, Font, \" \" .. round(tonumber(Data[ii]),1) .. \" L/H\", X + sx, Y + (ii - 0.5)*ywidth) \n \n setNextTextAlign(layer, AlignH_Right, AlignV_Middle)\n if Height == 0 then\n setNextFillColor(layer,r/255,g/255,b/255,0.1)\n else\n setNextFillColor(layer,r/255,g/255,b/255,1)\n end\n setFontSize(Font,3*vh)\n addText(layer, Font, OreTable[ OreTierOrder[ii] ].displayNameWithSize .. \" \", X, Y + (ii - 0.5)*ywidth) \n\n end\n\nend\n\n------------------------------------------------------------ General Helpers -----------------------------------------------------------------(10)\n\n--- Splits String at Delimiter ---\nfunction mysplit(inputstr, sep)\n if sep == nil then\n sep = \"%s\"\n end\n local t={}\n for str in string.gmatch(inputstr, \"([^\"..sep..\"]+)\") do\n table.insert(t, str)\n end\n return t\nend\n\n--- Rounds Number to Precision ---\nfunction round(num, numDecimalPlaces)\n local mult = 10^(numDecimalPlaces or 0)\n return math.floor(num * mult + 0.5) / mult\nend\n\n--- Word Wrap ---\nlocal function wrap(str, limit)\n \n local Lines, here, limit = {}, 1, limit or 72\n \n if str:find(\"(%s+)()(%S+)()\") ~= nil then\n \n Lines[1] = string.sub(str,1,str:find(\"(%s+)()(%S+)()\")-1) -- Put the first word of the string in the first index of the table.\n\n str:gsub(\"(%s+)()(%S+)()\",\n function(sp, st, word, fi) -- Function gets called once for every space found.\n if fi-here > limit then\n here = st\n Lines[#Lines+1] = word -- If at the end of a line, start a new table index...\n else Lines[#Lines] = Lines[#Lines]..\" \"..word end -- ... otherwise add to the current table index.\n end)\n else\n Lines[1] = str\n end\n\n return Lines\nend\n------------------------------------------------------------ Reference Tables -----------------------------------------------------------------(11)\n\nOreTable = { \n [\"4234772167\"]={color={255,255,129},displayNameWithSize=\"Hematite\",iconPath=\"resources_generated/env/voxel/ore/iron-ore/icons/env_iron-ore_icon.png\"},\n [\"3724036288\"]={color={159,209,255},displayNameWithSize=\"Quartz\",iconPath=\"resources_generated/env/voxel/ore/silicon-ore/icons/env_silicon-ore_icon.png\"},\n [\"299255727\"]={color={192,255,255},displayNameWithSize=\"Coal\",iconPath=\"resources_generated/env/voxel/ore/carbon-ore/icons/env_carbon-ore_icon.png\"},\n [\"262147665\"]={color={255,188,68},displayNameWithSize=\"Bauxite\",iconPath=\"resources_generated/env/voxel/ore/aluminium-ore/icons/env_aluminium-ore_icon.png\"},\n \n [\"2289641763\"]={color={70,255,197},displayNameWithSize=\"Malachite\",iconPath=\"resources_generated/env/voxel/ore/copper-ore/icons/env_copper-ore_icon.png\"},\n [\"3086347393\"]={color={255,128,88},displayNameWithSize=\"Limestone\",iconPath=\"resources_generated/env/voxel/ore/calcium-ore/icons/env_calcium-ore_icon.png\"},\n [\"2029139010\"]={color={129,255,129},displayNameWithSize=\"Chromite\",iconPath=\"resources_generated/env/voxel/ore/chromium-ore/icons/env_chromium-ore_icon.png\"},\n [\"343766315\"]={color={255,139,157},displayNameWithSize=\"Natron\",iconPath=\"resources_generated/env/voxel/ore/sodium-ore/icons/env_sodium-ore_icon.png\"},\n \n [\"4041459743\"]={color={74,255,74},displayNameWithSize=\"Pyrite\",iconPath=\"resources_generated/env/voxel/ore/sulfur-ore/icons/env_sulfur-ore_icon.png\"}, \n [\"3837858336\"]={color={108,255,255},displayNameWithSize=\"Petalite\",iconPath=\"resources_generated/env/voxel/ore/lithium-ore/icons/env_lithium-ore_icon.png\"}, \n [\"1050500112\"]={color={75,255,166},displayNameWithSize=\"Acanthite\",iconPath=\"resources_generated/env/voxel/ore/silver-ore/icons/env_silver-ore_icon.png\"},\n [\"1065079614\"]={color={255,148,124},displayNameWithSize=\"Garnierite\",iconPath=\"resources_generated/env/voxel/ore/nickel-ore/icons/env_nickel-ore_icon.png\"},\n \n [\"1866812055\"]={color={255,103,63},displayNameWithSize=\"Gold Nuggets\",iconPath=\"resources_generated/env/voxel/ore/gold-ore/icons/env_gold-ore_icon.png\"},\n [\"271971371\"]={color={255,166,104},displayNameWithSize=\"Kolbeckite\",iconPath=\"resources_generated/env/voxel/ore/scandium-ore/icons/env_scandium-ore_icon.png\"},\n [\"3546085401\"]={color={255,132,79},displayNameWithSize=\"Cobaltite\",iconPath=\"resources_generated/env/voxel/ore/cobalt-ore/icons/env_cobalt-ore_icon.png\"},\n [\"1467310917\"]={color={168,255,73},displayNameWithSize=\"Cryolite\",iconPath=\"resources_generated/env/voxel/ore/fluorine-ore/icons/env_fluorine-ore_icon.png\"},\n \n [\"3934774987\"]={color={90,206,255},displayNameWithSize=\"Rhodonite\",iconPath=\"resources_generated/env/voxel/ore/manganese-ore/icons/env_manganese-ore_icon.png\"},\n [\"629636034\"]={color={255,203,255},displayNameWithSize=\"Ilmenite\",iconPath=\"resources_generated/env/voxel/ore/titanium-ore/icons/env_titanium-ore_icon.png\"},\n [\"2162350405\"]={color={184,184,255},displayNameWithSize=\"Vanadinite\",iconPath=\"resources_generated/env/voxel/ore/vanadium-ore/icons/env_vanadium-ore_icon.png\"}, \n [\"789110817\"]={color={231,229,74},displayNameWithSize=\"Columbite\",iconPath=\"resources_generated/env/voxel/ore/niobium-ore/icons/env_niobium-ore_icon.png\"}\n}\n\nOreTierOrder = {\"4234772167\",\"3724036288\",\"299255727\",\"262147665\",\"2289641763\",\"3086347393\",\"2029139010\",\"343766315\",\"4041459743\",\"3837858336\",\"1050500112\",\"1065079614\",\"1866812055\",\"271971371\",\"3546085401\",\"1467310917\",\"3934774987\",\"629636034\",\"2162350405\",\"789110817\"}\n\n--------------------------------------------------------------------------------------------------------------------------------------------------\n--------------------------------------------------------------- Compose --------------------------------------------------------------------------\n--------------------------------------------------------------------------------------------------------------------------------------------------\n\nlocal rx, ry = getResolution()\nlocal vw = rx/100\nlocal vh = ry/100\n\nlocal Logo = createLayer()\nlocal Aura0 = createLayer()\nlocal Aura1 = createLayer()\nlocal Back = createLayer()\nlocal Center = createLayer()\nlocal Front = createLayer()\nlocal Top = createLayer()\n\nlocal Font = loadFont(getAvailableFontName(5), 6*vh)\n\nif not _init then\n\n ConstructTable = {}\n TotalOut = 100\n \n _init = true\n \nend\n\njson = require('dkjson')\n\nPayload = getInput()\n\nlogMessage(Payload)\n\nif Payload ~= nil and Payload ~= '' then\n \n PayloadType = mysplit(Payload, \"&\") \n \n if PayloadType[1] ~= nil and PayloadType[1] ~= '' then\n \n ConstructRows = mysplit(PayloadType[1], \"#\") \n ConstructTable = {}\n for idx, v in ipairs(ConstructRows) do\n CurrentRow = mysplit(v, \"$\") \n ConstructTable[idx] = {\n Name = CurrentRow[1],\n Mass = CurrentRow[2],\n Vol = CurrentRow[3],\n StorageTime = CurrentRow[4],\n CalibrationTime = CurrentRow[5],\n CDTime = CurrentRow[6],\n ID = CurrentRow[7]\n }\n end\n \n end\n \n ------\n\n if PayloadType[2] ~= nil and PayloadType[2] ~= '' then\n \n DataRows = mysplit(PayloadType[2], \"#\") \n DataTable = {}\n \n TotalOut = 0\n for idx, v in ipairs(DataRows) do\n CurrentRow = mysplit(v, \"$\") \n DataTable[ CurrentRow[1] ] = tonumber(CurrentRow[2])\n TotalOut = TotalOut + tonumber(CurrentRow[2])\n end\n \n end\n\nend\n\nBackground(Logo,Aura0,Aura1)\n\nX = 9.5*vh\nY = 10*vh\nSX = 80*vh\nSY = 8*vh\n\n--------- Row Background ----------\n\nlocal HeaderFont = loadFont(getAvailableFontName(11), 3*vh)\n\nsetNextFillColor(Top, 255/255,175/255,83/255,1)\nsetNextTextAlign(Top, AlignH_Left, AlignV_Descender)\naddText(Top, HeaderFont, \"Construct\", X, Y - 0.5*vh)\n\nsetNextFillColor(Top, 0.2,0.7,1,1)\nsetNextTextAlign(Top, AlignH_Right, AlignV_Descender)\naddText(Top, HeaderFont, \"Calibrate\", X + SX, Y - 0.5*vh)\n\nsetNextFillColor(Top, 1,1,0.5,1)\nsetNextTextAlign(Top, AlignH_Center, AlignV_Descender)\naddText(Top, HeaderFont, \"Storage\", X + SX - 32*vh, Y - 0.5*vh)\n\nsetNextFillColor(Top, 1,1,1,1)\nsetNextTextAlign(Top, AlignH_Center, AlignV_Descender)\naddText(Top, HeaderFont, \"Cumulative Mining Rate\", X + SX + 39.75*vh, Y - 0.5*vh)\n\nfor jj = 1,11 do\n setNextStrokeColor(Top,1,1,1,0.05+jj*0.085)\n setNextStrokeWidth(Top,0.02*vh+jj*0.02*vh)\n addLine(Top,X + SX/21*(jj-1) + 0.1*vh, Y + (1-1)*10*vh, X + SX/21*(jj) - 0.1*vh, Y + (1-1)*10*vh)\nend\n\nfor jj = 12,21 do\n setNextStrokeColor(Top,1,1,1,1-(jj-11)*0.085)\n setNextStrokeWidth(Top,0.22*vh-(jj-11)*0.02*vh)\n addLine(Top,X + SX/21*(jj-1) + 0.1*vh, Y + (1-1)*10*vh, X + SX/21*(jj) - 0.1*vh, Y + (1-1)*10*vh)\nend\n \n\n\nfor ii = 1,5 do\n\n setNextFillColor(Top,1,1,1,0.1)\n addBox(Top, X, Y + (ii-1)*2*SY, SX, SY)\n\n setNextFillColor(Top,0,0.6,1,0.1)\n addBox(Top, X, Y + (ii-1)*2*SY, SX, SY)\n\n setNextFillColor(Top,1,1,1,0.1)\n addBox(Top, X, Y + SY + (ii-1)*2*SY, SX, SY)\n\n setNextFillColor(Top,0,0.3,0.5,0.1)\n addBox(Top, X, Y + SY + (ii-1)*2*SY, SX, SY)\n\nend\n\n--------------- Fill in Rows ----------------------\n\nif ConstructTable[1] ~= nil and ConstructTable[1] ~= {} then\n for ii = 1,#ConstructTable do\n\n local ConstructImage = loadImage(\"resources_generated/gameplay/marks/icon_static_construct.png\")\n addImage(Top, ConstructImage, X + 0.5*vh, Y + (ii-0.5)*SY - 2*vh, 4*vh, 4*vh)\n\n ConstructText = wrap(ConstructTable[ii].Name,20)\n\n WrapLines = math.min(#ConstructText,3)\n for jj = 1,WrapLines do\n setNextFillColor(Top, 1,1,1,1)\n setNextTextAlign(Top, AlignH_Left, AlignV_Middle)\n setFontSize(Font,2.5*vh)\n if WrapLines == 1 then\n addText(Top, Font, ConstructText[jj], X + 5*vh, Y + (ii - 0.5)*SY)\n elseif WrapLines == 2 then\n addText(Top, Font, ConstructText[jj], X + 5*vh, Y + (ii-(3-jj)*0.5 + 0.25)*SY)\n elseif WrapLines == 3 then\n addText(Top, Font, ConstructText[jj], X + 5*vh, Y + (ii-(4-jj)*0.33 + 0.165)*SY)\n end \n end\n\n StorageTime = ConstructTable[ii].StorageTime\n \n local Days = math.floor(StorageTime/24)\n local Hours = StorageTime - Days*24\n local Minutes = (Hours - math.floor(Hours))*60\n \n local DaysText = tostring(math.floor(Days))\n local HoursText = tostring(math.floor(Hours))\n local MinutesText = tostring(math.floor(Minutes))\n \n StorageTimeText = DaysText .. \"D\" .. HoursText .. \"H\" .. MinutesText .. \"M\"\n \n StorageText = {round(ConstructTable[ii].Vol/1000,2) .. \"kL\", round(ConstructTable[ii].Mass/1000,2) .. \"t\"}\n\n for jj = 1,2 do\n setNextFillColor(Top, 1,1,0.5,1)\n setNextTextAlign(Top, AlignH_Center, AlignV_Middle)\n setFontSize(Font,2.5*vh)\n addText(Top, Font, StorageText[jj], X + 40*vh, Y + (ii-(3-jj)*0.5 + 0.25)*SY)\n end\n \n if tonumber(StorageTime)<0 then\n setNextFillColor(Top, 1,0.2,0.2,1)\n setNextTextAlign(Top, AlignH_Center, AlignV_Middle)\n setFontSize(Font,2.5*vh)\n addText(Top, Font, \"FULL\", X + 55*vh, Y + (ii - 0.5)*SY)\n else \n setNextFillColor(Top, 1,1,0.5,1)\n setNextTextAlign(Top, AlignH_Center, AlignV_Middle)\n setFontSize(Font,2.5*vh)\n addText(Top, Font, StorageTimeText, X + 55*vh, Y + (ii - 0.5)*SY)\n end\n\n CalibrationTime = ConstructTable[ii].CalibrationTime\n \n local Days = math.floor(CalibrationTime)\n local Hours = (CalibrationTime - Days)*24\n local Minutes = (Hours - math.floor(Hours))*60\n \n local DaysText = tostring(math.floor(Days))\n local HoursText = tostring(math.floor(Hours))\n local MinutesText = tostring(math.floor(Minutes))\n \n logMessage(CalibrationTime)\n \n CalibrationTimeText = DaysText .. \"D\" .. HoursText .. \"H\" .. MinutesText .. \"M \"\n \n CDTime = ConstructTable[ii].CDTime\n \n local Hours = math.floor(CDTime)\n local Minutes = (CDTime - Hours)*60\n \n local HoursText = tostring(math.floor(Hours))\n local MinutesText = tostring(math.floor(Minutes))\n \n CDTimeText = HoursText .. \"H\" .. MinutesText .. \"M \"\n \n CalibrationFlag = 0\n \n if tonumber(CalibrationTime)<0 then\n CalibrationTimeText = \"CALIBRATE\"\n CalibrationFlag = 1\n end\n \n if tonumber(CDTime)<0 then\n CDTimeText = \"CALIBRATE\"\n CalibrationFlag = 1\n end\n \n CooldownText = {CalibrationTimeText,CDTimeText}\n\n for jj = 1,2 do\n setNextFillColor(Top, 0.2 + 0.8*CalibrationFlag,0.7,1,1)\n setNextTextAlign(Top, AlignH_Right, AlignV_Middle)\n setFontSize(Font,2.5*vh)\n addText(Top, Font, CooldownText[jj], X + SX, Y + (ii-(3-jj)*0.5 + 0.25)*SY)\n end\n\n if getCursorReleased() then\n x,y = getCursor()\n if (x > X) and (x < (X + SX)) and (y > (Y + (ii-1)*SY)) and (y < (Y + (ii)*SY)) then\n setOutput(ConstructTable[ii].ID)\n logMessage(ConstructTable[ii].ID)\n end \n end \n\n end\nend\n\n\n--------------------------------------------------------------------------------------------\n\nlocal Bar = createLayer()\nlocal Font = loadFont(getAvailableFontName(5), 6*vh)\n\nData = {}\n\nif DataTable then\n for ii = 1,20 do\n if DataTable[ OreTierOrder[ii] ] ~= nil and DataTable[ OreTierOrder[ii] ] ~= {} then\n Data[ii] = DataTable[ OreTierOrder[ii] ]\n else \n Data[ii] = 0\n end\n end\n \nelse\n for ii = 1,20 do\n Data[ii] = 0\n end\nend\n \nBarChart(Bar,Font,0.675*rx,0.1*ry,Data,10,0.0,0.4,0.8,0.2*rx,0.8*ry,TotalOut)\n\nrequestAnimationFrame(1)\n]]\n )",
"filter": {
"args": [],
"signature": "onStart()",
"slotKey": "-1"
},
"key": "5"
},
{
"code": "if Emitter then\n \n EmitterMessage = json.encode(MasterTable)\n ChunkCount = math.ceil(EmitterMessage:len() / 500);\n \n Emitter.send(\"ChunkCount\",tostring(ChunkCount));\n\n ChunkIndex = 0;\n unit.setTimer(\"Send\",0.5);\n \nend ",
"filter": {
"args": [
{
"value": "option1"
}
],
"signature": "onActionStart(action)",
"slotKey": "-4"
},
"key": "6"
}
],
"methods": [],
"events": []
}