@@ -115,22 +115,14 @@ function doors.register_door(name, def)
115
115
end
116
116
end
117
117
118
- local function make_on_blast (base_name , door_type , other_door_type )
118
+ local function make_on_blast (base_name , dir , door_type , other_door_type )
119
119
if def .only_placer_can_open then
120
120
return function () end
121
121
else
122
- if door_type == " _b_1" or door_type == " _b_2" then
123
- return function (pos , intensity )
124
- check_and_blast (pos , base_name .. door_type )
125
- pos .y = pos .y + 1
126
- check_and_blast (pos , base_name .. other_door_type )
127
- end
128
- elseif door_type == " _t_1" or door_type == " _t_2" then
129
- return function (pos , intensity )
130
- check_and_blast (pos , base_name .. door_type )
131
- pos .y = pos .y - 1
132
- check_and_blast (pos , base_name .. other_door_type )
133
- end
122
+ return function (pos , intensity )
123
+ check_and_blast (pos , base_name .. door_type )
124
+ pos .y = pos .y + dir
125
+ check_and_blast (pos , base_name .. other_door_type )
134
126
end
135
127
end
136
128
end
@@ -201,7 +193,7 @@ function doors.register_door(name, def)
201
193
can_dig = check_player_priv ,
202
194
sounds = def .sounds ,
203
195
sunlight_propagates = def .sunlight ,
204
- on_blast = make_on_blast (name , " _b_1" , " _t_1" )
196
+ on_blast = make_on_blast (name , 1 , " _b_1" , " _t_1" )
205
197
})
206
198
207
199
minetest .register_node (name .. " _t_1" , {
@@ -234,7 +226,7 @@ function doors.register_door(name, def)
234
226
can_dig = check_player_priv ,
235
227
sounds = def .sounds ,
236
228
sunlight_propagates = def .sunlight ,
237
- on_blast = make_on_blast (name , " _t_1" , " _b_1" )
229
+ on_blast = make_on_blast (name , - 1 , " _t_1" , " _b_1" )
238
230
})
239
231
240
232
minetest .register_node (name .. " _b_2" , {
@@ -267,7 +259,7 @@ function doors.register_door(name, def)
267
259
can_dig = check_player_priv ,
268
260
sounds = def .sounds ,
269
261
sunlight_propagates = def .sunlight ,
270
- on_blast = make_on_blast (name , " _b_2" , " _t_2" )
262
+ on_blast = make_on_blast (name , 1 , " _b_2" , " _t_2" )
271
263
})
272
264
273
265
minetest .register_node (name .. " _t_2" , {
@@ -300,7 +292,7 @@ function doors.register_door(name, def)
300
292
can_dig = check_player_priv ,
301
293
sounds = def .sounds ,
302
294
sunlight_propagates = def .sunlight ,
303
- on_blast = make_on_blast (name , " _t_2" , " _b_2" )
295
+ on_blast = make_on_blast (name , - 1 , " _t_2" , " _b_2" )
304
296
})
305
297
306
298
end
0 commit comments