summaryrefslogtreecommitdiff
path: root/gates.lua
diff options
context:
space:
mode:
Diffstat (limited to 'gates.lua')
-rw-r--r--gates.lua65
1 files changed, 32 insertions, 33 deletions
diff --git a/gates.lua b/gates.lua
index aa81ad8..1c9ce9c 100644
--- a/gates.lua
+++ b/gates.lua
@@ -17,7 +17,6 @@ local nb_pil = {
function gate_rightclick(pos, node)
local gate, open = unpack(string.split(node.name, "_", 2))
local gate = gate.."_"
-
local sound, name
if open == "open" then
sound = "close"
@@ -28,38 +27,39 @@ function gate_rightclick(pos, node)
end
node.name = gate..name
minetest.set_node(pos, node)
- minetest.sound_play("doors_door_"..sound, {pos=pos, gain = 0.3, max_hear_distance = 10})
+ minetest.sound_play("doors_door_"..sound, {
+ pos = pos,
+ gain = 0.3,
+ max_hear_distance = 10
+ })
end
-local gate = {}
-
-gate.type = {
- {"wood", "Wood", "default_wood.png", "default:wood"},
- {"junglewood", "Jungle Wood", "default_junglewood.png", "default:junglewood"},
- {"scorched", "Scorched", "scorched_tree.png", "ethereal:scorched_tree"},
- {"frostwood", "Frost Wood", "frost_wood.png", "ethereal:frost_wood"},
- {"redwood", "Redwood", "redwood_wood.png", "ethereal:redwood_wood"},
- {"willow", "Willow", "willow_wood.png", "ethereal:willow_wood"},
- {"yellowwood", "Healing Wood", "yellow_wood.png", "ethereal:yellow_wood"},
- {"palm", "Palm Wood", "moretrees_palm_wood.png", "ethereal:palm_wood"},
- {"banana", "Banana Wood", "banana_wood.png", "ethereal:banana_wood"},
- {"mushroom", "Mushroom", "mushroom_trunk.png", "ethereal:mushroom_trunk"},
- {"acacia", "Acacia Wood", "moretrees_acacia_wood.png","ethereal:acacia_wood"},
- {"pine", "Pine Wood", "default_pinewood.png", "default:pinewood"},
+local gates = {
+ {"wood", "Wood", "default_wood.png", "default:wood"},
+ {"junglewood", "Jungle Wood", "default_junglewood.png", "default:junglewood"},
+ {"scorched", "Scorched", "scorched_tree.png", "ethereal:scorched_tree"},
+ {"frostwood", "Frost Wood", "frost_wood.png", "ethereal:frost_wood"},
+ {"redwood", "Redwood", "redwood_wood.png", "ethereal:redwood_wood"},
+ {"willow", "Willow", "willow_wood.png", "ethereal:willow_wood"},
+ {"yellowwood", "Healing Wood", "yellow_wood.png", "ethereal:yellow_wood"},
+ {"palm", "Palm Wood", "moretrees_palm_wood.png", "ethereal:palm_wood"},
+ {"banana", "Banana Wood", "banana_wood.png", "ethereal:banana_wood"},
+ {"mushroom", "Mushroom", "mushroom_trunk.png", "ethereal:mushroom_trunk"},
+ {"acacia", "Acacia Wood", "moretrees_acacia_wood.png", "ethereal:acacia_wood"},
+ {"pine", "Pine Wood", "default_pinewood.png", "default:pinewood"},
}
-for _, row in pairs(gate.type) do
- local name, desc, texture, nod = unpack(row)
-
-minetest.register_node("ethereal:"..name.."gate_open", {
- tiles = {texture},
+for _, row in pairs(gates) do
+
+minetest.register_node("ethereal:"..row[1].."gate_open", {
+ tiles = {row[3]},
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
is_ground_content = false,
walkable = true,
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, not_in_inventory = 1},
- drop = "ethereal:"..name.."gate_closed",
+ drop = "ethereal:"..row[1].."gate_closed",
drawtype = "nodebox",
node_box = {
type = "fixed",
@@ -86,11 +86,11 @@ minetest.register_node("ethereal:"..name.."gate_open", {
on_rightclick = gate_rightclick,
})
-minetest.register_node("ethereal:"..name.."gate_closed", {
- description = desc.." Gate",
- tiles = {texture},
- inventory_image = "default_gate_overlay.png^"..texture.."^default_gate_overlay.png^[makealpha:255,126,126",
- wield_image = "default_gate_overlay.png^"..texture.."^default_gate_overlay.png^[makealpha:255,126,126",
+minetest.register_node("ethereal:"..row[1].."gate_closed", {
+ description = row[2].." Gate",
+ tiles = {row[3]},
+ inventory_image = "default_gate_overlay.png^"..row[3].."^default_gate_overlay.png^[makealpha:255,126,126",
+ wield_image = "default_gate_overlay.png^"..row[3].."^default_gate_overlay.png^[makealpha:255,126,126",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
@@ -114,13 +114,12 @@ minetest.register_node("ethereal:"..name.."gate_closed", {
on_rightclick = gate_rightclick,
})
--- Fencegate Recipe
minetest.register_craft({
- output = "ethereal:"..name.."gate_closed",
+ output = "ethereal:"..row[1].."gate_closed",
recipe = {
- {"group:stick", nod, "group:stick"},
- {"group:stick", nod, "group:stick"},
+ {"group:stick", row[4], "group:stick"},
+ {"group:stick", row[4], "group:stick"},
}
})
-end
+end \ No newline at end of file