diff options
author | Jeija <norrepli@gmail.com> | 2012-07-22 09:32:24 +0200 |
---|---|---|
committer | Jeija <norrepli@gmail.com> | 2012-07-22 09:32:24 +0200 |
commit | 81f0772db8dd67cef32b783490092c271b4402da (patch) | |
tree | 9d2070f25b6d49db5e8a534c54f97ceadc96a6a1 | |
parent | 811403c9d59aa4ba6be77199714a40baa8ef1a8c (diff) | |
download | mesecons-81f0772db8dd67cef32b783490092c271b4402da.tar mesecons-81f0772db8dd67cef32b783490092c271b4402da.tar.gz mesecons-81f0772db8dd67cef32b783490092c271b4402da.tar.bz2 mesecons-81f0772db8dd67cef32b783490092c271b4402da.tar.xz mesecons-81f0772db8dd67cef32b783490092c271b4402da.zip |
Remove debug output, Fix Bugs
-rw-r--r-- | mesecons_battery/init.lua | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/mesecons_battery/init.lua b/mesecons_battery/init.lua index fc559aa..b7a5ed6 100644 --- a/mesecons_battery/init.lua +++ b/mesecons_battery/init.lua @@ -17,12 +17,7 @@ for i = 1, 5 do selection_box = { type = "fixed", - fixed = { - {-0.499, -0.499, -0.499, -0.4, 0.499, 0.499}, - { 0.499, -0.499, -0.499, 0.4, 0.499, 0.499}, - {-0.499, -0.499, -0.499, 0.499, 0.499, -0.4 }, - {-0.499, -0.499, 0.499, 0.499, 0.499, 0.4 }, - {-0.4 , -0.5 , -0.4 , 0.4 , 1*(i/5)-0.5, 0.4}} + fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, }, groups = {dig_immediate=2}, description="Battery", @@ -49,12 +44,7 @@ for i = 1, 5 do selection_box = { type = "fixed", - fixed = { - {-0.499, -0.499, -0.499, -0.4, 0.499, 0.499}, - { 0.499, -0.499, -0.499, 0.4, 0.499, 0.499}, - {-0.499, -0.499, -0.499, 0.499, 0.499, -0.4 }, - {-0.499, -0.499, 0.499, 0.499, 0.499, 0.4 }, - {-0.4 , -0.5 , -0.4 , 0.4 , 1*(i/5)-0.5, 0.4}} + fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, }, groups = {dig_immediate=2}, description="Battery", @@ -63,9 +53,11 @@ for i = 1, 5 do end minetest.register_on_placenode(function (pos, newnode, placer) - meta = minetest.env:get_meta(pos) - meta:set_int("batterystate", 1) - meta:set_int("charging", 0) + if string.find(newnode.name, "mesecons_battery:battery") then + meta = minetest.env:get_meta(pos) + meta:set_int("batterystate", tonumber(string.sub(newnode.name, string.len(newnode.name)))*20-19) + meta:set_int("charging", 0) + end end) minetest.register_on_punchnode(function(pos, node, puncher) @@ -132,8 +124,6 @@ nodenames = {"mesecons_battery:battery_discharging_1", "mesecons_battery:battery node.name=string.gsub(node.name, "discharging", "charging") end - print(tostring(math.ceil(batterystate/20))) - print("battstate: "..batterystate) if string.find(node.name, tostring(math.ceil(batterystate/20))) == nil then node.name = string.gsub(node.name, tostring(math.ceil(batterystate/20)+1), tostring(math.ceil(batterystate/20))) --change node for new nodebox model end @@ -155,7 +145,3 @@ mesecon:register_on_signal_off(function(pos, node) minetest.env:get_meta(pos):set_int("charging", 0) end end) - -minetest.register_on_punchnode(function(pos, node, puncher) - print(minetest.env:get_meta(pos):get_int("batterystate")) -end) |