fix mergeconflicts

This commit is contained in:
Milan* 2017-05-22 09:30:22 +02:00
commit 9052d3ae14
98 changed files with 2574 additions and 582 deletions

View file

@ -20,6 +20,30 @@ minetest.register_alias("moretrees:slab_acacia_planks", "stairs:slab_acacia_wood
local replace = minetest.setting_getbool("enable_stairs_replace_abm")
local function rotate_and_place(itemstack, placer, pointed_thing)
local p0 = pointed_thing.under
local p1 = pointed_thing.above
local param2 = 0
local placer_pos = placer:getpos()
if placer_pos then
param2 = minetest.dir_to_facedir(vector.subtract(p1, placer_pos))
end
local finepos = minetest.pointed_thing_to_face_pos(placer, pointed_thing)
local fpos = finepos.y % 1
if p0.y - 1 == p1.y or (fpos > 0 and fpos < 0.5)
or (fpos < -0.5 and fpos > -0.999999999) then
param2 = param2 + 20
if param2 == 21 then
param2 = 23
elseif param2 == 23 then
param2 = 21
end
end
return minetest.item_place(itemstack, placer, pointed_thing, param2)
end
-- Register stairs.
-- Node will be called stairs:stair_<subname>
@ -55,30 +79,7 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
return itemstack
end
local p0 = pointed_thing.under
local p1 = pointed_thing.above
local param2 = 0
local placer_pos = placer:getpos()
if placer_pos then
local dir = {
x = p1.x - placer_pos.x,
y = p1.y - placer_pos.y,
z = p1.z - placer_pos.z
}
param2 = minetest.dir_to_facedir(dir)
end
if p0.y - 1 == p1.y then
param2 = param2 + 20
if param2 == 21 then
param2 = 23
elseif param2 == 23 then
param2 = 21
end
end
return minetest.item_place(itemstack, placer, pointed_thing, param2)
return rotate_and_place(itemstack, placer, pointed_thing)
end,
})
@ -129,8 +130,6 @@ end
-- Slab facedir to placement 6d matching table
local slab_trans_dir = {[0] = 8, 0, 2, 1, 3, 4}
-- Slab facedir when placing initial slab against other surface
local slab_trans_dir_place = {[0] = 0, 20, 12, 16, 4, 8}
-- Register slabs.
-- Node will be called stairs:slab_<subname>
@ -153,8 +152,10 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
on_place = function(itemstack, placer, pointed_thing)
local under = minetest.get_node(pointed_thing.under)
local wield_item = itemstack:get_name()
local creative_enabled = (creative and creative.is_enabled_for
and creative.is_enabled_for(placer:get_player_name()))
if under and wield_item == under.name then
if under and under.name:find("stairs:slab_") then
-- place slab using under node orientation
local dir = minetest.dir_to_facedir(vector.subtract(
pointed_thing.above, pointed_thing.under), true)
@ -162,7 +163,9 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
local p2 = under.param2
-- combine two slabs if possible
if slab_trans_dir[math.floor(p2 / 4)] == dir then
if slab_trans_dir[math.floor(p2 / 4)] == dir
and wield_item == under.name then
if not recipeitem then
return itemstack
end
@ -174,7 +177,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
return
end
minetest.set_node(pointed_thing.under, {name = recipeitem, param2 = p2})
if not minetest.setting_getbool("creative_mode") then
if not creative_enabled then
itemstack:take_item()
end
return itemstack
@ -190,21 +193,12 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
-- else attempt to place node with proper param2
minetest.item_place_node(ItemStack(wield_item), placer, pointed_thing, p2)
if not minetest.setting_getbool("creative_mode") then
if not creative_enabled then
itemstack:take_item()
end
return itemstack
else
-- place slab using look direction of player
local dir = minetest.dir_to_wallmounted(vector.subtract(
pointed_thing.above, pointed_thing.under), true)
local rot = slab_trans_dir_place[dir]
if rot == 0 or rot == 20 then
rot = rot + minetest.dir_to_facedir(placer:get_look_dir())
end
return minetest.item_place(itemstack, placer, pointed_thing, rot)
return rotate_and_place(itemstack, placer, pointed_thing)
end
end,
})
@ -596,3 +590,27 @@ stairs.register_stair_and_slab(
"Gold Block Slab",
default.node_sound_metal_defaults()
)
stairs.register_stair_and_slab(
"ice",
"default:ice",
{cracky = 3, puts_out_fire = 1, cools_lava = 1},
{"default_ice.png"},
"Ice Stair",
"Ice Slab",
default.node_sound_glass_defaults()
)
stairs.register_stair_and_slab(
"snowblock",
"default:snowblock",
{crumbly = 3, puts_out_fire = 1, cools_lava = 1, snowy = 1},
{"default_snow.png"},
"Snow Block Stair",
"Snow Block Slab",
default.node_sound_dirt_defaults({
footstep = {name = "default_snow_footstep", gain = 0.15},
dug = {name = "default_snow_footstep", gain = 0.2},
dig = {name = "default_snow_footstep", gain = 0.2}
})
)