ShadowNinja
2013-12-18 d8437faebc1c544c22d806c8fe4025556d94c396
More global localiztions
4 files modified
55 ■■■■ changed files
technic/machines/LV/extractor.lua 1 ●●●● patch | view | raw | blame | history
technic/machines/MV/tool_workshop.lua 2 ●●● patch | view | raw | blame | history
technic/machines/switching_station.lua 2 ●●● patch | view | raw | blame | history
technic/tools/flashlight.lua 50 ●●●● patch | view | raw | blame | history
technic/machines/LV/extractor.lua
@@ -121,6 +121,7 @@
        -- Power off automatically if no longer connected to a switching station
        technic.switching_station_timeout_count(pos, "LV")
        local src_item = nil
        if srcstack then
            src_item = srcstack:to_table()
        end
technic/machines/MV/tool_workshop.lua
@@ -60,7 +60,7 @@
        -- Power off automatically if no longer connected to a switching station
        technic.switching_station_timeout_count(pos, "MV")
        srcstack = inv:get_stack("src", 1)
        local srcstack = inv:get_stack("src", 1)
        if inv:is_empty("src") or
           srcstack:get_wear() == 0 or
           srcstack:get_name() == "technic:water_can" or
technic/machines/switching_station.lua
@@ -67,7 +67,7 @@
-- A node must be touched by the station continuously in order to function
function technic.switching_station_timeout_count(pos, tier)
    local meta = minetest.get_meta(pos)
    timeout = meta:get_int(tier.."_EU_timeout")
    local timeout = meta:get_int(tier.."_EU_timeout")
    if timeout == 0 then
        meta:set_int(tier.."_EU_input", 0)
    else
technic/tools/flashlight.lua
@@ -27,8 +27,32 @@
local player_positions = {}
local last_wielded = {}
function round(num)
local function round(num)
    return math.floor(num + 0.5) 
end
local function check_for_flashlight(player)
    if player == nil then
        return false
    end
    local inv = player:get_inventory()
    local hotbar = inv:get_list("main")
    for i = 1, 8 do
        if hotbar[i]:get_name() == "technic:flashlight" then
            local meta = minetest.deserialize(hotbar[i]:get_metadata())
            if not meta or not meta.charge then
                return false
            end
            if meta.charge - 2 > 0 then
                meta.charge = meta.charge - 2;
                technic.set_RE_wear(hotbar[i], meta.charge, flashlight_max_charge)
                hotbar[i]:set_metadata(minetest.serialize(meta))
                inv:set_stack("main", i, hotbar[i])
                return true
            end
        end
    end
    return false
end
minetest.register_on_joinplayer(function(player)
@@ -142,28 +166,4 @@
        fixed = {0, 0, 0, 0, 0, 0},
    },
})
function check_for_flashlight(player)
    if player == nil then
        return false
    end
    local inv = player:get_inventory()
    local hotbar = inv:get_list("main")
    for i = 1, 8 do
        if hotbar[i]:get_name() == "technic:flashlight" then
            local meta = minetest.deserialize(hotbar[i]:get_metadata())
            if not meta or not meta.charge then
                return false
            end
            if meta.charge - 2 > 0 then
                meta.charge = meta.charge - 2;
                technic.set_RE_wear(hotbar[i], meta.charge, flashlight_max_charge)
                hotbar[i]:set_metadata(minetest.serialize(meta))
                inv:set_stack("main", i, hotbar[i])
                return true
            end
        end
    end
    return false
end