mirror of
https://github.com/D00Med/scifi_nodes.git
synced 2024-12-22 16:10:18 +01:00
commit
162aa2c8ff
21
.luacheckrc
Normal file
21
.luacheckrc
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
unused_args = false
|
||||||
|
allow_defined_top = true
|
||||||
|
|
||||||
|
globals = {
|
||||||
|
"minetest",
|
||||||
|
"mesecon"
|
||||||
|
}
|
||||||
|
|
||||||
|
read_globals = {
|
||||||
|
-- Stdlib
|
||||||
|
string = {fields = {"split"}},
|
||||||
|
table = {fields = {"copy", "getn"}},
|
||||||
|
|
||||||
|
-- Minetest
|
||||||
|
"vector", "ItemStack",
|
||||||
|
"dump",
|
||||||
|
|
||||||
|
-- optional deps
|
||||||
|
"default", "stairsplus", "xpanes", "screwdriver"
|
||||||
|
|
||||||
|
}
|
109
builder.lua
Normal file
109
builder.lua
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
|
||||||
|
|
||||||
|
--the builder node
|
||||||
|
|
||||||
|
local builder_formspec =
|
||||||
|
"size[8,9]" ..
|
||||||
|
default.gui_bg ..
|
||||||
|
default.gui_bg_img ..
|
||||||
|
default.gui_slots ..
|
||||||
|
"list[current_name;input;1,1;1,1;]" ..
|
||||||
|
"list[current_name;output;3,0;4,3;]" ..
|
||||||
|
"list[current_player;main;0,4.85;8,1;]" ..
|
||||||
|
"list[current_player;main;0,6.08;8,3;8]" ..
|
||||||
|
"listring[current_name;input]" ..
|
||||||
|
"listring[current_name;output]" ..
|
||||||
|
"listring[current_player;main]" ..
|
||||||
|
default.get_hotbar_bg(0,4.85)
|
||||||
|
|
||||||
|
local input_items = {
|
||||||
|
{
|
||||||
|
"default:steel_ingot 1",
|
||||||
|
"scifi_nodes:black",
|
||||||
|
"scifi_nodes:blue",
|
||||||
|
"scifi_nodes:rough",
|
||||||
|
"scifi_nodes:rust",
|
||||||
|
"scifi_nodes:white",
|
||||||
|
"scifi_nodes:grey",
|
||||||
|
"scifi_nodes:pplwll",
|
||||||
|
"scifi_nodes:greenmetal",
|
||||||
|
"scifi_nodes:wall",
|
||||||
|
"scifi_nodes:blue_square",
|
||||||
|
"scifi_nodes:mesh",
|
||||||
|
"scifi_nodes:greytile"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:builder", {
|
||||||
|
description = "Sci-fi Node Builder",
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_builder.png",
|
||||||
|
"scifi_nodes_builder.png",
|
||||||
|
"scifi_nodes_builder_side.png",
|
||||||
|
"scifi_nodes_builder_side.png",
|
||||||
|
"scifi_nodes_builder_side.png",
|
||||||
|
"scifi_nodes_builder_front.png"
|
||||||
|
},
|
||||||
|
on_construct = function(pos)
|
||||||
|
--local meta = minetest.get_meta(pos)
|
||||||
|
--meta:set_string("infotext", "Node Builder (currently does nothing)")
|
||||||
|
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("formspec", builder_formspec)
|
||||||
|
meta:set_string("infotext", "Node Builder")
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
inv:set_size("output", 4 * 3)
|
||||||
|
inv:set_size("input", 1 * 1)
|
||||||
|
end,
|
||||||
|
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
local player_inv = player:get_inventory()
|
||||||
|
if listname == "output" then
|
||||||
|
player_inv:add_item("main", stack)
|
||||||
|
inv:set_stack("output", index, "")
|
||||||
|
end
|
||||||
|
if listname == "input" then
|
||||||
|
for _, row in ipairs(input_items) do
|
||||||
|
local item = row[1]
|
||||||
|
if inv:contains_item("input", item) then
|
||||||
|
inv:set_stack("output", 1, row[2])
|
||||||
|
inv:set_stack("output", 2, row[3])
|
||||||
|
inv:set_stack("output", 3, row[4])
|
||||||
|
inv:set_stack("output", 4, row[5])
|
||||||
|
inv:set_stack("output", 5, row[6])
|
||||||
|
inv:set_stack("output", 6, row[7])
|
||||||
|
inv:set_stack("output", 7, row[8])
|
||||||
|
inv:set_stack("output", 8, row[9])
|
||||||
|
inv:set_stack("output", 9, row[10])
|
||||||
|
inv:set_stack("output", 10, row[11])
|
||||||
|
inv:set_stack("output", 11, row[12])
|
||||||
|
inv:set_stack("output", 12, row[13])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
local istack = inv:get_stack("input", 1)
|
||||||
|
local stack_name = istack:get_name()
|
||||||
|
inv:remove_item("input", stack_name.." 1")
|
||||||
|
|
||||||
|
inv:set_stack("output", 1, "")
|
||||||
|
inv:set_stack("output", 2, "")
|
||||||
|
inv:set_stack("output", 3, "")
|
||||||
|
inv:set_stack("output", 4, "")
|
||||||
|
inv:set_stack("output", 5, "")
|
||||||
|
inv:set_stack("output", 6, "")
|
||||||
|
inv:set_stack("output", 7, "")
|
||||||
|
inv:set_stack("output", 8, "")
|
||||||
|
inv:set_stack("output", 9, "")
|
||||||
|
inv:set_stack("output", 10, "")
|
||||||
|
inv:set_stack("output", 11, "")
|
||||||
|
inv:set_stack("output", 12, "")
|
||||||
|
end,
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {cracky=1, oddly_breakable_by_hand=1}
|
||||||
|
})
|
109
chest.lua
Normal file
109
chest.lua
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
|
||||||
|
--chest code from default(Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>)
|
||||||
|
|
||||||
|
local chest_formspec =
|
||||||
|
"size[8,9]" ..
|
||||||
|
default.gui_bg ..
|
||||||
|
default.gui_bg_img ..
|
||||||
|
default.gui_slots ..
|
||||||
|
"list[current_name;main;0,0.3;8,4;]" ..
|
||||||
|
"list[current_player;main;0,4.85;8,1;]" ..
|
||||||
|
"list[current_player;main;0,6.08;8,3;8]" ..
|
||||||
|
"listring[current_name;main]" ..
|
||||||
|
"listring[current_player;main]" ..
|
||||||
|
default.get_hotbar_bg(0,4.85)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Helper functions
|
||||||
|
|
||||||
|
local function drop_chest_stuff()
|
||||||
|
return function(pos, oldnode, oldmetadata, digger)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:from_table(oldmetadata)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
for i = 1, inv:get_size("main") do
|
||||||
|
local stack = inv:get_stack("main", i)
|
||||||
|
if not stack:is_empty() then
|
||||||
|
local p = {
|
||||||
|
x = pos.x + math.random(0, 5)/5 - 0.5,
|
||||||
|
y = pos.y,
|
||||||
|
z = pos.z + math.random(0, 5)/5 - 0.5}
|
||||||
|
minetest.add_item(p, stack)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--chest code Copyright (C) 2011-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||||
|
minetest.register_node("scifi_nodes:crate", {
|
||||||
|
description = "Crate",
|
||||||
|
tiles = {"scifi_nodes_crate.png"},
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {cracky = 1, oddly_breakable_by_hand = 2, fuel = 8},
|
||||||
|
legacy_facedir_simple = true,
|
||||||
|
is_ground_content = false,
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
|
||||||
|
after_dig_node = drop_chest_stuff(),
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("formspec", chest_formspec)
|
||||||
|
meta:set_string("infotext", "Crate")
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
inv:set_size("main", 8 * 4)
|
||||||
|
end,
|
||||||
|
on_metadata_inventory_move = function(pos, from_list, from_index,
|
||||||
|
to_list, to_index, count, player)
|
||||||
|
minetest.log("action", player:get_player_name() ..
|
||||||
|
" moves stuff in chest at " .. minetest.pos_to_string(pos))
|
||||||
|
end,
|
||||||
|
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
|
minetest.log("action", player:get_player_name() ..
|
||||||
|
" moves stuff to chest at " .. minetest.pos_to_string(pos))
|
||||||
|
end,
|
||||||
|
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
|
minetest.log("action", player:get_player_name() ..
|
||||||
|
" takes stuff from chest at " .. minetest.pos_to_string(pos))
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:box", {
|
||||||
|
description = "Storage box",
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_box_top.png",
|
||||||
|
"scifi_nodes_box_top.png",
|
||||||
|
"scifi_nodes_box.png",
|
||||||
|
"scifi_nodes_box.png",
|
||||||
|
"scifi_nodes_box.png",
|
||||||
|
"scifi_nodes_box.png"
|
||||||
|
},
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {cracky = 1},
|
||||||
|
legacy_facedir_simple = true,
|
||||||
|
is_ground_content = false,
|
||||||
|
sounds = default.node_sound_metal_defaults(),
|
||||||
|
|
||||||
|
after_dig_node = drop_chest_stuff(),
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("formspec", chest_formspec)
|
||||||
|
meta:set_string("infotext", "Box")
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
inv:set_size("main", 8 * 4)
|
||||||
|
end,
|
||||||
|
on_metadata_inventory_move = function(pos, from_list, from_index,
|
||||||
|
to_list, to_index, count, player)
|
||||||
|
minetest.log("action", player:get_player_name() ..
|
||||||
|
" moves stuff in chest at " .. minetest.pos_to_string(pos))
|
||||||
|
end,
|
||||||
|
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
|
minetest.log("action", player:get_player_name() ..
|
||||||
|
" moves stuff to chest at " .. minetest.pos_to_string(pos))
|
||||||
|
end,
|
||||||
|
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
|
minetest.log("action", player:get_player_name() ..
|
||||||
|
" takes stuff from chest at " .. minetest.pos_to_string(pos))
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
--end of chest code
|
22
common.lua
Normal file
22
common.lua
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
|
||||||
|
scifi_nodes.get_switch_rules = function(param2)
|
||||||
|
|
||||||
|
-- param2 = 2
|
||||||
|
local rules = {
|
||||||
|
{x=1, y=-1, z=-1},
|
||||||
|
{x=1, y=-1, z=1},
|
||||||
|
{x=0, y=-1, z=-1},
|
||||||
|
{x=0, y=-1, z=1},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Left and right when looking to +y ?
|
||||||
|
if param2 == 3 then
|
||||||
|
rules = mesecon.rotate_rules_right(mesecon.rotate_rules_right (rules))
|
||||||
|
elseif param2 == 4 then
|
||||||
|
rules = mesecon.rotate_rules_right(rules)
|
||||||
|
elseif param2 == 5 then
|
||||||
|
rules = mesecon.rotate_rules_left(rules)
|
||||||
|
end
|
||||||
|
return rules
|
||||||
|
end
|
20
crafts.lua
20
crafts.lua
@ -97,7 +97,7 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- 8 ceiling light from 2 plastic and 1 meselamp
|
-- 8 ceiling light from 2 plastic and 1 meselamp
|
||||||
-- Old recipe used "moreblocks:trap_super_glow_glass"
|
-- Old recipe used "moreblocks:trap_super_glow_glass"
|
||||||
-- but moreblocks is an optional dependance
|
-- but moreblocks is an optional dependance
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "scifi_nodes:lightbar 8",
|
output = "scifi_nodes:lightbar 8",
|
||||||
@ -191,7 +191,7 @@ minetest.register_craft({
|
|||||||
{"scifi_nodes:black", "scifi_nodes:black", "scifi_nodes:black"}
|
{"scifi_nodes:black", "scifi_nodes:black", "scifi_nodes:black"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- 8 metal block from 8 black wall and 1 iron ingot
|
-- 8 metal block from 8 black wall and 1 iron ingot
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "scifi_nodes:lighttop 8",
|
output = "scifi_nodes:lighttop 8",
|
||||||
@ -343,7 +343,11 @@ minetest.register_craft({
|
|||||||
output = "scifi_nodes:keysmonitor",
|
output = "scifi_nodes:keysmonitor",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"scifi_nodes:black", "scifi_nodes:widescreen", "scifi_nodes:black"},
|
{"scifi_nodes:black", "scifi_nodes:widescreen", "scifi_nodes:black"},
|
||||||
{"mesecons_microcontroller:microcontroller0000", "scifi_nodes:black_detail", "mesecons_microcontroller:microcontroller0000"}
|
{
|
||||||
|
"mesecons_microcontroller:microcontroller0000",
|
||||||
|
"scifi_nodes:black_detail",
|
||||||
|
"mesecons_microcontroller:microcontroller0000"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -513,7 +517,7 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- 6 capsule from 1 plastic, 1 glass, 1 orange dye, 1 green dye and
|
-- 6 capsule from 1 plastic, 1 glass, 1 orange dye, 1 green dye and
|
||||||
-- 1 cyan dye
|
-- 1 cyan dye
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "scifi_nodes:capsule 6",
|
output = "scifi_nodes:capsule 6",
|
||||||
@ -608,7 +612,11 @@ minetest.register_craft({
|
|||||||
output = "scifi_nodes:black_lights",
|
output = "scifi_nodes:black_lights",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"dye:red", "dye:green", "dye:yellow"},
|
{"dye:red", "dye:green", "dye:yellow"},
|
||||||
{"mesecons_microcontroller:microcontroller0000", "scifi_nodes:black", "mesecons_microcontroller:microcontroller0000"}
|
{
|
||||||
|
"mesecons_microcontroller:microcontroller0000",
|
||||||
|
"scifi_nodes:black",
|
||||||
|
"mesecons_microcontroller:microcontroller0000"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1100,7 +1108,7 @@ minetest.register_craft({
|
|||||||
{"scifi_nodes:white2", ""},
|
{"scifi_nodes:white2", ""},
|
||||||
{"scifi_nodes:white2","scifi_nodes:white2"}
|
{"scifi_nodes:white2","scifi_nodes:white2"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- 6 white slope from 3 plastic wall
|
-- 6 white slope from 3 plastic wall
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
161
digicode.lua
Normal file
161
digicode.lua
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
|
||||||
|
--------------
|
||||||
|
-- Digicode --
|
||||||
|
--------------
|
||||||
|
local has_mesecons = minetest.get_modpath("mesecons")
|
||||||
|
|
||||||
|
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, scifi_nodes.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, scifi_nodes.get_switch_rules(node.param2))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function code_is_valid(code)
|
||||||
|
local valid = false
|
||||||
|
if type(code) == "string" and #code == code_length then
|
||||||
|
valid = true
|
||||||
|
end
|
||||||
|
for i=1, #code do
|
||||||
|
if not string.find(allowed_chars, string.sub(code,i,i)) then
|
||||||
|
valid = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return valid
|
||||||
|
end
|
||||||
|
|
||||||
|
local function update_code(pos, code)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("code", code)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function show_digicode_formspec(pos, node, player, itemstack, pointed_thing)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local owner = meta:get_string("owner")
|
||||||
|
local current_code = meta:get_string("code")
|
||||||
|
local current_player = player:get_player_name()
|
||||||
|
|
||||||
|
-- Gathering datas that will be used by callback function
|
||||||
|
digicode_context[current_player] = {code = current_code, pos = pos}
|
||||||
|
|
||||||
|
if current_player == owner then
|
||||||
|
minetest.show_formspec(current_player, "digicode_formspec",
|
||||||
|
"size[6,3]"..
|
||||||
|
"field[1,1;3,1;code;Code;]".. -- type, position, size, name, label
|
||||||
|
"button_exit[1,2;2,1;change;Change code]"..
|
||||||
|
"button_exit[3,2;2,1;open;Open door]")
|
||||||
|
else
|
||||||
|
minetest.show_formspec(current_player, "digicode_formspec",
|
||||||
|
"size[6,3]"..
|
||||||
|
"field[2,1;3,1;code;Code;]"..
|
||||||
|
"button_exit[2,2;3,1;open;Open door]")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Process datas from digicode_formspec
|
||||||
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
|
if formname ~= "digicode_formspec" then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local sounds = {"scifi_nodes_scanner_granted","scifi_nodes_scanner_refused",
|
||||||
|
"scifi_nodes_digicode_granted","scifi_nodes_digicode_refused"
|
||||||
|
}
|
||||||
|
local sound_index
|
||||||
|
|
||||||
|
-- We have the right formspec so we can proceed it.
|
||||||
|
-- Let's retrieve the datas we need :
|
||||||
|
local context = digicode_context[player:get_player_name()]
|
||||||
|
|
||||||
|
if fields.change and code_is_valid(fields.code) then
|
||||||
|
update_code(context.pos, fields.code)
|
||||||
|
sound_index = 1
|
||||||
|
elseif
|
||||||
|
fields.change and not code_is_valid(fields.code) then
|
||||||
|
sound_index = 2
|
||||||
|
elseif
|
||||||
|
fields.open and fields.code == context.code then
|
||||||
|
toggle_digicode(context.pos)
|
||||||
|
sound_index = 3
|
||||||
|
elseif
|
||||||
|
fields.open and fields.code ~= context.code then
|
||||||
|
sound_index = 4
|
||||||
|
end
|
||||||
|
-- play sound at context position
|
||||||
|
minetest.sound_play(sounds[sound_index], {
|
||||||
|
pos = context.pos,
|
||||||
|
max_hear_distance = 10
|
||||||
|
})
|
||||||
|
context[player:get_player_name()] = nil -- we don't need it anymore
|
||||||
|
end)
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:digicode_on", {
|
||||||
|
description = "Digicode",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
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 = (has_mesecons and 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 = (has_mesecons and 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", ""}}
|
||||||
|
})
|
13
doors.lua
13
doors.lua
@ -10,12 +10,11 @@
|
|||||||
-- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
-- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
-- 1. You are allowed to do whatever you want to with what content is using this license.
|
-- 1. You are allowed to do whatever you want to with what content is using this license.
|
||||||
-- 2. This content is provided 'as-is', without any express or implied warranty. In no event
|
-- 2. This content is provided 'as-is', without any express or implied warranty. In no event
|
||||||
-- will the authors be held liable for any damages arising from the use of this content.
|
-- will the authors be held liable for any damages arising from the use of this content.
|
||||||
|
|
||||||
|
|
||||||
-- Retrieving mod settings
|
-- 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)
|
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 --
|
-- Some aliases to deal with old namming policy --
|
||||||
@ -57,7 +56,6 @@ for _, current_door in ipairs(doors) do
|
|||||||
local base_name = current_door.base_name
|
local base_name = current_door.base_name
|
||||||
local base_ingredient = current_door.base_ingredient
|
local base_ingredient = current_door.base_ingredient
|
||||||
local sound = current_door.sound
|
local sound = current_door.sound
|
||||||
local doors_rightclick
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = closed .. " 2",
|
output = closed .. " 2",
|
||||||
@ -143,8 +141,8 @@ for _, current_door in ipairs(doors) do
|
|||||||
local f = 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 g = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z+1})
|
||||||
local h = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z+1})
|
local h = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z+1})
|
||||||
|
|
||||||
|
|
||||||
minetest.set_node(pos, {name=opened, param2=node.param2})
|
minetest.set_node(pos, {name=opened, param2=node.param2})
|
||||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=opened_top, param2=node.param2})
|
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=opened_top, param2=node.param2})
|
||||||
|
|
||||||
@ -184,7 +182,8 @@ for _, current_door in ipairs(doors) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
function afterplace(pos, placer, itemstack, pointed_thing)
|
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})
|
local node = minetest.get_node(pos)
|
||||||
|
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name=opened_top,param2=node.param2})
|
||||||
end
|
end
|
||||||
|
|
||||||
function ontimer(pos, elapsed)
|
function ontimer(pos, elapsed)
|
||||||
@ -383,7 +382,7 @@ for _, current_door in ipairs(doors) do
|
|||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{0, 0, 0, 0, 0, 0},
|
{0, 0, 0, 0, 0, 0},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
893
init.lua
893
init.lua
@ -1,881 +1,22 @@
|
|||||||
--scifi_nodes by D00Med
|
--scifi_nodes by D00Med
|
||||||
|
|
||||||
--the builder node
|
scifi_nodes = {}
|
||||||
|
|
||||||
local builder_formspec =
|
local MP = minetest.get_modpath("scifi_nodes")
|
||||||
"size[8,9]" ..
|
|
||||||
default.gui_bg ..
|
|
||||||
default.gui_bg_img ..
|
|
||||||
default.gui_slots ..
|
|
||||||
"list[current_name;input;1,1;1,1;]" ..
|
|
||||||
"list[current_name;output;3,0;4,3;]" ..
|
|
||||||
"list[current_player;main;0,4.85;8,1;]" ..
|
|
||||||
"list[current_player;main;0,6.08;8,3;8]" ..
|
|
||||||
"listring[current_name;input]" ..
|
|
||||||
"listring[current_name;output]" ..
|
|
||||||
"listring[current_player;main]" ..
|
|
||||||
default.get_hotbar_bg(0,4.85)
|
|
||||||
|
|
||||||
local input_items = {
|
if minetest.get_modpath("xpanes") then
|
||||||
{"default:steel_ingot 1", "scifi_nodes:black", "scifi_nodes:blue", "scifi_nodes:rough", "scifi_nodes:rust", "scifi_nodes:white", "scifi_nodes:grey", "scifi_nodes:pplwll", "scifi_nodes:greenmetal", "scifi_nodes:wall", "scifi_nodes:blue_square", "scifi_nodes:mesh", "scifi_nodes:greytile"}
|
dofile(MP.."/panes.lua")
|
||||||
}
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:builder", {
|
|
||||||
description = "Sci-fi Node Builder",
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_builder.png",
|
|
||||||
"scifi_nodes_builder.png",
|
|
||||||
"scifi_nodes_builder_side.png",
|
|
||||||
"scifi_nodes_builder_side.png",
|
|
||||||
"scifi_nodes_builder_side.png",
|
|
||||||
"scifi_nodes_builder_front.png"
|
|
||||||
},
|
|
||||||
on_construct = function(pos)
|
|
||||||
--local meta = minetest.get_meta(pos)
|
|
||||||
--meta:set_string("infotext", "Node Builder (currently does nothing)")
|
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
meta:set_string("formspec", builder_formspec)
|
|
||||||
meta:set_string("infotext", "Node Builder")
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
inv:set_size("output", 4 * 3)
|
|
||||||
inv:set_size("input", 1 * 1)
|
|
||||||
end,
|
|
||||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
local player_inv = player:get_inventory()
|
|
||||||
if listname == "output" then
|
|
||||||
player_inv:add_item("main", stack)
|
|
||||||
inv:set_stack("output", index, "")
|
|
||||||
end
|
|
||||||
if listname == "input" then
|
|
||||||
for _, row in ipairs(input_items) do
|
|
||||||
local item = row[1]
|
|
||||||
if inv:contains_item("input", item) then
|
|
||||||
inv:set_stack("output", 1, row[2])
|
|
||||||
inv:set_stack("output", 2, row[3])
|
|
||||||
inv:set_stack("output", 3, row[4])
|
|
||||||
inv:set_stack("output", 4, row[5])
|
|
||||||
inv:set_stack("output", 5, row[6])
|
|
||||||
inv:set_stack("output", 6, row[7])
|
|
||||||
inv:set_stack("output", 7, row[8])
|
|
||||||
inv:set_stack("output", 8, row[9])
|
|
||||||
inv:set_stack("output", 9, row[10])
|
|
||||||
inv:set_stack("output", 10, row[11])
|
|
||||||
inv:set_stack("output", 11, row[12])
|
|
||||||
inv:set_stack("output", 12, row[13])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
local stack = inv:get_stack("input", 1)
|
|
||||||
local stack_name = stack:get_name()
|
|
||||||
inv:remove_item("input", stack_name.." 1")
|
|
||||||
|
|
||||||
inv:set_stack("output", 1, "")
|
|
||||||
inv:set_stack("output", 2, "")
|
|
||||||
inv:set_stack("output", 3, "")
|
|
||||||
inv:set_stack("output", 4, "")
|
|
||||||
inv:set_stack("output", 5, "")
|
|
||||||
inv:set_stack("output", 6, "")
|
|
||||||
inv:set_stack("output", 7, "")
|
|
||||||
inv:set_stack("output", 8, "")
|
|
||||||
inv:set_stack("output", 9, "")
|
|
||||||
inv:set_stack("output", 10, "")
|
|
||||||
inv:set_stack("output", 11, "")
|
|
||||||
inv:set_stack("output", 12, "")
|
|
||||||
end,
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
groups = {cracky=1, oddly_breakable_by_hand=1}
|
|
||||||
})
|
|
||||||
|
|
||||||
--nodes
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:grassblk", {
|
|
||||||
description = "Dirt With Alien Grass",
|
|
||||||
tiles = {"default_grass.png^[colorize:cyan:80", "default_dirt.png",
|
|
||||||
{name = "default_dirt.png^(default_grass_side.png^[colorize:cyan:80)",
|
|
||||||
tileable_vertical = false}},
|
|
||||||
light_source = 2,
|
|
||||||
groups = {crumbly=1, oddly_breakable_by_hand=1, soil=1}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:light", {
|
|
||||||
description = "blue lightbox",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_lighttop.png",
|
|
||||||
"scifi_nodes_lighttop.png",
|
|
||||||
"scifi_nodes_light.png",
|
|
||||||
"scifi_nodes_light.png",
|
|
||||||
"scifi_nodes_light.png",
|
|
||||||
"scifi_nodes_light.png"
|
|
||||||
},
|
|
||||||
light_source = 10,
|
|
||||||
paramtype = "light",
|
|
||||||
groups = {cracky=1}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:rfloor", {
|
|
||||||
description = "rusty floor",
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_rustfloor.png",
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
light_source = 10,
|
|
||||||
groups = {cracky=1},
|
|
||||||
sounds = default.node_sound_metal_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:bfloor", {
|
|
||||||
description = "blue floor",
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_bluefloor.png",
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
light_source = 10,
|
|
||||||
groups = {cracky=1},
|
|
||||||
sounds = default.node_sound_metal_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:stripes2", {
|
|
||||||
description = "hazard stripes2",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_stripes2top.png",
|
|
||||||
"scifi_nodes_stripes2top.png",
|
|
||||||
"scifi_nodes_stripes2.png",
|
|
||||||
"scifi_nodes_stripes2.png",
|
|
||||||
"scifi_nodes_stripes2.png",
|
|
||||||
"scifi_nodes_stripes2.png"
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
|
||||||
groups = {cracky=1},
|
|
||||||
sounds = default.node_sound_metal_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:gblock", {
|
|
||||||
description = "Green metal block",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_gblock.png",
|
|
||||||
"scifi_nodes_gblock.png",
|
|
||||||
"scifi_nodes_gblock.png",
|
|
||||||
"scifi_nodes_gblock.png",
|
|
||||||
"scifi_nodes_gblock.png",
|
|
||||||
"scifi_nodes_gblock.png"
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
|
||||||
groups = {cracky=1};
|
|
||||||
sounds = default.node_sound_metal_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:gblock2", {
|
|
||||||
description = "Green metal block 2",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_gblock2_top.png",
|
|
||||||
"scifi_nodes_gblock.png",
|
|
||||||
"scifi_nodes_gblock2.png",
|
|
||||||
"scifi_nodes_gblock2_fx.png",
|
|
||||||
"scifi_nodes_gblock.png",
|
|
||||||
"scifi_nodes_gblock2_front1.png"
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
groups = {cracky=1},
|
|
||||||
sounds = default.node_sound_metal_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:gblock3", {
|
|
||||||
description = "Green metal block 3",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_gblock2_top.png",
|
|
||||||
"scifi_nodes_gblock.png",
|
|
||||||
"scifi_nodes_gblock2.png",
|
|
||||||
"scifi_nodes_gblock2_fx.png",
|
|
||||||
"scifi_nodes_gblock.png",
|
|
||||||
"scifi_nodes_gblock2_screen.png"
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
groups = {cracky=1},
|
|
||||||
sounds = default.node_sound_metal_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:green_light", {
|
|
||||||
description = "green lightbox",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_lighttop.png",
|
|
||||||
"scifi_nodes_lighttop.png",
|
|
||||||
"scifi_nodes_greenlight.png",
|
|
||||||
"scifi_nodes_greenlight.png",
|
|
||||||
"scifi_nodes_greenlight.png",
|
|
||||||
"scifi_nodes_greenlight.png"
|
|
||||||
},
|
|
||||||
light_source = 10,
|
|
||||||
paramtype = "light",
|
|
||||||
groups = {cracky=1},
|
|
||||||
sounds = default.node_sound_glass_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:red_light", {
|
|
||||||
description = "red lightbox",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_lighttop.png",
|
|
||||||
"scifi_nodes_lighttop.png",
|
|
||||||
"scifi_nodes_redlight.png",
|
|
||||||
"scifi_nodes_redlight.png",
|
|
||||||
"scifi_nodes_redlight.png",
|
|
||||||
"scifi_nodes_redlight.png"
|
|
||||||
},
|
|
||||||
light_source = 10,
|
|
||||||
paramtype = "light",
|
|
||||||
groups = {cracky=1},
|
|
||||||
sounds = default.node_sound_glass_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:discs", {
|
|
||||||
description = "disc shelves",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_box_top.png",
|
|
||||||
"scifi_nodes_box_top.png",
|
|
||||||
"scifi_nodes_discs.png",
|
|
||||||
"scifi_nodes_discs.png",
|
|
||||||
"scifi_nodes_discs.png",
|
|
||||||
"scifi_nodes_discs.png"
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
|
||||||
groups = {cracky=1},
|
|
||||||
sounds = default.node_sound_glass_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:disc", {
|
|
||||||
description = "disc",
|
|
||||||
drawtype = "torchlike",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_disc.png"
|
|
||||||
},
|
|
||||||
inventory_image = "scifi_nodes_disc.png",
|
|
||||||
wield_image = "scifi_nodes_disc.png",
|
|
||||||
paramtype = "light",
|
|
||||||
groups = {cracky=1}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:blink", {
|
|
||||||
description = "blinking light",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {{
|
|
||||||
name="scifi_nodes_lightbox.png",
|
|
||||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.00},
|
|
||||||
}},
|
|
||||||
paramtype = "light",
|
|
||||||
groups = {cracky=1},
|
|
||||||
light_source = 5,
|
|
||||||
sounds = default.node_sound_glass_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:black_lights", {
|
|
||||||
description = "black wallpanel",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {{
|
|
||||||
name="scifi_nodes_black_lights.png",
|
|
||||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.50},
|
|
||||||
}},
|
|
||||||
paramtype = "light",
|
|
||||||
groups = {cracky=1},
|
|
||||||
sounds = default.node_sound_glass_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:black_screen", {
|
|
||||||
description = "black wall screen",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {{
|
|
||||||
name="scifi_nodes_black_screen.png",
|
|
||||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.00},
|
|
||||||
}},
|
|
||||||
paramtype = "light",
|
|
||||||
groups = {cracky=1},
|
|
||||||
light_source = 1,
|
|
||||||
sounds = default.node_sound_stone_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:screen", {
|
|
||||||
description = "electronic screen",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {{
|
|
||||||
name="scifi_nodes_screen.png",
|
|
||||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.50},
|
|
||||||
}},
|
|
||||||
paramtype = "light",
|
|
||||||
groups = {cracky=1},
|
|
||||||
light_source = 5,
|
|
||||||
sounds = default.node_sound_glass_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:screen2", {
|
|
||||||
description = "electronic screen 2",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {{
|
|
||||||
name="scifi_nodes_screen2.png",
|
|
||||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.50},
|
|
||||||
}},
|
|
||||||
paramtype = "light",
|
|
||||||
groups = {cracky=1},
|
|
||||||
light_source = 5,
|
|
||||||
sounds = default.node_sound_glass_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:white_pad", {
|
|
||||||
description = "white keypad",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_white2.png",
|
|
||||||
"scifi_nodes_white2.png",
|
|
||||||
"scifi_nodes_white2.png",
|
|
||||||
"scifi_nodes_white2.png",
|
|
||||||
"scifi_nodes_white2.png",
|
|
||||||
"scifi_nodes_white_pad.png"
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
groups = {cracky=1},
|
|
||||||
sounds = default.node_sound_glass_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:white_base", {
|
|
||||||
description = "white wall base",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_white2.png",
|
|
||||||
"scifi_nodes_white2.png",
|
|
||||||
"scifi_nodes_white_side.png",
|
|
||||||
"scifi_nodes_white_side.png",
|
|
||||||
"scifi_nodes_white_side.png",
|
|
||||||
"scifi_nodes_white_side.png"
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
groups = {cracky=1},
|
|
||||||
sounds = default.node_sound_glass_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:grnpipe", {
|
|
||||||
description = "green pipe",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_greenpipe_front.png",
|
|
||||||
"scifi_nodes_greenpipe_front.png",
|
|
||||||
"scifi_nodes_greenpipe_top.png",
|
|
||||||
"scifi_nodes_greenpipe_top.png",
|
|
||||||
"scifi_nodes_greenpipe_top.png",
|
|
||||||
"scifi_nodes_greenpipe_top.png"
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
groups = {cracky=1},
|
|
||||||
sounds = default.node_sound_metal_defaults(),
|
|
||||||
on_place = minetest.rotate_node
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:grnpipe2", {
|
|
||||||
description = "broken green pipe",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_greenpipe_front.png",
|
|
||||||
"scifi_nodes_greenpipe_front.png",
|
|
||||||
"scifi_nodes_greenpipe2_top.png",
|
|
||||||
"scifi_nodes_greenpipe2_top.png",
|
|
||||||
"scifi_nodes_greenpipe2_top.png",
|
|
||||||
"scifi_nodes_greenpipe2_top.png"
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
groups = {cracky=1},
|
|
||||||
sounds = default.node_sound_metal_defaults(),
|
|
||||||
on_place = minetest.rotate_node
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:octrng", {
|
|
||||||
description = "Orange Octagon Glass",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
drawtype = "glasslike",
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_octrng.png",
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
use_texture_alpha = true,
|
|
||||||
light_source = 10,
|
|
||||||
groups = {cracky=2},
|
|
||||||
sounds = default.node_sound_glass_defaults(),
|
|
||||||
sounds = default.node_sound_glass_defaults(),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:octgrn", {
|
|
||||||
description = "Green Octagon Glass",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
drawtype = "glasslike",
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_octgrn.png",
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
use_texture_alpha = true,
|
|
||||||
light_source = 10,
|
|
||||||
groups = {cracky=2},
|
|
||||||
sounds = default.node_sound_glass_defaults(),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:octbl", {
|
|
||||||
description = "Blue Octagon Glass",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
drawtype = "glasslike",
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_octbl.png",
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
use_texture_alpha = true,
|
|
||||||
light_source = 10,
|
|
||||||
groups = {cracky=2},
|
|
||||||
sounds = default.node_sound_glass_defaults(),
|
|
||||||
sounds = default.node_sound_glass_defaults(),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:octppl", {
|
|
||||||
description = "Purple Octagon Glass",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
drawtype = "glasslike",
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_octppl.png",
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
use_texture_alpha = true,
|
|
||||||
light_source = 10,
|
|
||||||
groups = {cracky=2},
|
|
||||||
sounds = default.node_sound_glass_defaults(),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:tower", {
|
|
||||||
description = "Wind tower",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
drawtype = "plantlike",
|
|
||||||
tiles = {{
|
|
||||||
name = "scifi_nodes_tower_anim.png",
|
|
||||||
animation = {type = "vertical_frames", aspect_w = 32, aspect_h = 32, length = 1.00},
|
|
||||||
}},
|
|
||||||
visual_scale = 2,
|
|
||||||
inventory_image = "scifi_nodes_tower.png",
|
|
||||||
paramtype = "light",
|
|
||||||
groups = {cracky=2},
|
|
||||||
sounds = default.node_sound_metal_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:junk", {
|
|
||||||
description = "Junk",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
paramtype = "light",
|
|
||||||
liquid_viscosity = 8,
|
|
||||||
liquidtype = "source",
|
|
||||||
liquid_alternative_flowing = "scifi_nodes:junk",
|
|
||||||
liquid_alternative_source = "scifi_nodes:junk",
|
|
||||||
liquid_renewable = false,
|
|
||||||
liquid_range = 0,
|
|
||||||
walkable = false,
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_junk.png"
|
|
||||||
},
|
|
||||||
groups = {snappy=1, oddly_breakable_by_hand=1, liquid=3, dig_immediate=1}
|
|
||||||
})
|
|
||||||
|
|
||||||
--edited wool code (Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>)
|
|
||||||
|
|
||||||
local node = {}
|
|
||||||
-- This uses a trick: you can first define the recipes using all of the base
|
|
||||||
-- colors, and then some recipes using more specific colors for a few non-base
|
|
||||||
-- colors available. When crafting, the last recipes will be checked first.
|
|
||||||
--add new block using texture name(without "scifi_nodes_" prefix) then the description, and then the name of the block
|
|
||||||
node.types = {
|
|
||||||
{"blue", "blue lines", "blue"},
|
|
||||||
{"holes", "metal with holes","holes"},
|
|
||||||
{"white2", "plastic", "white2"},
|
|
||||||
{"super_white", "Super Plastic", "super_white", 11},
|
|
||||||
{"ultra_white", "Ultra Plastic", "ultra_white", default.LIGHT_MAX},
|
|
||||||
{"engine", "engine", "engine"},
|
|
||||||
{"wall", "metal wall", "wall"},
|
|
||||||
{"white", "plastic wall", "white"},
|
|
||||||
{"stripes2top", "dirty metal block","metal2"},
|
|
||||||
{"rough", "rough metal", "rough"},
|
|
||||||
{"lighttop", "metal block", "metal"},
|
|
||||||
{"red", "red lines", "red"},
|
|
||||||
{"green", "green lines", "green"},
|
|
||||||
{"vent2", "vent", "vent"},
|
|
||||||
{"stripes", "hazard stripes", "stripes"},
|
|
||||||
{"rust", "rusty metal", "rust"},
|
|
||||||
{"mesh", "metal mesh", "mesh"},
|
|
||||||
{"black", "black wall", "black"},
|
|
||||||
{"blackoct", "black octagon", "blackoct"},
|
|
||||||
{"blackpipe", "black pipe", "blackpipe"},
|
|
||||||
{"blacktile", "black tile", "blktl"},
|
|
||||||
{"blacktile2", "black tile 2", "blktl2"},
|
|
||||||
{"blackvent", "black vent", "blkvnt"},
|
|
||||||
{"bluebars", "blue bars", "bluebars"},
|
|
||||||
{"bluemetal", "blue metal", "blumtl"},
|
|
||||||
{"bluetile", "blue tile", "blutl"},
|
|
||||||
{"greytile", "grey tile", "grytl"},
|
|
||||||
{"mesh2", "metal floormesh", "mesh2"},
|
|
||||||
{"white", "plastic wall", "white"},
|
|
||||||
{"pipe", "wall pipe", "pipe2"},
|
|
||||||
{"pipeside", "side pipe", "pipe3"},
|
|
||||||
{"tile", "white tile", "tile"},
|
|
||||||
{"whiteoct", "white octagon", "whiteoct"},
|
|
||||||
{"whitetile", "white tile2", "whttl"},
|
|
||||||
{"black_detail", "black detail", "blckdtl"},
|
|
||||||
{"green_square", "green metal block", "grnblck"},
|
|
||||||
{"red_square", "red metal block", "redblck"},
|
|
||||||
{"grey_square", "grey metal block", "greyblck"},
|
|
||||||
{"blue_square", "blue metal block", "blublck"},
|
|
||||||
{"black_mesh", "black vent block", "blckmsh"},
|
|
||||||
{"dent", "dented metal block", "dent"},
|
|
||||||
{"greenmetal", "green metal wall", "grnmetl"},
|
|
||||||
{"greenmetal2", "green metal wall2", "grnmetl2"},
|
|
||||||
{"greenlights", "green wall lights", "grnlt", 10},
|
|
||||||
{"greenlights2", "green wall lights2", "grnlt2", 10},
|
|
||||||
{"greenbar", "green light bar", "grnlghtbr", 10},
|
|
||||||
{"green2", "green wall panel", "grn2"},
|
|
||||||
{"greentubes", "green pipes", "grntubes"},
|
|
||||||
{"grey", "grey wall", "gry"},
|
|
||||||
{"greybolts", "grey wall bolts", "gryblts"},
|
|
||||||
{"greybars", "grey bars", "grybrs"},
|
|
||||||
{"greydots", "grey wall dots", "grydts"},
|
|
||||||
{"greygreenbar", "gray power pipe", "grygrnbr", 10},
|
|
||||||
{"octofloor", "Doom floor", "octofloor"},
|
|
||||||
{"octofloor2", "Brown Doom floor", "octofloor2"},
|
|
||||||
{"doomwall1", "Doom wall 1", "doomwall1"},
|
|
||||||
{"doomwall2", "Doom wall 2", "doomwall2"},
|
|
||||||
{"doomwall3", "Doom wall 3", "doomwall3"},
|
|
||||||
{"doomwall4", "Doom wall 4", "doomwall4"},
|
|
||||||
{"doomwall41", "Doom wall 4.1", "doomwall4.1"},
|
|
||||||
{"doomwall42", "Doom wall 4.2", "doomwall4.2"},
|
|
||||||
{"doomwall43", "Doom wall 4.3", "doomwall4.3"},
|
|
||||||
{"doomwall431", "Doom wall 4.3.1", "doomwall4.3.1"},
|
|
||||||
{"doomwall44", "Doom wall 4.4", "doomwall4.4"},
|
|
||||||
{"blackdmg", "Damaged black wall", "blckdmg"},
|
|
||||||
{"blackdmgstripe", "Damaged black wall(stripes)", "blckdmgstripe"},
|
|
||||||
{"doomengine", "Doom engine wall", "doomengine"},
|
|
||||||
{"monitorwall", "Wall monitors", "monitorwall"},
|
|
||||||
{"screen3", "Wall monitor", "screen3"},
|
|
||||||
{"doomlight", "Doom light", "doomlight", 12},
|
|
||||||
{"bluwllight", "Blue wall light", "capsule3", default.LIGHT_MAX},
|
|
||||||
{"bluegrid", "Blue Grid", "bluegrid", 5},
|
|
||||||
{"fan", "Fan", "fan"},
|
|
||||||
{"ppllght", "Purple wall light", "", default.LIGHT_MAX},
|
|
||||||
{"pplwll", "Purple wall", "", 0},
|
|
||||||
{"pplwll2", "Purple wall2", "", 0},
|
|
||||||
{"pplwll3", "Purple wall3", "", 0},
|
|
||||||
{"pplwll4", "Purple wall4", "", 0},
|
|
||||||
{"pplblk", "Purple tile", "", 0},
|
|
||||||
{"purple", "Purple node", "", 0},
|
|
||||||
{"rock", "Moonstone", "", 0},
|
|
||||||
{"rock2", "Moonstone2", "", 0},
|
|
||||||
{"blackvnt", "Black vent", "", 0},
|
|
||||||
{"blackplate", "Black plate", "", 0},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, row in ipairs(node.types) do
|
|
||||||
local name = row[1]
|
|
||||||
local desc = row[2]
|
|
||||||
local light = row[4]
|
|
||||||
-- Node Definition
|
|
||||||
minetest.register_node("scifi_nodes:"..name, {
|
|
||||||
description = desc,
|
|
||||||
tiles = {"scifi_nodes_"..name..".png"},
|
|
||||||
groups = {cracky=1},
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
light_source = light,
|
|
||||||
sounds = default.node_sound_glass_defaults()
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
node.plants = {
|
dofile(MP.."/common.lua")
|
||||||
{"flower1", "Glow Flower", 1,0, default.LIGHT_MAX},
|
dofile(MP.."/builder.lua")
|
||||||
{"flower2", "Pink Flower", 1.5,0, 10},
|
dofile(MP.."/chest.lua")
|
||||||
{"flower3", "Triffid", 2,5, 0},
|
dofile(MP.."/plants.lua")
|
||||||
{"flower4", "Weeping flower", 1.5,0, 0},
|
dofile(MP.."/nodes.lua")
|
||||||
{"plant1", "Bulb Plant", 1,0, 0},
|
dofile(MP.."/doors.lua")
|
||||||
{"plant2", "Trap Plant", 1.5,0, default.LIGHT_MAX},
|
dofile(MP.."/switches.lua")
|
||||||
{"plant3", "Blue Jelly Plant", 1.2,0, 10},
|
dofile(MP.."/nodeboxes.lua")
|
||||||
{"plant4", "Green Jelly Plant", 1.2,0, 10},
|
dofile(MP.."/palm_scanner.lua")
|
||||||
{"plant5", "Fern Plant", 1.7,0, 0},
|
dofile(MP.."/digicode.lua")
|
||||||
{"plant6", "Curly Plant", 1,0, 10},
|
dofile(MP.."/models.lua")
|
||||||
{"plant7", "Egg weed", 1,0, 0},
|
dofile(MP.."/crafts.lua")
|
||||||
{"plant8", "Slug weed", 1,0, 10},
|
|
||||||
{"plant9", "Prickly Plant", 1,0, 0},
|
|
||||||
{"plant10", "Umbrella weed", 1,0, 10},
|
|
||||||
{"eyetree", "Eye Tree", 2.5,0, 0},
|
|
||||||
{"grass", "Alien Grass", 1,0, 0},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, row in ipairs(node.plants) do
|
|
||||||
local name = row[1]
|
|
||||||
local desc = row[2]
|
|
||||||
local size = row[3]
|
|
||||||
local dmg = row[4]
|
|
||||||
local light = row[5]
|
|
||||||
-- Node Definition
|
|
||||||
minetest.register_node("scifi_nodes:"..name, {
|
|
||||||
description = desc,
|
|
||||||
tiles = {"scifi_nodes_"..name..".png"},
|
|
||||||
drawtype = "plantlike",
|
|
||||||
inventory_image = {"scifi_nodes_"..name..".png"},
|
|
||||||
groups = {snappy=1, oddly_breakable_by_hand=1, dig_immediate=3, flora=1},
|
|
||||||
paramtype = "light",
|
|
||||||
visual_scale = size,
|
|
||||||
buildable_to = true,
|
|
||||||
walkable = false,
|
|
||||||
damage_per_second = dmg,
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
is_ground_content = false,
|
|
||||||
light_source = light,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
--chest code from default(Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>)
|
|
||||||
|
|
||||||
local chest_formspec =
|
|
||||||
"size[8,9]" ..
|
|
||||||
default.gui_bg ..
|
|
||||||
default.gui_bg_img ..
|
|
||||||
default.gui_slots ..
|
|
||||||
"list[current_name;main;0,0.3;8,4;]" ..
|
|
||||||
"list[current_player;main;0,4.85;8,1;]" ..
|
|
||||||
"list[current_player;main;0,6.08;8,3;8]" ..
|
|
||||||
"listring[current_name;main]" ..
|
|
||||||
"listring[current_player;main]" ..
|
|
||||||
default.get_hotbar_bg(0,4.85)
|
|
||||||
|
|
||||||
local function get_locked_chest_formspec(pos)
|
|
||||||
local spos = pos.x .. "," .. pos.y .. "," .. pos.z
|
|
||||||
local formspec =
|
|
||||||
"size[8,9]" ..
|
|
||||||
default.gui_bg ..
|
|
||||||
default.gui_bg_img ..
|
|
||||||
default.gui_slots ..
|
|
||||||
"list[nodemeta:" .. spos .. ";main;0,0.3;8,4;]" ..
|
|
||||||
"list[current_player;main;0,4.85;8,1;]" ..
|
|
||||||
"list[current_player;main;0,6.08;8,3;8]" ..
|
|
||||||
"listring[nodemeta:" .. spos .. ";main]" ..
|
|
||||||
"listring[current_player;main]" ..
|
|
||||||
default.get_hotbar_bg(0,4.85)
|
|
||||||
return formspec
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Helper functions
|
|
||||||
|
|
||||||
local function drop_chest_stuff()
|
|
||||||
return function(pos, oldnode, oldmetadata, digger)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
meta:from_table(oldmetadata)
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
for i = 1, inv:get_size("main") do
|
|
||||||
local stack = inv:get_stack("main", i)
|
|
||||||
if not stack:is_empty() then
|
|
||||||
local p = {
|
|
||||||
x = pos.x + math.random(0, 5)/5 - 0.5,
|
|
||||||
y = pos.y,
|
|
||||||
z = pos.z + math.random(0, 5)/5 - 0.5}
|
|
||||||
minetest.add_item(p, stack)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--chest code Copyright (C) 2011-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
|
|
||||||
minetest.register_node("scifi_nodes:crate", {
|
|
||||||
description = "Crate",
|
|
||||||
tiles = {"scifi_nodes_crate.png"},
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
groups = {cracky = 1, oddly_breakable_by_hand = 2, fuel = 8},
|
|
||||||
legacy_facedir_simple = true,
|
|
||||||
is_ground_content = false,
|
|
||||||
sounds = default.node_sound_wood_defaults(),
|
|
||||||
|
|
||||||
after_dig_node = drop_chest_stuff(),
|
|
||||||
on_construct = function(pos)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
meta:set_string("formspec", chest_formspec)
|
|
||||||
meta:set_string("infotext", "Crate")
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
inv:set_size("main", 8 * 4)
|
|
||||||
end,
|
|
||||||
on_metadata_inventory_move = function(pos, from_list, from_index,
|
|
||||||
to_list, to_index, count, player)
|
|
||||||
minetest.log("action", player:get_player_name() ..
|
|
||||||
" moves stuff in chest at " .. minetest.pos_to_string(pos))
|
|
||||||
end,
|
|
||||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
|
||||||
minetest.log("action", player:get_player_name() ..
|
|
||||||
" moves stuff to chest at " .. minetest.pos_to_string(pos))
|
|
||||||
end,
|
|
||||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
|
||||||
minetest.log("action", player:get_player_name() ..
|
|
||||||
" takes stuff from chest at " .. minetest.pos_to_string(pos))
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:box", {
|
|
||||||
description = "Storage box",
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_box_top.png",
|
|
||||||
"scifi_nodes_box_top.png",
|
|
||||||
"scifi_nodes_box.png",
|
|
||||||
"scifi_nodes_box.png",
|
|
||||||
"scifi_nodes_box.png",
|
|
||||||
"scifi_nodes_box.png"
|
|
||||||
},
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
groups = {cracky = 1},
|
|
||||||
legacy_facedir_simple = true,
|
|
||||||
is_ground_content = false,
|
|
||||||
sounds = default.node_sound_metal_defaults(),
|
|
||||||
|
|
||||||
after_dig_node = drop_chest_stuff(),
|
|
||||||
on_construct = function(pos)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
meta:set_string("formspec", chest_formspec)
|
|
||||||
meta:set_string("infotext", "Box")
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
inv:set_size("main", 8 * 4)
|
|
||||||
end,
|
|
||||||
on_metadata_inventory_move = function(pos, from_list, from_index,
|
|
||||||
to_list, to_index, count, player)
|
|
||||||
minetest.log("action", player:get_player_name() ..
|
|
||||||
" moves stuff in chest at " .. minetest.pos_to_string(pos))
|
|
||||||
end,
|
|
||||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
|
||||||
minetest.log("action", player:get_player_name() ..
|
|
||||||
" moves stuff to chest at " .. minetest.pos_to_string(pos))
|
|
||||||
end,
|
|
||||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
|
||||||
minetest.log("action", player:get_player_name() ..
|
|
||||||
" takes stuff from chest at " .. minetest.pos_to_string(pos))
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
--end of chest code
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:blumetlight", {
|
|
||||||
description = "blue metal light",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_bluemetal.png",
|
|
||||||
"scifi_nodes_bluemetal.png",
|
|
||||||
"scifi_nodes_blue_metal_light.png",
|
|
||||||
"scifi_nodes_blue_metal_light.png",
|
|
||||||
"scifi_nodes_blue_metal_light.png",
|
|
||||||
"scifi_nodes_blue_metal_light.png"
|
|
||||||
},
|
|
||||||
light_source = 10,
|
|
||||||
paramtype = "light",
|
|
||||||
groups = {cracky=1},
|
|
||||||
sounds = default.node_sound_glass_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:lightstp", {
|
|
||||||
description = "twin lights",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_lightstripe.png"
|
|
||||||
},
|
|
||||||
light_source = default.LIGHT_MAX,
|
|
||||||
paramtype = "light",
|
|
||||||
groups = {cracky=1},
|
|
||||||
sounds = default.node_sound_glass_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:blklt2", {
|
|
||||||
description = "black stripe light",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_black_light2.png"
|
|
||||||
},
|
|
||||||
light_source = 10,
|
|
||||||
paramtype = "light",
|
|
||||||
groups = {cracky=1},
|
|
||||||
sounds = default.node_sound_glass_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:blumetstr", {
|
|
||||||
description = "blue stripe light",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_blue_metal_stripes2.png"
|
|
||||||
},
|
|
||||||
light_source = 10,
|
|
||||||
paramtype = "light",
|
|
||||||
groups = {cracky=1},
|
|
||||||
sounds = default.node_sound_glass_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:glass", {
|
|
||||||
description = "dark glass",
|
|
||||||
drawtype = "glasslike",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_glass.png"
|
|
||||||
},
|
|
||||||
use_texture_alpha = true,
|
|
||||||
paramtype = "light",
|
|
||||||
groups = {cracky=1},
|
|
||||||
sounds = default.node_sound_glass_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:whtlightbnd", {
|
|
||||||
description = "white light stripe",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
tiles = {
|
|
||||||
"scifi_nodes_lightband.png"
|
|
||||||
},
|
|
||||||
light_source = 10,
|
|
||||||
paramtype = "light",
|
|
||||||
groups = {cracky=1},
|
|
||||||
sounds = default.node_sound_glass_defaults()
|
|
||||||
})
|
|
||||||
|
|
||||||
--extra stuff
|
|
||||||
local xpane = minetest.get_modnames()
|
|
||||||
if xpane == xpane then
|
|
||||||
dofile(minetest.get_modpath("scifi_nodes").."/panes.lua")
|
|
||||||
end
|
|
||||||
dofile(minetest.get_modpath("scifi_nodes").."/doors.lua")
|
|
||||||
dofile(minetest.get_modpath("scifi_nodes").."/nodeboxes.lua")
|
|
||||||
dofile(minetest.get_modpath("scifi_nodes").."/models.lua")
|
|
||||||
dofile(minetest.get_modpath("scifi_nodes").."/crafts.lua")
|
|
||||||
|
6
mod.conf
6
mod.conf
@ -1,4 +1,4 @@
|
|||||||
name = scifi_nodes
|
name = scifi_nodes
|
||||||
description = A mod which the vegan kitchen to Minetest.
|
description = Minetest mod that adds scifi themed blocks, doors, materials, plants and other assets.
|
||||||
depends = default,dye,basic_materials, mesecons
|
depends = default,dye
|
||||||
optional_depends = xpanes,moreblocks,mesecons_microcontroller,mesecons_button,mesecons_torch,mesecons_receiver
|
optional_depends = xpanes,mesecons,moreblocks,mesecons_microcontroller,mesecons_button,mesecons_torch,mesecons_receiver,basic_materials
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
--Copyright (c) 2011-2015 Calinou and contributors.
|
--Copyright (c) 2011-2015 Calinou and contributors.
|
||||||
--Licensed under the zlib license.
|
--Licensed under the zlib license.
|
||||||
|
|
||||||
scifi_nodes = {}
|
|
||||||
|
|
||||||
function scifi_nodes.register_slope(name, desc, texture, light)
|
function scifi_nodes.register_slope(name, desc, texture, light)
|
||||||
minetest.register_node("scifi_nodes:slope_"..name, {
|
minetest.register_node("scifi_nodes:slope_"..name, {
|
||||||
description = desc.." Slope",
|
description = desc.." Slope",
|
||||||
@ -158,7 +156,7 @@ node.types = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if minetest.global_exists("stairsplus") then
|
if minetest.global_exists("stairsplus") then
|
||||||
|
|
||||||
for _, row in ipairs(node.types) do
|
for _, row in ipairs(node.types) do
|
||||||
local name = row[1]
|
local name = row[1]
|
||||||
local desc = row[2]
|
local desc = row[2]
|
||||||
@ -174,4 +172,3 @@ if minetest.global_exists("stairsplus") then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
405
nodeboxes.lua
405
nodeboxes.lua
@ -154,13 +154,13 @@ minetest.register_node("scifi_nodes:pad", {
|
|||||||
on_construct = function(pos, node, placer)
|
on_construct = function(pos, node, placer)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
if position1 == nil then
|
if position1 == nil then
|
||||||
position1 = pos
|
position1 = pos
|
||||||
meta:set_int("type", 1)
|
meta:set_int("type", 1)
|
||||||
elseif position2 == nil then
|
elseif position2 == nil then
|
||||||
position2 = pos
|
position2 = pos
|
||||||
meta:set_int("type", 2)
|
meta:set_int("type", 2)
|
||||||
else
|
else
|
||||||
minetest.chat_send_all("There can only be two teleportation pads at a time!")
|
minetest.chat_send_all("There can only be two teleportation pads at a time!")
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_rightclick = function(pos, node, clicker)
|
on_rightclick = function(pos, node, clicker)
|
||||||
@ -185,11 +185,9 @@ minetest.register_node("scifi_nodes:pad", {
|
|||||||
minetest.after(1, function()
|
minetest.after(1, function()
|
||||||
local ppos = clicker:getpos()
|
local ppos = clicker:getpos()
|
||||||
if minetest.get_node({x=ppos.x, y=ppos.y, z=ppos.z}).name == "scifi_nodes:pad" then
|
if minetest.get_node({x=ppos.x, y=ppos.y, z=ppos.z}).name == "scifi_nodes:pad" then
|
||||||
clicker:setpos(position2)
|
clicker:setpos(position2)
|
||||||
else
|
|
||||||
--minetest.chat_send_all("Nothing to teleport!")
|
|
||||||
end
|
end
|
||||||
local objs = minetest.env:get_objects_inside_radius(pos, 3)
|
local objs = minetest.env:get_objects_inside_radius(pos, 3)
|
||||||
for _, obj in pairs(objs) do
|
for _, obj in pairs(objs) do
|
||||||
if obj:get_luaentity() and not obj:is_player() then
|
if obj:get_luaentity() and not obj:is_player() then
|
||||||
if obj:get_luaentity().name == "__builtin:item" then
|
if obj:get_luaentity().name == "__builtin:item" then
|
||||||
@ -221,11 +219,9 @@ minetest.register_node("scifi_nodes:pad", {
|
|||||||
minetest.after(1, function()
|
minetest.after(1, function()
|
||||||
local ppos = clicker:getpos()
|
local ppos = clicker:getpos()
|
||||||
if minetest.get_node({x=ppos.x, y=ppos.y, z=ppos.z}).name == "scifi_nodes:pad" then
|
if minetest.get_node({x=ppos.x, y=ppos.y, z=ppos.z}).name == "scifi_nodes:pad" then
|
||||||
clicker:setpos(position1)
|
clicker:setpos(position1)
|
||||||
else
|
|
||||||
--minetest.chat_send_all("No-one to teleport!")
|
|
||||||
end
|
end
|
||||||
local objs = minetest.env:get_objects_inside_radius(pos, 3)
|
local objs = minetest.env:get_objects_inside_radius(pos, 3)
|
||||||
for _, obj in pairs(objs) do
|
for _, obj in pairs(objs) do
|
||||||
if obj:get_luaentity() and not obj:is_player() then
|
if obj:get_luaentity() and not obj:is_player() then
|
||||||
if obj:get_luaentity().name == "__builtin:item" then
|
if obj:get_luaentity().name == "__builtin:item" then
|
||||||
@ -390,12 +386,12 @@ minetest.register_node("scifi_nodes:pot", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
on_rightclick = function(pos, node, clicker, item, _)
|
on_rightclick = function(pos, node, clicker, item, _)
|
||||||
local node = minetest.get_node({x=pos.x, y=pos.y+2, z=pos.z})
|
local lid_node = minetest.get_node({x=pos.x, y=pos.y+2, z=pos.z})
|
||||||
if node.name == "scifi_nodes:pot_lid" then
|
if lid_node.name == "scifi_nodes:pot_lid" then
|
||||||
minetest.set_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="air", param2=node.param2})
|
minetest.set_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="air", param2=lid_node.param2})
|
||||||
elseif node.name ~= "scifi_nodes:pot_lid" and node.name == "air" then
|
elseif lid_node.name ~= "scifi_nodes:pot_lid" and node.name == "air" then
|
||||||
minetest.set_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="scifi_nodes:pot_lid", param2=node.param2})
|
minetest.set_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="scifi_nodes:pot_lid", param2=lid_node.param2})
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_destruct = function(pos, node, _)
|
on_destruct = function(pos, node, _)
|
||||||
minetest.remove_node({x=pos.x, y=pos.y+2, z=pos.z})
|
minetest.remove_node({x=pos.x, y=pos.y+2, z=pos.z})
|
||||||
@ -426,12 +422,12 @@ minetest.register_node("scifi_nodes:pot2", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
on_rightclick = function(pos, node, clicker, item, _)
|
on_rightclick = function(pos, node, clicker, item, _)
|
||||||
local node = minetest.get_node({x=pos.x, y=pos.y+2, z=pos.z})
|
local lid_node = minetest.get_node({x=pos.x, y=pos.y+2, z=pos.z})
|
||||||
if node.name == "scifi_nodes:pot_lid" then
|
if lid_node.name == "scifi_nodes:pot_lid" then
|
||||||
minetest.set_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="air", param2=node.param2})
|
minetest.set_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="air", param2=lid_node.param2})
|
||||||
elseif node.name ~= "scifi_nodes:pot_lid" and node.name == "air" then
|
elseif lid_node.name ~= "scifi_nodes:pot_lid" and node.name == "air" then
|
||||||
minetest.set_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="scifi_nodes:pot_lid", param2=node.param2})
|
minetest.set_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="scifi_nodes:pot_lid", param2=lid_node.param2})
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_destruct = function(pos, node, _)
|
on_destruct = function(pos, node, _)
|
||||||
minetest.remove_node({x=pos.x, y=pos.y+2, z=pos.z})
|
minetest.remove_node({x=pos.x, y=pos.y+2, z=pos.z})
|
||||||
@ -1092,9 +1088,8 @@ minetest.register_node("scifi_nodes:itemholder", {
|
|||||||
end,
|
end,
|
||||||
on_destruct = function(pos)
|
on_destruct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local node = minetest.get_node(pos)
|
|
||||||
if meta:get_string("item") ~= "" then
|
if meta:get_string("item") ~= "" then
|
||||||
drop_item(pos, node)
|
minetest.add_item(pos, meta:get_string("item"))
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@ -1208,357 +1203,3 @@ minetest.register_node("scifi_nodes:windowpanel", {
|
|||||||
on_place = minetest.rotate_node,
|
on_place = minetest.rotate_node,
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
--------------
|
|
||||||
-- Switches --
|
|
||||||
--------------
|
|
||||||
|
|
||||||
local function get_switch_rules(param2)
|
|
||||||
|
|
||||||
-- param2 = 2
|
|
||||||
local rules = {
|
|
||||||
{x=1, y=-1, z=-1},
|
|
||||||
{x=1, y=-1, z=1},
|
|
||||||
{x=0, y=-1, z=-1},
|
|
||||||
{x=0, y=-1, z=1},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Left and right when looking to +y ?
|
|
||||||
if param2 == 3 then
|
|
||||||
rules = mesecon.rotate_rules_right(mesecon.rotate_rules_right (rules))
|
|
||||||
elseif param2 == 4 then
|
|
||||||
rules = mesecon.rotate_rules_right(rules)
|
|
||||||
elseif param2 == 5 then
|
|
||||||
rules = mesecon.rotate_rules_left(rules)
|
|
||||||
end
|
|
||||||
return rules
|
|
||||||
end
|
|
||||||
|
|
||||||
local function toggle_switch(pos)
|
|
||||||
local node = minetest.get_node(pos)
|
|
||||||
local name = node.name
|
|
||||||
if name == "scifi_nodes:switch_on" then
|
|
||||||
minetest.sound_play("scifi_nodes_switch", {max_hear_distance = 8, pos = pos})
|
|
||||||
minetest.set_node(pos, {name = "scifi_nodes:switch_off", param2 = node.param2})
|
|
||||||
mesecon.receptor_off(pos, get_switch_rules(node.param2))
|
|
||||||
elseif name == "scifi_nodes:switch_off" then
|
|
||||||
minetest.sound_play("scifi_nodes_switch", {max_hear_distance = 8, pos = pos})
|
|
||||||
minetest.set_node(pos, {name = "scifi_nodes:switch_on", param2 = node.param2})
|
|
||||||
mesecon.receptor_on(pos, get_switch_rules(node.param2))
|
|
||||||
minetest.get_node_timer(pos):start(2)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:switch_on", {
|
|
||||||
description = "Wall switch",
|
|
||||||
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
|
|
||||||
})
|
|
||||||
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", ""}}
|
|
||||||
})
|
|
||||||
|
603
nodes.lua
Normal file
603
nodes.lua
Normal file
@ -0,0 +1,603 @@
|
|||||||
|
|
||||||
|
--nodes
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:grassblk", {
|
||||||
|
description = "Dirt With Alien Grass",
|
||||||
|
tiles = {"default_grass.png^[colorize:cyan:80", "default_dirt.png",
|
||||||
|
{name = "default_dirt.png^(default_grass_side.png^[colorize:cyan:80)",
|
||||||
|
tileable_vertical = false}},
|
||||||
|
light_source = 2,
|
||||||
|
groups = {crumbly=1, oddly_breakable_by_hand=1, soil=1}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:light", {
|
||||||
|
description = "blue lightbox",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_lighttop.png",
|
||||||
|
"scifi_nodes_lighttop.png",
|
||||||
|
"scifi_nodes_light.png",
|
||||||
|
"scifi_nodes_light.png",
|
||||||
|
"scifi_nodes_light.png",
|
||||||
|
"scifi_nodes_light.png"
|
||||||
|
},
|
||||||
|
light_source = 10,
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {cracky=1}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:rfloor", {
|
||||||
|
description = "rusty floor",
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_rustfloor.png",
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
light_source = 10,
|
||||||
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_metal_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:bfloor", {
|
||||||
|
description = "blue floor",
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_bluefloor.png",
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
light_source = 10,
|
||||||
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_metal_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:stripes2", {
|
||||||
|
description = "hazard stripes2",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_stripes2top.png",
|
||||||
|
"scifi_nodes_stripes2top.png",
|
||||||
|
"scifi_nodes_stripes2.png",
|
||||||
|
"scifi_nodes_stripes2.png",
|
||||||
|
"scifi_nodes_stripes2.png",
|
||||||
|
"scifi_nodes_stripes2.png"
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_metal_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:gblock", {
|
||||||
|
description = "Green metal block",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_gblock.png",
|
||||||
|
"scifi_nodes_gblock.png",
|
||||||
|
"scifi_nodes_gblock.png",
|
||||||
|
"scifi_nodes_gblock.png",
|
||||||
|
"scifi_nodes_gblock.png",
|
||||||
|
"scifi_nodes_gblock.png"
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {cracky=1};
|
||||||
|
sounds = default.node_sound_metal_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:gblock2", {
|
||||||
|
description = "Green metal block 2",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_gblock2_top.png",
|
||||||
|
"scifi_nodes_gblock.png",
|
||||||
|
"scifi_nodes_gblock2.png",
|
||||||
|
"scifi_nodes_gblock2_fx.png",
|
||||||
|
"scifi_nodes_gblock.png",
|
||||||
|
"scifi_nodes_gblock2_front1.png"
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_metal_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:gblock3", {
|
||||||
|
description = "Green metal block 3",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_gblock2_top.png",
|
||||||
|
"scifi_nodes_gblock.png",
|
||||||
|
"scifi_nodes_gblock2.png",
|
||||||
|
"scifi_nodes_gblock2_fx.png",
|
||||||
|
"scifi_nodes_gblock.png",
|
||||||
|
"scifi_nodes_gblock2_screen.png"
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_metal_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:green_light", {
|
||||||
|
description = "green lightbox",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_lighttop.png",
|
||||||
|
"scifi_nodes_lighttop.png",
|
||||||
|
"scifi_nodes_greenlight.png",
|
||||||
|
"scifi_nodes_greenlight.png",
|
||||||
|
"scifi_nodes_greenlight.png",
|
||||||
|
"scifi_nodes_greenlight.png"
|
||||||
|
},
|
||||||
|
light_source = 10,
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:red_light", {
|
||||||
|
description = "red lightbox",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_lighttop.png",
|
||||||
|
"scifi_nodes_lighttop.png",
|
||||||
|
"scifi_nodes_redlight.png",
|
||||||
|
"scifi_nodes_redlight.png",
|
||||||
|
"scifi_nodes_redlight.png",
|
||||||
|
"scifi_nodes_redlight.png"
|
||||||
|
},
|
||||||
|
light_source = 10,
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:discs", {
|
||||||
|
description = "disc shelves",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_box_top.png",
|
||||||
|
"scifi_nodes_box_top.png",
|
||||||
|
"scifi_nodes_discs.png",
|
||||||
|
"scifi_nodes_discs.png",
|
||||||
|
"scifi_nodes_discs.png",
|
||||||
|
"scifi_nodes_discs.png"
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:disc", {
|
||||||
|
description = "disc",
|
||||||
|
drawtype = "torchlike",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_disc.png"
|
||||||
|
},
|
||||||
|
inventory_image = "scifi_nodes_disc.png",
|
||||||
|
wield_image = "scifi_nodes_disc.png",
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {cracky=1}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:blink", {
|
||||||
|
description = "blinking light",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {{
|
||||||
|
name="scifi_nodes_lightbox.png",
|
||||||
|
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.00},
|
||||||
|
}},
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {cracky=1},
|
||||||
|
light_source = 5,
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:black_lights", {
|
||||||
|
description = "black wallpanel",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {{
|
||||||
|
name="scifi_nodes_black_lights.png",
|
||||||
|
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.50},
|
||||||
|
}},
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:black_screen", {
|
||||||
|
description = "black wall screen",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {{
|
||||||
|
name="scifi_nodes_black_screen.png",
|
||||||
|
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.00},
|
||||||
|
}},
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {cracky=1},
|
||||||
|
light_source = 1,
|
||||||
|
sounds = default.node_sound_stone_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:screen", {
|
||||||
|
description = "electronic screen",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {{
|
||||||
|
name="scifi_nodes_screen.png",
|
||||||
|
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.50},
|
||||||
|
}},
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {cracky=1},
|
||||||
|
light_source = 5,
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:screen2", {
|
||||||
|
description = "electronic screen 2",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {{
|
||||||
|
name="scifi_nodes_screen2.png",
|
||||||
|
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.50},
|
||||||
|
}},
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {cracky=1},
|
||||||
|
light_source = 5,
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:white_pad", {
|
||||||
|
description = "white keypad",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_white2.png",
|
||||||
|
"scifi_nodes_white2.png",
|
||||||
|
"scifi_nodes_white2.png",
|
||||||
|
"scifi_nodes_white2.png",
|
||||||
|
"scifi_nodes_white2.png",
|
||||||
|
"scifi_nodes_white_pad.png"
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:white_base", {
|
||||||
|
description = "white wall base",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_white2.png",
|
||||||
|
"scifi_nodes_white2.png",
|
||||||
|
"scifi_nodes_white_side.png",
|
||||||
|
"scifi_nodes_white_side.png",
|
||||||
|
"scifi_nodes_white_side.png",
|
||||||
|
"scifi_nodes_white_side.png"
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:grnpipe", {
|
||||||
|
description = "green pipe",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_greenpipe_front.png",
|
||||||
|
"scifi_nodes_greenpipe_front.png",
|
||||||
|
"scifi_nodes_greenpipe_top.png",
|
||||||
|
"scifi_nodes_greenpipe_top.png",
|
||||||
|
"scifi_nodes_greenpipe_top.png",
|
||||||
|
"scifi_nodes_greenpipe_top.png"
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_metal_defaults(),
|
||||||
|
on_place = minetest.rotate_node
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:grnpipe2", {
|
||||||
|
description = "broken green pipe",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_greenpipe_front.png",
|
||||||
|
"scifi_nodes_greenpipe_front.png",
|
||||||
|
"scifi_nodes_greenpipe2_top.png",
|
||||||
|
"scifi_nodes_greenpipe2_top.png",
|
||||||
|
"scifi_nodes_greenpipe2_top.png",
|
||||||
|
"scifi_nodes_greenpipe2_top.png"
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_metal_defaults(),
|
||||||
|
on_place = minetest.rotate_node
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:octrng", {
|
||||||
|
description = "Orange Octagon Glass",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
drawtype = "glasslike",
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_octrng.png",
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
use_texture_alpha = true,
|
||||||
|
light_source = 10,
|
||||||
|
groups = {cracky=2},
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:octgrn", {
|
||||||
|
description = "Green Octagon Glass",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
drawtype = "glasslike",
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_octgrn.png",
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
use_texture_alpha = true,
|
||||||
|
light_source = 10,
|
||||||
|
groups = {cracky=2},
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:octbl", {
|
||||||
|
description = "Blue Octagon Glass",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
drawtype = "glasslike",
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_octbl.png",
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
use_texture_alpha = true,
|
||||||
|
light_source = 10,
|
||||||
|
groups = {cracky=2},
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:octppl", {
|
||||||
|
description = "Purple Octagon Glass",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
drawtype = "glasslike",
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_octppl.png",
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
use_texture_alpha = true,
|
||||||
|
light_source = 10,
|
||||||
|
groups = {cracky=2},
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:tower", {
|
||||||
|
description = "Wind tower",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
drawtype = "plantlike",
|
||||||
|
tiles = {{
|
||||||
|
name = "scifi_nodes_tower_anim.png",
|
||||||
|
animation = {type = "vertical_frames", aspect_w = 32, aspect_h = 32, length = 1.00},
|
||||||
|
}},
|
||||||
|
visual_scale = 2,
|
||||||
|
inventory_image = "scifi_nodes_tower.png",
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {cracky=2},
|
||||||
|
sounds = default.node_sound_metal_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:junk", {
|
||||||
|
description = "Junk",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
paramtype = "light",
|
||||||
|
liquid_viscosity = 8,
|
||||||
|
liquidtype = "source",
|
||||||
|
liquid_alternative_flowing = "scifi_nodes:junk",
|
||||||
|
liquid_alternative_source = "scifi_nodes:junk",
|
||||||
|
liquid_renewable = false,
|
||||||
|
liquid_range = 0,
|
||||||
|
walkable = false,
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_junk.png"
|
||||||
|
},
|
||||||
|
groups = {snappy=1, oddly_breakable_by_hand=1, liquid=3, dig_immediate=1}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:blumetlight", {
|
||||||
|
description = "blue metal light",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_bluemetal.png",
|
||||||
|
"scifi_nodes_bluemetal.png",
|
||||||
|
"scifi_nodes_blue_metal_light.png",
|
||||||
|
"scifi_nodes_blue_metal_light.png",
|
||||||
|
"scifi_nodes_blue_metal_light.png",
|
||||||
|
"scifi_nodes_blue_metal_light.png"
|
||||||
|
},
|
||||||
|
light_source = 10,
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:lightstp", {
|
||||||
|
description = "twin lights",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_lightstripe.png"
|
||||||
|
},
|
||||||
|
light_source = default.LIGHT_MAX,
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:blklt2", {
|
||||||
|
description = "black stripe light",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_black_light2.png"
|
||||||
|
},
|
||||||
|
light_source = 10,
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:blumetstr", {
|
||||||
|
description = "blue stripe light",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_blue_metal_stripes2.png"
|
||||||
|
},
|
||||||
|
light_source = 10,
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:glass", {
|
||||||
|
description = "dark glass",
|
||||||
|
drawtype = "glasslike",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_glass.png"
|
||||||
|
},
|
||||||
|
use_texture_alpha = true,
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes:whtlightbnd", {
|
||||||
|
description = "white light stripe",
|
||||||
|
sunlight_propagates = false,
|
||||||
|
tiles = {
|
||||||
|
"scifi_nodes_lightband.png"
|
||||||
|
},
|
||||||
|
light_source = 10,
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {cracky=1},
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
--edited wool code (Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>)
|
||||||
|
|
||||||
|
|
||||||
|
-- This uses a trick: you can first define the recipes using all of the base
|
||||||
|
-- colors, and then some recipes using more specific colors for a few non-base
|
||||||
|
-- colors available. When crafting, the last recipes will be checked first.
|
||||||
|
--add new block using texture name(without "scifi_nodes_" prefix) then the description, and then the name of the block
|
||||||
|
local nodetypes = {
|
||||||
|
{"blue", "blue lines", "blue"},
|
||||||
|
{"holes", "metal with holes","holes"},
|
||||||
|
{"white2", "plastic", "white2"},
|
||||||
|
{"super_white", "Super Plastic", "super_white", 11},
|
||||||
|
{"ultra_white", "Ultra Plastic", "ultra_white", default.LIGHT_MAX},
|
||||||
|
{"engine", "engine", "engine"},
|
||||||
|
{"wall", "metal wall", "wall"},
|
||||||
|
{"white", "plastic wall", "white"},
|
||||||
|
{"stripes2top", "dirty metal block","metal2"},
|
||||||
|
{"rough", "rough metal", "rough"},
|
||||||
|
{"lighttop", "metal block", "metal"},
|
||||||
|
{"red", "red lines", "red"},
|
||||||
|
{"green", "green lines", "green"},
|
||||||
|
{"vent2", "vent", "vent"},
|
||||||
|
{"stripes", "hazard stripes", "stripes"},
|
||||||
|
{"rust", "rusty metal", "rust"},
|
||||||
|
{"mesh", "metal mesh", "mesh"},
|
||||||
|
{"black", "black wall", "black"},
|
||||||
|
{"blackoct", "black octagon", "blackoct"},
|
||||||
|
{"blackpipe", "black pipe", "blackpipe"},
|
||||||
|
{"blacktile", "black tile", "blktl"},
|
||||||
|
{"blacktile2", "black tile 2", "blktl2"},
|
||||||
|
{"blackvent", "black vent", "blkvnt"},
|
||||||
|
{"bluebars", "blue bars", "bluebars"},
|
||||||
|
{"bluemetal", "blue metal", "blumtl"},
|
||||||
|
{"bluetile", "blue tile", "blutl"},
|
||||||
|
{"greytile", "grey tile", "grytl"},
|
||||||
|
{"mesh2", "metal floormesh", "mesh2"},
|
||||||
|
{"white", "plastic wall", "white"},
|
||||||
|
{"pipe", "wall pipe", "pipe2"},
|
||||||
|
{"pipeside", "side pipe", "pipe3"},
|
||||||
|
{"tile", "white tile", "tile"},
|
||||||
|
{"whiteoct", "white octagon", "whiteoct"},
|
||||||
|
{"whitetile", "white tile2", "whttl"},
|
||||||
|
{"black_detail", "black detail", "blckdtl"},
|
||||||
|
{"green_square", "green metal block", "grnblck"},
|
||||||
|
{"red_square", "red metal block", "redblck"},
|
||||||
|
{"grey_square", "grey metal block", "greyblck"},
|
||||||
|
{"blue_square", "blue metal block", "blublck"},
|
||||||
|
{"black_mesh", "black vent block", "blckmsh"},
|
||||||
|
{"dent", "dented metal block", "dent"},
|
||||||
|
{"greenmetal", "green metal wall", "grnmetl"},
|
||||||
|
{"greenmetal2", "green metal wall2", "grnmetl2"},
|
||||||
|
{"greenlights", "green wall lights", "grnlt", 10},
|
||||||
|
{"greenlights2", "green wall lights2", "grnlt2", 10},
|
||||||
|
{"greenbar", "green light bar", "grnlghtbr", 10},
|
||||||
|
{"green2", "green wall panel", "grn2"},
|
||||||
|
{"greentubes", "green pipes", "grntubes"},
|
||||||
|
{"grey", "grey wall", "gry"},
|
||||||
|
{"greybolts", "grey wall bolts", "gryblts"},
|
||||||
|
{"greybars", "grey bars", "grybrs"},
|
||||||
|
{"greydots", "grey wall dots", "grydts"},
|
||||||
|
{"greygreenbar", "gray power pipe", "grygrnbr", 10},
|
||||||
|
{"octofloor", "Doom floor", "octofloor"},
|
||||||
|
{"octofloor2", "Brown Doom floor", "octofloor2"},
|
||||||
|
{"doomwall1", "Doom wall 1", "doomwall1"},
|
||||||
|
{"doomwall2", "Doom wall 2", "doomwall2"},
|
||||||
|
{"doomwall3", "Doom wall 3", "doomwall3"},
|
||||||
|
{"doomwall4", "Doom wall 4", "doomwall4"},
|
||||||
|
{"doomwall41", "Doom wall 4.1", "doomwall4.1"},
|
||||||
|
{"doomwall42", "Doom wall 4.2", "doomwall4.2"},
|
||||||
|
{"doomwall43", "Doom wall 4.3", "doomwall4.3"},
|
||||||
|
{"doomwall431", "Doom wall 4.3.1", "doomwall4.3.1"},
|
||||||
|
{"doomwall44", "Doom wall 4.4", "doomwall4.4"},
|
||||||
|
{"blackdmg", "Damaged black wall", "blckdmg"},
|
||||||
|
{"blackdmgstripe", "Damaged black wall(stripes)", "blckdmgstripe"},
|
||||||
|
{"doomengine", "Doom engine wall", "doomengine"},
|
||||||
|
{"monitorwall", "Wall monitors", "monitorwall"},
|
||||||
|
{"screen3", "Wall monitor", "screen3"},
|
||||||
|
{"doomlight", "Doom light", "doomlight", 12},
|
||||||
|
{"bluwllight", "Blue wall light", "capsule3", default.LIGHT_MAX},
|
||||||
|
{"bluegrid", "Blue Grid", "bluegrid", 5},
|
||||||
|
{"fan", "Fan", "fan"},
|
||||||
|
{"ppllght", "Purple wall light", "", default.LIGHT_MAX},
|
||||||
|
{"pplwll", "Purple wall", "", 0},
|
||||||
|
{"pplwll2", "Purple wall2", "", 0},
|
||||||
|
{"pplwll3", "Purple wall3", "", 0},
|
||||||
|
{"pplwll4", "Purple wall4", "", 0},
|
||||||
|
{"pplblk", "Purple tile", "", 0},
|
||||||
|
{"purple", "Purple node", "", 0},
|
||||||
|
{"rock", "Moonstone", "", 0},
|
||||||
|
{"rock2", "Moonstone2", "", 0},
|
||||||
|
{"blackvnt", "Black vent", "", 0},
|
||||||
|
{"blackplate", "Black plate", "", 0},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, row in ipairs(nodetypes) do
|
||||||
|
local name = row[1]
|
||||||
|
local desc = row[2]
|
||||||
|
local light = row[4]
|
||||||
|
-- Node Definition
|
||||||
|
minetest.register_node("scifi_nodes:"..name, {
|
||||||
|
description = desc,
|
||||||
|
tiles = {"scifi_nodes_"..name..".png"},
|
||||||
|
groups = {cracky=1},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
light_source = light,
|
||||||
|
sounds = default.node_sound_glass_defaults()
|
||||||
|
})
|
||||||
|
end
|
112
palm_scanner.lua
Normal file
112
palm_scanner.lua
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------
|
||||||
|
-- Palm scanner --
|
||||||
|
-----------------------------------------------
|
||||||
|
-- /!\ When "overriding" a callback function --
|
||||||
|
-- re-use all the parameters in same order ! --
|
||||||
|
-----------------------------------------------
|
||||||
|
|
||||||
|
local has_mesecons = minetest.get_modpath("mesecons")
|
||||||
|
|
||||||
|
|
||||||
|
function activate_palm_scanner(pos, node, player)
|
||||||
|
local name = player and player:get_player_name()
|
||||||
|
name = name or ""
|
||||||
|
|
||||||
|
node.name = "scifi_nodes:palm_scanner_checking"
|
||||||
|
minetest.swap_node(pos, node)
|
||||||
|
|
||||||
|
minetest.sound_play("scifi_nodes_palm_scanner", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||||
|
minetest.chat_send_player(name, "Checking : please wait.")
|
||||||
|
|
||||||
|
-- check protection
|
||||||
|
minetest.after(2, function()
|
||||||
|
if minetest.is_protected(pos, name or "") then
|
||||||
|
-- clicker has no access to area
|
||||||
|
minetest.chat_send_player(name, "Access denied !")
|
||||||
|
minetest.sound_play("scifi_nodes_scanner_refused", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||||
|
|
||||||
|
else
|
||||||
|
-- clicker can build here
|
||||||
|
minetest.chat_send_player(name, "Access granted !")
|
||||||
|
mesecon.receptor_on(pos, scifi_nodes.get_switch_rules(node.param2))
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- reset state
|
||||||
|
minetest.after(1, function()
|
||||||
|
node.name = "scifi_nodes:palm_scanner_off"
|
||||||
|
minetest.swap_node(pos, node)
|
||||||
|
mesecon.receptor_off(pos, scifi_nodes.get_switch_rules(node.param2))
|
||||||
|
end)
|
||||||
|
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 = (has_mesecons and mesecon.state.off)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
on_rightclick = (has_mesecons and activate_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()
|
||||||
|
})
|
||||||
|
|
||||||
|
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 = (has_mesecons and mesecon.state.on)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "scifi_nodes:palm_scanner_off 2",
|
||||||
|
recipe = {{"mesecons_powerplant:power_plant", "scifi_nodes:grey", ""}}
|
||||||
|
})
|
48
plants.lua
Normal file
48
plants.lua
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
|
||||||
|
local plants = {
|
||||||
|
{"flower1", "Glow Flower", 1,0, default.LIGHT_MAX},
|
||||||
|
{"flower2", "Pink Flower", 1.5,0, 10},
|
||||||
|
{"flower3", "Triffid", 2,5, 0},
|
||||||
|
{"flower4", "Weeping flower", 1.5,0, 0},
|
||||||
|
{"plant1", "Bulb Plant", 1,0, 0},
|
||||||
|
{"plant2", "Trap Plant", 1.5,0, default.LIGHT_MAX},
|
||||||
|
{"plant3", "Blue Jelly Plant", 1.2,0, 10},
|
||||||
|
{"plant4", "Green Jelly Plant", 1.2,0, 10},
|
||||||
|
{"plant5", "Fern Plant", 1.7,0, 0},
|
||||||
|
{"plant6", "Curly Plant", 1,0, 10},
|
||||||
|
{"plant7", "Egg weed", 1,0, 0},
|
||||||
|
{"plant8", "Slug weed", 1,0, 10},
|
||||||
|
{"plant9", "Prickly Plant", 1,0, 0},
|
||||||
|
{"plant10", "Umbrella weed", 1,0, 10},
|
||||||
|
{"eyetree", "Eye Tree", 2.5,0, 0},
|
||||||
|
{"grass", "Alien Grass", 1,0, 0},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, row in ipairs(plants) do
|
||||||
|
local name = row[1]
|
||||||
|
local desc = row[2]
|
||||||
|
local size = row[3]
|
||||||
|
local dmg = row[4]
|
||||||
|
local light = row[5]
|
||||||
|
-- Node Definition
|
||||||
|
minetest.register_node("scifi_nodes:"..name, {
|
||||||
|
description = desc,
|
||||||
|
tiles = {"scifi_nodes_"..name..".png"},
|
||||||
|
drawtype = "plantlike",
|
||||||
|
inventory_image = {"scifi_nodes_"..name..".png"},
|
||||||
|
groups = {snappy=1, oddly_breakable_by_hand=1, dig_immediate=3, flora=1},
|
||||||
|
paramtype = "light",
|
||||||
|
visual_scale = size,
|
||||||
|
buildable_to = true,
|
||||||
|
walkable = false,
|
||||||
|
damage_per_second = dmg,
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
is_ground_content = false,
|
||||||
|
light_source = light,
|
||||||
|
})
|
||||||
|
end
|
72
switches.lua
Normal file
72
switches.lua
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
|
||||||
|
--------------
|
||||||
|
-- Switches --
|
||||||
|
--------------
|
||||||
|
|
||||||
|
local has_mesecons = minetest.get_modpath("mesecons")
|
||||||
|
|
||||||
|
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, scifi_nodes.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, scifi_nodes.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 = (has_mesecons and mesecon.state.on)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
on_rightclick = (has_mesecons and toggle_switch),
|
||||||
|
on_timer = (has_mesecons and 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 = (has_mesecons and mesecon.state.off)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
on_rightclick = (has_mesecons and toggle_switch)
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "scifi_nodes:switch_off 2",
|
||||||
|
recipe = {{"mesecons_button:button_off", "scifi_nodes:grey", ""}}
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user