From ecf3b94d5375d6207492b86d10b1d42e1fd7c570 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sun, 27 Jul 2025 22:30:30 +0300 Subject: [PATCH] add hud.hand_controller --- doc/en/scripting/builtins/libhud.md | 3 +++ doc/ru/scripting/builtins/libhud.md | 3 +++ res/scripts/hud.lua | 8 ++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/en/scripting/builtins/libhud.md b/doc/en/scripting/builtins/libhud.md index 06766422..58d78302 100644 --- a/doc/en/scripting/builtins/libhud.md +++ b/doc/en/scripting/builtins/libhud.md @@ -65,4 +65,7 @@ hud.is_inventory_open() -> bool -- Sets whether to allow pausing. If false, the pause menu will not pause the game. hud.set_allow_pause(flag: bool) + +-- Function that controls the named skeleton 'hand' (see gfx.skeletons) +hud.hand_controller: function() ``` diff --git a/doc/ru/scripting/builtins/libhud.md b/doc/ru/scripting/builtins/libhud.md index 311542cb..5f0856b3 100644 --- a/doc/ru/scripting/builtins/libhud.md +++ b/doc/ru/scripting/builtins/libhud.md @@ -68,4 +68,7 @@ hud.is_inventory_open() -> bool -- Устанавливает разрешение на паузу. При значении false меню паузы не приостанавливает игру. hud.set_allow_pause(flag: bool) + +-- Функция, управляющая именованным скелетом 'hand' (см. gfx.skeletons) +hud.hand_controller: function() ``` diff --git a/res/scripts/hud.lua b/res/scripts/hud.lua index e189d098..abd1eaf4 100644 --- a/res/scripts/hud.lua +++ b/res/scripts/hud.lua @@ -83,7 +83,7 @@ function on_hud_open() configure_SSAO() end -function update_hand() +local function update_hand() local skeleton = gfx.skeletons local pid = hud.get_player() local invid, slot = player.get_inventory(pid) @@ -117,5 +117,9 @@ function update_hand() end function on_hud_render() - timeit(1, update_hand) + if hud.hand_controller then + hud.hand_controller() + else + update_hand() + end end