forked from mtcontrib/scifi_nodes
Latest versions I hope…
This commit is contained in:
parent
ac4f79ccd2
commit
cbcbc3dfb8
|
@ -10,3 +10,5 @@ Minetest mod that adds scifi themed nodes
|
||||||
CC BY-NC 3.0
|
CC BY-NC 3.0
|
||||||
* scifi_nodes_door_normal.ogg tlwmdbt https://freesound.org/people/tlwmdbt/sounds/165862/
|
* scifi_nodes_door_normal.ogg tlwmdbt https://freesound.org/people/tlwmdbt/sounds/165862/
|
||||||
* scifi_nodes_door_mechanic.ogg primeval_polypod https://freesound.org/people/primeval_polypod/sounds/156507/
|
* scifi_nodes_door_mechanic.ogg primeval_polypod https://freesound.org/people/primeval_polypod/sounds/156507/
|
||||||
|
* scifi_nodes_digicode.ogg https://freesound.org/people/Robinhood76/sounds/94933/
|
||||||
|
* scifi_nodes_switch.ogg http://soundbible.com/1950-Button-Push.html
|
||||||
|
|
638
doors.lua
638
doors.lua
|
@ -27,331 +27,355 @@ local doors = {
|
||||||
{base_name = "blue", base_ingredient = "default:steel_block", sound = "scifi_nodes_door_normal"}
|
{base_name = "blue", base_ingredient = "default:steel_block", sound = "scifi_nodes_door_normal"}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
-- Maybe useful later with mesecons_doors.meseconify_door()
|
|
||||||
function get_doors_list()
|
|
||||||
return doors
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
for _, current_door in ipairs(doors) do
|
for _, current_door in ipairs(doors) do
|
||||||
|
|
||||||
local closed = "scifi_nodes:"..current_door.base_name.."_door_closed"
|
local closed = "scifi_nodes:"..current_door.base_name.."_door_closed"
|
||||||
local closed_top = "scifi_nodes:"..current_door.base_name.."_door_closed_top"
|
local closed_top = "scifi_nodes:"..current_door.base_name.."_door_closed_top"
|
||||||
local opened = "scifi_nodes:"..current_door.base_name.."_door_opened"
|
local opened = "scifi_nodes:"..current_door.base_name.."_door_opened"
|
||||||
local opened_top = "scifi_nodes:"..current_door.base_name.."_door_opened_top"
|
local opened_top = "scifi_nodes:"..current_door.base_name.."_door_opened_top"
|
||||||
local base_name = current_door.base_name
|
local base_name = current_door.base_name
|
||||||
local base_ingredient = current_door.base_ingredient
|
local base_ingredient = current_door.base_ingredient
|
||||||
local sound = current_door.sound
|
local sound = current_door.sound
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = closed .. " 2",
|
output = closed .. " 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"scifi_nodes:white2", base_ingredient, "scifi_nodes:white2"},
|
{"scifi_nodes:white2", base_ingredient, "scifi_nodes:white2"},
|
||||||
{"scifi_nodes:black", base_ingredient, "scifi_nodes:black"}
|
{"scifi_nodes:black", base_ingredient, "scifi_nodes:black"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
function onplace(itemstack, placer, pointed_thing)
|
function onplace(itemstack, placer, pointed_thing)
|
||||||
local pos1 = pointed_thing.above
|
local pos1 = pointed_thing.above
|
||||||
local pos2 = {x=pos1.x, y=pos1.y, z=pos1.z}
|
local pos2 = {x=pos1.x, y=pos1.y, z=pos1.z}
|
||||||
pos2.y = pos2.y+1
|
pos2.y = pos2.y+1
|
||||||
if
|
if
|
||||||
|
|
||||||
not minetest.registered_nodes[minetest.get_node(pos1).name].buildable_to or
|
not minetest.registered_nodes[minetest.get_node(pos1).name].buildable_to or
|
||||||
not minetest.registered_nodes[minetest.get_node(pos2).name].buildable_to or
|
not minetest.registered_nodes[minetest.get_node(pos2).name].buildable_to or
|
||||||
not placer or
|
not placer or
|
||||||
not placer:is_player() or
|
not placer:is_player() or
|
||||||
minetest.is_protected(pos1, placer:get_player_name()) or
|
minetest.is_protected(pos1, placer:get_player_name()) or
|
||||||
minetest.is_protected(pos2, placer:get_player_name()) then
|
minetest.is_protected(pos2, placer:get_player_name()) then
|
||||||
return
|
return
|
||||||
|
end
|
||||||
|
local pt = pointed_thing.above
|
||||||
|
local pt2 = {x=pt.x, y=pt.y, z=pt.z}
|
||||||
|
pt2.y = pt2.y+1
|
||||||
|
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
|
||||||
|
local pt3 = {x=pt.x, y=pt.y, z=pt.z}
|
||||||
|
local p4 = 0
|
||||||
|
if p2 == 0 then
|
||||||
|
pt3.x = pt3.x-1
|
||||||
|
p4 = 2
|
||||||
|
elseif p2 == 1 then
|
||||||
|
pt3.z = pt3.z+1
|
||||||
|
p4 = 3
|
||||||
|
elseif p2 == 2 then
|
||||||
|
pt3.x = pt3.x+1
|
||||||
|
p4 = 0
|
||||||
|
elseif p2 == 3 then
|
||||||
|
pt3.z = pt3.z-1
|
||||||
|
p4 = 1
|
||||||
|
end
|
||||||
|
if minetest.get_node(pt3).name == closed then
|
||||||
|
minetest.set_node(pt, {name=closed, param2=p4})
|
||||||
|
minetest.set_node(pt2, {name=closed_top, param2=p4})
|
||||||
|
else
|
||||||
|
minetest.set_node(pt, {name=closed, param2=p2})
|
||||||
|
minetest.set_node(pt2, {name=closed_top, param2=p2})
|
||||||
|
end
|
||||||
|
itemstack:take_item(1)
|
||||||
|
|
||||||
|
return itemstack;
|
||||||
end
|
end
|
||||||
local pt = pointed_thing.above
|
|
||||||
local pt2 = {x=pt.x, y=pt.y, z=pt.z}
|
function afterdestruct(pos, oldnode)
|
||||||
pt2.y = pt2.y+1
|
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
|
||||||
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
|
end
|
||||||
local pt3 = {x=pt.x, y=pt.y, z=pt.z}
|
|
||||||
local p4 = 0
|
function rightclick(pos, node, player, itemstack, pointed_thing)
|
||||||
if p2 == 0 then
|
-- play sound
|
||||||
pt3.x = pt3.x-1
|
minetest.sound_play(sound,{
|
||||||
p4 = 2
|
max_hear_distance = 16,
|
||||||
elseif p2 == 1 then
|
pos = pos,
|
||||||
pt3.z = pt3.z+1
|
gain = 1.0
|
||||||
p4 = 3
|
})
|
||||||
elseif p2 == 2 then
|
|
||||||
pt3.x = pt3.x+1
|
local timer = minetest.get_node_timer(pos)
|
||||||
p4 = 0
|
local a = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1})
|
||||||
elseif p2 == 3 then
|
local b = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1})
|
||||||
pt3.z = pt3.z-1
|
local c = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z})
|
||||||
p4 = 1
|
local d = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z})
|
||||||
|
local e = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z-1})
|
||||||
|
local f = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z-1})
|
||||||
|
local g = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z+1})
|
||||||
|
local h = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z+1})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.set_node(pos, {name=opened, param2=node.param2})
|
||||||
|
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=opened_top, param2=node.param2})
|
||||||
|
|
||||||
|
if a.name == closed then
|
||||||
|
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name=opened, param2=a.param2})
|
||||||
|
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name=opened_top, param2=a.param2})
|
||||||
end
|
end
|
||||||
if minetest.get_node(pt3).name == closed then
|
if b.name == closed then
|
||||||
minetest.set_node(pt, {name=closed, param2=p4})
|
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name=opened, param2=b.param2})
|
||||||
minetest.set_node(pt2, {name=closed_top, param2=p4})
|
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name=opened_top, param2=b.param2})
|
||||||
else
|
end
|
||||||
minetest.set_node(pt, {name=closed, param2=p2})
|
if c.name == closed then
|
||||||
minetest.set_node(pt2, {name=closed_top, param2=p2})
|
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name=opened, param2=c.param2})
|
||||||
|
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name=opened_top, param2=c.param2})
|
||||||
|
end
|
||||||
|
if d.name == closed then
|
||||||
|
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name=opened, param2=d.param2})
|
||||||
|
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name=opened_top, param2=d.param2})
|
||||||
|
end
|
||||||
|
if e.name == closed then
|
||||||
|
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z-1}, {name=opened, param2=e.param2})
|
||||||
|
minetest.set_node({x=pos.x+1, y=pos.y+1, z=pos.z-1}, {name=opened_top, param2=e.param2})
|
||||||
|
end
|
||||||
|
if f.name == closed then
|
||||||
|
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z-1}, {name=opened, param2=f.param2})
|
||||||
|
minetest.set_node({x=pos.x-1, y=pos.y+1, z=pos.z-1}, {name=opened_top, param2=f.param2})
|
||||||
|
end
|
||||||
|
if g.name == closed then
|
||||||
|
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z+1}, {name=opened, param2=g.param2})
|
||||||
|
minetest.set_node({x=pos.x+1, y=pos.y+1, z=pos.z+1}, {name=opened_top, param2=g.param2})
|
||||||
|
end
|
||||||
|
if h.name == closed then
|
||||||
|
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z+1}, {name=opened, param2=h.param2})
|
||||||
|
minetest.set_node({x=pos.x-1, y=pos.y+1, z=pos.z+1}, {name=opened_top, param2=h.param2})
|
||||||
end
|
end
|
||||||
itemstack:take_item(1)
|
|
||||||
|
|
||||||
return itemstack;
|
timer:start(3)
|
||||||
end
|
|
||||||
|
|
||||||
function afterdestruct(pos, oldnode)
|
end
|
||||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
|
|
||||||
end
|
|
||||||
|
|
||||||
function rightclick(pos, node, player, itemstack, pointed_thing)
|
function afterplace(pos, placer, itemstack, pointed_thing)
|
||||||
-- play sound
|
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name=opened_top,param2=nodeu.param2})
|
||||||
minetest.sound_play(sound,{
|
end
|
||||||
max_hear_distance = 16,
|
|
||||||
pos = pos,
|
|
||||||
gain = 1.0
|
|
||||||
})
|
|
||||||
|
|
||||||
local timer = minetest.get_node_timer(pos)
|
function ontimer(pos, elapsed)
|
||||||
local a = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1})
|
-- play sound
|
||||||
local b = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1})
|
minetest.sound_play(sound,{
|
||||||
local c = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z})
|
max_hear_distance = 16,
|
||||||
local d = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z})
|
pos = pos,
|
||||||
local e = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z-1})
|
gain = 1.0
|
||||||
local f = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z-1})
|
})
|
||||||
local g = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z+1})
|
|
||||||
local h = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z+1})
|
local node = minetest.get_node(pos)
|
||||||
|
local a = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1})
|
||||||
|
local b = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1})
|
||||||
|
local c = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z})
|
||||||
|
local d = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z})
|
||||||
|
local e = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z-1})
|
||||||
|
local f = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z-1})
|
||||||
|
local g = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z+1})
|
||||||
|
local h = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z+1})
|
||||||
|
|
||||||
|
|
||||||
minetest.set_node(pos, {name=opened, param2=node.param2})
|
minetest.set_node(pos, {name=closed, param2=node.param2})
|
||||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=opened_top, param2=node.param2})
|
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=closed_top, param2=node.param2})
|
||||||
|
|
||||||
if a.name == closed then
|
if a.name == opened then
|
||||||
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name=opened, param2=a.param2})
|
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name=closed, param2=a.param2})
|
||||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name=opened_top, param2=a.param2})
|
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name=closed_top, param2=a.param2})
|
||||||
end
|
end
|
||||||
if b.name == closed then
|
if b.name == opened then
|
||||||
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name=opened, param2=b.param2})
|
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name=closed, param2=b.param2})
|
||||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name=opened_top, param2=b.param2})
|
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name=closed_top, param2=b.param2})
|
||||||
end
|
end
|
||||||
if c.name == closed then
|
if c.name == opened then
|
||||||
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name=opened, param2=c.param2})
|
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name=closed, param2=c.param2})
|
||||||
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name=opened_top, param2=c.param2})
|
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name=closed_top, param2=c.param2})
|
||||||
end
|
end
|
||||||
if d.name == closed then
|
if d.name == opened then
|
||||||
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name=opened, param2=d.param2})
|
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name=closed, param2=d.param2})
|
||||||
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name=opened_top, param2=d.param2})
|
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name=closed_top, param2=d.param2})
|
||||||
end
|
end
|
||||||
if e.name == closed then
|
if e.name == opened then
|
||||||
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z-1}, {name=opened, param2=e.param2})
|
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z-1}, {name=closed, param2=e.param2})
|
||||||
minetest.set_node({x=pos.x+1, y=pos.y+1, z=pos.z-1}, {name=opened_top, param2=e.param2})
|
minetest.set_node({x=pos.x+1, y=pos.y+1, z=pos.z-1}, {name=closed_top, param2=e.param2})
|
||||||
end
|
end
|
||||||
if f.name == closed then
|
if f.name == opened then
|
||||||
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z-1}, {name=opened, param2=f.param2})
|
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z-1}, {name=closed, param2=f.param2})
|
||||||
minetest.set_node({x=pos.x-1, y=pos.y+1, z=pos.z-1}, {name=opened_top, param2=f.param2})
|
minetest.set_node({x=pos.x-1, y=pos.y+1, z=pos.z-1}, {name=closed_top, param2=f.param2})
|
||||||
end
|
end
|
||||||
if g.name == closed then
|
if g.name == opened then
|
||||||
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z+1}, {name=opened, param2=g.param2})
|
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z+1}, {name=closed, param2=g.param2})
|
||||||
minetest.set_node({x=pos.x+1, y=pos.y+1, z=pos.z+1}, {name=opened_top, param2=g.param2})
|
minetest.set_node({x=pos.x+1, y=pos.y+1, z=pos.z+1}, {name=closed_top, param2=g.param2})
|
||||||
end
|
end
|
||||||
if h.name == closed then
|
if h.name == opened then
|
||||||
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z+1}, {name=opened, param2=h.param2})
|
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z+1}, {name=closed, param2=h.param2})
|
||||||
minetest.set_node({x=pos.x-1, y=pos.y+1, z=pos.z+1}, {name=opened_top, param2=h.param2})
|
minetest.set_node({x=pos.x-1, y=pos.y+1, z=pos.z+1}, {name=closed_top, param2=h.param2})
|
||||||
end
|
end
|
||||||
|
|
||||||
timer:start(3)
|
end
|
||||||
|
|
||||||
end
|
-- allow doors opening on mesecon signal
|
||||||
|
-- from a pressure plate
|
||||||
function afterplace(pos, placer, itemstack, pointed_thing)
|
local mesecons_door_def
|
||||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name=opened_top,param2=nodeu.param2})
|
--local mesecons_door_top_def
|
||||||
end
|
local mesecons_door_rules
|
||||||
|
--local mesecons_door_top_rules
|
||||||
function ontimer(pos, elapsed)
|
if minetest.get_modpath("mesecons") then
|
||||||
-- play sound
|
mesecons_door_rules = {
|
||||||
minetest.sound_play(sound,{
|
-- get signal from pressure plate
|
||||||
max_hear_distance = 16,
|
{x=1, y=0, z=0},
|
||||||
pos = pos,
|
{x=-1, y=0, z=0},
|
||||||
gain = 1.0
|
{x=0, y=0, z=1},
|
||||||
})
|
{x=0, y=0, z=-1},
|
||||||
|
-- get signal from wall mounted button
|
||||||
local node = minetest.get_node(pos)
|
{x=1, y=1, z=1},
|
||||||
local a = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1})
|
{x=-1, y=1, z=1},
|
||||||
local b = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1})
|
{x=1, y=1, z=-1},
|
||||||
local c = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z})
|
{x=-1, y=1, z=-1},
|
||||||
local d = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z})
|
}
|
||||||
local e = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z-1})
|
mesecons_door_def = {
|
||||||
local f = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z-1})
|
|
||||||
local g = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z+1})
|
|
||||||
local h = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z+1})
|
|
||||||
|
|
||||||
|
|
||||||
minetest.set_node(pos, {name=closed, param2=node.param2})
|
|
||||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=closed_top, param2=node.param2})
|
|
||||||
|
|
||||||
if a.name == opened then
|
|
||||||
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name=closed, param2=a.param2})
|
|
||||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name=closed_top, param2=a.param2})
|
|
||||||
end
|
|
||||||
if b.name == opened then
|
|
||||||
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name=closed, param2=b.param2})
|
|
||||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name=closed_top, param2=b.param2})
|
|
||||||
end
|
|
||||||
if c.name == opened then
|
|
||||||
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name=closed, param2=c.param2})
|
|
||||||
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name=closed_top, param2=c.param2})
|
|
||||||
end
|
|
||||||
if d.name == opened then
|
|
||||||
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name=closed, param2=d.param2})
|
|
||||||
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name=closed_top, param2=d.param2})
|
|
||||||
end
|
|
||||||
if e.name == opened then
|
|
||||||
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z-1}, {name=closed, param2=e.param2})
|
|
||||||
minetest.set_node({x=pos.x+1, y=pos.y+1, z=pos.z-1}, {name=closed_top, param2=e.param2})
|
|
||||||
end
|
|
||||||
if f.name == opened then
|
|
||||||
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z-1}, {name=closed, param2=f.param2})
|
|
||||||
minetest.set_node({x=pos.x-1, y=pos.y+1, z=pos.z-1}, {name=closed_top, param2=f.param2})
|
|
||||||
end
|
|
||||||
if g.name == opened then
|
|
||||||
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z+1}, {name=closed, param2=g.param2})
|
|
||||||
minetest.set_node({x=pos.x+1, y=pos.y+1, z=pos.z+1}, {name=closed_top, param2=g.param2})
|
|
||||||
end
|
|
||||||
if h.name == opened then
|
|
||||||
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z+1}, {name=closed, param2=h.param2})
|
|
||||||
minetest.set_node({x=pos.x-1, y=pos.y+1, z=pos.z+1}, {name=closed_top, param2=h.param2})
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_node(closed, {
|
|
||||||
description = current_door.base_name.." sliding door",
|
|
||||||
inventory_image = "scifi_nodes_door_"..base_name.."_inv.png",
|
|
||||||
wield_image = "scifi_nodes_door_"..base_name.."_inv.png",
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_door_"..base_name.."_edge.png",
|
|
||||||
"scifi_nodes_door_"..base_name.."_edge.png",
|
|
||||||
"scifi_nodes_door_"..base_name.."_edge.png",
|
|
||||||
"scifi_nodes_door_"..base_name.."_edge.png",
|
|
||||||
"scifi_nodes_door_"..base_name.."_rbottom.png",
|
|
||||||
"scifi_nodes_door_"..base_name.."_bottom.png"
|
|
||||||
},
|
|
||||||
drawtype = "nodebox",
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
groups = {cracky = 3},
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.5, -0.5, -0.0625, 0.5, 0.5, 0.0625}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.5, -0.5, -0.0625, 0.5, 1.5, 0.0625}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mesecon = {
|
|
||||||
effector = {
|
effector = {
|
||||||
action_on = function (pos, node)
|
action_on = rightclick,
|
||||||
minetest.sound_play(sound, {
|
rules = mesecons_door_rules
|
||||||
max_hear_distance = 16,
|
|
||||||
pos = pos,
|
|
||||||
gain = 1.0
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
rules = mesecon.rules.pplate
|
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
|
-- mesecons_door_top_rules = {
|
||||||
on_place = onplace,
|
-- -- get signal switch or digicode
|
||||||
|
-- {x=1, y=0, z=1},
|
||||||
after_destruct = afterdestruct,
|
-- {x=-1, y=0, z=1},
|
||||||
|
-- {x=1, y=0, z=1},
|
||||||
on_rightclick = rightclick,
|
-- {x=-1, y=0, z=-1},
|
||||||
})
|
-- -- get signal from door_bottom
|
||||||
|
-- {x=0, y=-1, z=0},
|
||||||
minetest.register_node(closed_top, {
|
-- }
|
||||||
tiles = {
|
-- mesecons_door_top_def = {
|
||||||
"scifi_nodes_door_"..base_name.."_edge.png",
|
-- conductor = {
|
||||||
"scifi_nodes_door_"..base_name.."_edge.png",
|
-- rules = mesecons_door_top_rules
|
||||||
"scifi_nodes_door_"..base_name.."_edge.png",
|
-- }
|
||||||
"scifi_nodes_door_"..base_name.."_edge.png",
|
-- }
|
||||||
"scifi_nodes_door_"..base_name.."_rtop.png",
|
|
||||||
"scifi_nodes_door_"..base_name.."_top.png"
|
|
||||||
},
|
|
||||||
drawtype = "nodebox",
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
groups = {cracky = 1},
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.5, -0.5, -0.0625, 0.5, 0.5, 0.0625}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{0, 0, 0, 0, 0, 0},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node(opened, {
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_door_"..base_name.."_edge.png",
|
|
||||||
"scifi_nodes_door_"..base_name.."_edge.png",
|
|
||||||
"scifi_nodes_door_"..base_name.."_edge.png",
|
|
||||||
"scifi_nodes_door_"..base_name.."_edge.png",
|
|
||||||
"scifi_nodes_door_"..base_name.."_rbottom0.png",
|
|
||||||
"scifi_nodes_door_"..base_name.."_bottom0.png"
|
|
||||||
},
|
|
||||||
drawtype = "nodebox",
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
drop = closed,
|
|
||||||
groups = {cracky = 1},
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.5, -0.5, -0.0625, -0.25, 0.5, 0.0625},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.5, -0.5, -0.0625, -0.25, 1.5, 0.0625},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
after_place_node = afterplace,
|
|
||||||
after_destruct = afterdestruct,
|
|
||||||
on_timer = ontimer,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node(opened_top, {
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_door_"..base_name.."_edge.png",
|
|
||||||
"scifi_nodes_door_"..base_name.."_edge.png",
|
|
||||||
"scifi_nodes_door_"..base_name.."_edge.png",
|
|
||||||
"scifi_nodes_door_"..base_name.."_edge.png",
|
|
||||||
"scifi_nodes_door_"..base_name.."_rtopo.png",
|
|
||||||
"scifi_nodes_door_"..base_name.."_topo.png"
|
|
||||||
},
|
|
||||||
drawtype = "nodebox",
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
groups = {cracky = 1},
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.5, -0.5, -0.0625, -0.25, 0.5, 0.0625},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{0, 0, 0, 0, 0, 0},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
minetest.register_node(closed, {
|
||||||
|
description = current_door.base_name.." sliding door",
|
||||||
|
inventory_image = "scifi_nodes_door_"..base_name.."_inv.png",
|
||||||
|
wield_image = "scifi_nodes_door_"..base_name.."_inv.png",
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
|
"scifi_nodes_door_"..base_name.."_rbottom.png",
|
||||||
|
"scifi_nodes_door_"..base_name.."_bottom.png"
|
||||||
|
},
|
||||||
|
drawtype = "nodebox",
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {cracky = 3},
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.5, -0.0625, 0.5, 0.5, 0.0625}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.5, -0.0625, 0.5, 1.5, 0.0625}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mesecons = mesecons_door_def,
|
||||||
|
|
||||||
|
on_place = onplace,
|
||||||
|
|
||||||
|
after_destruct = afterdestruct,
|
||||||
|
|
||||||
|
on_rightclick = rightclick,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node(closed_top, {
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
|
"scifi_nodes_door_"..base_name.."_rtop.png",
|
||||||
|
"scifi_nodes_door_"..base_name.."_top.png"
|
||||||
|
},
|
||||||
|
drawtype = "nodebox",
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {cracky = 1},
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.5, -0.0625, 0.5, 0.5, 0.0625}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{0, 0, 0, 0, 0, 0},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
-- mesecons = mesecons_door_top_def,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node(opened, {
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
|
"scifi_nodes_door_"..base_name.."_rbottom0.png",
|
||||||
|
"scifi_nodes_door_"..base_name.."_bottom0.png"
|
||||||
|
},
|
||||||
|
drawtype = "nodebox",
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
drop = closed,
|
||||||
|
groups = {cracky = 1},
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.5, -0.0625, -0.25, 0.5, 0.0625},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.5, -0.0625, -0.25, 1.5, 0.0625},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
after_place_node = afterplace,
|
||||||
|
after_destruct = afterdestruct,
|
||||||
|
on_timer = ontimer,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node(opened_top, {
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
|
"scifi_nodes_door_"..base_name.."_rtopo.png",
|
||||||
|
"scifi_nodes_door_"..base_name.."_topo.png"
|
||||||
|
},
|
||||||
|
drawtype = "nodebox",
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {cracky = 1},
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.5, -0.0625, -0.25, 0.5, 0.0625},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{0, 0, 0, 0, 0, 0},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end -- end of doors table browsing
|
||||||
|
|
226
nodeboxes.lua
226
nodeboxes.lua
|
@ -366,8 +366,6 @@ minetest.register_node("scifi_nodes:pot_lid", {
|
||||||
sounds = default.node_sound_glass_defaults()
|
sounds = default.node_sound_glass_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:pot", {
|
minetest.register_node("scifi_nodes:pot", {
|
||||||
description = "metal plant pot (right click for lid, shift+rightclick to plant)",
|
description = "metal plant pot (right click for lid, shift+rightclick to plant)",
|
||||||
tiles = {
|
tiles = {
|
||||||
|
@ -1205,34 +1203,25 @@ minetest.register_node("scifi_nodes:windowpanel", {
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
--------------
|
||||||
|
-- Switches --
|
||||||
|
--------------
|
||||||
|
local switch_rules = {}
|
||||||
|
local mesecons_switch_on_def = {}
|
||||||
|
local mesecons_switch_off_def = {}
|
||||||
|
|
||||||
if (mesecon ~= nil) and
|
if (mesecon ~= nil) and
|
||||||
(mesecon.receptor_on ~= nil) and
|
(mesecon.receptor_on ~= nil) and
|
||||||
(mesecon.receptor_off ~= nil) then
|
(mesecon.receptor_off ~= nil) then
|
||||||
minetest.register_node("scifi_nodes:switch_off", {
|
|
||||||
description = "Wall switch",
|
switch_rules = {
|
||||||
tiles = {
|
{x=1, y=-1, z=1},
|
||||||
"scifi_nodes_switch_off.png",
|
{x=1, y=-1, z=-1},
|
||||||
},
|
{x=-1, y=-1, z=1},
|
||||||
inventory_image = "scifi_nodes_switch_on.png",
|
{x=-1, y=-1, z=-1}
|
||||||
wield_image = "scifi_nodes_switch_on.png",
|
}
|
||||||
drawtype = "signlike",
|
mesecons_switch_on_def = {receptor = {state = mesecon.state.on, rules = switch_rules}}
|
||||||
sunlight_propagates = true,
|
mesecons_switch_off_def = {receptor = {state = mesecon.state.off, rules = switch_rules}}
|
||||||
node_box = {
|
|
||||||
type = "wallmounted",
|
|
||||||
},
|
|
||||||
selection_box = {
|
|
||||||
type = "wallmounted",
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "wallmounted",
|
|
||||||
groups = {cracky=1, oddly_breakable_by_hand=1, mesecon_needs_receiver = 1},
|
|
||||||
on_rightclick = function(pos, node, clicker, item, _)
|
|
||||||
minetest.set_node(pos, {name="scifi_nodes:switch_on", param2=node.param2})
|
|
||||||
mesecon.receptor_on(pos)
|
|
||||||
end,
|
|
||||||
sounds = default.node_sound_glass_defaults(),
|
|
||||||
mesecons = {receptor = { state = mesecon.state.off }}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:switch_on", {
|
minetest.register_node("scifi_nodes:switch_on", {
|
||||||
description = "Wall switch",
|
description = "Wall switch",
|
||||||
|
@ -1253,20 +1242,43 @@ if (mesecon ~= nil) and
|
||||||
paramtype2 = "wallmounted",
|
paramtype2 = "wallmounted",
|
||||||
light_source = 5,
|
light_source = 5,
|
||||||
groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, mesecon_needs_receiver = 1},
|
groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, mesecon_needs_receiver = 1},
|
||||||
|
mesecons = mesecons_switch_on_def,
|
||||||
on_rightclick = function(pos, node, clicker, item, _)
|
on_rightclick = function(pos, node, clicker, item, _)
|
||||||
minetest.set_node(pos, {name="scifi_nodes:switch_off", param2=node.param2})
|
minetest.set_node(pos, {name="scifi_nodes:switch_off", param2=node.param2})
|
||||||
mesecon.receptor_off(pos)
|
mesecon.receptor_off(pos, switch_rules)
|
||||||
|
if switch_rules == {} or nil then minetest.chat_send_all("Nib !") end
|
||||||
|
minetest.sound_play("scifi_nodes_switch", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||||
|
end,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:switch_off", {
|
||||||
|
description = "Wall switch",
|
||||||
|
tiles = {"scifi_nodes_switch_off.png",},
|
||||||
|
inventory_image = "scifi_nodes_switch_on.png",
|
||||||
|
wield_image = "scifi_nodes_switch_on.png",
|
||||||
|
drawtype = "signlike",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
node_box = {type = "wallmounted",},
|
||||||
|
selection_box = {type = "wallmounted",},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "wallmounted",
|
||||||
|
groups = {cracky=1, oddly_breakable_by_hand=1, mesecon_needs_receiver = 1},
|
||||||
|
mesecons = mesecons_switch_off_def,
|
||||||
|
on_rightclick = function(pos, node, clicker, item, _)
|
||||||
|
minetest.set_node(pos, {name="scifi_nodes:switch_on", param2=node.param2})
|
||||||
|
mesecon.receptor_on(pos, switch_rules)
|
||||||
|
minetest.sound_play("scifi_nodes_switch", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||||
end,
|
end,
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
mesecons = {receptor = { state = mesecon.state.on }}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "scifi_nodes:switch_off 2",
|
output = "scifi_nodes:switch_off 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"mesecons_button:button_off", "scifi_nodes:grey", ""}
|
{"mesecons_button:button_off", "scifi_nodes:grey", ""}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
else
|
else
|
||||||
--wall switch, currently does not do anything
|
--wall switch, currently does not do anything
|
||||||
|
@ -1290,6 +1302,7 @@ else
|
||||||
groups = {cracky=1, oddly_breakable_by_hand=1},
|
groups = {cracky=1, oddly_breakable_by_hand=1},
|
||||||
on_rightclick = function(pos, node, clicker, item, _)
|
on_rightclick = function(pos, node, clicker, item, _)
|
||||||
minetest.set_node(pos, {name="scifi_nodes:switch_on", param2=node.param2})
|
minetest.set_node(pos, {name="scifi_nodes:switch_on", param2=node.param2})
|
||||||
|
minetest.sound_play("scifi_nodes_switch", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||||
end,
|
end,
|
||||||
sounds = default.node_sound_glass_defaults()
|
sounds = default.node_sound_glass_defaults()
|
||||||
})
|
})
|
||||||
|
@ -1315,10 +1328,149 @@ else
|
||||||
groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1},
|
groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1},
|
||||||
on_rightclick = function(pos, node, clicker, item, _)
|
on_rightclick = function(pos, node, clicker, item, _)
|
||||||
minetest.set_node(pos, {name="scifi_nodes:switch_off", param2=node.param2})
|
minetest.set_node(pos, {name="scifi_nodes:switch_off", param2=node.param2})
|
||||||
|
minetest.sound_play("scifi_nodes_switch", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||||
end,
|
end,
|
||||||
sounds = default.node_sound_glass_defaults()
|
sounds = default.node_sound_glass_defaults()
|
||||||
|
}) --end of wall switch
|
||||||
|
end -- if(mesecon.receptor ~= on
|
||||||
|
|
||||||
|
--------------
|
||||||
|
-- Digicode --
|
||||||
|
--------------
|
||||||
|
local digicode_rules = {}
|
||||||
|
local mesecons_digicode_on_def = {}
|
||||||
|
local mesecons_digicode_off_def = {}
|
||||||
|
|
||||||
|
if (mesecon ~= nil) and
|
||||||
|
(mesecon.receptor_on ~= nil) and
|
||||||
|
(mesecon.receptor_off ~= nil) then
|
||||||
|
|
||||||
|
digicode_rules = {
|
||||||
|
{x=1, y=-1, z=1},
|
||||||
|
{x=1, y=-1, z=-1},
|
||||||
|
{x=-1, y=-1, z=1},
|
||||||
|
{x=-1, y=-1, z=-1}
|
||||||
|
}
|
||||||
|
mesecons_digicode_on_def = {receptor = {state = mesecon.state.on, rules = digicode_rules}}
|
||||||
|
mesecons_digicode_off_def = {receptor = {state = mesecon.state.off, rules = digicode_rules}}
|
||||||
|
|
||||||
|
local function toggle_digicode(pos)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
local name = node.name
|
||||||
|
if name == "scifi_nodes:digicode_off" then
|
||||||
|
minetest.sound_play("scifi_nodes_digicode", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||||
|
minetest.set_node(pos, {name="scifi_nodes:digicode_on", param2=node.param2})
|
||||||
|
mesecon.receptor_on(pos, digicode_rules)
|
||||||
|
minetest.get_node_timer(pos):start(2)
|
||||||
|
else
|
||||||
|
minetest.set_node(pos, {name="scifi_nodes:digicode_off", param2=node.param2})
|
||||||
|
mesecon.receptor_off(pos, digicode_rules)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- local function digicode_turn_off (pos)
|
||||||
|
-- local node = minetest.get_node(pos)
|
||||||
|
-- minetest.set_node (pos, {name = "scifi_nodes:digicode_off", param2 = node.param2})
|
||||||
|
-- mesecon.receptor_off(pos, digicode_rules)
|
||||||
|
-- return false
|
||||||
|
-- end
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:digicode_on", {
|
||||||
|
description = "Wall switch",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
tiles = {"scifi_nodes_digicode_on.png",},
|
||||||
|
inventory_image = "scifi_nodes_digicode_on.png",
|
||||||
|
wield_image = "scifi_nodes_digicode_on.png",
|
||||||
|
drawtype = "signlike",
|
||||||
|
node_box = {type = "wallmounted",},
|
||||||
|
selection_box = {type = "wallmounted",},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "wallmounted",
|
||||||
|
light_source = 5,
|
||||||
|
groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, mesecon_needs_receiver = 1},
|
||||||
|
mesecons = mesecons_digicode_on_def,
|
||||||
|
on_rightclick = toggle_digicode,
|
||||||
|
on_timer = toggle_digicode,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:digicode_off", {
|
||||||
|
description = "Digicode",
|
||||||
|
tiles = {"scifi_nodes_digicode_off.png",},
|
||||||
|
inventory_image = "scifi_nodes_digicode_on.png",
|
||||||
|
wield_image = "scifi_nodes_digicode_on.png",
|
||||||
|
drawtype = "signlike",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
node_box = {type = "wallmounted",},
|
||||||
|
selection_box = {type = "wallmounted",},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "wallmounted",
|
||||||
|
groups = {cracky=1, oddly_breakable_by_hand=1, mesecon_needs_receiver = 1},
|
||||||
|
mesecons = mesecons_digicode_off_def,
|
||||||
|
on_rightclick = toggle_digicode,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "scifi_nodes:digicode_off 2",
|
||||||
|
recipe = {
|
||||||
|
{"mesecons_switch:mesecon_switch_off", "scifi_nodes:grey", ""}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
--end of wall switch
|
-- In case mesecons mod is missing :
|
||||||
|
else
|
||||||
|
minetest.register_node("scifi_nodes:digicode_off", {
|
||||||
|
description = "Digicode",
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_digicode_off.png",
|
||||||
|
},
|
||||||
|
inventory_image = "scifi_nodes_digicode_on.png",
|
||||||
|
wield_image = "scifi_nodes_digicode_on.png",
|
||||||
|
drawtype = "signlike",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
node_box = {
|
||||||
|
type = "wallmounted",
|
||||||
|
},
|
||||||
|
selection_box = {
|
||||||
|
type = "wallmounted",
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "wallmounted",
|
||||||
|
groups = {cracky=1, oddly_breakable_by_hand=1},
|
||||||
|
on_rightclick = function(pos, node, clicker, item, _)
|
||||||
|
minetest.sound_play("scifi_nodes_digicode", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||||
|
minetest.swap_node(pos, {name="scifi_nodes:digicode_on", param2=node.param2})
|
||||||
|
end,
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:digicode_on", {
|
||||||
|
description = "Digicode",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_switch_on.png",
|
||||||
|
},
|
||||||
|
inventory_image = "scifi_nodes_digicode_on.png",
|
||||||
|
wield_image = "scifi_nodes_digicode_on.png",
|
||||||
|
drawtype = "signlike",
|
||||||
|
node_box = {
|
||||||
|
type = "wallmounted",
|
||||||
|
},
|
||||||
|
selecion_box = {
|
||||||
|
type = "wallmounted",
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "wallmounted",
|
||||||
|
light_source = 5,
|
||||||
|
groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1},
|
||||||
|
on_rightclick = function(pos, node, clicker, item, _)
|
||||||
|
minetest.swap_node(pos, {name="scifi_nodes:digicode_off", param2=node.param2})
|
||||||
|
end,
|
||||||
|
on_timer = function(pos, node, clicker, item, _)
|
||||||
|
minetest.swap_node(pos, {name="scifi_nodes:digicode_off", param2=node.param2})
|
||||||
|
end,
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
|
})
|
||||||
end -- if(mesecon.receptor ~= on
|
end -- if(mesecon.receptor ~= on
|
||||||
|
|
Loading…
Reference in New Issue