44
README.md
@ -1,19 +1,45 @@
|
||||
![Scifi nodes](screenshot.png)
|
||||
|
||||
# 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
|
||||
|
||||
CC BY-NC 3.0
|
||||
* 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_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:
|
||||
tanmayameher https://github.com/tanmayameher
|
||||
naturefreshmilk https://github.com/naturefreshmilk
|
||||
acmgit https://github.com/acmgit
|
||||
catz85 https://github.com/catz85
|
||||
coil0 https://github.com/coil0
|
||||
# Contributors:
|
||||
|
||||
* tanmayameher https://github.com/tanmayameher
|
||||
* naturefreshmilk https://github.com/naturefreshmilk
|
||||
* acmgit https://github.com/acmgit
|
||||
* 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({
|
||||
output = "scifi_nodes:lightbar 6",
|
||||
output = "scifi_nodes:lightbar 8",
|
||||
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
|
||||
basic_materials
|
||||
mesecons
|
||||
xpanes?
|
||||
moreblocks?
|
||||
mesecons?
|
||||
mesecons_microcontroller?
|
||||
mesecons_button?
|
||||
mesecons_torch?
|
||||
mesecons_receiver?
|
||||
dye?
|
||||
|
||||
|
656
doors.lua
@ -14,323 +14,377 @@
|
||||
-- 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 = {
|
||||
-- Black door
|
||||
{"scifi_nodes:door2a","scifi_nodes:door2b","scifi_nodes:door2c","scifi_nodes:door2d","2","black", "doors:door_steel", "scifi_nodes_door_mechanic"},
|
||||
-- White door
|
||||
{"scifi_nodes:door3a","scifi_nodes:door3b","scifi_nodes:door3c","scifi_nodes:door3d","3","white", "doors:door_glass", "scifi_nodes_door_normal"},
|
||||
-- Green door
|
||||
{"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"}
|
||||
{base_name = "Doom", base_ingredient = "doors:door_obsidian_glass", sound = "scifi_nodes_door_mechanic"},
|
||||
{base_name = "black", base_ingredient = "doors:door_steel", sound = "scifi_nodes_door_mechanic"},
|
||||
{base_name = "white", base_ingredient = "doors:door_glass", sound = "scifi_nodes_door_normal"},
|
||||
{base_name = "green", base_ingredient = "doors:door_wood", sound = "scifi_nodes_door_mechanic"},
|
||||
{base_name = "blue", base_ingredient = "default:steel_block", sound = "scifi_nodes_door_normal"}
|
||||
}
|
||||
|
||||
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}
|
||||
local doora = doors[i][1]
|
||||
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 = {
|
||||
{"scifi_nodes:white2", base_ingredient, "scifi_nodes:white2"},
|
||||
{"scifi_nodes:black", base_ingredient, "scifi_nodes:black"}
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = closed .. " 2",
|
||||
recipe = {
|
||||
{"scifi_nodes:white2", base_ingredient, "scifi_nodes:white2"},
|
||||
{"scifi_nodes:black", base_ingredient, "scifi_nodes:black"}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
function onplace(itemstack, placer, pointed_thing)
|
||||
local pos1 = pointed_thing.above
|
||||
local pos2 = {x=pos1.x, y=pos1.y, z=pos1.z}
|
||||
pos2.y = pos2.y+1
|
||||
if
|
||||
function onplace(itemstack, placer, pointed_thing)
|
||||
-- Is there room enough ?
|
||||
local pos1 = pointed_thing.above
|
||||
local pos2 = {x=pos1.x, y=pos1.y, z=pos1.z}
|
||||
pos2.y = pos2.y+1 -- 2 nodes above
|
||||
|
||||
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 placer or
|
||||
not placer:is_player() or
|
||||
minetest.is_protected(pos1, placer:get_player_name()) or
|
||||
minetest.is_protected(pos2, placer:get_player_name()) then
|
||||
return
|
||||
if
|
||||
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 placer or
|
||||
not placer:is_player() or
|
||||
minetest.is_protected(pos1, placer:get_player_name()) or
|
||||
minetest.is_protected(pos2, placer:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
local pt = pointed_thing.above
|
||||
local pt2 = {x=pt.x, y=pt.y, z=pt.z}
|
||||
pt2.y = pt2.y+1
|
||||
-- Player look dir is converted to node rotation ?
|
||||
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}
|
||||
|
||||
-- Door param2 depends of placer's look dir
|
||||
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
|
||||
|
||||
-- First door of a pair is already there
|
||||
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
|
||||
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
|
||||
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
|
||||
|
||||
function afterdestruct(pos, oldnode)
|
||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
|
||||
end
|
||||
|
||||
function open_door(pos, node, player, itemstack, pointed_thing)
|
||||
-- play sound
|
||||
minetest.sound_play(sound,{
|
||||
max_hear_distance = 16,
|
||||
pos = pos,
|
||||
gain = 1.0
|
||||
})
|
||||
|
||||
local timer = minetest.get_node_timer(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({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
|
||||
if minetest.get_node(pt3).name == doora then
|
||||
minetest.set_node(pt, {name=doora, param2=p4})
|
||||
minetest.set_node(pt2, {name=doorb, param2=p4})
|
||||
else
|
||||
minetest.set_node(pt, {name=doora, param2=p2})
|
||||
minetest.set_node(pt2, {name=doorb, param2=p2})
|
||||
if b.name == closed 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+1,z=pos.z+1}, {name=opened_top, param2=b.param2})
|
||||
end
|
||||
itemstack:take_item(1)
|
||||
if c.name == closed 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+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
|
||||
timer:start(3)
|
||||
end
|
||||
|
||||
return itemstack;
|
||||
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 afterdestruct(pos, oldnode)
|
||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
|
||||
end
|
||||
function ontimer(pos, elapsed)
|
||||
-- play sound
|
||||
minetest.sound_play(sound,{
|
||||
max_hear_distance = 16,
|
||||
pos = pos,
|
||||
gain = 1.0
|
||||
})
|
||||
|
||||
function rightclick(pos, node, player, itemstack, pointed_thing)
|
||||
-- play sound
|
||||
minetest.sound_play(sound,{
|
||||
max_hear_distance = 16,
|
||||
pos = pos,
|
||||
gain = 1.0
|
||||
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=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
|
||||
|
||||
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},
|
||||
}
|
||||
|
||||
local mesecons_doors_def = {
|
||||
effector = {
|
||||
action_on = open_door,
|
||||
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 = {
|
||||
"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, oddly_breakable_by_hand = 1},
|
||||
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_doors_def,
|
||||
on_place = onplace,
|
||||
after_destruct = afterdestruct,
|
||||
on_rightclick = doors_rightclick,
|
||||
})
|
||||
|
||||
local timer = minetest.get_node_timer(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=doorc, param2=node.param2})
|
||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=doord, param2=node.param2})
|
||||
|
||||
if a.name == doora 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+1,z=pos.z-1}, {name=doord, param2=a.param2})
|
||||
end
|
||||
if b.name == doora 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+1,z=pos.z+1}, {name=doord, param2=b.param2})
|
||||
end
|
||||
if c.name == doora 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+1,z=pos.z}, {name=doord, param2=c.param2})
|
||||
end
|
||||
if d.name == doora 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+1,z=pos.z}, {name=doord, param2=d.param2})
|
||||
end
|
||||
if e.name == doora 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+1, z=pos.z-1}, {name=doord, param2=e.param2})
|
||||
end
|
||||
if f.name == doora 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+1, z=pos.z-1}, {name=doord, param2=f.param2})
|
||||
end
|
||||
if g.name == doora 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+1, z=pos.z+1}, {name=doord, param2=g.param2})
|
||||
end
|
||||
if h.name == doora 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+1, z=pos.z+1}, {name=doord, param2=h.param2})
|
||||
end
|
||||
|
||||
timer:start(3)
|
||||
|
||||
end
|
||||
|
||||
function afterplace(pos, placer, itemstack, pointed_thing)
|
||||
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
|
||||
minetest.sound_play(sound,{
|
||||
max_hear_distance = 16,
|
||||
pos = pos,
|
||||
gain = 1.0
|
||||
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},
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
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=doora, param2=node.param2})
|
||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=doorb, param2=node.param2})
|
||||
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,
|
||||
})
|
||||
|
||||
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
|
||||
if b.name == doorc 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+1,z=pos.z+1}, {name=doorb, param2=b.param2})
|
||||
end
|
||||
if c.name == doorc 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+1,z=pos.z}, {name=doorb, param2=c.param2})
|
||||
end
|
||||
if d.name == doorc 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+1,z=pos.z}, {name=doorb, param2=d.param2})
|
||||
end
|
||||
if e.name == doorc 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+1, z=pos.z-1}, {name=doorb, param2=e.param2})
|
||||
end
|
||||
if f.name == doorc 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+1, z=pos.z-1}, {name=doorb, param2=f.param2})
|
||||
end
|
||||
if g.name == doorc 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+1, z=pos.z+1}, {name=doorb, param2=g.param2})
|
||||
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
|
||||
|
||||
minetest.register_node(doora, {
|
||||
description = des.." Sliding Door",
|
||||
inventory_image = "scifi_nodes_door"..num.."a_inv.png",
|
||||
wield_image = "scifi_nodes_door"..num.."a_inv.png",
|
||||
tiles = {
|
||||
"scifi_nodes_door"..num.."a_edge.png",
|
||||
"scifi_nodes_door"..num.."a_edge.png",
|
||||
"scifi_nodes_door"..num.."a_edge.png",
|
||||
"scifi_nodes_door"..num.."a_edge.png",
|
||||
"scifi_nodes_door"..num.."a_rbottom.png",
|
||||
"scifi_nodes_door"..num.."a_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}
|
||||
}
|
||||
},
|
||||
|
||||
on_place = onplace,
|
||||
|
||||
after_destruct = afterdestruct,
|
||||
|
||||
on_rightclick = rightclick,
|
||||
})
|
||||
minetest.register_node(doorb, {
|
||||
tiles = {
|
||||
"scifi_nodes_door"..num.."a_edge.png",
|
||||
"scifi_nodes_door"..num.."a_edge.png",
|
||||
"scifi_nodes_door"..num.."a_edge.png",
|
||||
"scifi_nodes_door"..num.."a_edge.png",
|
||||
"scifi_nodes_door"..num.."a_rtop.png",
|
||||
"scifi_nodes_door"..num.."a_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(doorc, {
|
||||
tiles = {
|
||||
"scifi_nodes_door"..num.."a_edge.png",
|
||||
"scifi_nodes_door"..num.."a_edge.png",
|
||||
"scifi_nodes_door"..num.."a_edge.png",
|
||||
"scifi_nodes_door"..num.."a_edge.png",
|
||||
"scifi_nodes_door"..num.."a_rbottom0.png",
|
||||
"scifi_nodes_door"..num.."a_bottom0.png"
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
drop = doora,
|
||||
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(doord, {
|
||||
tiles = {
|
||||
"scifi_nodes_door"..num.."a_edge.png",
|
||||
"scifi_nodes_door"..num.."a_edge.png",
|
||||
"scifi_nodes_door"..num.."a_edge.png",
|
||||
"scifi_nodes_door"..num.."a_edge.png",
|
||||
"scifi_nodes_door"..num.."a_rtopo.png",
|
||||
"scifi_nodes_door"..num.."a_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
|
||||
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
|
||||
|
62
init.lua
@ -129,7 +129,8 @@ minetest.register_node("scifi_nodes:rfloor", {
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
light_source = 10,
|
||||
groups = {cracky=1}
|
||||
groups = {cracky=1},
|
||||
sounds = default.node_sound_metal_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:bfloor", {
|
||||
@ -140,7 +141,8 @@ minetest.register_node("scifi_nodes:bfloor", {
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
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"
|
||||
},
|
||||
paramtype = "light",
|
||||
groups = {cracky=1}
|
||||
groups = {cracky=1},
|
||||
sounds = default.node_sound_metal_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:gblock", {
|
||||
@ -171,7 +174,8 @@ minetest.register_node("scifi_nodes:gblock", {
|
||||
"scifi_nodes_gblock.png"
|
||||
},
|
||||
paramtype = "light",
|
||||
groups = {cracky=1}
|
||||
groups = {cracky=1};
|
||||
sounds = default.node_sound_metal_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:gblock2", {
|
||||
@ -187,7 +191,8 @@ minetest.register_node("scifi_nodes:gblock2", {
|
||||
},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=1}
|
||||
groups = {cracky=1},
|
||||
sounds = default.node_sound_metal_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:gblock3", {
|
||||
@ -203,7 +208,8 @@ minetest.register_node("scifi_nodes:gblock3", {
|
||||
},
|
||||
paramtype = "light",
|
||||
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,
|
||||
paramtype = "light",
|
||||
groups = {cracky=1}
|
||||
groups = {cracky=1},
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:red_light", {
|
||||
@ -237,7 +244,8 @@ minetest.register_node("scifi_nodes:red_light", {
|
||||
},
|
||||
light_source = 10,
|
||||
paramtype = "light",
|
||||
groups = {cracky=1}
|
||||
groups = {cracky=1},
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:discs", {
|
||||
@ -252,7 +260,8 @@ minetest.register_node("scifi_nodes:discs", {
|
||||
"scifi_nodes_discs.png"
|
||||
},
|
||||
paramtype = "light",
|
||||
groups = {cracky=1}
|
||||
groups = {cracky=1},
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:disc", {
|
||||
@ -279,6 +288,7 @@ minetest.register_node("scifi_nodes:blink", {
|
||||
paramtype = "light",
|
||||
groups = {cracky=1},
|
||||
light_source = 5,
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:black_lights", {
|
||||
@ -290,6 +300,7 @@ minetest.register_node("scifi_nodes:black_lights", {
|
||||
}},
|
||||
paramtype = "light",
|
||||
groups = {cracky=1},
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:black_screen", {
|
||||
@ -302,6 +313,7 @@ minetest.register_node("scifi_nodes:black_screen", {
|
||||
paramtype = "light",
|
||||
groups = {cracky=1},
|
||||
light_source = 1,
|
||||
sounds = default.node_sound_stone_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:screen", {
|
||||
@ -314,6 +326,7 @@ minetest.register_node("scifi_nodes:screen", {
|
||||
paramtype = "light",
|
||||
groups = {cracky=1},
|
||||
light_source = 5,
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:screen2", {
|
||||
@ -326,6 +339,7 @@ minetest.register_node("scifi_nodes:screen2", {
|
||||
paramtype = "light",
|
||||
groups = {cracky=1},
|
||||
light_source = 5,
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
|
||||
|
||||
@ -343,7 +357,8 @@ minetest.register_node("scifi_nodes:white_pad", {
|
||||
},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=1}
|
||||
groups = {cracky=1},
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:white_base", {
|
||||
@ -359,7 +374,8 @@ minetest.register_node("scifi_nodes:white_base", {
|
||||
},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=1}
|
||||
groups = {cracky=1},
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:grnpipe", {
|
||||
@ -376,6 +392,7 @@ minetest.register_node("scifi_nodes:grnpipe", {
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=1},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
on_place = minetest.rotate_node
|
||||
})
|
||||
|
||||
@ -394,6 +411,7 @@ minetest.register_node("scifi_nodes:grnpipe2", {
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=1},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
on_place = minetest.rotate_node
|
||||
})
|
||||
|
||||
@ -410,6 +428,7 @@ minetest.register_node("scifi_nodes:octrng", {
|
||||
light_source = 10,
|
||||
groups = {cracky=2},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:octgrn", {
|
||||
@ -440,6 +459,7 @@ minetest.register_node("scifi_nodes:octbl", {
|
||||
light_source = 10,
|
||||
groups = {cracky=2},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:octppl", {
|
||||
@ -469,6 +489,7 @@ minetest.register_node("scifi_nodes:tower", {
|
||||
inventory_image = "scifi_nodes_tower.png",
|
||||
paramtype = "light",
|
||||
groups = {cracky=2},
|
||||
sounds = default.node_sound_metal_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:junk", {
|
||||
@ -594,6 +615,7 @@ for _, row in ipairs(node.types) do
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
light_source = light,
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
end
|
||||
|
||||
@ -782,7 +804,8 @@ minetest.register_node("scifi_nodes:blumetlight", {
|
||||
},
|
||||
light_source = 10,
|
||||
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,
|
||||
paramtype = "light",
|
||||
groups = {cracky=1}
|
||||
groups = {cracky=1},
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:blklt2", {
|
||||
@ -805,7 +829,8 @@ minetest.register_node("scifi_nodes:blklt2", {
|
||||
},
|
||||
light_source = 10,
|
||||
paramtype = "light",
|
||||
groups = {cracky=1}
|
||||
groups = {cracky=1},
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:blumetstr", {
|
||||
@ -816,7 +841,8 @@ minetest.register_node("scifi_nodes:blumetstr", {
|
||||
},
|
||||
light_source = 10,
|
||||
paramtype = "light",
|
||||
groups = {cracky=1}
|
||||
groups = {cracky=1},
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:glass", {
|
||||
@ -828,7 +854,8 @@ minetest.register_node("scifi_nodes:glass", {
|
||||
},
|
||||
use_texture_alpha = true,
|
||||
paramtype = "light",
|
||||
groups = {cracky=1}
|
||||
groups = {cracky=1},
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:whtlightbnd", {
|
||||
@ -839,7 +866,8 @@ minetest.register_node("scifi_nodes:whtlightbnd", {
|
||||
},
|
||||
light_source = 10,
|
||||
paramtype = "light",
|
||||
groups = {cracky=1}
|
||||
groups = {cracky=1},
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
|
||||
--extra stuff
|
||||
|
4
mod.conf
@ -1,4 +1,4 @@
|
||||
name = scifi_nodes
|
||||
description = A mod which the vegan kitchen to Minetest.
|
||||
depends = default,dye,basic_materials
|
||||
optional_depends = xpanes,moreblocks,mesecons,mesecons_microcontroller,mesecons_button,mesecons_torch,mesecons_receiver
|
||||
depends = default,dye,basic_materials, mesecons
|
||||
optional_depends = xpanes,moreblocks,mesecons_microcontroller,mesecons_button,mesecons_torch,mesecons_receiver
|
||||
|
484
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
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
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
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults()
|
||||
})
|
||||
|
||||
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.3125, 0, 0.5, 0.375}, -- NodeBox28
|
||||
}
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
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.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
|
||||
}
|
||||
},
|
||||
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.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
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults()
|
||||
}
|
||||
})
|
||||
|
||||
@ -361,8 +366,6 @@ minetest.register_node("scifi_nodes:pot_lid", {
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
|
||||
|
||||
|
||||
minetest.register_node("scifi_nodes:pot", {
|
||||
description = "metal plant pot (right click for lid, shift+rightclick to plant)",
|
||||
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.0625, 0.4375, -0.375, 0.1875}, -- NodeBox25
|
||||
{0.3125, -0.5, -0.1875, 0.4375, -0.375, -0.0625}, -- NodeBox26
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_metal_defaults()
|
||||
},
|
||||
paramtype2 = "wallmounted",
|
||||
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
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
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
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
groups = {cracky=1}
|
||||
})
|
||||
|
||||
@ -1140,12 +1146,12 @@ minetest.register_node("scifi_nodes:widescreen", {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.375, -0.3125, 0.4375, 0.375, 0.3125, 0.5}, -- NodeBox1
|
||||
{-0.5, -0.375, 0.375, -0.375, 0.375, 0.5}, -- NodeBox2
|
||||
{0.375, -0.375, 0.375, 0.5, 0.375, 0.5}, -- NodeBox3
|
||||
{-0.3125, 0.25, 0.375, 0.3125, 0.375, 0.5}, -- NodeBox4
|
||||
{-0.3125, -0.375, 0.375, 0.25, -0.25, 0.5}, -- NodeBox5
|
||||
{-0.5, -0.3125, 0.375, 0.5, -0.25, 0.5}, -- NodeBox6
|
||||
{-0.5, 0.25, 0.375, 0.5, 0.3125, 0.5}, -- NodeBox7
|
||||
{-0.5, -0.375, 0.375, -0.375, 0.375, 0.5}, -- NodeBox2
|
||||
{0.375, -0.375, 0.375, 0.5, 0.375, 0.5}, -- NodeBox3
|
||||
{-0.3125, 0.25, 0.375, 0.3125, 0.375, 0.5}, -- NodeBox4
|
||||
{-0.3125, -0.375, 0.375, 0.25, -0.25, 0.5}, -- NodeBox5
|
||||
{-0.5, -0.3125, 0.375, 0.5, -0.25, 0.5}, -- NodeBox6
|
||||
{-0.5, 0.25, 0.375, 0.5, 0.3125, 0.5}, -- NodeBox7
|
||||
}
|
||||
},
|
||||
groups = {cracky=1, oddly_breakable_by_hand=1}
|
||||
@ -1203,112 +1209,356 @@ minetest.register_node("scifi_nodes:windowpanel", {
|
||||
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", {
|
||||
description = "Wall switch",
|
||||
sunlight_propagates = true,
|
||||
tiles = {
|
||||
"scifi_nodes_switch_on.png",
|
||||
},
|
||||
inventory_image = "scifi_nodes_switch_on.png",
|
||||
wield_image = "scifi_nodes_switch_on.png",
|
||||
drawtype = "signlike",
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
fixed = {-0.5, -0.3, -0.3, -0.45, 0.3, 0.3}
|
||||
},
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
light_source = 5,
|
||||
groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, mesecon_needs_receiver = 1},
|
||||
on_rightclick = function(pos, node, clicker, item, _)
|
||||
minetest.set_node(pos, {name="scifi_nodes:switch_off", param2=node.param2})
|
||||
mesecon.receptor_off(pos)
|
||||
end,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
mesecons = {receptor = { state = mesecon.state.on }}
|
||||
})
|
||||
--------------
|
||||
-- Switches --
|
||||
--------------
|
||||
|
||||
minetest.register_craft({
|
||||
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",
|
||||
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},
|
||||
on_rightclick = function(pos, node, clicker, item, _)
|
||||
minetest.set_node(pos, {name="scifi_nodes:switch_on", param2=node.param2})
|
||||
end,
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
local function get_switch_rules(param2)
|
||||
|
||||
minetest.register_node("scifi_nodes:switch_on", {
|
||||
description = "Wall switch",
|
||||
sunlight_propagates = true,
|
||||
tiles = {
|
||||
"scifi_nodes_switch_on.png",
|
||||
},
|
||||
inventory_image = "scifi_nodes_switch_on.png",
|
||||
wield_image = "scifi_nodes_switch_on.png",
|
||||
drawtype = "signlike",
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
fixed = {-0.5, -0.3, -0.3, -0.45, 0.3, 0.3}
|
||||
},
|
||||
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.set_node(pos, {name="scifi_nodes:switch_off", param2=node.param2})
|
||||
end,
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
-- 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",
|
||||
sunlight_propagates = true,
|
||||
buildable_to = false,
|
||||
tiles = {"scifi_nodes_switch_on.png",},
|
||||
inventory_image = "scifi_nodes_switch_on.png",
|
||||
wield_image = "scifi_nodes_switch_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 = {receptor = {state = mesecon.state.on,}},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
on_rightclick = toggle_switch,
|
||||
on_timer = toggle_switch
|
||||
})
|
||||
|
||||
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,
|
||||
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,}},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
on_rightclick = toggle_switch
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
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
|
||||
})
|
||||
|
||||
--end of wall switch
|
||||
|
||||
end -- if(mesecon.receptor ~= on
|
||||
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,
|
||||
buildable_to = false,
|
||||
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},
|
||||
drop = {items = {"scifi_nodes:digicode_off"}},
|
||||
mesecons = {receptor = {state = mesecon.state.on,}},
|
||||
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_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(),
|
||||
})
|
||||
|
||||
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 |