Controller bugs fixed

This commit is contained in:
Joachim Stolberg 2018-06-25 21:53:23 +02:00
parent e011819891
commit 2813fa08a0
4 changed files with 9 additions and 8 deletions

2
.gitignore vendored

@ -43,3 +43,5 @@ luac.out
.project
org.eclipse.*
*.lua.new
test_*.lua

@ -1,6 +0,0 @@
.buildpath
.project
org.eclipse.*
test_*.lua

@ -51,6 +51,7 @@ minetest.register_node("sl_controller:battery", {
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
meta:set_int("content", sl_controller.battery_capacity)
on_timer(pos, 1)
minetest.get_node_timer(pos):start(30)
end,
@ -60,6 +61,7 @@ minetest.register_node("sl_controller:battery", {
sunlight_propagates = true,
paramtype2 = "facedir",
groups = {choppy=1, cracky=1, crumbly=1},
drop = "",
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
})

@ -20,6 +20,9 @@ SaferLua is a subset of Lua with the following restrictions:
- Limited set of available functions
- Store() as alternative to Lua tables
The controller needs a battery nearby.
Don't remove the battery, it will be destroyed!
See: goo.gl/WRWZgt
]]
@ -261,7 +264,7 @@ end
local function on_timer(pos, elapsed)
local t = minetest.get_us_time()
local meta = minetest.get_meta(pos)
if meta:get_int("state") ~= "running" then
if meta:get_int("state") ~= tubelib.RUNNING then
return false
end
local number = meta:get_string("number")