mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-23 00:13:13 +09:00
Support setting world ID, and if set, output it on the Inventory Combinator, and include it in transmitted frames.
This commit is contained in:
1 parent
16ec26984a
commit
bf2d16669d
1 file changed
+12
-2
@@ -398,6 +398,9 @@ function HandleTXCombinators()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if #frame > 0 then
|
if #frame > 0 then
|
||||||
|
if global.worldID then
|
||||||
|
table.insert(frame,1,{count=global.worldID,name="signal-srcid",type="virtual"})
|
||||||
|
end
|
||||||
table.insert(frame,{count=game.tick,name="signal-srctick",type="virtual"})
|
table.insert(frame,{count=game.tick,name="signal-srctick",type="virtual"})
|
||||||
game.write_file(TX_BUFFER_FILE, json:encode(frame).."\n", true, global.write_file_player or 0)
|
game.write_file(TX_BUFFER_FILE, json:encode(frame).."\n", true, global.write_file_player or 0)
|
||||||
|
|
||||||
@@ -434,8 +437,11 @@ end
|
|||||||
function UpdateInvCombinators()
|
function UpdateInvCombinators()
|
||||||
-- Update all inventory Combinators
|
-- Update all inventory Combinators
|
||||||
-- Prepare a frame from the last inventory report, plus any virtuals
|
-- Prepare a frame from the last inventory report, plus any virtuals
|
||||||
local invframe = {
|
local invframe = {}
|
||||||
--TODO: virtual signals here, localid, possibly others
|
if global.worldID then
|
||||||
|
table.insert(invframe,{count=global.worldID,index=#invframe+1,signal={name="signal-localid",type="virtual"}})
|
||||||
|
end
|
||||||
|
|
||||||
}
|
}
|
||||||
local items = game.item_prototypes
|
local items = game.item_prototypes
|
||||||
if global.invdata then
|
if global.invdata then
|
||||||
@@ -500,4 +506,8 @@ remote.add_interface("clusterio",
|
|||||||
global.invdata = invdata
|
global.invdata = invdata
|
||||||
UpdateInvCombinators()
|
UpdateInvCombinators()
|
||||||
end,
|
end,
|
||||||
|
setWorldID = function(newid)
|
||||||
|
global.worldID = newid
|
||||||
|
UpdateInvCombinators()
|
||||||
|
end
|
||||||
})
|
})
|
||||||
Reference in new issue
Block a user