Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --
- -- Fence registration helper
- --
- function default.register_fence(name, def)
- minetest.register_craft({
- output = name .. " 4",
- recipe = {
- { def.material, 'group:stick', def.material },
- { def.material, 'group:stick', def.material },
- }
- })
- local fence_texture = "default_fence_overlay.png^" .. def.texture ..
- "^default_fence_overlay.png^[makealpha:255,126,126"
- -- Allow almost everything to be overridden
- local default_fields = {
- paramtype = "light",
- drawtype = "nodebox",
- node_box = {
- type = "connected",
- 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}},
- },
- connects_to = {"group:fence", "group:fence_rail", "group:wood", "group:tree"},
- inventory_image = fence_texture,
- wield_image = fence_texture,
- tiles = {def.texture},
- sunlight_propagates = true,
- is_ground_content = false,
- groups = {},
- }
- for k, v in pairs(default_fields) do
- if def[k] == nil then
- def[k] = v
- end
- end
- -- Always add to the fence group, even if no group provided
- def.groups.fence = 1
- def.texture = nil
- def.material = nil
- minetest.register_node(name, def)
- end
- --
- -- Fence rail registration helper
- --
- function default.register_fence_rail(name, def)
- minetest.register_craft({
- output = name .. " 4",
- recipe = {
- { 'group:stick', 'group:stick', 'group:stick' },
- { 'group:stick', 'group:stick', 'group:stick' },
- }
- })
- local fence_rail_texture = "default_fence_rail_overlay.png^" .. def.texture ..
- "^default_fence_rail_overlay.png^[makealpha:255,126,126"
- -- Allow almost everything to be overridden
- local default_fields = {
- paramtype = "light",
- -- paramtype2 = "facedir",
- -- legacy_facedir_simple = true,
- drawtype = "nodebox",
- node_box = {
- type = "connected",
- fixed = {{-0.5, 0.1875, -0.0625, 0.5, 0.3125, 0.0625},
- {-0.5, -0.3125, -0.0625, 0.5, -0.1875, 0.0625}},
- -- connect_top =
- -- connect_bottom =
- -- connect_front =
- 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 =
- 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}},
- },
- connects_to = {"group:fence", "group:fence_rail", "group:wood", "group:tree"},
- inventory_image = fence_rail_texture,
- wield_image = fence_rail_texture,
- tiles = {def.texture},
- sunlight_propagates = true,
- is_ground_content = false,
- groups = {},
- }
- for k, v in pairs(default_fields) do
- if def[k] == nil then
- def[k] = v
- end
- end
- -- Always add to the fence rail group, even if no group provided
- def.groups.fence_rail = 1
- def.texture = nil
- def.material = nil
- minetest.register_node(name, def)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement