More global localiztions
authorShadowNinja <shadowninja@minetest.net>
Wed, 18 Dec 2013 00:51:38 +0000 (19:51 -0500)
committerShadowNinja <shadowninja@minetest.net>
Wed, 18 Dec 2013 00:56:01 +0000 (19:56 -0500)
technic/machines/LV/extractor.lua
technic/machines/MV/tool_workshop.lua
technic/machines/switching_station.lua
technic/tools/flashlight.lua

index c4d8ad34e458f34b9e48b4d13e24073eb8dc99cc..c814d9e3facbb3646fb29b074256653cd6f131d2 100644 (file)
@@ -121,6 +121,7 @@ minetest.register_abm({
                -- 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
index 7191c0ca8323abf2b120ad9567018cc39fa7d87f..9955d5f19cae18c0296d5954733acbb1b2d102cf 100644 (file)
@@ -60,7 +60,7 @@ minetest.register_abm({
                -- 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
index 206284f380e57028434c2f47921e82b70dacaace..f7a0f44d915a4240f250c13d705986e601ab65f5 100644 (file)
@@ -67,7 +67,7 @@ minetest.register_node("technic:switching_station",{
 -- 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
index 61eceae7c4d3e1501a9e79b5b77efb72de08fc6e..4e868937aa15037740a40df37622e65a63997caa 100644 (file)
@@ -27,10 +27,34 @@ local players = {}
 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)
        local player_name = player:get_player_name()
        table.insert(players, player_name)
@@ -143,27 +167,3 @@ minetest.register_node("technic:light_off", {
     },
 })
 
-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
-