Remove debug output, Fix Bugs

This commit is contained in:
Jeija 2012-07-22 09:32:24 +02:00
parent 811403c9d5
commit 81f0772db8

View File

@ -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)
if string.find(newnode.name, "mesecons_battery:battery") then
meta = minetest.env:get_meta(pos)
meta:set_int("batterystate", 1)
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)