1
0
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:
fwhcat 2019-05-08 06:25:17 +00:00 committed by Gitea
commit bc1b4c7b47
6 changed files with 242 additions and 242 deletions

View File

@ -1,9 +1,10 @@
![Scifi nodes][screenshot.png] ![Scifi nodes](screenshot.png)
# scifi_nodes # scifi_nodes
Minetest mod that adds scifi themed blocks, doors, materials, plants and other assets. Minetest mod that adds scifi themed blocks, doors, materials, plants and other assets.
* 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 * 05/01/2019 : create aliases to deal with old namming policy un doors.lua
* 04/26/2019 : * 04/26/2019 :
* sliding doors now open with mesecon signal * sliding doors now open with mesecon signal

View File

@ -276,7 +276,7 @@ for _, current_door in ipairs(doors) do
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 = {

View File

@ -1206,271 +1206,270 @@ minetest.register_node("scifi_nodes:windowpanel", {
-------------- --------------
-- Switches -- -- Switches --
-------------- --------------
local switch_rules = {}
local mesecons_switch_on_def = {}
local mesecons_switch_off_def = {}
if (mesecon ~= nil) and local function get_switch_rules(param2)
(mesecon.receptor_on ~= nil) and
(mesecon.receptor_off ~= nil) then
switch_rules = { -- param2 = 2
{x=1, y=-1, z=1}, local 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},
{x=-1, y=-1, z=-1} {x=0, y=-1, z=-1},
{x=0, 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", { -- Left and right when looking to +y ?
description = "Wall switch", if param2 == 3 then
sunlight_propagates = true, rules = mesecon.rotate_rules_right(mesecon.rotate_rules_right (rules))
tiles = { elseif param2 == 4 then
"scifi_nodes_switch_on.png", rules = mesecon.rotate_rules_right(rules)
}, elseif param2 == 5 then
inventory_image = "scifi_nodes_switch_on.png", rules = mesecon.rotate_rules_left(rules)
wield_image = "scifi_nodes_switch_on.png", end
drawtype = "signlike", return rules
node_box = { end
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_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, 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", { local function toggle_switch(pos)
description = "Wall switch", local node = minetest.get_node(pos)
tiles = {"scifi_nodes_switch_off.png",}, local name = node.name
inventory_image = "scifi_nodes_switch_on.png", if name == "scifi_nodes:switch_on" then
wield_image = "scifi_nodes_switch_on.png", minetest.sound_play("scifi_nodes_switch", {max_hear_distance = 8, pos = pos})
drawtype = "signlike", minetest.set_node(pos, {name = "scifi_nodes:switch_off", param2 = node.param2})
sunlight_propagates = true, mesecon.receptor_off(pos, get_switch_rules(node.param2))
node_box = {type = "wallmounted",}, elseif name == "scifi_nodes:switch_off" then
selection_box = {type = "wallmounted",}, minetest.sound_play("scifi_nodes_switch", {max_hear_distance = 8, pos = pos})
paramtype = "light", minetest.set_node(pos, {name = "scifi_nodes:switch_on", param2 = node.param2})
paramtype2 = "wallmounted", mesecon.receptor_on(pos, get_switch_rules(node.param2))
groups = {cracky=1, oddly_breakable_by_hand=1, mesecon_needs_receiver = 1}, minetest.get_node_timer(pos):start(2)
mesecons = mesecons_switch_off_def, end
on_rightclick = function(pos, node, clicker, item, _) end
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(),
})
minetest.register_craft({ minetest.register_node("scifi_nodes:switch_on", {
output = "scifi_nodes:switch_off 2", description = "Wall switch",
recipe = { sunlight_propagates = true,
{"mesecons_button:button_off", "scifi_nodes:grey", ""} 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
})
else minetest.register_node("scifi_nodes:switch_off", {
--wall switch, currently does not do anything description = "Wall switch",
minetest.register_node("scifi_nodes:switch_off", { tiles = {"scifi_nodes_switch_off.png",},
description = "Wall switch", inventory_image = "scifi_nodes_switch_on.png",
tiles = { wield_image = "scifi_nodes_switch_on.png",
"scifi_nodes_switch_off.png", drawtype = "signlike",
}, sunlight_propagates = true,
inventory_image = "scifi_nodes_switch_on.png", buildable_to = false,
wield_image = "scifi_nodes_switch_on.png", node_box = {type = "wallmounted",},
drawtype = "signlike", selection_box = {type = "wallmounted",},
sunlight_propagates = true, paramtype = "light",
node_box = { paramtype2 = "wallmounted",
type = "wallmounted", groups = {cracky=1, oddly_breakable_by_hand=1, mesecon_needs_receiver = 1},
}, mesecons = {receptor = {state = mesecon.state.off,}},
selection_box = { sounds = default.node_sound_glass_defaults(),
type = "wallmounted", on_rightclick = toggle_switch
}, })
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})
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_on", { minetest.register_craft({
description = "Wall switch", output = "scifi_nodes:switch_off 2",
sunlight_propagates = true, recipe = {{"mesecons_button:button_off", "scifi_nodes:grey", ""}}
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",
},
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.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 -- -- Digicode --
-------------- --------------
local digicode_rules = {}
local mesecons_digicode_on_def = {}
local mesecons_digicode_off_def = {}
if (mesecon ~= nil) and local secret_code = {"1234"}
(mesecon.receptor_on ~= nil) and local allowed_chars = {"0123456789"}
(mesecon.receptor_off ~= nil) then local code_length = 4
digicode_rules = { local function toggle_digicode(pos)
{x=1, y=-1, z=1}, local node = minetest.get_node(pos)
{x=1, y=-1, z=-1}, local name = node.name
{x=-1, y=-1, z=1}, if name == "scifi_nodes:digicode_off" then
{x=-1, y=-1, z=-1} 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})
mesecons_digicode_on_def = {receptor = {state = mesecon.state.on, rules = digicode_rules}} mesecon.receptor_on(pos, get_switch_rules(node.param2))
mesecons_digicode_off_def = {receptor = {state = mesecon.state.off, rules = digicode_rules}} minetest.get_node_timer(pos):start(2)
elseif name == "scifi_nodes:digicode_on" then
local function toggle_digicode(pos) minetest.set_node(pos, {name="scifi_nodes:digicode_off", param2=node.param2})
local node = minetest.get_node(pos) mesecon.receptor_off(pos, get_switch_rules(node.param2))
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 end
end
local function code_is_valid(code)
local valid = true
return valid
end
-- local function digicode_turn_off (pos) -- local function digicode_turn_off (pos)
-- local node = minetest.get_node(pos) -- local node = minetest.get_node(pos)
-- minetest.set_node (pos, {name = "scifi_nodes:digicode_off", param2 = node.param2}) -- minetest.set_node (pos, {name = "scifi_nodes:digicode_off", param2 = node.param2})
-- mesecon.receptor_off(pos, digicode_rules) -- mesecon.receptor_off(pos, get_switch_rules(node.param2))
-- return false -- return false
-- end -- end
minetest.register_node("scifi_nodes:digicode_on", { minetest.register_node("scifi_nodes:digicode_on", {
description = "Wall switch", description = "Digicode",
sunlight_propagates = true, sunlight_propagates = true,
tiles = {"scifi_nodes_digicode_on.png",}, buildable_to = false,
inventory_image = "scifi_nodes_digicode_on.png", tiles = {"scifi_nodes_digicode_on.png",},
wield_image = "scifi_nodes_digicode_on.png", inventory_image = "scifi_nodes_digicode_on.png",
drawtype = "signlike", wield_image = "scifi_nodes_digicode_on.png",
node_box = {type = "wallmounted",}, drawtype = "signlike",
selection_box = {type = "wallmounted",}, node_box = {type = "wallmounted",},
paramtype = "light", selection_box = {type = "wallmounted",},
paramtype2 = "wallmounted", paramtype = "light",
light_source = 5, paramtype2 = "wallmounted",
groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, mesecon_needs_receiver = 1}, light_source = 5,
mesecons = mesecons_digicode_on_def, groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, mesecon_needs_receiver = 1},
on_rightclick = toggle_digicode, mesecons = {receptor = {state = mesecon.state.on,}},
on_timer = toggle_digicode, on_timer = toggle_digicode,
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
}) })
minetest.register_node("scifi_nodes:digicode_off", { minetest.register_node("scifi_nodes:digicode_off", {
description = "Digicode", description = "Digicode",
tiles = {"scifi_nodes_digicode_off.png",}, tiles = {"scifi_nodes_digicode_off.png",},
inventory_image = "scifi_nodes_digicode_on.png", inventory_image = "scifi_nodes_digicode_on.png",
wield_image = "scifi_nodes_digicode_on.png", wield_image = "scifi_nodes_digicode_on.png",
drawtype = "signlike", drawtype = "signlike",
sunlight_propagates = true, sunlight_propagates = true,
node_box = {type = "wallmounted",}, buildable_to = false,
selection_box = {type = "wallmounted",}, node_box = {type = "wallmounted",},
paramtype = "light", selection_box = {type = "wallmounted",},
paramtype2 = "wallmounted", paramtype = "light",
groups = {cracky=1, oddly_breakable_by_hand=1, mesecon_needs_receiver = 1}, paramtype2 = "wallmounted",
mesecons = mesecons_digicode_off_def, groups = {cracky=1, oddly_breakable_by_hand=1, mesecon_needs_receiver = 1},
on_rightclick = toggle_digicode, mesecons = {receptor = {state = mesecon.state.off,}},
sounds = default.node_sound_glass_defaults(), 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", ""}}
})
minetest.register_craft({ ------------------
output = "scifi_nodes:digicode_off 2", -- Palm scanner --
recipe = { ------------------
{"mesecons_switch:mesecon_switch_off", "scifi_nodes:grey", ""}
}
})
-- In case mesecons mod is missing : -----------------------------------------------
else -- /!\ When "overriding" a callback function --
minetest.register_node("scifi_nodes:digicode_off", { -- re-use all the parameters in same order ! --
description = "Digicode", -----------------------------------------------
tiles = {
"scifi_nodes_digicode_off.png",
},
inventory_image = "scifi_nodes_digicode_on.png",
wield_image = "scifi_nodes_digicode_on.png",
drawtype = "signlike",
sunlight_propagates = true,
node_box = {
type = "wallmounted",
},
selection_box = {
type = "wallmounted",
},
paramtype = "light",
paramtype2 = "wallmounted",
groups = {cracky=1, oddly_breakable_by_hand=1},
on_rightclick = function(pos, node, clicker, item, _)
minetest.sound_play("scifi_nodes_digicode", {max_hear_distance = 8, pos = pos, gain = 1.0})
minetest.swap_node(pos, {name="scifi_nodes:digicode_on", param2=node.param2})
end,
sounds = default.node_sound_glass_defaults()
})
minetest.register_node("scifi_nodes:digicode_on", { local function toggle_palm_scanner(pos)
description = "Digicode", local node = minetest.get_node(pos)
sunlight_propagates = true, local name = node.name
tiles = { minetest.swap_node(pos, {name="scifi_nodes:palm_scanner_off", param2=node.param2})
"scifi_nodes_switch_on.png", mesecon.receptor_off(pos, get_switch_rules(node.param2))
}, end
inventory_image = "scifi_nodes_digicode_on.png",
wield_image = "scifi_nodes_digicode_on.png", -- after_place_node
drawtype = "signlike", -- placer is a player object
node_box = { local function set_owner(pos, placer, itemstack, pointed_thing)
type = "wallmounted", local meta = minetest.get_meta(pos)
}, meta:set_string("owner", placer:get_player_name())
selecion_box = { end
type = "wallmounted",
}, -- on_rightclick
paramtype = "light", -- player is a player object
paramtype2 = "wallmounted", local function check_owner(pos, node, player, itemstack, pointed_thing)
light_source = 5, local meta = minetest.get_meta(pos)
groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1}, local owner = meta:get_string("owner")
on_rightclick = function(pos, node, clicker, item, _) local tested_player = player:get_player_name()
minetest.swap_node(pos, {name="scifi_nodes:digicode_off", param2=node.param2}) minetest.swap_node(pos, {name = "scifi_nodes:palm_scanner_checking", param2 = node.param2})
end, minetest.sound_play("scifi_nodes_palm_scanner", {max_hear_distance = 8, pos = pos, gain = 1.0})
on_timer = function(pos, node, clicker, item, _) minetest.chat_send_player(tested_player, "Checking : please wait.")
minetest.swap_node(pos, {name="scifi_nodes:digicode_off", param2=node.param2})
end, -- wait for a bit please !
sounds = default.node_sound_glass_defaults() minetest.after(1.5, function(pos, node, tested_player, owner)
}) if tested_player == owner then
end -- if(mesecon.receptor ~= on minetest.sound_play("scifi_nodes_access_granted", {max_hear_distance = 8, pos = pos, gain = 1.0})
minetest.chat_send_player(tested_player, "Access granted !")
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)
else
minetest.chat_send_player(tested_player, "Access refused !")
minetest.sound_play("scifi_nodes_access_refused", {max_hear_distance = 8, pos = pos, gain = 1.0})
minetest.swap_node(pos, {name = "scifi_nodes:palm_scanner_off", param2 = node.param2})
end
end, pos, node, tested_player, owner) -- end of anonymous function
end
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},
mesecons = {receptor = {state = mesecon.state.on,}},
on_timer = toggle_palm_scanner,
sounds = default.node_sound_glass_defaults(),
})
minetest.register_node("scifi_nodes:palm_scanner_off", {
description = "Palm scanner",
tiles = {"scifi_nodes_palm_scanner_off.png",},
inventory_image = "scifi_nodes_palm_scanner_on.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_owner,
on_rightclick = check_owner,
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}
}},
wield_image = "scifi_nodes_palm_scanner_on.png",
inventory_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, not_in_creative_inventory=1, mesecon_needs_receiver = 1},
})
minetest.register_craft({
output = "scifi_nodes:palm_scanner_off 2",
recipe = {
{"mesecons_powerplant:power_plant", "scifi_nodes:grey", ""}
}
})

Binary file not shown.

Binary file not shown.

Binary file not shown.