summaryrefslogtreecommitdiff
path: root/gates.lua
diff options
context:
space:
mode:
Diffstat (limited to 'gates.lua')
-rw-r--r--gates.lua184
1 files changed, 63 insertions, 121 deletions
diff --git a/gates.lua b/gates.lua
index b351582..d921b20 100644
--- a/gates.lua
+++ b/gates.lua
@@ -1,136 +1,78 @@
--- Node Box coords
-local nb_gap = {
- {-1, 0.1875, -0.0625, -0.5, 0.3125, 0.0625},
- {-1, -0.1875, -0.0625, -0.5, -0.3125, 0.0625},
- {0.5, 0.1875, -0.0625, 1, 0.3125, 0.0625},
- {0.5, -0.1875, -0.0625, 1, -0.3125, 0.0625}
- }
-local nb_pil = {
- {0.5, -0.5, -0.09375, 0.5625, 0.5, 0.09375},
- {-0.5625, -0.5, -0.09375, -0.5, 0.5, 0.09375},
- {-0.5, -0.3125, -0.0625, -0.375, 0.3125, 0.0625},
- {0.375, -0.3125, -0.0625, 0.5, 0.3125, 0.0625}
- }
+-- register Ethereal wood type gates
--- Open/Close Gates
-function gate_rightclick(pos, node)
+doors.register_fencegate("ethereal:fencegate_scorched", {
+ description = "Scorched Wood Fence Gate",
+ texture = "scorched_tree.png",
+ material = "ethereal:scorched_tree",
+ groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}
+})
- local split = string.split(node.name, "_")
- local sound = "open"
- local name = "open"
+doors.register_fencegate("ethereal:fencegate_frostwood", {
+ description = "Frost Wood Fence Gate",
+ texture = "frost_wood.png",
+ material = "ethereal:frost_wood",
+ groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}
+})
- if split[3] == "open" then
- sound = "close"
- name = "closed"
- end
+doors.register_fencegate("ethereal:fencegate_redwood", {
+ description = "Redwood Fence Gate",
+ texture = "redwood_wood.png",
+ material = "ethereal:redwood_wood",
+ groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}
+})
- node.name = split[1] .. "_" .. split[2] .. "_" .. name
+doors.register_fencegate("ethereal:fencegate_willow", {
+ description = "Willow Wood Fence Gate",
+ texture = "willow_wood.png",
+ material = "ethereal:willow_wood",
+ groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}
+})
- minetest.swap_node(pos, node)
+doors.register_fencegate("ethereal:fencegate_yellowwood", {
+ description = "Healing Wood Fence Gate",
+ texture = "yellow_wood.png",
+ material = "ethereal:yellow_wood",
+ groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}
+})
- minetest.sound_play("doors_door_"..sound, {
- pos = pos,
- gain = 0.3,
- max_hear_distance = 10
- })
-end
+doors.register_fencegate("ethereal:fencegate_palm", {
+ description = "Palm Wood Fence Gate",
+ texture = "moretrees_palm_wood.png",
+ material = "ethereal:palm_wood",
+ groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}
+})
-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_pine_wood.png", "default:pinewood"},
- {"birch", "Birch Wood", "moretrees_birch_wood.png", "ethereal:birch_wood"},
-}
+doors.register_fencegate("ethereal:fencegate_banana", {
+ description = "Banana Wood Fence Gate",
+ texture = "banana_wood.png",
+ material = "ethereal:banana_wood",
+ groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}
+})
-for _, row in pairs(gates) do
+doors.register_fencegate("ethereal:fencegate_mushroom", {
+ description = "Mushroom Trunk Fence Gate",
+ texture = "mushroom_trunk.png",
+ material = "ethereal:mushroom_trunk",
+ groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}
+})
-minetest.register_node("ethereal:fencegate_"..row[1].."_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:fencegate_"..row[1].."_closed",
- drawtype = "nodebox",
- node_box = {
- type = "fixed",
- fixed = {
- {-0.5, -0.3125, 0.4375, -0.375, 0.3125, 0.5},
- {0.375, -0.3125, 0.4375, 0.5, 0.3125, 0.5},
- {-0.5, 0.1875, 0.0625, -0.375, 0.3125, 0.4375},
- {-0.5, -0.1875, 0.0625, -0.375, -0.3125, 0.4375},
- {0.375, 0.1875, 0.0625, 0.5, 0.3125, 0.4375},
- {0.375, -0.1875, 0.0625, 0.5, -0.3125, 0.4375},
- nb_pil[1], nb_pil[2],
- nb_pil[3], nb_pil[4],
- nb_gap[1], nb_gap[2],
- nb_gap[3], nb_gap[4],
- }
- },
- selection_box = {
- type = "fixed",
- fixed = {
- {-0.5, -0.3125, -0.0625, -0.375, 0.3125, 0.5},
- {0.375, -0.3125, -0.0625, 0.5, 0.3125, 0.5},
- }
- },
- on_rightclick = gate_rightclick,
+doors.register_fencegate("ethereal:fencegate_birch", {
+ description = "Birch Wood Fence Gate",
+ texture = "moretrees_birch_wood.png",
+ material = "ethereal:birch_wood",
+ groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}
})
-minetest.register_alias("ethereal:"..row[1].."gate_open", "ethereal:fencegate_"..row[1].."_open")
+-- add compatibility for ethereal's to default wooden gates
+minetest.register_alias("ethereal:fencegate_wood_open", "doors:gate_wood_open")
+minetest.register_alias("ethereal:fencegate_wood_closed", "doors:gate_wood_closed")
-minetest.register_node("ethereal:fencegate_"..row[1].."_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,
- walkable = true,
- groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
- drawtype = "nodebox",
- node_box = {
- type = "fixed",
- fixed = {
- nb_pil[1], nb_pil[2],
- nb_pil[3], nb_pil[4],
- {-0.0625, -0.3125, -0.0625, 0.0625, 0.3125, 0.0625},
- {-1, 0.1875, -0.0625, 1, 0.3125, 0.0625},
- {-1, -0.1875, -0.0625, 1, -0.3125, 0.0625},
- }
- },
- selection_box = {
- type = "fixed",
- fixed = {{-0.5, -0.3125, -0.0625, 0.5, 0.3125, 0.0625}}
- },
- on_rightclick = gate_rightclick,
-})
-minetest.register_alias("ethereal:"..row[1].."gate_closed", "ethereal:fencegate_"..row[1].."_closed")
+minetest.register_alias("ethereal:fencegate_acacia_open", "doors:gate_acacia_wood_open")
+minetest.register_alias("ethereal:fencegate_acacia_closed", "doors:gate_acacia_wood_closed")
-minetest.register_craft({
- output = "ethereal:fencegate_"..row[1].."_closed",
- recipe = {
- {"group:stick", row[4], "group:stick"},
- {"group:stick", row[4], "group:stick"},
- }
-})
+minetest.register_alias("ethereal:fencegate_junglewood_open", "doors:gate_junglewood_open")
+minetest.register_alias("ethereal:fencegate_junglewood_closed", "doors:gate_junglewood_closed")
-end
+minetest.register_alias("ethereal:fencegate_pine_open", "doors:gate_pine_wood_open")
+minetest.register_alias("ethereal:fencegate_pine_closed", "doors:gate_pine_wood_closed")