1
0
mirror of https://github.com/D00Med/scifi_nodes.git synced 2024-11-13 05:40:28 +01:00
This commit is contained in:
D00Med 2017-03-07 07:04:32 +10:00
parent 2c98ef0687
commit d64758c113
4 changed files with 77 additions and 5 deletions

View File

@ -2,9 +2,26 @@
--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:black", "scifi_nodes:black", "scifi_nodes:black", "scifi_nodes:black", "scifi_nodes:black", "scifi_nodes:black", "scifi_nodes:black", "scifi_nodes:black", "scifi_nodes:black", "scifi_nodes:black", "scifi_nodes:black"}
}
minetest.register_node("scifi_nodes:builder", {
description = "Sci-fi Node Builder",
sunlight_propagates = false,
tiles = {
"scifi_nodes_builder.png",
"scifi_nodes_builder.png",
@ -14,16 +31,64 @@ minetest.register_node("scifi_nodes:builder", {
"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("infotext", "Node Builder (currently does nothing)")
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()
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", {
@ -494,6 +559,7 @@ node.types = {
{"screen3", "Wall monitor", "screen3"},
{"doomlight", "Doom light", "doomlight", 12},
{"bluwllight", "Blue wall light", "capsule3", 20},
{"bluegrid", "Blue Grid", "bluegrid", 5},
{"fan", "Fan", "fan"},
{"ppllght", "Purple wall light", "", 50},
{"pplwll", "Purple wall", "", 0},

View File

@ -54,5 +54,5 @@ scifi_nodes.register_slope("lightstripe", "Lightstripe", {"scifi_nodes_lightstri
scifi_nodes.register_slope("blight2", "Blue Light 2", {"scifi_nodes_capsule3.png",}, 20)
scifi_nodes.register_slope("wallpipe", "Alien Pipe", {"scifi_nodes_wallpipe.png",}, 0)
scifi_nodes.register_slope("alien", "Alien Wall", {"scifi_nodes_alnslp.png",}, 0)
scifi_nodes.register_slope("purple", "Purple", {"scifi_nodes_stripes.png",}, 0)
scifi_nodes.register_slope("purple", "Purple", {"scifi_nodes_purple.png",}, 0)
scifi_nodes.register_slope("gblock", "Gblock", {"scifi_nodes_gblock2_front1.png",}, 0)

View File

@ -451,6 +451,12 @@ minetest.register_node("scifi_nodes:lightbar", {
{-0.125, -0.5, -0.5, 0.125, -0.375, 0.5}, -- NodeBox1
}
},
selection_box = {
type = "wallmounted",
wallmounted = {
{-0.125, -0.5, -0.5, 0.125, -0.375, 0.5}, -- NodeBox1
}
},
groups = {cracky=1},
sounds = default.node_sound_glass_defaults()
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B