Add early implementation of sitting by right-click

currently uses function from homedecor_seating/armchairs.lua... need to work on it
This commit is contained in:
Mikita Wiśniewski 2022-02-23 11:53:52 +07:00
parent 525d1f37c3
commit 13201c0b98
1 changed files with 10 additions and 1 deletions

11
api.lua
View File

@ -33,7 +33,16 @@ function mcl_decor:register_chair(name, def)
_mcl_hardness = def._mcl_hardness,
_mcl_blast_resistance = def._mcl_blast_resistance,
sounds = def.sounds,
-- TODO: make player sit on the chair by rightclick (maybe via homedecor funcs?)
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
if not clicker:is_player() then
return itemstack
end
mcl_player.player_set_animation(clicker, "sit_mount", 30)
pos.y = pos.y-0.5
clicker:setpos(pos)
clicker:set_hp(20)
return itemstack
end
})
end