From 13201c0b986285f0cefec4c598ff25b633566193 Mon Sep 17 00:00:00 2001 From: rudzik8 Date: Wed, 23 Feb 2022 11:53:52 +0700 Subject: [PATCH] Add early implementation of sitting by right-click currently uses function from homedecor_seating/armchairs.lua... need to work on it --- api.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/api.lua b/api.lua index 8859a84..f244536 100644 --- a/api.lua +++ b/api.lua @@ -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