Added unixtime signal to inventory combinator

This commit is contained in:
Danielv123 committed 2016-12-26 23:25:59 +01:00
1 parent 7c1caebccc
commit a70342fd82
3 files changed
+12 -2

No files matched your search

+2 -1
View File
@@ -287,7 +287,8 @@ setInterval(function () {
for (i = 0; i < inventory.length; i++) {
inventoryFrame[inventory[i].name] = Number(inventory[i].count);
}
// console.log("RCONing inventory! " + JSON.stringify(inventoryFrame));
inventoryFrame["signal-unixtime"] = Math.floor(Date.now()/1000);
console.log("RCONing inventory! " + JSON.stringify(inventoryFrame));
client.exec("/silent-command remote.call('clusterio', 'receiveInventory', '" + JSON.stringify(inventoryFrame) + "')");
}
});
+3 -1
View File
@@ -446,7 +446,9 @@ function UpdateInvCombinators()
local fluids = game.fluid_prototypes
if global.invdata then
for name,count in pairs(global.invdata) do
if fluids[name] then
if name == "signal-unixtime" then
invframe[#invframe+1] = {count=count,index=#invframe+1,signal={name=name,type="virtual"}}
elseif fluids[name] then
invframe[#invframe+1] = {count=count,index=#invframe+1,signal={name=name,type="fluid"}}
elseif items[name] then
invframe[#invframe+1] = {count=count,index=#invframe+1,signal={name=name,type="item"}}
+7
View File
@@ -175,6 +175,13 @@ data:extend{
subgroup = "virtual-signal-clusterio",
order = "e[clusterio]-[3localid]"
},
{
type = "virtual-signal",
name = "signal-unixtime",
icon = "__base__/graphics/icons/signal/signal_grey.png",
subgroup = "virtual-signal-clusterio",
order = "e[clusterio]-[4unixtime]"
},
}
-- TX Combinator