mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-13 15:14:52 +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
|
||||
|
||||
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"})
|
||||
game.write_file(TX_BUFFER_FILE, json:encode(frame).."\n", true, global.write_file_player or 0)
|
||||
|
||||
@@ -434,8 +437,11 @@ end
|
||||
function UpdateInvCombinators()
|
||||
-- Update all inventory Combinators
|
||||
-- Prepare a frame from the last inventory report, plus any virtuals
|
||||
local invframe = {
|
||||
--TODO: virtual signals here, localid, possibly others
|
||||
local invframe = {}
|
||||
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
|
||||
if global.invdata then
|
||||
@@ -500,4 +506,8 @@ remote.add_interface("clusterio",
|
||||
global.invdata = invdata
|
||||
UpdateInvCombinators()
|
||||
end,
|
||||
setWorldID = function(newid)
|
||||
global.worldID = newid
|
||||
UpdateInvCombinators()
|
||||
end
|
||||
})
|
||||
Reference in new issue
Block a user