@@ -25,11 +25,11 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
25
25
if pointed_thing .type ~= " node" then
26
26
return itemstack
27
27
end
28
-
28
+
29
29
local p0 = pointed_thing .under
30
30
local p1 = pointed_thing .above
31
31
local param2 = 0
32
-
32
+
33
33
local placer_pos = placer :getpos ()
34
34
if placer_pos then
35
35
local dir = {
@@ -39,7 +39,7 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
39
39
}
40
40
param2 = minetest .dir_to_facedir (dir )
41
41
end
42
-
42
+
43
43
if p0 .y - 1 == p1 .y then
44
44
param2 = param2 + 20
45
45
if param2 == 21 then
@@ -48,11 +48,11 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
48
48
param2 = 21
49
49
end
50
50
end
51
-
51
+
52
52
return minetest .item_place (itemstack , placer , pointed_thing , param2 )
53
53
end ,
54
54
})
55
-
55
+
56
56
-- for replace ABM
57
57
minetest .register_node (" :stairs:stair_" .. subname .. " upside_down" , {
58
58
replace_name = " stairs:stair_" .. subname ,
@@ -108,10 +108,10 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
108
108
local n0 = minetest .get_node (p0 )
109
109
local n1 = minetest .get_node (p1 )
110
110
local param2 = 0
111
-
111
+
112
112
local n0_is_upside_down = (n0 .name == " stairs:slab_" .. subname and
113
113
n0 .param2 >= 20 )
114
-
114
+
115
115
if n0 .name == " stairs:slab_" .. subname and not n0_is_upside_down and p0 .y + 1 == p1 .y then
116
116
slabpos = p0
117
117
slabnode = n0
@@ -125,7 +125,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
125
125
-- Make a fake stack of a single item and try to place it
126
126
local fakestack = ItemStack (recipeitem )
127
127
fakestack :set_count (itemstack :get_count ())
128
-
128
+
129
129
pointed_thing .above = slabpos
130
130
local success
131
131
fakestack , success = minetest .item_place (fakestack , placer , pointed_thing )
@@ -148,7 +148,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
148
148
-- Make a fake stack of a single item and try to place it
149
149
local fakestack = ItemStack (recipeitem )
150
150
fakestack :set_count (itemstack :get_count ())
151
-
151
+
152
152
pointed_thing .above = p0
153
153
local success
154
154
fakestack , success = minetest .item_place (fakestack , placer , pointed_thing )
@@ -161,20 +161,20 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
161
161
end
162
162
return itemstack
163
163
end
164
-
164
+
165
165
-- Place upside down slab
166
166
param2 = 20
167
167
end
168
-
168
+
169
169
-- If pointing at the side of a upside down slab
170
170
if n0_is_upside_down and p0 .y + 1 ~= p1 .y then
171
171
param2 = 20
172
172
end
173
-
173
+
174
174
return minetest .item_place (itemstack , placer , pointed_thing , param2 )
175
175
end ,
176
176
})
177
-
177
+
178
178
-- for replace ABM
179
179
minetest .register_node (" :stairs:slab_" .. subname .. " upside_down" , {
180
180
replace_name = " stairs:slab_" .. subname ,
0 commit comments