Skip to content

Commit

Permalink
provide "lag" info in switching station digiline response
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Jun 18, 2020
1 parent 4a6d6f6 commit 7c0d0a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion technic/machines/switching_station.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ minetest.register_node("technic:switching_station",{
end
digilines.receptor_send(pos, technic.digilines.rules, channel, {
supply = meta:get_int("supply"),
demand = meta:get_int("demand")
demand = meta:get_int("demand"),
lag = meta:get_int("lag")
})
end
},
Expand Down
3 changes: 3 additions & 0 deletions technic/machines/switching_station_globalstep.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ minetest.register_globalstep(function(dtime)

local meta = minetest.get_meta(pos)

-- set lag in microseconds into the "lag" meta field
meta:set_int("lag", switch_diff)

-- overload detection
if switch_diff > 250000 then
switch.skip = 30
Expand Down

0 comments on commit 7c0d0a2

Please sign in to comment.