mirror of
https://github.com/D00Med/scifi_nodes.git
synced 2024-12-22 16:10:18 +01:00
Merge branch 'master' of Grossam/scifi_nodes into master
This commit is contained in:
commit
91f1c1412d
@ -10,3 +10,5 @@ Minetest mod that adds scifi themed nodes
|
||||
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
|
||||
|
64
doors.lua
64
doors.lua
@ -27,13 +27,6 @@ local doors = {
|
||||
{base_name = "blue", base_ingredient = "default:steel_block", sound = "scifi_nodes_door_normal"}
|
||||
}
|
||||
|
||||
|
||||
-- Maybe useful later with mesecons_doors.meseconify_door()
|
||||
function get_doors_list()
|
||||
return doors
|
||||
end
|
||||
|
||||
|
||||
for _, current_door in ipairs(doors) do
|
||||
|
||||
local closed = "scifi_nodes:"..current_door.base_name.."_door_closed"
|
||||
@ -222,6 +215,47 @@ function ontimer(pos, elapsed)
|
||||
|
||||
end
|
||||
|
||||
-- allow doors opening on mesecon signal
|
||||
-- from a pressure plate
|
||||
local mesecons_door_def
|
||||
--local mesecons_door_top_def
|
||||
local mesecons_door_rules
|
||||
--local mesecons_door_top_rules
|
||||
if minetest.get_modpath("mesecons") then
|
||||
mesecons_door_rules = {
|
||||
-- get signal from pressure plate
|
||||
{x=1, y=0, z=0},
|
||||
{x=-1, y=0, z=0},
|
||||
{x=0, y=0, z=1},
|
||||
{x=0, y=0, z=-1},
|
||||
-- get signal from wall mounted button
|
||||
{x=1, y=1, z=1},
|
||||
{x=-1, y=1, z=1},
|
||||
{x=1, y=1, z=-1},
|
||||
{x=-1, y=1, z=-1},
|
||||
}
|
||||
mesecons_door_def = {
|
||||
effector = {
|
||||
action_on = rightclick,
|
||||
rules = mesecons_door_rules
|
||||
},
|
||||
}
|
||||
-- mesecons_door_top_rules = {
|
||||
-- -- get signal switch or digicode
|
||||
-- {x=1, y=0, z=1},
|
||||
-- {x=-1, y=0, z=1},
|
||||
-- {x=1, y=0, z=1},
|
||||
-- {x=-1, y=0, z=-1},
|
||||
-- -- get signal from door_bottom
|
||||
-- {x=0, y=-1, z=0},
|
||||
-- }
|
||||
-- mesecons_door_top_def = {
|
||||
-- conductor = {
|
||||
-- rules = mesecons_door_top_rules
|
||||
-- }
|
||||
-- }
|
||||
end
|
||||
|
||||
minetest.register_node(closed, {
|
||||
description = current_door.base_name.." sliding door",
|
||||
inventory_image = "scifi_nodes_door_"..base_name.."_inv.png",
|
||||
@ -250,18 +284,7 @@ minetest.register_node(closed, {
|
||||
{-0.5, -0.5, -0.0625, 0.5, 1.5, 0.0625}
|
||||
}
|
||||
},
|
||||
mesecon = {
|
||||
effector = {
|
||||
action_on = function (pos, node)
|
||||
minetest.sound_play(sound, {
|
||||
max_hear_distance = 16,
|
||||
pos = pos,
|
||||
gain = 1.0
|
||||
})
|
||||
end,
|
||||
rules = mesecon.rules.pplate
|
||||
},
|
||||
},
|
||||
mesecons = mesecons_door_def,
|
||||
|
||||
on_place = onplace,
|
||||
|
||||
@ -295,6 +318,7 @@ minetest.register_node(closed_top, {
|
||||
{0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
},
|
||||
-- mesecons = mesecons_door_top_def,
|
||||
})
|
||||
|
||||
minetest.register_node(opened, {
|
||||
@ -354,4 +378,4 @@ minetest.register_node(opened_top, {
|
||||
}
|
||||
},
|
||||
})
|
||||
end
|
||||
end -- end of doors table browsing
|
||||
|
214
nodeboxes.lua
214
nodeboxes.lua
@ -366,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 = {
|
||||
@ -1205,34 +1203,25 @@ minetest.register_node("scifi_nodes:windowpanel", {
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
--------------
|
||||
-- Switches --
|
||||
--------------
|
||||
local switch_rules = {}
|
||||
local mesecons_switch_on_def = {}
|
||||
local mesecons_switch_off_def = {}
|
||||
|
||||
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,
|
||||
node_box = {
|
||||
type = "wallmounted",
|
||||
},
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
},
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
groups = {cracky=1, oddly_breakable_by_hand=1, mesecon_needs_receiver = 1},
|
||||
on_rightclick = function(pos, node, clicker, item, _)
|
||||
minetest.set_node(pos, {name="scifi_nodes:switch_on", param2=node.param2})
|
||||
mesecon.receptor_on(pos)
|
||||
end,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
mesecons = {receptor = { state = mesecon.state.off }}
|
||||
})
|
||||
|
||||
switch_rules = {
|
||||
{x=1, y=-1, z=1},
|
||||
{x=1, y=-1, z=-1},
|
||||
{x=-1, y=-1, z=1},
|
||||
{x=-1, y=-1, z=-1}
|
||||
}
|
||||
mesecons_switch_on_def = {receptor = {state = mesecon.state.on, rules = switch_rules}}
|
||||
mesecons_switch_off_def = {receptor = {state = mesecon.state.off, rules = switch_rules}}
|
||||
|
||||
minetest.register_node("scifi_nodes:switch_on", {
|
||||
description = "Wall switch",
|
||||
@ -1253,12 +1242,35 @@ if (mesecon ~= nil) and
|
||||
paramtype2 = "wallmounted",
|
||||
light_source = 5,
|
||||
groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, mesecon_needs_receiver = 1},
|
||||
mesecons = mesecons_switch_on_def,
|
||||
on_rightclick = function(pos, node, clicker, item, _)
|
||||
minetest.set_node(pos, {name="scifi_nodes:switch_off", param2=node.param2})
|
||||
mesecon.receptor_off(pos)
|
||||
mesecon.receptor_off(pos, switch_rules)
|
||||
if switch_rules == {} or nil then minetest.chat_send_all("Nib !") end
|
||||
minetest.sound_play("scifi_nodes_switch", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||
end,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:switch_off", {
|
||||
description = "Wall switch",
|
||||
tiles = {"scifi_nodes_switch_off.png",},
|
||||
inventory_image = "scifi_nodes_switch_on.png",
|
||||
wield_image = "scifi_nodes_switch_on.png",
|
||||
drawtype = "signlike",
|
||||
sunlight_propagates = true,
|
||||
node_box = {type = "wallmounted",},
|
||||
selection_box = {type = "wallmounted",},
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
groups = {cracky=1, oddly_breakable_by_hand=1, mesecon_needs_receiver = 1},
|
||||
mesecons = mesecons_switch_off_def,
|
||||
on_rightclick = function(pos, node, clicker, item, _)
|
||||
minetest.set_node(pos, {name="scifi_nodes:switch_on", param2=node.param2})
|
||||
mesecon.receptor_on(pos, switch_rules)
|
||||
minetest.sound_play("scifi_nodes_switch", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||
end,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
mesecons = {receptor = { state = mesecon.state.on }}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
@ -1290,6 +1302,7 @@ else
|
||||
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})
|
||||
minetest.sound_play("scifi_nodes_switch", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||
end,
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
@ -1315,10 +1328,149 @@ else
|
||||
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})
|
||||
minetest.sound_play("scifi_nodes_switch", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||
end,
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
}) --end of wall switch
|
||||
end -- if(mesecon.receptor ~= on
|
||||
|
||||
--------------
|
||||
-- Digicode --
|
||||
--------------
|
||||
local digicode_rules = {}
|
||||
local mesecons_digicode_on_def = {}
|
||||
local mesecons_digicode_off_def = {}
|
||||
|
||||
if (mesecon ~= nil) and
|
||||
(mesecon.receptor_on ~= nil) and
|
||||
(mesecon.receptor_off ~= nil) then
|
||||
|
||||
digicode_rules = {
|
||||
{x=1, y=-1, z=1},
|
||||
{x=1, y=-1, z=-1},
|
||||
{x=-1, y=-1, z=1},
|
||||
{x=-1, y=-1, z=-1}
|
||||
}
|
||||
mesecons_digicode_on_def = {receptor = {state = mesecon.state.on, rules = digicode_rules}}
|
||||
mesecons_digicode_off_def = {receptor = {state = mesecon.state.off, rules = digicode_rules}}
|
||||
|
||||
local function toggle_digicode(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local name = node.name
|
||||
if name == "scifi_nodes:digicode_off" then
|
||||
minetest.sound_play("scifi_nodes_digicode", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||
minetest.set_node(pos, {name="scifi_nodes:digicode_on", param2=node.param2})
|
||||
mesecon.receptor_on(pos, digicode_rules)
|
||||
minetest.get_node_timer(pos):start(2)
|
||||
else
|
||||
minetest.set_node(pos, {name="scifi_nodes:digicode_off", param2=node.param2})
|
||||
mesecon.receptor_off(pos, digicode_rules)
|
||||
end
|
||||
end
|
||||
|
||||
-- local function digicode_turn_off (pos)
|
||||
-- local node = minetest.get_node(pos)
|
||||
-- minetest.set_node (pos, {name = "scifi_nodes:digicode_off", param2 = node.param2})
|
||||
-- mesecon.receptor_off(pos, digicode_rules)
|
||||
-- return false
|
||||
-- end
|
||||
|
||||
minetest.register_node("scifi_nodes:digicode_on", {
|
||||
description = "Wall switch",
|
||||
sunlight_propagates = true,
|
||||
tiles = {"scifi_nodes_digicode_on.png",},
|
||||
inventory_image = "scifi_nodes_digicode_on.png",
|
||||
wield_image = "scifi_nodes_digicode_on.png",
|
||||
drawtype = "signlike",
|
||||
node_box = {type = "wallmounted",},
|
||||
selection_box = {type = "wallmounted",},
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
light_source = 5,
|
||||
groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, mesecon_needs_receiver = 1},
|
||||
mesecons = mesecons_digicode_on_def,
|
||||
on_rightclick = toggle_digicode,
|
||||
on_timer = toggle_digicode,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:digicode_off", {
|
||||
description = "Digicode",
|
||||
tiles = {"scifi_nodes_digicode_off.png",},
|
||||
inventory_image = "scifi_nodes_digicode_on.png",
|
||||
wield_image = "scifi_nodes_digicode_on.png",
|
||||
drawtype = "signlike",
|
||||
sunlight_propagates = true,
|
||||
node_box = {type = "wallmounted",},
|
||||
selection_box = {type = "wallmounted",},
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
groups = {cracky=1, oddly_breakable_by_hand=1, mesecon_needs_receiver = 1},
|
||||
mesecons = mesecons_digicode_off_def,
|
||||
on_rightclick = toggle_digicode,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "scifi_nodes:digicode_off 2",
|
||||
recipe = {
|
||||
{"mesecons_switch:mesecon_switch_off", "scifi_nodes:grey", ""}
|
||||
}
|
||||
})
|
||||
|
||||
-- In case mesecons mod is missing :
|
||||
else
|
||||
minetest.register_node("scifi_nodes:digicode_off", {
|
||||
description = "Digicode",
|
||||
tiles = {
|
||||
"scifi_nodes_digicode_off.png",
|
||||
},
|
||||
inventory_image = "scifi_nodes_digicode_on.png",
|
||||
wield_image = "scifi_nodes_digicode_on.png",
|
||||
drawtype = "signlike",
|
||||
sunlight_propagates = true,
|
||||
node_box = {
|
||||
type = "wallmounted",
|
||||
},
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
},
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
groups = {cracky=1, oddly_breakable_by_hand=1},
|
||||
on_rightclick = function(pos, node, clicker, item, _)
|
||||
minetest.sound_play("scifi_nodes_digicode", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||
minetest.swap_node(pos, {name="scifi_nodes:digicode_on", param2=node.param2})
|
||||
end,
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
|
||||
--end of wall switch
|
||||
|
||||
minetest.register_node("scifi_nodes:digicode_on", {
|
||||
description = "Digicode",
|
||||
sunlight_propagates = true,
|
||||
tiles = {
|
||||
"scifi_nodes_switch_on.png",
|
||||
},
|
||||
inventory_image = "scifi_nodes_digicode_on.png",
|
||||
wield_image = "scifi_nodes_digicode_on.png",
|
||||
drawtype = "signlike",
|
||||
node_box = {
|
||||
type = "wallmounted",
|
||||
},
|
||||
selecion_box = {
|
||||
type = "wallmounted",
|
||||
},
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
light_source = 5,
|
||||
groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1},
|
||||
on_rightclick = function(pos, node, clicker, item, _)
|
||||
minetest.swap_node(pos, {name="scifi_nodes:digicode_off", param2=node.param2})
|
||||
end,
|
||||
on_timer = function(pos, node, clicker, item, _)
|
||||
minetest.swap_node(pos, {name="scifi_nodes:digicode_off", param2=node.param2})
|
||||
end,
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
end -- if(mesecon.receptor ~= on
|
||||
|
Loading…
Reference in New Issue
Block a user