--
-- Fence registration helper
--
+local fence_collision_extra = minetest.settings:get_bool("enable_fence_tall") and 3/8 or 0
function default.register_fence(name, def)
minetest.register_craft({
drawtype = "nodebox",
node_box = {
type = "connected",
- fixed = {{-1/8, -1/2, -1/8, 1/8, 1/2, 1/8}},
+ fixed = {-1/8, -1/2, -1/8, 1/8, 1/2, 1/8},
-- connect_top =
-- connect_bottom =
- connect_front = {{-1/16,3/16,-1/2,1/16,5/16,-1/8},
- {-1/16,-5/16,-1/2,1/16,-3/16,-1/8}},
- connect_left = {{-1/2,3/16,-1/16,-1/8,5/16,1/16},
- {-1/2,-5/16,-1/16,-1/8,-3/16,1/16}},
- connect_back = {{-1/16,3/16,1/8,1/16,5/16,1/2},
- {-1/16,-5/16,1/8,1/16,-3/16,1/2}},
- connect_right = {{1/8,3/16,-1/16,1/2,5/16,1/16},
- {1/8,-5/16,-1/16,1/2,-3/16,1/16}},
+ connect_front = {{-1/16, 3/16, -1/2, 1/16, 5/16, -1/8 },
+ {-1/16, -5/16, -1/2, 1/16, -3/16, -1/8 }},
+ connect_left = {{-1/2, 3/16, -1/16, -1/8, 5/16, 1/16},
+ {-1/2, -5/16, -1/16, -1/8, -3/16, 1/16}},
+ connect_back = {{-1/16, 3/16, 1/8, 1/16, 5/16, 1/2 },
+ {-1/16, -5/16, 1/8, 1/16, -3/16, 1/2 }},
+ connect_right = {{ 1/8, 3/16, -1/16, 1/2, 5/16, 1/16},
+ { 1/8, -5/16, -1/16, 1/2, -3/16, 1/16}}
+ },
+ collision_box = {
+ type = "connected",
+ fixed = {-1/8, -1/2, -1/8, 1/8, 1/2 + fence_collision_extra, 1/8},
+ -- connect_top =
+ -- connect_bottom =
+ connect_front = {-1/8, -1/2, -1/2, 1/8, 1/2 + fence_collision_extra, -1/8},
+ connect_left = {-1/2, -1/2, -1/8, -1/8, 1/2 + fence_collision_extra, 1/8},
+ connect_back = {-1/8, -1/2, 1/8, 1/8, 1/2 + fence_collision_extra, 1/2},
+ connect_right = { 1/8, -1/2, -1/8, 1/2, 1/2 + fence_collision_extra, 1/8}
},
connects_to = {"group:fence", "group:wood", "group:tree", "group:wall"},
inventory_image = fence_texture,
drawtype = "nodebox",
node_box = {
type = "connected",
- fixed = {
- {-1/16, 3/16, -1/16, 1/16, 5/16, 1/16},
- {-1/16, -3/16, -1/16, 1/16, -5/16, 1/16}
- },
+ fixed = {{-1/16, 3/16, -1/16, 1/16, 5/16, 1/16},
+ {-1/16, -3/16, -1/16, 1/16, -5/16, 1/16}},
+ -- connect_top =
+ -- connect_bottom =
+ connect_front = {{-1/16, 3/16, -1/2, 1/16, 5/16, -1/16},
+ {-1/16, -5/16, -1/2, 1/16, -3/16, -1/16}},
+ connect_left = {{-1/2, 3/16, -1/16, -1/16, 5/16, 1/16},
+ {-1/2, -5/16, -1/16, -1/16, -3/16, 1/16}},
+ connect_back = {{-1/16, 3/16, 1/16, 1/16, 5/16, 1/2 },
+ {-1/16, -5/16, 1/16, 1/16, -3/16, 1/2 }},
+ connect_right = {{ 1/16, 3/16, -1/16, 1/2, 5/16, 1/16},
+ { 1/16, -5/16, -1/16, 1/2, -3/16, 1/16}}
+ },
+ collision_box = {
+ type = "connected",
+ fixed = {-1/8, -1/2, -1/8, 1/8, 1/2 + fence_collision_extra, 1/8},
-- connect_top =
-- connect_bottom =
- connect_front = {
- {-1/16, 3/16, -1/2, 1/16, 5/16, -1/16},
- {-1/16, -5/16, -1/2, 1/16, -3/16, -1/16}},
- connect_left = {
- {-1/2, 3/16, -1/16, -1/16, 5/16, 1/16},
- {-1/2, -5/16, -1/16, -1/16, -3/16, 1/16}},
- connect_back = {
- {-1/16, 3/16, 1/16, 1/16, 5/16, 1/2},
- {-1/16, -5/16, 1/16, 1/16, -3/16, 1/2}},
- connect_right = {
- {1/16, 3/16, -1/16, 1/2, 5/16, 1/16},
- {1/16, -5/16, -1/16, 1/2, -3/16, 1/16}},
+ connect_front = {-1/8, -1/2, -1/2, 1/8, 1/2 + fence_collision_extra, -1/8},
+ connect_left = {-1/2, -1/2, -1/8, -1/8, 1/2 + fence_collision_extra, 1/8},
+ connect_back = {-1/8, -1/2, 1/8, 1/8, 1/2 + fence_collision_extra, 1/2},
+ connect_right = { 1/8, -1/2, -1/8, 1/2, 1/2 + fence_collision_extra, 1/8}
},
connects_to = {"group:fence", "group:wall"},
inventory_image = fence_rail_texture,
----fence gate----
+local fence_collision_extra = minetest.settings:get_bool("enable_fence_tall") and 3/8 or 0
function doors.register_fencegate(name, def)
local fence = {
end,
selection_box = {
type = "fixed",
- fixed = {-1/2, -1/2, -1/4, 1/2, 1/2, 1/4},
+ fixed = {-1/2, -1/2, -1/4, 1/2, 1/2, 1/4}
},
}
fence_closed.sound = "doors_fencegate_open"
fence_closed.collision_box = {
type = "fixed",
- fixed = {-1/2, -1/2, -1/4, 1/2, 1/2, 1/4},
+ fixed = {-1/2, -1/2, -1/8, 1/2, 1/2 + fence_collision_extra, 1/8}
}
local fence_open = table.copy(fence)
fence_open.groups.not_in_creative_inventory = 1
fence_open.collision_box = {
type = "fixed",
- fixed = {{-1/2, -1/2, -1/4, -3/8, 1/2, 1/4},
- {-1/2, -3/8, -1/2, -3/8, 3/8, 0}},
+ fixed = {{-1/2, -1/2, -1/8, -3/8, 1/2 + fence_collision_extra, 1/8},
+ {-1/2, -3/8, -1/2, -3/8, 3/8, 0 }}
}
minetest.register_node(":" .. name .. "_closed", fence_closed)
walls = {}
+local fence_collision_extra = minetest.settings:get_bool("enable_fence_tall") and 3/8 or 0
+
-- Load support for MT game translation.
local S = minetest.get_translator("walls")
-
walls.register = function(wall_name, wall_desc, wall_texture_table, wall_mat, wall_sounds)
--make wall_texture_table paramenter backwards compatible for mods passing single texture
if type(wall_texture_table) ~= "table" then
drawtype = "nodebox",
node_box = {
type = "connected",
- fixed = {{-1/4, -1/2, -1/4, 1/4, 1/2, 1/4}},
+ fixed = {-1/4, -1/2, -1/4, 1/4, 1/2, 1/4},
+ -- connect_bottom =
+ connect_front = {-3/16, -1/2, -1/2, 3/16, 3/8, -1/4},
+ connect_left = {-1/2, -1/2, -3/16, -1/4, 3/8, 3/16},
+ connect_back = {-3/16, -1/2, 1/4, 3/16, 3/8, 1/2},
+ connect_right = { 1/4, -1/2, -3/16, 1/2, 3/8, 3/16},
+ },
+ collision_box = {
+ type = "connected",
+ fixed = {-1/4, -1/2, -1/4, 1/4, 1/2 + fence_collision_extra, 1/4},
+ -- connect_top =
-- connect_bottom =
- connect_front = {{-3/16, -1/2, -1/2, 3/16, 3/8, -1/4}},
- connect_left = {{-1/2, -1/2, -3/16, -1/4, 3/8, 3/16}},
- connect_back = {{-3/16, -1/2, 1/4, 3/16, 3/8, 1/2}},
- connect_right = {{ 1/4, -1/2, -3/16, 1/2, 3/8, 3/16}},
+ connect_front = {-1/4,-1/2,-1/2,1/4,1/2 + fence_collision_extra,-1/4},
+ connect_left = {-1/2,-1/2,-1/4,-1/4,1/2 + fence_collision_extra,1/4},
+ connect_back = {-1/4,-1/2,1/4,1/4,1/2 + fence_collision_extra,1/2},
+ connect_right = {1/4,-1/2,-1/4,1/2,1/2 + fence_collision_extra,1/4},
},
connects_to = { "group:wall", "group:stone", "group:fence" },
paramtype = "light",