mirror of
https://github.com/minetest-mods/MoreMesecons.git
synced 2024-11-19 21:53:50 +01:00
disallow removing any node using the igniter
This commit is contained in:
parent
1d954c5069
commit
3c8a97bc0b
@ -1,12 +1,36 @@
|
|||||||
|
local function add_back_igniter(pos)
|
||||||
|
local name = minetest.get_node(pos).name
|
||||||
|
|
||||||
|
if name == "moremesecons_igniter:igniter" then
|
||||||
|
-- this should not happen
|
||||||
|
minetest.log("error", "[moremesecons_igniter] igniter is already back")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if name == "ignore" then
|
||||||
|
-- in case of unloaded chunk
|
||||||
|
minetest.get_voxel_manip():read_from_map(pos, pos)
|
||||||
|
name = minetest.get_node(pos).name
|
||||||
|
end
|
||||||
|
|
||||||
|
if name == "air"
|
||||||
|
or name == "fire:basic_flame" then
|
||||||
|
minetest.set_node(pos, {name="moremesecons_igniter:igniter"})
|
||||||
|
else
|
||||||
|
-- drop it as item if something took place there in the 0.8 seconds
|
||||||
|
pos.y = pos.y+1
|
||||||
|
minetest.add_item(pos, "moremesecons_igniter:igniter")
|
||||||
|
pos.y = pos.y-1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function igniter_on(pos)
|
local function igniter_on(pos)
|
||||||
local fire_node = {name="fire:basic_flame"}
|
minetest.set_node(pos, {name="fire:basic_flame"})
|
||||||
local igniter_node = {name="moremesecons_igniter:igniter"}
|
minetest.after(0.8, add_back_igniter, pos)
|
||||||
minetest.set_node(pos, fire_node)
|
|
||||||
minetest.after(0.8, minetest.set_node, pos, igniter_node)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("moremesecons_igniter:igniter", {
|
minetest.register_node("moremesecons_igniter:igniter", {
|
||||||
description="Igniter",
|
description = "Igniter",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
tiles = {"moremesecons_igniter.png"},
|
tiles = {"moremesecons_igniter.png"},
|
||||||
groups = {cracky=3},
|
groups = {cracky=3},
|
||||||
|
Loading…
Reference in New Issue
Block a user