Tim
2015-01-27 3252da05d104e25a2335becce07e7d657a68c125
use the timers, that are allready running instead of allocating a new one every tick
2 files modified
14 ■■■■■ changed files
technic/machines/HV/nuclear_reactor.lua 7 ●●●●● patch | view | raw | blame | history
technic/machines/register/generator.lua 7 ●●●●● patch | view | raw | blame | history
technic/machines/HV/nuclear_reactor.lua
@@ -319,7 +319,7 @@
        local meta = minetest.get_meta(pos)
        
        -- Connected back?
        if meta:get_int("HV_EU_timeout") > 0 then return end
        if meta:get_int("HV_EU_timeout") > 0 then return false end
        
        local burn_time = meta:get_int("burn_time") or 0
@@ -329,12 +329,11 @@
            technic.swap_node(pos, "technic:hv_nuclear_reactor_core")
            meta:set_int("structure_accumulated_badness", 0)
            siren_clear(pos, meta)
            return
            return false
        end
        
        meta:set_int("burn_time", burn_time + 1)
        local timer = minetest.get_node_timer(pos)
            timer:start(1)
        return true
    end,
})
technic/machines/register/generator.lua
@@ -135,7 +135,7 @@
            local meta = minetest.get_meta(pos)
            
            -- Connected back?
            if meta:get_int(tier.."_EU_timeout") > 0 then return end
            if meta:get_int(tier.."_EU_timeout") > 0 then return false end
            
            local burn_time = meta:get_int("burn_time") or 0
@@ -143,7 +143,7 @@
                meta:set_int(tier.."_EU_supply", 0)
                meta:set_int("burn_time", 0)
                technic.swap_node(pos, "technic:"..ltier.."_generator")
                return
                return false
            end
            local burn_totaltime = meta:get_int("burn_totaltime") or 0
@@ -158,8 +158,7 @@
                "image[4, 1;1, 1;default_furnace_fire_bg.png^[lowpart:"..
                (percent)..":default_furnace_fire_fg.png]"..
                "list[current_player;main;0, 5;8, 4;]")
            local timer = minetest.get_node_timer(pos)
                timer:start(1)
            return true
        end,
    })