Optimize electric network operations a little
This commit is contained in:
@@ -60,6 +60,18 @@ function industrialtest.Machine.updateFormspec(self,pos)
|
||||
meta:set_string("formspec",self:getFormspec(pos))
|
||||
end
|
||||
|
||||
function industrialtest.Machine.canUpdate(self,pos)
|
||||
return false
|
||||
end
|
||||
|
||||
function industrialtest.Machine.triggerIfNeeded(self,pos)
|
||||
local timer=minetest.get_node_timer(pos)
|
||||
if not timer:is_started() and self:canUpdate(pos) then
|
||||
minetest.debug("updating "..minetest.serialize(pos))
|
||||
timer:start(industrialtest.updateDelay)
|
||||
end
|
||||
end
|
||||
|
||||
function industrialtest.Machine.onTimer(self,pos,elapsed)
|
||||
local meta=minetest.get_meta(pos)
|
||||
local inv=meta:get_inventory()
|
||||
|
||||
Reference in New Issue
Block a user