Make a big cushion in combining 2 cushion slabs with sneak + right-click
This commit is contained in:
parent
fa0544f134
commit
18dd8582be
@ -172,6 +172,12 @@ xdecor.register("crate", {
|
||||
sounds = default.node_sound_wood_defaults()
|
||||
})
|
||||
|
||||
xdecor.register("cushion_block", {
|
||||
tiles = {"xdecor_cushion.png"},
|
||||
groups = {snappy=3, flammable=3, fall_damage_add_percent=-75, not_in_creative_inventory=1},
|
||||
drop = "xdecor:cushion 2"
|
||||
})
|
||||
|
||||
local function door_access(door)
|
||||
return door:find("prison")
|
||||
end
|
||||
|
16
sitting.lua
16
sitting.lua
@ -82,9 +82,23 @@ xdecor.register("cushion", {
|
||||
on_place = minetest.rotate_node,
|
||||
node_box = xdecor.nodebox.slab_y(0.5),
|
||||
can_dig = dig,
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
pos.y = pos.y + 0
|
||||
sit(pos, node, clicker)
|
||||
|
||||
local wield_item = clicker:get_wielded_item():get_name()
|
||||
if wield_item == "xdecor:cushion" and clicker:get_player_control().sneak then
|
||||
local player_name = clicker:get_player_name()
|
||||
if minetest.is_protected(pos, player_name) then
|
||||
minetest.record_protection_violation(pos, player_name)
|
||||
return
|
||||
end
|
||||
minetest.set_node(pos, {name="xdecor:cushion_block", param2=node.param2})
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user