@@ -17,11 +17,7 @@ local function update_pane(pos, name)
17
17
end
18
18
local sum = 0
19
19
for i , dir in pairs (directions ) do
20
- local node = minetest .get_node ({
21
- x = pos .x + dir .x ,
22
- y = pos .y + dir .y ,
23
- z = pos .z + dir .z
24
- })
20
+ local node = minetest .get_node (vector .add (pos , dir ))
25
21
local def = minetest .registered_nodes [node .name ]
26
22
local pane_num = def and def .groups .pane or 0
27
23
if pane_num > 0 or not def or (def .walkable ~= false and
@@ -50,14 +46,13 @@ local function update_nearby(pos, node)
50
46
name = name :sub (8 , underscore_pos - 1 )
51
47
end
52
48
for i , dir in pairs (directions ) do
53
- update_pane ({
54
- x = pos .x + dir .x ,
55
- y = pos .y + dir .y ,
56
- z = pos .z + dir .z
57
- }, name )
49
+ update_pane (vector .add (pos , dir ), name )
58
50
end
59
51
end
60
52
53
+ minetest .register_on_placenode (update_nearby )
54
+ minetest .register_on_dignode (update_nearby )
55
+
61
56
local half_boxes = {
62
57
{0 , - 0.5 , - 1 / 32 , 0.5 , 0.5 , 1 / 32 },
63
58
{- 1 / 32 , - 0.5 , 0 , 1 / 32 , 0.5 , 0.5 },
@@ -82,6 +77,18 @@ local sb_full_boxes = {
82
77
{- 0.06 , - 0.5 , - 0.5 , 0.06 , 0.5 , 0.5 }
83
78
}
84
79
80
+ local pane_def_fields = {
81
+ drawtype = " airlike" ,
82
+ paramtype = " light" ,
83
+ is_ground_content = false ,
84
+ sunlight_propagates = true ,
85
+ walkable = false ,
86
+ pointable = false ,
87
+ diggable = false ,
88
+ buildable_to = true ,
89
+ air_equivalent = true ,
90
+ }
91
+
85
92
function xpanes .register_pane (name , def )
86
93
for i = 1 , 15 do
87
94
local need = {}
@@ -132,6 +139,10 @@ function xpanes.register_pane(name, def)
132
139
})
133
140
end
134
141
142
+ for k , v in pairs (pane_def_fields ) do
143
+ def [k ] = def [k ] or v
144
+ end
145
+
135
146
def .on_construct = function (pos )
136
147
update_pane (pos , name )
137
148
end
@@ -144,52 +155,29 @@ function xpanes.register_pane(name, def)
144
155
})
145
156
end
146
157
147
- minetest .register_on_placenode (update_nearby )
148
- minetest .register_on_dignode (update_nearby )
149
-
150
158
xpanes .register_pane (" pane" , {
151
159
description = " Glass Pane" ,
152
- tiles = {" xpanes_space.png" },
153
- drawtype = " airlike" ,
154
- paramtype = " light" ,
155
- is_ground_content = false ,
156
- sunlight_propagates = true ,
157
- walkable = false ,
158
- pointable = false ,
159
- diggable = false ,
160
- buildable_to = true ,
161
- air_equivalent = true ,
162
160
textures = {" default_glass.png" ," xpanes_pane_half.png" ," xpanes_white.png" },
163
161
inventory_image = " default_glass.png" ,
164
162
wield_image = " default_glass.png" ,
165
163
sounds = default .node_sound_glass_defaults (),
166
164
groups = {snappy = 2 , cracky = 3 , oddly_breakable_by_hand = 3 , pane = 1 },
167
165
recipe = {
168
- {' default:glass' , ' default:glass' , ' default:glass' },
169
- {' default:glass' , ' default:glass' , ' default:glass' }
166
+ {" default:glass" , " default:glass" , " default:glass" },
167
+ {" default:glass" , " default:glass" , " default:glass" }
170
168
}
171
169
})
172
170
173
171
xpanes .register_pane (" bar" , {
174
172
description = " Iron bar" ,
175
- tiles = {" xpanes_space.png" },
176
- drawtype = " airlike" ,
177
- paramtype = " light" ,
178
- is_ground_content = false ,
179
- sunlight_propagates = true ,
180
- walkable = false ,
181
- pointable = false ,
182
- diggable = false ,
183
- buildable_to = true ,
184
- air_equivalent = true ,
185
173
textures = {" xpanes_bar.png" ," xpanes_bar.png" ," xpanes_space.png" },
186
174
inventory_image = " xpanes_bar.png" ,
187
175
wield_image = " xpanes_bar.png" ,
188
176
groups = {snappy = 2 , cracky = 3 , oddly_breakable_by_hand = 3 , pane = 1 },
189
177
sounds = default .node_sound_stone_defaults (),
190
178
recipe = {
191
- {' default:steel_ingot' , ' default:steel_ingot' , ' default:steel_ingot' },
192
- {' default:steel_ingot' , ' default:steel_ingot' , ' default:steel_ingot' }
179
+ {" default:steel_ingot" , " default:steel_ingot" , " default:steel_ingot" },
180
+ {" default:steel_ingot" , " default:steel_ingot" , " default:steel_ingot" }
193
181
}
194
182
})
195
183
0 commit comments