44
README.md
@ -1,19 +1,45 @@
|
|||||||
|
![Scifi nodes](screenshot.png)
|
||||||
|
|
||||||
# scifi_nodes
|
# scifi_nodes
|
||||||
Minetest mod that adds scifi themed nodes
|
|
||||||
|
|
||||||
**Adding Recipes for the unfinished scifi_nodes**
|
Minetest mod that adds scifi themed blocks, doors, materials, plants and other assets.
|
||||||
|
|
||||||
** Added support for stairsplus **
|
# Changes log
|
||||||
|
|
||||||
|
* 14/08/2019 : retrocompatibility fixed (aliases in doors.lua)
|
||||||
|
* 13/08/2019 :
|
||||||
|
* added mod option doors_open_with_mesecon_only (default = false)
|
||||||
|
* fixed a bug preventing the option from working
|
||||||
|
* 05/09/2019 : door opening on rightclick is disabled (maybe reactivated via a mod option)
|
||||||
|
* 05/08/2019 :
|
||||||
|
* digicodes now work
|
||||||
|
* new (and cleaner) implementation for palm scanner
|
||||||
|
* 05/05/2019 : added palm_scanner, which emmits mesecon signal when rightclicked by owner
|
||||||
|
* 05/01/2019 : create aliases to deal with old namming policy un doors.lua
|
||||||
|
* 04/26/2019 :
|
||||||
|
* sliding doors now open with mesecon signal
|
||||||
|
* added blue sliding doors
|
||||||
|
* added digicode node
|
||||||
|
* changed ceiling lights recipe
|
||||||
|
* added some sounds
|
||||||
|
* Added Recipes for the unfinished scifi_nodes
|
||||||
|
* Added support for stairsplus
|
||||||
|
|
||||||
# Attributions
|
# Attributions
|
||||||
|
|
||||||
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
|
||||||
|
* scifi_nodes_palm_scanner.ogg https://freesound.org/people/THE_bizniss/sounds/39313/
|
||||||
|
* scifi_nodes_access_granted https://freesound.org/people/TheBuilder15/sounds/415762/
|
||||||
|
* scifi_nodes_access_refused https://freesound.org/people/RICHERlandTV/sounds/216090/
|
||||||
|
|
||||||
Contributors:
|
# Contributors:
|
||||||
tanmayameher https://github.com/tanmayameher
|
|
||||||
naturefreshmilk https://github.com/naturefreshmilk
|
* tanmayameher https://github.com/tanmayameher
|
||||||
acmgit https://github.com/acmgit
|
* naturefreshmilk https://github.com/naturefreshmilk
|
||||||
catz85 https://github.com/catz85
|
* acmgit https://github.com/acmgit
|
||||||
coil0 https://github.com/coil0
|
* catz85 https://github.com/catz85
|
||||||
|
* coil0 https://github.com/coil0
|
||||||
|
@ -96,11 +96,13 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- 6 ceiling light from 2 plastic and 1 trap super glow glass
|
-- 8 ceiling light from 2 plastic and 1 meselamp
|
||||||
|
-- Old recipe used "moreblocks:trap_super_glow_glass"
|
||||||
|
-- but moreblocks is an optional dependance
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "scifi_nodes:lightbar 6",
|
output = "scifi_nodes:lightbar 8",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"scifi_nodes:white2", "moreblocks:trap_super_glow_glass", "scifi_nodes:white2"}
|
{"scifi_nodes:white2", "default:meselamp", "scifi_nodes:white2"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
default
|
default
|
||||||
basic_materials
|
basic_materials
|
||||||
|
mesecons
|
||||||
xpanes?
|
xpanes?
|
||||||
moreblocks?
|
moreblocks?
|
||||||
mesecons?
|
|
||||||
mesecons_microcontroller?
|
mesecons_microcontroller?
|
||||||
mesecons_button?
|
mesecons_button?
|
||||||
mesecons_torch?
|
mesecons_torch?
|
||||||
mesecons_receiver?
|
mesecons_receiver?
|
||||||
dye?
|
dye?
|
||||||
|
|
||||||
|
338
doors.lua
@ -14,45 +14,67 @@
|
|||||||
-- will the authors be held liable for any damages arising from the use of this content.
|
-- will the authors be held liable for any damages arising from the use of this content.
|
||||||
|
|
||||||
|
|
||||||
|
-- Retrieving mod settings
|
||||||
|
local scifi_nodes = {}
|
||||||
|
scifi_nodes.doors_open_with_mesecon_only = minetest.settings:get_bool("scifi_nodes.doors_open_with_mesecon_only", false)
|
||||||
|
|
||||||
|
-- Some aliases to deal with old namming policy --
|
||||||
|
minetest.register_alias("scifi_nodes:door1a","scifi_nodes:Doom_door_closed")
|
||||||
|
minetest.register_alias("scifi_nodes:door1b","scifi_nodes:Doom_door_closed_top")
|
||||||
|
minetest.register_alias("scifi_nodes:door1c","scifi_nodes:Doom_door_opened")
|
||||||
|
minetest.register_alias("scifi_nodes:door1d","scifi_nodes:Doom_door_opened_top")
|
||||||
|
|
||||||
|
minetest.register_alias("scifi_nodes:door2a","scifi_nodes:black_door_closed")
|
||||||
|
minetest.register_alias("scifi_nodes:door2b","scifi_nodes:black_door_closed_top")
|
||||||
|
minetest.register_alias("scifi_nodes:door2c","scifi_nodes:black_door_opened")
|
||||||
|
minetest.register_alias("scifi_nodes:door2d","scifi_nodes:black_door_opened_top")
|
||||||
|
|
||||||
|
minetest.register_alias("scifi_nodes:door3a","scifi_nodes:white_door_closed")
|
||||||
|
minetest.register_alias("scifi_nodes:door3b","scifi_nodes:white_door_closed_top")
|
||||||
|
minetest.register_alias("scifi_nodes:door3c","scifi_nodes:white_door_opened")
|
||||||
|
minetest.register_alias("scifi_nodes:door3d","scifi_nodes:white_door_opened_top")
|
||||||
|
|
||||||
|
minetest.register_alias("scifi_nodes:door4a","scifi_nodes:green_door_closed")
|
||||||
|
minetest.register_alias("scifi_nodes:door4b","scifi_nodes:green_door_closed_top")
|
||||||
|
minetest.register_alias("scifi_nodes:door4c","scifi_nodes:green_door_opened")
|
||||||
|
minetest.register_alias("scifi_nodes:door4d","scifi_nodes:green_door_opened_top")
|
||||||
|
|
||||||
|
-- This table now uses named parameters and more convenient variables names
|
||||||
local doors = {
|
local doors = {
|
||||||
-- Black door
|
{base_name = "Doom", base_ingredient = "doors:door_obsidian_glass", sound = "scifi_nodes_door_mechanic"},
|
||||||
{"scifi_nodes:door2a","scifi_nodes:door2b","scifi_nodes:door2c","scifi_nodes:door2d","2","black", "doors:door_steel", "scifi_nodes_door_mechanic"},
|
{base_name = "black", base_ingredient = "doors:door_steel", sound = "scifi_nodes_door_mechanic"},
|
||||||
-- White door
|
{base_name = "white", base_ingredient = "doors:door_glass", sound = "scifi_nodes_door_normal"},
|
||||||
{"scifi_nodes:door3a","scifi_nodes:door3b","scifi_nodes:door3c","scifi_nodes:door3d","3","white", "doors:door_glass", "scifi_nodes_door_normal"},
|
{base_name = "green", base_ingredient = "doors:door_wood", sound = "scifi_nodes_door_mechanic"},
|
||||||
-- Green door
|
{base_name = "blue", base_ingredient = "default:steel_block", sound = "scifi_nodes_door_normal"}
|
||||||
{"scifi_nodes:door4a","scifi_nodes:door4b","scifi_nodes:door4c","scifi_nodes:door4d","4","green", "doors:door_wood", "scifi_nodes_door_mechanic"},
|
|
||||||
-- DOOM door
|
|
||||||
{"scifi_nodes:door1a","scifi_nodes:door1b","scifi_nodes:door1c","scifi_nodes:door1d","1","Doom", "doors:door_obsidian_glass", "scifi_nodes_door_mechanic"}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, current_door in ipairs(doors) do
|
||||||
|
|
||||||
for i in ipairs (doors) do
|
local closed = "scifi_nodes:"..current_door.base_name.."_door_closed"
|
||||||
|
local closed_top = "scifi_nodes:"..current_door.base_name.."_door_closed_top"
|
||||||
|
local opened = "scifi_nodes:"..current_door.base_name.."_door_opened"
|
||||||
|
local opened_top = "scifi_nodes:"..current_door.base_name.."_door_opened_top"
|
||||||
|
local base_name = current_door.base_name
|
||||||
|
local base_ingredient = current_door.base_ingredient
|
||||||
|
local sound = current_door.sound
|
||||||
|
local doors_rightclick
|
||||||
|
|
||||||
-- TODO: make a map with entries: {a="", b="", desc="", etc}
|
minetest.register_craft({
|
||||||
local doora = doors[i][1]
|
output = closed .. " 2",
|
||||||
local doorb = doors[i][2]
|
|
||||||
local doorc = doors[i][3]
|
|
||||||
local doord = doors[i][4]
|
|
||||||
local num = doors[i][5]
|
|
||||||
local des = doors[i][6]
|
|
||||||
local base_ingredient = doors[i][7]
|
|
||||||
local sound = doors[i][8]
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = doora .. " 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)
|
||||||
|
-- Is there room enough ?
|
||||||
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 -- 2 nodes above
|
||||||
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
|
||||||
@ -61,11 +83,16 @@ function onplace(itemstack, placer, pointed_thing)
|
|||||||
minetest.is_protected(pos2, placer:get_player_name()) then
|
minetest.is_protected(pos2, placer:get_player_name()) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local pt = pointed_thing.above
|
local pt = pointed_thing.above
|
||||||
local pt2 = {x=pt.x, y=pt.y, z=pt.z}
|
local pt2 = {x=pt.x, y=pt.y, z=pt.z}
|
||||||
pt2.y = pt2.y+1
|
pt2.y = pt2.y+1
|
||||||
|
-- Player look dir is converted to node rotation ?
|
||||||
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
|
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
|
||||||
|
-- Where to look for another door ?
|
||||||
local pt3 = {x=pt.x, y=pt.y, z=pt.z}
|
local pt3 = {x=pt.x, y=pt.y, z=pt.z}
|
||||||
|
|
||||||
|
-- Door param2 depends of placer's look dir
|
||||||
local p4 = 0
|
local p4 = 0
|
||||||
if p2 == 0 then
|
if p2 == 0 then
|
||||||
pt3.x = pt3.x-1
|
pt3.x = pt3.x-1
|
||||||
@ -80,23 +107,26 @@ function onplace(itemstack, placer, pointed_thing)
|
|||||||
pt3.z = pt3.z-1
|
pt3.z = pt3.z-1
|
||||||
p4 = 1
|
p4 = 1
|
||||||
end
|
end
|
||||||
if minetest.get_node(pt3).name == doora then
|
|
||||||
minetest.set_node(pt, {name=doora, param2=p4})
|
-- First door of a pair is already there
|
||||||
minetest.set_node(pt2, {name=doorb, param2=p4})
|
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})
|
||||||
|
-- Placed door is the first of a pair
|
||||||
else
|
else
|
||||||
minetest.set_node(pt, {name=doora, param2=p2})
|
minetest.set_node(pt, {name=closed, param2=p2,})
|
||||||
minetest.set_node(pt2, {name=doorb, param2=p2})
|
minetest.set_node(pt2, {name=closed_top, param2=p2})
|
||||||
end
|
end
|
||||||
|
|
||||||
itemstack:take_item(1)
|
itemstack:take_item(1)
|
||||||
|
|
||||||
return itemstack;
|
return itemstack;
|
||||||
end
|
end
|
||||||
|
|
||||||
function afterdestruct(pos, oldnode)
|
function afterdestruct(pos, oldnode)
|
||||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
|
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
|
||||||
end
|
end
|
||||||
|
|
||||||
function rightclick(pos, node, player, itemstack, pointed_thing)
|
function open_door(pos, node, player, itemstack, pointed_thing)
|
||||||
-- play sound
|
-- play sound
|
||||||
minetest.sound_play(sound,{
|
minetest.sound_play(sound,{
|
||||||
max_hear_distance = 16,
|
max_hear_distance = 16,
|
||||||
@ -115,51 +145,49 @@ function rightclick(pos, node, player, itemstack, pointed_thing)
|
|||||||
local h = 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=doorc, param2=node.param2})
|
minetest.set_node(pos, {name=opened, param2=node.param2})
|
||||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=doord, 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 == doora then
|
if a.name == closed then
|
||||||
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name=doorc, param2=a.param2})
|
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=doord, 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 b.name == doora then
|
if b.name == closed then
|
||||||
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name=doorc, param2=b.param2})
|
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+1,z=pos.z+1}, {name=doord, param2=b.param2})
|
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name=opened_top, param2=b.param2})
|
||||||
end
|
end
|
||||||
if c.name == doora then
|
if c.name == closed then
|
||||||
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name=doorc, param2=c.param2})
|
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=doord, param2=c.param2})
|
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name=opened_top, param2=c.param2})
|
||||||
end
|
end
|
||||||
if d.name == doora then
|
if d.name == closed then
|
||||||
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name=doorc, param2=d.param2})
|
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=doord, param2=d.param2})
|
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name=opened_top, param2=d.param2})
|
||||||
end
|
end
|
||||||
if e.name == doora then
|
if e.name == closed then
|
||||||
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z-1}, {name=doorc, param2=e.param2})
|
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=doord, 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
|
end
|
||||||
if f.name == doora then
|
if f.name == closed then
|
||||||
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z-1}, {name=doorc, param2=f.param2})
|
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=doord, 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
|
end
|
||||||
if g.name == doora then
|
if g.name == closed then
|
||||||
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z+1}, {name=doorc, param2=g.param2})
|
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=doord, 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
|
end
|
||||||
if h.name == doora then
|
if h.name == closed then
|
||||||
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z+1}, {name=doorc, param2=h.param2})
|
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=doord, 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
|
||||||
|
|
||||||
timer:start(3)
|
timer:start(3)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
function afterplace(pos, placer, itemstack, pointed_thing)
|
||||||
|
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name=opened_top,param2=nodeu.param2})
|
||||||
|
end
|
||||||
|
|
||||||
function afterplace(pos, placer, itemstack, pointed_thing)
|
function ontimer(pos, elapsed)
|
||||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name=doord,param2=nodeu.param2})
|
|
||||||
end
|
|
||||||
|
|
||||||
function ontimer(pos, elapsed)
|
|
||||||
-- play sound
|
-- play sound
|
||||||
minetest.sound_play(sound,{
|
minetest.sound_play(sound,{
|
||||||
max_hear_distance = 16,
|
max_hear_distance = 16,
|
||||||
@ -177,61 +205,86 @@ function ontimer(pos, elapsed)
|
|||||||
local g = 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 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})
|
||||||
|
|
||||||
minetest.set_node(pos, {name=doora, param2=node.param2})
|
if a.name == opened then
|
||||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=doorb, param2=node.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=closed_top, param2=a.param2})
|
||||||
if a.name == doorc then
|
|
||||||
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name=doora, param2=a.param2})
|
|
||||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name=doorb, param2=a.param2})
|
|
||||||
end
|
end
|
||||||
if b.name == doorc then
|
if b.name == opened then
|
||||||
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name=doora, 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=doorb, 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 == doorc then
|
if c.name == opened then
|
||||||
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name=doora, 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=doorb, 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 == doorc then
|
if d.name == opened then
|
||||||
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name=doora, 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=doorb, 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 == doorc then
|
if e.name == opened then
|
||||||
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z-1}, {name=doora, 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=doorb, 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 == doorc then
|
if f.name == opened then
|
||||||
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z-1}, {name=doora, 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=doorb, 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 == doorc then
|
if g.name == opened then
|
||||||
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z+1}, {name=doora, 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=doorb, 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
|
||||||
if h.name == doorc then
|
|
||||||
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z+1}, {name=doora, param2=h.param2})
|
|
||||||
minetest.set_node({x=pos.x-1, y=pos.y+1, z=pos.z+1}, {name=doorb, param2=h.param2})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
local mesecons_doors_rules = {
|
||||||
|
-- get signal from pressure plate
|
||||||
|
{x=-1, y=0, z=0},
|
||||||
|
{x=0, y=0, z=1},
|
||||||
|
{x=0, y=0, z=-1},
|
||||||
|
{x=1, y=0, z=0},
|
||||||
|
-- get signal from wall mounted button
|
||||||
|
{x=-1, y=1, z=-1},
|
||||||
|
{x=-1, y=1, z=1},
|
||||||
|
{x=0, y=1, z=-1},
|
||||||
|
{x=0, y=1, z=1},
|
||||||
|
{x=1, y=1, z=-1},
|
||||||
|
{x=1, y=1, z=1},
|
||||||
|
{x=-1, y=1, z=0},
|
||||||
|
{x=1, y=1, z=0},
|
||||||
|
}
|
||||||
|
|
||||||
minetest.register_node(doora, {
|
local mesecons_doors_def = {
|
||||||
description = des.." Sliding Door",
|
effector = {
|
||||||
inventory_image = "scifi_nodes_door"..num.."a_inv.png",
|
action_on = open_door,
|
||||||
wield_image = "scifi_nodes_door"..num.."a_inv.png",
|
rules = mesecons_doors_rules
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local doors_rightclick = nil -- Crashes serv if empty table !
|
||||||
|
if not scifi_nodes.doors_open_with_mesecon_only then doors_rightclick = open_door 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 = {
|
tiles = {
|
||||||
"scifi_nodes_door"..num.."a_edge.png",
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
"scifi_nodes_door"..num.."a_edge.png",
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
"scifi_nodes_door"..num.."a_edge.png",
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
"scifi_nodes_door"..num.."a_edge.png",
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
"scifi_nodes_door"..num.."a_rbottom.png",
|
"scifi_nodes_door_"..base_name.."_rbottom.png",
|
||||||
"scifi_nodes_door"..num.."a_bottom.png"
|
"scifi_nodes_door_"..base_name.."_bottom.png"
|
||||||
},
|
},
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky = 3},
|
groups = {cracky = 3, oddly_breakable_by_hand = 1},
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
@ -244,21 +297,20 @@ minetest.register_node(doora, {
|
|||||||
{-0.5, -0.5, -0.0625, 0.5, 1.5, 0.0625}
|
{-0.5, -0.5, -0.0625, 0.5, 1.5, 0.0625}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mesecons = mesecons_doors_def,
|
||||||
|
on_place = onplace,
|
||||||
|
after_destruct = afterdestruct,
|
||||||
|
on_rightclick = doors_rightclick,
|
||||||
|
})
|
||||||
|
|
||||||
on_place = onplace,
|
minetest.register_node(closed_top, {
|
||||||
|
|
||||||
after_destruct = afterdestruct,
|
|
||||||
|
|
||||||
on_rightclick = rightclick,
|
|
||||||
})
|
|
||||||
minetest.register_node(doorb, {
|
|
||||||
tiles = {
|
tiles = {
|
||||||
"scifi_nodes_door"..num.."a_edge.png",
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
"scifi_nodes_door"..num.."a_edge.png",
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
"scifi_nodes_door"..num.."a_edge.png",
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
"scifi_nodes_door"..num.."a_edge.png",
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
"scifi_nodes_door"..num.."a_rtop.png",
|
"scifi_nodes_door_"..base_name.."_rtop.png",
|
||||||
"scifi_nodes_door"..num.."a_top.png"
|
"scifi_nodes_door_"..base_name.."_top.png"
|
||||||
},
|
},
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
@ -276,20 +328,21 @@ minetest.register_node(doorb, {
|
|||||||
{0, 0, 0, 0, 0, 0},
|
{0, 0, 0, 0, 0, 0},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
minetest.register_node(doorc, {
|
|
||||||
|
minetest.register_node(opened, {
|
||||||
tiles = {
|
tiles = {
|
||||||
"scifi_nodes_door"..num.."a_edge.png",
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
"scifi_nodes_door"..num.."a_edge.png",
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
"scifi_nodes_door"..num.."a_edge.png",
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
"scifi_nodes_door"..num.."a_edge.png",
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
"scifi_nodes_door"..num.."a_rbottom0.png",
|
"scifi_nodes_door_"..base_name.."_rbottom0.png",
|
||||||
"scifi_nodes_door"..num.."a_bottom0.png"
|
"scifi_nodes_door_"..base_name.."_bottom0.png"
|
||||||
},
|
},
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
drop = doora,
|
drop = closed,
|
||||||
groups = {cracky = 1},
|
groups = {cracky = 1},
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
@ -303,18 +356,19 @@ minetest.register_node(doorc, {
|
|||||||
{-0.5, -0.5, -0.0625, -0.25, 1.5, 0.0625},
|
{-0.5, -0.5, -0.0625, -0.25, 1.5, 0.0625},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
after_place_node = afterplace,
|
after_place_node = afterplace,
|
||||||
after_destruct = afterdestruct,
|
after_destruct = afterdestruct,
|
||||||
on_timer = ontimer,
|
on_timer = ontimer,
|
||||||
})
|
})
|
||||||
minetest.register_node(doord, {
|
|
||||||
|
minetest.register_node(opened_top, {
|
||||||
tiles = {
|
tiles = {
|
||||||
"scifi_nodes_door"..num.."a_edge.png",
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
"scifi_nodes_door"..num.."a_edge.png",
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
"scifi_nodes_door"..num.."a_edge.png",
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
"scifi_nodes_door"..num.."a_edge.png",
|
"scifi_nodes_door_"..base_name.."_edge.png",
|
||||||
"scifi_nodes_door"..num.."a_rtopo.png",
|
"scifi_nodes_door_"..base_name.."_rtopo.png",
|
||||||
"scifi_nodes_door"..num.."a_topo.png"
|
"scifi_nodes_door_"..base_name.."_topo.png"
|
||||||
},
|
},
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
@ -332,5 +386,5 @@ minetest.register_node(doord, {
|
|||||||
{0, 0, 0, 0, 0, 0},
|
{0, 0, 0, 0, 0, 0},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end -- end of doors table browsing
|
||||||
|
62
init.lua
@ -129,7 +129,8 @@ minetest.register_node("scifi_nodes:rfloor", {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
light_source = 10,
|
light_source = 10,
|
||||||
groups = {cracky=1}
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_metal_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:bfloor", {
|
minetest.register_node("scifi_nodes:bfloor", {
|
||||||
@ -140,7 +141,8 @@ minetest.register_node("scifi_nodes:bfloor", {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
light_source = 10,
|
light_source = 10,
|
||||||
groups = {cracky=1}
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_metal_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -156,7 +158,8 @@ minetest.register_node("scifi_nodes:stripes2", {
|
|||||||
"scifi_nodes_stripes2.png"
|
"scifi_nodes_stripes2.png"
|
||||||
},
|
},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {cracky=1}
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_metal_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:gblock", {
|
minetest.register_node("scifi_nodes:gblock", {
|
||||||
@ -171,7 +174,8 @@ minetest.register_node("scifi_nodes:gblock", {
|
|||||||
"scifi_nodes_gblock.png"
|
"scifi_nodes_gblock.png"
|
||||||
},
|
},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {cracky=1}
|
groups = {cracky=1};
|
||||||
|
sounds = default.node_sound_metal_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:gblock2", {
|
minetest.register_node("scifi_nodes:gblock2", {
|
||||||
@ -187,7 +191,8 @@ minetest.register_node("scifi_nodes:gblock2", {
|
|||||||
},
|
},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=1}
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_metal_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:gblock3", {
|
minetest.register_node("scifi_nodes:gblock3", {
|
||||||
@ -203,7 +208,8 @@ minetest.register_node("scifi_nodes:gblock3", {
|
|||||||
},
|
},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=1}
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_metal_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -221,7 +227,8 @@ minetest.register_node("scifi_nodes:green_light", {
|
|||||||
},
|
},
|
||||||
light_source = 10,
|
light_source = 10,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {cracky=1}
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:red_light", {
|
minetest.register_node("scifi_nodes:red_light", {
|
||||||
@ -237,7 +244,8 @@ minetest.register_node("scifi_nodes:red_light", {
|
|||||||
},
|
},
|
||||||
light_source = 10,
|
light_source = 10,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {cracky=1}
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:discs", {
|
minetest.register_node("scifi_nodes:discs", {
|
||||||
@ -252,7 +260,8 @@ minetest.register_node("scifi_nodes:discs", {
|
|||||||
"scifi_nodes_discs.png"
|
"scifi_nodes_discs.png"
|
||||||
},
|
},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {cracky=1}
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:disc", {
|
minetest.register_node("scifi_nodes:disc", {
|
||||||
@ -279,6 +288,7 @@ minetest.register_node("scifi_nodes:blink", {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {cracky=1},
|
groups = {cracky=1},
|
||||||
light_source = 5,
|
light_source = 5,
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:black_lights", {
|
minetest.register_node("scifi_nodes:black_lights", {
|
||||||
@ -290,6 +300,7 @@ minetest.register_node("scifi_nodes:black_lights", {
|
|||||||
}},
|
}},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {cracky=1},
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:black_screen", {
|
minetest.register_node("scifi_nodes:black_screen", {
|
||||||
@ -302,6 +313,7 @@ minetest.register_node("scifi_nodes:black_screen", {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {cracky=1},
|
groups = {cracky=1},
|
||||||
light_source = 1,
|
light_source = 1,
|
||||||
|
sounds = default.node_sound_stone_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:screen", {
|
minetest.register_node("scifi_nodes:screen", {
|
||||||
@ -314,6 +326,7 @@ minetest.register_node("scifi_nodes:screen", {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {cracky=1},
|
groups = {cracky=1},
|
||||||
light_source = 5,
|
light_source = 5,
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:screen2", {
|
minetest.register_node("scifi_nodes:screen2", {
|
||||||
@ -326,6 +339,7 @@ minetest.register_node("scifi_nodes:screen2", {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {cracky=1},
|
groups = {cracky=1},
|
||||||
light_source = 5,
|
light_source = 5,
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -343,7 +357,8 @@ minetest.register_node("scifi_nodes:white_pad", {
|
|||||||
},
|
},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=1}
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:white_base", {
|
minetest.register_node("scifi_nodes:white_base", {
|
||||||
@ -359,7 +374,8 @@ minetest.register_node("scifi_nodes:white_base", {
|
|||||||
},
|
},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=1}
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:grnpipe", {
|
minetest.register_node("scifi_nodes:grnpipe", {
|
||||||
@ -376,6 +392,7 @@ minetest.register_node("scifi_nodes:grnpipe", {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=1},
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_metal_defaults(),
|
||||||
on_place = minetest.rotate_node
|
on_place = minetest.rotate_node
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -394,6 +411,7 @@ minetest.register_node("scifi_nodes:grnpipe2", {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=1},
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_metal_defaults(),
|
||||||
on_place = minetest.rotate_node
|
on_place = minetest.rotate_node
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -410,6 +428,7 @@ minetest.register_node("scifi_nodes:octrng", {
|
|||||||
light_source = 10,
|
light_source = 10,
|
||||||
groups = {cracky=2},
|
groups = {cracky=2},
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:octgrn", {
|
minetest.register_node("scifi_nodes:octgrn", {
|
||||||
@ -440,6 +459,7 @@ minetest.register_node("scifi_nodes:octbl", {
|
|||||||
light_source = 10,
|
light_source = 10,
|
||||||
groups = {cracky=2},
|
groups = {cracky=2},
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:octppl", {
|
minetest.register_node("scifi_nodes:octppl", {
|
||||||
@ -469,6 +489,7 @@ minetest.register_node("scifi_nodes:tower", {
|
|||||||
inventory_image = "scifi_nodes_tower.png",
|
inventory_image = "scifi_nodes_tower.png",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {cracky=2},
|
groups = {cracky=2},
|
||||||
|
sounds = default.node_sound_metal_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:junk", {
|
minetest.register_node("scifi_nodes:junk", {
|
||||||
@ -594,6 +615,7 @@ for _, row in ipairs(node.types) do
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
light_source = light,
|
light_source = light,
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -782,7 +804,8 @@ minetest.register_node("scifi_nodes:blumetlight", {
|
|||||||
},
|
},
|
||||||
light_source = 10,
|
light_source = 10,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {cracky=1}
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -794,7 +817,8 @@ minetest.register_node("scifi_nodes:lightstp", {
|
|||||||
},
|
},
|
||||||
light_source = default.LIGHT_MAX,
|
light_source = default.LIGHT_MAX,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {cracky=1}
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:blklt2", {
|
minetest.register_node("scifi_nodes:blklt2", {
|
||||||
@ -805,7 +829,8 @@ minetest.register_node("scifi_nodes:blklt2", {
|
|||||||
},
|
},
|
||||||
light_source = 10,
|
light_source = 10,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {cracky=1}
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:blumetstr", {
|
minetest.register_node("scifi_nodes:blumetstr", {
|
||||||
@ -816,7 +841,8 @@ minetest.register_node("scifi_nodes:blumetstr", {
|
|||||||
},
|
},
|
||||||
light_source = 10,
|
light_source = 10,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {cracky=1}
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:glass", {
|
minetest.register_node("scifi_nodes:glass", {
|
||||||
@ -828,7 +854,8 @@ minetest.register_node("scifi_nodes:glass", {
|
|||||||
},
|
},
|
||||||
use_texture_alpha = true,
|
use_texture_alpha = true,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {cracky=1}
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:whtlightbnd", {
|
minetest.register_node("scifi_nodes:whtlightbnd", {
|
||||||
@ -839,7 +866,8 @@ minetest.register_node("scifi_nodes:whtlightbnd", {
|
|||||||
},
|
},
|
||||||
light_source = 10,
|
light_source = 10,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {cracky=1}
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
--extra stuff
|
--extra stuff
|
||||||
|
4
mod.conf
@ -1,4 +1,4 @@
|
|||||||
name = scifi_nodes
|
name = scifi_nodes
|
||||||
description = A mod which the vegan kitchen to Minetest.
|
description = A mod which the vegan kitchen to Minetest.
|
||||||
depends = default,dye,basic_materials
|
depends = default,dye,basic_materials, mesecons
|
||||||
optional_depends = xpanes,moreblocks,mesecons,mesecons_microcontroller,mesecons_button,mesecons_torch,mesecons_receiver
|
optional_depends = xpanes,moreblocks,mesecons_microcontroller,mesecons_button,mesecons_torch,mesecons_receiver
|
||||||
|
426
nodeboxes.lua
@ -32,6 +32,7 @@ minetest.register_node("scifi_nodes:alienslope", {
|
|||||||
{-0.125, 0.375, -0.5, 0.5, 0.5, 0.5}, -- NodeBox17
|
{-0.125, 0.375, -0.5, 0.5, 0.5, 0.5}, -- NodeBox17
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
on_place = minetest.rotate_node
|
on_place = minetest.rotate_node
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -61,6 +62,7 @@ minetest.register_node("scifi_nodes:wallpipe", {
|
|||||||
{-0.5, -0.125, 0, 0.5, 0, 0.0625}, -- NodeBox24
|
{-0.5, -0.125, 0, 0.5, 0, 0.0625}, -- NodeBox24
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
sounds = default.node_sound_wood_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:plant_trap", {
|
minetest.register_node("scifi_nodes:plant_trap", {
|
||||||
@ -88,7 +90,8 @@ minetest.register_node("scifi_nodes:plant_trap", {
|
|||||||
{-0.0625, -0.5, -0.0625, 0, -0.4375, 0.375}, -- NodeBox27
|
{-0.0625, -0.5, -0.0625, 0, -0.4375, 0.375}, -- NodeBox27
|
||||||
{-0.0625, -0.5, 0.3125, 0, 0.5, 0.375}, -- NodeBox28
|
{-0.0625, -0.5, 0.3125, 0, 0.5, 0.375}, -- NodeBox28
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:egg", {
|
minetest.register_node("scifi_nodes:egg", {
|
||||||
@ -118,7 +121,8 @@ minetest.register_node("scifi_nodes:egg", {
|
|||||||
{-0.1875, 0.6875, -0.1875, 0.1875, 0.75, 0.1875}, -- NodeBox7
|
{-0.1875, 0.6875, -0.1875, 0.1875, 0.75, 0.1875}, -- NodeBox7
|
||||||
{-0.125, 0.75, -0.125, 0.125, 0.8125, 0.125}, -- NodeBox8
|
{-0.125, 0.75, -0.125, 0.125, 0.8125, 0.125}, -- NodeBox8
|
||||||
{-0.375, -0.3125, -0.4375, 0.375, 0.3125, 0.4375}, -- NodeBox9
|
{-0.375, -0.3125, -0.4375, 0.375, 0.3125, 0.4375}, -- NodeBox9
|
||||||
}
|
},
|
||||||
|
sounds = default.node_sound_wood_defaults()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -261,7 +265,8 @@ minetest.register_node("scifi_nodes:pad", {
|
|||||||
{-0.8125, -0.5, -0.875, 0.75, -0.375, 0.875}, -- NodeBox2
|
{-0.8125, -0.5, -0.875, 0.75, -0.375, 0.875}, -- NodeBox2
|
||||||
{-0.875, -0.5, -0.8125, 0.8125, -0.375, 0.8125}, -- NodeBox3
|
{-0.875, -0.5, -0.8125, 0.8125, -0.375, 0.8125}, -- NodeBox3
|
||||||
{-0.8125, -0.5, -0.75, 0.75, -0.3125, 0.75}, -- NodeBox4
|
{-0.8125, -0.5, -0.75, 0.75, -0.3125, 0.75}, -- NodeBox4
|
||||||
}
|
},
|
||||||
|
sounds = default.node_sound_wood_defaults()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -361,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 = {
|
||||||
@ -506,7 +509,8 @@ minetest.register_node("scifi_nodes:ladder", {
|
|||||||
{0.3125, -0.5, 0.3125, 0.4375, -0.375, 0.4375}, -- NodeBox24
|
{0.3125, -0.5, 0.3125, 0.4375, -0.375, 0.4375}, -- NodeBox24
|
||||||
{0.3125, -0.5, 0.0625, 0.4375, -0.375, 0.1875}, -- NodeBox25
|
{0.3125, -0.5, 0.0625, 0.4375, -0.375, 0.1875}, -- NodeBox25
|
||||||
{0.3125, -0.5, -0.1875, 0.4375, -0.375, -0.0625}, -- NodeBox26
|
{0.3125, -0.5, -0.1875, 0.4375, -0.375, -0.0625}, -- NodeBox26
|
||||||
}
|
},
|
||||||
|
sounds = default.node_sound_metal_defaults()
|
||||||
},
|
},
|
||||||
paramtype2 = "wallmounted",
|
paramtype2 = "wallmounted",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
@ -634,6 +638,7 @@ minetest.register_node("scifi_nodes:cover", {
|
|||||||
{-0.3125, -0.375, -0.3125, 0.3125, -0.3125, 0.3125}, -- NodeBox6
|
{-0.3125, -0.375, -0.3125, 0.3125, -0.3125, 0.3125}, -- NodeBox6
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
groups = {cracky=1, oddly_breakable_by_hand=1}
|
groups = {cracky=1, oddly_breakable_by_hand=1}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -738,6 +743,7 @@ minetest.register_node("scifi_nodes:table", {
|
|||||||
{-0.0625, 0.25, -0.125, 0.0625, 0.4375, -0.0625}, -- NodeBox7
|
{-0.0625, 0.25, -0.125, 0.0625, 0.4375, -0.0625}, -- NodeBox7
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
sounds = default.node_sound_metal_defaults(),
|
||||||
groups = {cracky=1}
|
groups = {cracky=1}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1203,112 +1209,356 @@ minetest.register_node("scifi_nodes:windowpanel", {
|
|||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
if (mesecon ~= nil) and
|
|
||||||
(mesecon.receptor_on ~= nil) and
|
|
||||||
(mesecon.receptor_off ~= nil) then
|
|
||||||
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,
|
|
||||||
selection_box = {
|
|
||||||
type = "wallmounted",
|
|
||||||
fixed = {-0.5, -0.3, -0.3, -0.45, 0.3, 0.3}
|
|
||||||
},
|
|
||||||
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", {
|
--------------
|
||||||
|
-- Switches --
|
||||||
|
--------------
|
||||||
|
|
||||||
|
local function get_switch_rules(param2)
|
||||||
|
|
||||||
|
-- param2 = 2
|
||||||
|
local rules = {
|
||||||
|
{x=1, y=-1, z=-1},
|
||||||
|
{x=1, y=-1, z=1},
|
||||||
|
{x=0, y=-1, z=-1},
|
||||||
|
{x=0, y=-1, z=1},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Left and right when looking to +y ?
|
||||||
|
if param2 == 3 then
|
||||||
|
rules = mesecon.rotate_rules_right(mesecon.rotate_rules_right (rules))
|
||||||
|
elseif param2 == 4 then
|
||||||
|
rules = mesecon.rotate_rules_right(rules)
|
||||||
|
elseif param2 == 5 then
|
||||||
|
rules = mesecon.rotate_rules_left(rules)
|
||||||
|
end
|
||||||
|
return rules
|
||||||
|
end
|
||||||
|
|
||||||
|
local function toggle_switch(pos)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
local name = node.name
|
||||||
|
if name == "scifi_nodes:switch_on" then
|
||||||
|
minetest.sound_play("scifi_nodes_switch", {max_hear_distance = 8, pos = pos})
|
||||||
|
minetest.set_node(pos, {name = "scifi_nodes:switch_off", param2 = node.param2})
|
||||||
|
mesecon.receptor_off(pos, get_switch_rules(node.param2))
|
||||||
|
elseif name == "scifi_nodes:switch_off" then
|
||||||
|
minetest.sound_play("scifi_nodes_switch", {max_hear_distance = 8, pos = pos})
|
||||||
|
minetest.set_node(pos, {name = "scifi_nodes:switch_on", param2 = node.param2})
|
||||||
|
mesecon.receptor_on(pos, get_switch_rules(node.param2))
|
||||||
|
minetest.get_node_timer(pos):start(2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:switch_on", {
|
||||||
description = "Wall switch",
|
description = "Wall switch",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
tiles = {
|
buildable_to = false,
|
||||||
"scifi_nodes_switch_on.png",
|
tiles = {"scifi_nodes_switch_on.png",},
|
||||||
},
|
|
||||||
inventory_image = "scifi_nodes_switch_on.png",
|
inventory_image = "scifi_nodes_switch_on.png",
|
||||||
wield_image = "scifi_nodes_switch_on.png",
|
wield_image = "scifi_nodes_switch_on.png",
|
||||||
drawtype = "signlike",
|
drawtype = "signlike",
|
||||||
selection_box = {
|
node_box = {type = "wallmounted",},
|
||||||
type = "wallmounted",
|
selection_box = {type = "wallmounted",},
|
||||||
fixed = {-0.5, -0.3, -0.3, -0.45, 0.3, 0.3}
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
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},
|
||||||
on_rightclick = function(pos, node, clicker, item, _)
|
mesecons = {receptor = {state = mesecon.state.on,}},
|
||||||
minetest.set_node(pos, {name="scifi_nodes:switch_off", param2=node.param2})
|
|
||||||
mesecon.receptor_off(pos)
|
|
||||||
end,
|
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
mesecons = {receptor = { state = mesecon.state.on }}
|
on_rightclick = toggle_switch,
|
||||||
})
|
on_timer = toggle_switch
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_node("scifi_nodes:switch_off", {
|
||||||
output = "scifi_nodes:switch_off 2",
|
|
||||||
recipe = {
|
|
||||||
{"mesecons_button:button_off", "scifi_nodes:grey", ""}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
else
|
|
||||||
--wall switch, currently does not do anything
|
|
||||||
minetest.register_node("scifi_nodes:switch_off", {
|
|
||||||
description = "Wall switch",
|
description = "Wall switch",
|
||||||
tiles = {
|
tiles = {"scifi_nodes_switch_off.png",},
|
||||||
"scifi_nodes_switch_off.png",
|
|
||||||
},
|
|
||||||
inventory_image = "scifi_nodes_switch_on.png",
|
inventory_image = "scifi_nodes_switch_on.png",
|
||||||
wield_image = "scifi_nodes_switch_on.png",
|
wield_image = "scifi_nodes_switch_on.png",
|
||||||
drawtype = "signlike",
|
drawtype = "signlike",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
selection_box = {
|
buildable_to = false,
|
||||||
type = "wallmounted",
|
node_box = {type = "wallmounted",},
|
||||||
fixed = {-0.5, -0.3, -0.3, -0.45, 0.3, 0.3}
|
selection_box = {type = "wallmounted",},
|
||||||
},
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "wallmounted",
|
paramtype2 = "wallmounted",
|
||||||
groups = {cracky=1, oddly_breakable_by_hand=1},
|
groups = {cracky=1, oddly_breakable_by_hand=1, mesecon_needs_receiver = 1},
|
||||||
on_rightclick = function(pos, node, clicker, item, _)
|
mesecons = {receptor = {state = mesecon.state.off,}},
|
||||||
minetest.set_node(pos, {name="scifi_nodes:switch_on", param2=node.param2})
|
sounds = default.node_sound_glass_defaults(),
|
||||||
end,
|
on_rightclick = toggle_switch
|
||||||
sounds = default.node_sound_glass_defaults()
|
})
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:switch_on", {
|
minetest.register_craft({
|
||||||
description = "Wall switch",
|
output = "scifi_nodes:switch_off 2",
|
||||||
|
recipe = {{"mesecons_button:button_off", "scifi_nodes:grey", ""}}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
--------------
|
||||||
|
-- Digicode --
|
||||||
|
--------------
|
||||||
|
|
||||||
|
local secret_code = "1234"
|
||||||
|
local allowed_chars = "0123456789"
|
||||||
|
local code_length = 4
|
||||||
|
local digicode_context = {}
|
||||||
|
|
||||||
|
-- after_place_node, use by digicode and palm_scanner
|
||||||
|
-- placer is a player object
|
||||||
|
local function set_owner(pos, placer, itemstack, pointed_thing)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("owner", placer:get_player_name())
|
||||||
|
meta:set_string("code", secret_code)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function toggle_digicode(pos)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
local name = node.name
|
||||||
|
if name == "scifi_nodes:digicode_off" then
|
||||||
|
minetest.swap_node(pos, {name="scifi_nodes:digicode_on", param2=node.param2})
|
||||||
|
mesecon.receptor_on(pos, get_switch_rules(node.param2))
|
||||||
|
minetest.get_node_timer(pos):start(2)
|
||||||
|
elseif name == "scifi_nodes:digicode_on" then
|
||||||
|
minetest.swap_node(pos, {name="scifi_nodes:digicode_off", param2=node.param2})
|
||||||
|
mesecon.receptor_off(pos, get_switch_rules(node.param2))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function code_is_valid(code)
|
||||||
|
local valid = false
|
||||||
|
if type(code) == "string" and #code == code_length then
|
||||||
|
valid = true
|
||||||
|
end
|
||||||
|
for i=1, #code do
|
||||||
|
if not string.find(allowed_chars, string.sub(code,i,i)) then
|
||||||
|
valid = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return valid
|
||||||
|
end
|
||||||
|
|
||||||
|
local function update_code(pos, code)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("code", code)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function show_digicode_formspec(pos, node, player, itemstack, pointed_thing)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local owner = meta:get_string("owner")
|
||||||
|
local current_code = meta:get_string("code")
|
||||||
|
local current_player = player:get_player_name()
|
||||||
|
|
||||||
|
-- Gathering datas that will be used by callback function
|
||||||
|
digicode_context[current_player] = {code = current_code, pos = pos}
|
||||||
|
|
||||||
|
if current_player == owner then
|
||||||
|
minetest.show_formspec(current_player, "digicode_formspec",
|
||||||
|
"size[6,3]"..
|
||||||
|
"field[1,1;3,1;code;Code;]".. -- type, position, size, name, label
|
||||||
|
"button_exit[1,2;2,1;change;Change code]"..
|
||||||
|
"button_exit[3,2;2,1;open;Open door]")
|
||||||
|
else
|
||||||
|
minetest.show_formspec(current_player, "digicode_formspec",
|
||||||
|
"size[6,3]"..
|
||||||
|
"field[2,1;3,1;code;Code;]"..
|
||||||
|
"button_exit[2,2;3,1;open;Open door]")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Process datas from digicode_formspec
|
||||||
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
|
if formname ~= "digicode_formspec" then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local sounds = {"scifi_nodes_scanner_granted","scifi_nodes_scanner_refused",
|
||||||
|
"scifi_nodes_digicode_granted","scifi_nodes_digicode_refused"
|
||||||
|
}
|
||||||
|
local sound_index
|
||||||
|
|
||||||
|
-- We have the right formspec so we can proceed it.
|
||||||
|
-- Let's retrieve the datas we need :
|
||||||
|
local context = digicode_context[player:get_player_name()]
|
||||||
|
|
||||||
|
if fields.change and code_is_valid(fields.code) then
|
||||||
|
update_code(context.pos, fields.code)
|
||||||
|
sound_index = 1
|
||||||
|
elseif
|
||||||
|
fields.change and not code_is_valid(fields.code) then
|
||||||
|
sound_index = 2
|
||||||
|
elseif
|
||||||
|
fields.open and fields.code == context.code then
|
||||||
|
toggle_digicode(context.pos)
|
||||||
|
sound_index = 3
|
||||||
|
elseif
|
||||||
|
fields.open and fields.code ~= context.code then
|
||||||
|
sound_index = 4
|
||||||
|
end
|
||||||
|
-- play sound at context position
|
||||||
|
minetest.sound_play(sounds[sound_index], {
|
||||||
|
pos = context.pos,
|
||||||
|
max_hear_distance = 10
|
||||||
|
})
|
||||||
|
context[player:get_player_name()] = nil -- we don't need it anymore
|
||||||
|
end)
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:digicode_on", {
|
||||||
|
description = "Digicode",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
tiles = {
|
buildable_to = false,
|
||||||
"scifi_nodes_switch_on.png",
|
tiles = {"scifi_nodes_digicode_on.png",},
|
||||||
},
|
inventory_image = "scifi_nodes_digicode_on.png",
|
||||||
inventory_image = "scifi_nodes_switch_on.png",
|
wield_image = "scifi_nodes_digicode_on.png",
|
||||||
wield_image = "scifi_nodes_switch_on.png",
|
|
||||||
drawtype = "signlike",
|
drawtype = "signlike",
|
||||||
selection_box = {
|
node_box = {type = "wallmounted",},
|
||||||
type = "wallmounted",
|
selection_box = {type = "wallmounted",},
|
||||||
fixed = {-0.5, -0.3, -0.3, -0.45, 0.3, 0.3}
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "wallmounted",
|
paramtype2 = "wallmounted",
|
||||||
light_source = 5,
|
light_source = 5,
|
||||||
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, mesecon_needs_receiver = 1},
|
||||||
on_rightclick = function(pos, node, clicker, item, _)
|
drop = {items = {"scifi_nodes:digicode_off"}},
|
||||||
minetest.set_node(pos, {name="scifi_nodes:switch_off", param2=node.param2})
|
mesecons = {receptor = {state = mesecon.state.on,}},
|
||||||
end,
|
on_timer = toggle_digicode,
|
||||||
sounds = default.node_sound_glass_defaults()
|
sounds = default.node_sound_glass_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
--end of wall switch
|
minetest.register_node("scifi_nodes:digicode_off", {
|
||||||
|
description = "Digicode",
|
||||||
|
tiles = {"scifi_nodes_digicode_off.png",},
|
||||||
|
inventory_image = "scifi_nodes_digicode_off.png",
|
||||||
|
wield_image = "scifi_nodes_digicode_off.png",
|
||||||
|
drawtype = "signlike",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
buildable_to = false,
|
||||||
|
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 = {receptor = {state = mesecon.state.off,}},
|
||||||
|
after_place_node = set_owner,
|
||||||
|
on_rightclick = show_digicode_formspec,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
end -- if(mesecon.receptor ~= on
|
minetest.register_craft({
|
||||||
|
output = "scifi_nodes:digicode_off 2",
|
||||||
|
recipe = {{"mesecons_switch:mesecon_switch_off", "scifi_nodes:grey", ""}}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------
|
||||||
|
-- Palm scanner --
|
||||||
|
-----------------------------------------------
|
||||||
|
-- /!\ When "overriding" a callback function --
|
||||||
|
-- re-use all the parameters in same order ! --
|
||||||
|
-----------------------------------------------
|
||||||
|
|
||||||
|
-- after_place_node
|
||||||
|
-- placer is a player object
|
||||||
|
local function set_scanner_owner(pos, placer, itemstack, pointed_thing)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("owner", placer:get_player_name())
|
||||||
|
end
|
||||||
|
|
||||||
|
local function toggle_palm_scanner(pos, node, player, itemstack, pointed_thing)
|
||||||
|
-- Some calling function don't send node param, but everybody sends a pos, so :
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
if node.name == "scifi_nodes:palm_scanner_off" then
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("clicker", player:get_player_name()) -- need to keep it somewhere
|
||||||
|
minetest.swap_node(pos, {name = "scifi_nodes:palm_scanner_checking", param2 = node.param2})
|
||||||
|
minetest.sound_play("scifi_nodes_palm_scanner", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||||
|
minetest.chat_send_player(player:get_player_name(), "Checking : please wait.")
|
||||||
|
minetest.get_node_timer(pos):start(2)
|
||||||
|
elseif node.name == "scifi_nodes:palm_scanner_checking" then
|
||||||
|
minetest.swap_node(pos,{name = "scifi_nodes:palm_scanner_on", param2 = node.param2})
|
||||||
|
mesecon.receptor_on(pos, get_switch_rules(node.param2))
|
||||||
|
minetest.get_node_timer(pos):start(2)
|
||||||
|
elseif node.name == "scifi_nodes:palm_scanner_on" then
|
||||||
|
minetest.sound_play("scifi_nodes_switch", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||||
|
minetest.swap_node(pos, {name = "scifi_nodes:palm_scanner_off", param2 = node.param2})
|
||||||
|
mesecon.receptor_off (pos, get_switch_rules(node.param2))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- palm_scanner_checking.on_timer
|
||||||
|
local function check_owner(pos, elapsed)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local owner = meta:get_string("owner")
|
||||||
|
local clicker = meta:get_string("clicker")
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
if clicker == owner then
|
||||||
|
minetest.sound_play("scifi_nodes_scanner_granted", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||||
|
minetest.chat_send_player(clicker, "Access granted !")
|
||||||
|
toggle_palm_scanner (pos)
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(clicker, "Access refused !")
|
||||||
|
minetest.sound_play("scifi_nodes_scanner_refused", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||||
|
minetest.swap_node(pos, {name = "scifi_nodes:palm_scanner_off", param2 = node.param2})
|
||||||
|
mesecon.receptor_off(pos, get_switch_rules(node.param2))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:palm_scanner_off", {
|
||||||
|
description = "Palm scanner",
|
||||||
|
tiles = {"scifi_nodes_palm_scanner_off.png",},
|
||||||
|
inventory_image = "scifi_nodes_palm_scanner_off.png",
|
||||||
|
wield_image = "scifi_nodes_palm_scanner_on.png",
|
||||||
|
drawtype = "signlike",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
buildable_to = false,
|
||||||
|
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 = {receptor = {state = mesecon.state.off,}},
|
||||||
|
after_place_node = set_scanner_owner,
|
||||||
|
on_rightclick = toggle_palm_scanner,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:palm_scanner_checking", {
|
||||||
|
description = "Palm scanner",
|
||||||
|
tiles = {{
|
||||||
|
name = "scifi_nodes_palm_scanner_checking.png",
|
||||||
|
animation = {type = "vertical_frames",aspect_w = 16,aspect_h = 16,length = 1.5}
|
||||||
|
}},
|
||||||
|
drawtype = "signlike",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
buildable_to = false,
|
||||||
|
node_box = {type = "wallmounted",},
|
||||||
|
selection_box = {type = "wallmounted",},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "wallmounted",
|
||||||
|
groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, mesecon_needs_receiver = 1},
|
||||||
|
drop = "scifi_nodes:palm_scanner_off",
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
on_timer = check_owner,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:palm_scanner_on", {
|
||||||
|
description = "Palm scanner",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
buildable_to = false,
|
||||||
|
tiles = {"scifi_nodes_palm_scanner_on.png",},
|
||||||
|
inventory_image = "scifi_nodes_palm_scanner_on.png",
|
||||||
|
wield_image = "scifi_nodes_palm_scanner_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},
|
||||||
|
drop = "scifi_nodes:palm_scanner_off",
|
||||||
|
mesecons = {receptor = {state = mesecon.state.on,}},
|
||||||
|
on_timer = toggle_palm_scanner,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "scifi_nodes:palm_scanner_off 2",
|
||||||
|
recipe = {{"mesecons_powerplant:power_plant", "scifi_nodes:grey", ""}}
|
||||||
|
})
|
||||||
|
2
settingtypes.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Doors can only be opened by mesecon signal
|
||||||
|
scifi_nodes.doors_open_with_mesecon_only (disables right click on doors) bool true
|
BIN
sounds/scifi_nodes_access_granted.ogg
Normal file
BIN
sounds/scifi_nodes_access_refused.ogg
Normal file
BIN
sounds/scifi_nodes_digicode.ogg
Normal file
BIN
sounds/scifi_nodes_digicode_granted.ogg
Normal file
BIN
sounds/scifi_nodes_digicode_refused.ogg
Normal file
BIN
sounds/scifi_nodes_palm_scanner.ogg
Normal file
BIN
sounds/scifi_nodes_scanner_granted.ogg
Normal file
BIN
sounds/scifi_nodes_scanner_refused.ogg
Normal file
BIN
sounds/scifi_nodes_switch.ogg
Normal file
BIN
sounds/scifi_nodes_wrong.ogg
Normal file
BIN
textures/scifi_nodes_digicode_off.png
Normal file
After Width: | Height: | Size: 450 B |
BIN
textures/scifi_nodes_digicode_on.png
Normal file
After Width: | Height: | Size: 457 B |
Before Width: | Height: | Size: 382 B |
Before Width: | Height: | Size: 373 B |
Before Width: | Height: | Size: 754 B After Width: | Height: | Size: 754 B |
Before Width: | Height: | Size: 314 B After Width: | Height: | Size: 314 B |
Before Width: | Height: | Size: 91 B After Width: | Height: | Size: 91 B |
Before Width: | Height: | Size: 502 B After Width: | Height: | Size: 502 B |
Before Width: | Height: | Size: 780 B After Width: | Height: | Size: 780 B |
Before Width: | Height: | Size: 308 B After Width: | Height: | Size: 308 B |
Before Width: | Height: | Size: 637 B After Width: | Height: | Size: 637 B |
Before Width: | Height: | Size: 270 B After Width: | Height: | Size: 270 B |
Before Width: | Height: | Size: 691 B After Width: | Height: | Size: 691 B |
Before Width: | Height: | Size: 275 B After Width: | Height: | Size: 275 B |
Before Width: | Height: | Size: 324 B After Width: | Height: | Size: 324 B |
Before Width: | Height: | Size: 188 B After Width: | Height: | Size: 188 B |
Before Width: | Height: | Size: 70 B After Width: | Height: | Size: 70 B |
Before Width: | Height: | Size: 347 B After Width: | Height: | Size: 347 B |
Before Width: | Height: | Size: 351 B After Width: | Height: | Size: 351 B |
Before Width: | Height: | Size: 212 B After Width: | Height: | Size: 212 B |
Before Width: | Height: | Size: 401 B After Width: | Height: | Size: 401 B |
Before Width: | Height: | Size: 269 B After Width: | Height: | Size: 269 B |
Before Width: | Height: | Size: 385 B After Width: | Height: | Size: 385 B |
Before Width: | Height: | Size: 250 B After Width: | Height: | Size: 250 B |
BIN
textures/scifi_nodes_door_blue_bottom.png
Normal file
After Width: | Height: | Size: 238 B |
BIN
textures/scifi_nodes_door_blue_bottom0.png
Normal file
After Width: | Height: | Size: 210 B |
BIN
textures/scifi_nodes_door_blue_edge.png
Normal file
After Width: | Height: | Size: 128 B |
BIN
textures/scifi_nodes_door_blue_inv.png
Normal file
After Width: | Height: | Size: 269 B |
BIN
textures/scifi_nodes_door_blue_rbottom.png
Normal file
After Width: | Height: | Size: 219 B |
BIN
textures/scifi_nodes_door_blue_rbottom0.png
Normal file
After Width: | Height: | Size: 209 B |
BIN
textures/scifi_nodes_door_blue_rtop.png
Normal file
After Width: | Height: | Size: 264 B |
BIN
textures/scifi_nodes_door_blue_rtopo.png
Normal file
After Width: | Height: | Size: 223 B |
BIN
textures/scifi_nodes_door_blue_top.png
Normal file
After Width: | Height: | Size: 251 B |
BIN
textures/scifi_nodes_door_blue_topo.png
Normal file
After Width: | Height: | Size: 204 B |
BIN
textures/scifi_nodes_door_green_bottom.png
Normal file
After Width: | Height: | Size: 410 B |
Before Width: | Height: | Size: 187 B After Width: | Height: | Size: 187 B |
Before Width: | Height: | Size: 91 B After Width: | Height: | Size: 91 B |
Before Width: | Height: | Size: 299 B After Width: | Height: | Size: 299 B |
BIN
textures/scifi_nodes_door_green_rbottom.png
Normal file
After Width: | Height: | Size: 419 B |
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 194 B |
Before Width: | Height: | Size: 367 B After Width: | Height: | Size: 367 B |
Before Width: | Height: | Size: 159 B After Width: | Height: | Size: 159 B |
Before Width: | Height: | Size: 351 B After Width: | Height: | Size: 351 B |
Before Width: | Height: | Size: 161 B After Width: | Height: | Size: 161 B |
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 138 B After Width: | Height: | Size: 138 B |
Before Width: | Height: | Size: 70 B After Width: | Height: | Size: 70 B |
Before Width: | Height: | Size: 214 B After Width: | Height: | Size: 214 B |
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 218 B |
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 258 B After Width: | Height: | Size: 258 B |
Before Width: | Height: | Size: 164 B After Width: | Height: | Size: 164 B |
Before Width: | Height: | Size: 221 B After Width: | Height: | Size: 221 B |
Before Width: | Height: | Size: 145 B After Width: | Height: | Size: 145 B |
BIN
textures/scifi_nodes_palm_scanner_checking.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
textures/scifi_nodes_palm_scanner_off.png
Normal file
After Width: | Height: | Size: 408 B |
BIN
textures/scifi_nodes_palm_scanner_on.png
Normal file
After Width: | Height: | Size: 409 B |