mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-12-25 18:00:19 +01:00
Remove debug output, Fix Bugs
This commit is contained in:
parent
811403c9d5
commit
81f0772db8
@ -17,12 +17,7 @@ for i = 1, 5 do
|
|||||||
|
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||||
{-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}}
|
|
||||||
},
|
},
|
||||||
groups = {dig_immediate=2},
|
groups = {dig_immediate=2},
|
||||||
description="Battery",
|
description="Battery",
|
||||||
@ -49,12 +44,7 @@ for i = 1, 5 do
|
|||||||
|
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||||
{-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}}
|
|
||||||
},
|
},
|
||||||
groups = {dig_immediate=2},
|
groups = {dig_immediate=2},
|
||||||
description="Battery",
|
description="Battery",
|
||||||
@ -63,9 +53,11 @@ for i = 1, 5 do
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_on_placenode(function (pos, newnode, placer)
|
minetest.register_on_placenode(function (pos, newnode, placer)
|
||||||
meta = minetest.env:get_meta(pos)
|
if string.find(newnode.name, "mesecons_battery:battery") then
|
||||||
meta:set_int("batterystate", 1)
|
meta = minetest.env:get_meta(pos)
|
||||||
meta:set_int("charging", 0)
|
meta:set_int("batterystate", tonumber(string.sub(newnode.name, string.len(newnode.name)))*20-19)
|
||||||
|
meta:set_int("charging", 0)
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_on_punchnode(function(pos, node, puncher)
|
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")
|
node.name=string.gsub(node.name, "discharging", "charging")
|
||||||
end
|
end
|
||||||
|
|
||||||
print(tostring(math.ceil(batterystate/20)))
|
|
||||||
print("battstate: "..batterystate)
|
|
||||||
if string.find(node.name, tostring(math.ceil(batterystate/20))) == nil then
|
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
|
node.name = string.gsub(node.name, tostring(math.ceil(batterystate/20)+1), tostring(math.ceil(batterystate/20))) --change node for new nodebox model
|
||||||
end
|
end
|
||||||
@ -155,7 +145,3 @@ mesecon:register_on_signal_off(function(pos, node)
|
|||||||
minetest.env:get_meta(pos):set_int("charging", 0)
|
minetest.env:get_meta(pos):set_int("charging", 0)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_on_punchnode(function(pos, node, puncher)
|
|
||||||
print(minetest.env:get_meta(pos):get_int("batterystate"))
|
|
||||||
end)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user