summaryrefslogtreecommitdiff
path: root/technic/machines/MV
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2016-12-01 04:22:40 -0500
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2016-12-01 04:22:40 -0500
commit2922421f4a88e56a0a1c819f62bf2bc287835388 (patch)
treeb6dafb3d00ef05778e456716c03544279c2978fa /technic/machines/MV
parent67d414d2f9aa5999e3f1755543a68455b4bb6d99 (diff)
downloaddreambuilder_modpack-2922421f4a88e56a0a1c819f62bf2bc287835388.tar
dreambuilder_modpack-2922421f4a88e56a0a1c819f62bf2bc287835388.tar.gz
dreambuilder_modpack-2922421f4a88e56a0a1c819f62bf2bc287835388.tar.bz2
dreambuilder_modpack-2922421f4a88e56a0a1c819f62bf2bc287835388.tar.xz
dreambuilder_modpack-2922421f4a88e56a0a1c819f62bf2bc287835388.zip
Update several mods:
biome_lib, boost_cart, building_blocks, castle, homedecor, glooptest, currency, roads, invsaw, maptools, mesecons, moreblocks, nixie_tubes, pipeworks, signs_lib, technic, unified_inventory, unifiedbricks, worldedit, xban2
Diffstat (limited to 'technic/machines/MV')
-rw-r--r--technic/machines/MV/wind_mill.lua21
1 files changed, 14 insertions, 7 deletions
diff --git a/technic/machines/MV/wind_mill.lua b/technic/machines/MV/wind_mill.lua
index 1377c67..28a075d 100644
--- a/technic/machines/MV/wind_mill.lua
+++ b/technic/machines/MV/wind_mill.lua
@@ -33,8 +33,15 @@ local function check_wind_mill(pos)
if pos.y < 30 then
return false
end
+ pos = {x=pos.x, y=pos.y, z=pos.z}
for i = 1, 20 do
- local node = minetest.get_node({x=pos.x, y=pos.y-i, z=pos.z})
+ pos.y = pos.y - 1
+ local node = minetest.get_node_or_nil(pos)
+ if not node then
+ -- we reached CONTENT_IGNORE, we can assume, that nothing changed
+ -- as the user will have to load the block to change it
+ return
+ end
if node.name ~= "technic:wind_mill_frame" then
return false
end
@@ -45,17 +52,17 @@ end
local run = function(pos, node)
local meta = minetest.get_meta(pos)
local machine_name = S("Wind %s Generator"):format("MV")
- local power = math.min(pos.y * 100, 5000)
- if not check_wind_mill(pos) then
+ local check = check_wind_mill(pos)
+ if check == false then
meta:set_int("MV_EU_supply", 0)
meta:set_string("infotext", S("%s Improperly Placed"):format(machine_name))
- return
- else
+ elseif check == true then
+ local power = math.min(pos.y * 100, 5000)
meta:set_int("MV_EU_supply", power)
+ meta:set_string("infotext", S("@1 (@2 EU)", machine_name, technic.pretty_num(power)))
end
-
- meta:set_string("infotext", S("@1 (@2 EU)", machine_name, technic.pretty_num(power)))
+ -- check == nil: assume nothing has changed
end
minetest.register_node("technic:wind_mill", {