1 local fence_collision_extra = 4/8
3 --create fences for all solid nodes
4 for name,def in pairs(minetest.registered_nodes) do
5 if def.drawtype == "normal" and string.match(name, "main:") then
8 local def2 = table.copy(def)
9 local newname = "walls:"..string.gsub(name, "main:", "").."_fence"
10 def2.mod_origin = "walls"
12 def2.description = def.description.." Fence"
14 def2.paramtype = "light"
15 def2.drawtype = "nodebox"
19 fixed = {-1/8, -1/2, -1/8, 1/8, 1/2, 1/8},
22 connect_front = {{-1/16, 3/16, -1/2, 1/16, 5/16, -1/8 },
23 {-1/16, -5/16, -1/2, 1/16, -3/16, -1/8 }},
24 connect_left = {{-1/2, 3/16, -1/16, -1/8, 5/16, 1/16},
25 {-1/2, -5/16, -1/16, -1/8, -3/16, 1/16}},
26 connect_back = {{-1/16, 3/16, 1/8, 1/16, 5/16, 1/2 },
27 {-1/16, -5/16, 1/8, 1/16, -3/16, 1/2 }},
28 connect_right = {{ 1/8, 3/16, -1/16, 1/2, 5/16, 1/16},
29 { 1/8, -5/16, -1/16, 1/2, -3/16, 1/16}}
31 def2.collision_box = {
33 fixed = {-1/8, -1/2, -1/8, 1/8, 1/2 + fence_collision_extra, 1/8},
36 connect_front = {-1/8, -1/2, -1/2, 1/8, 1/2 + fence_collision_extra, -1/8},
37 connect_left = {-1/2, -1/2, -1/8, -1/8, 1/2 + fence_collision_extra, 1/8},
38 connect_back = {-1/8, -1/2, 1/8, 1/8, 1/2 + fence_collision_extra, 1/2},
39 connect_right = { 1/8, -1/2, -1/8, 1/2, 1/2 + fence_collision_extra, 1/8}
41 def2.connects_to = {"group:fence", "group:wood", "group:tree", "group:wall", "group:stone", "group:sand"}
42 def2.sunlight_propagates = true
43 minetest.register_node(newname,def2)
45 minetest.register_craft({
46 output = newname .. " 16",
48 { name, 'main:stick', name },
49 { name, 'main:stick', name },
57 for name,def in pairs(minetest.registered_nodes) do
58 if def.drawtype == "normal" and string.match(name, "main:") then
61 local def2 = table.copy(def)
62 local newname = "walls:"..string.gsub(name, "main:", "").."_wall_post"
63 def2.description = def.description.." Wall"
64 def2.mod_origin = "walls"
67 def2.paramtype = "light"
68 def2.drawtype = "nodebox"
70 --def2.on_place = function(itemstack, placer, pointed_thing)
71 -- minetest.item_place(itemstack, placer, pointed_thing)
72 -- wall_placing(pointed_thing.above,newname)
76 disconnected_sides = {-4/16, -1/2, -4/16, 4/16, 9/16, 4/16},
79 connect_front = {-2/16, -1/2, -1/2, 2/16, 1/2, 2/16 },
80 connect_left = {-1/2, -1/2, -2/16, 2/16, 1/2, 2/16},
81 connect_back = {-2/16, -1/2, -2/16, 2/16, 1/2, 1/2 },
82 connect_right = { -2/16, -1/2, -2/16, 1/2, 1/2, 2/16},
84 def2.collision_box = {
86 fixed = {-1/8, -1/2, -1/8, 1/8, 1/2 + fence_collision_extra, 1/8},
89 connect_front = {-2/16, -1/2, -1/2, 2/16,1/2 + fence_collision_extra, 2/16 },
90 connect_left = {-1/2, -1/2, -2/16, 2/16, 1/2 + fence_collision_extra, 2/16},
91 connect_back = {-2/16, -1/2, -2/16, 2/16, 1/2 + fence_collision_extra, 1/2 },
92 connect_right = {-2/16, -1/2, -2/16, 1/2, 1/2 + fence_collision_extra, 2/16},
94 def2.groups["fence"] = 1
95 def2.connects_to = {"group:fence", "group:wood", "group:tree", "group:wall", "group:stone", "group:sand"}
96 def2.sunlight_propagates = true
97 minetest.register_node(newname,def2)
99 minetest.register_craft({
100 output = newname .. " 16",
102 { name, 'main:iron', name },
103 { name, name , name },
111 local def = minetest.registered_nodes["main:glass"]
114 local def2 = table.copy(def)
115 local newname = "walls:window"
116 def2.description = "Window"
117 def2.mod_origin = "walls"
120 def2.paramtype = "light"
121 def2.drawtype = "nodebox"
123 --def2.on_place = function(itemstack, placer, pointed_thing)
124 -- minetest.item_place(itemstack, placer, pointed_thing)
125 -- wall_placing(pointed_thing.above,newname)
129 disconnected_sides = {
130 {-1/16, -1/2, -1/2, 1/16, 1/2, 1/16 },
131 {-1/2, -1/2, -1/16, 1/16, 1/2, 1/16},
132 {-1/16, -1/2, -1/16, 1/16, 1/2, 1/2 },
133 { -1/16, -1/2, -1/16, 1/2, 1/2, 1/16},
137 connect_front = {-1/16, -1/2, -1/2, 1/16, 1/2, 1/16 },
138 connect_left = {-1/2, -1/2, -1/16, 1/16, 1/2, 1/16},
139 connect_back = {-1/16, -1/2, -1/16, 1/16, 1/2, 1/2 },
140 connect_right = { -1/16, -1/2, -1/16, 1/2, 1/2, 1/16},
143 def2.connects_to = {"group:fence", "group:wood", "group:wall", "group:stone", "group:sand","group:glass"}
144 def2.sunlight_propagates = true
145 minetest.register_node(newname,def2)
147 minetest.register_craft({
148 output = newname .. " 16",
150 { "main:glass", "main:glass" },
151 { "main:glass", "main:glass" },