From 567eec88c82a1924b526efed03dc751d80c4efa3 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sun, 27 Jul 2025 16:04:25 +0300 Subject: [PATCH] add named skeletons support --- src/logic/scripting/lua/libs/lib__skeleton.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/logic/scripting/lua/libs/lib__skeleton.cpp b/src/logic/scripting/lua/libs/lib__skeleton.cpp index 208c3483..ff4a0eba 100644 --- a/src/logic/scripting/lua/libs/lib__skeleton.cpp +++ b/src/logic/scripting/lua/libs/lib__skeleton.cpp @@ -1,6 +1,13 @@ #include "objects/rigging.hpp" #include "libentity.hpp" +#include "graphics/render/WorldRenderer.hpp" +#include "graphics/render/NamedSkeletons.hpp" + +namespace scripting { + extern WorldRenderer* renderer; +} + static int index_range_check( const rigging::Skeleton& skeleton, lua::Integer index ) { @@ -14,6 +21,9 @@ static int index_range_check( } static rigging::Skeleton* get_skeleton(lua::State* L) { + if (lua::isstring(L, 1)) { + return scripting::renderer->skeletons->getSkeleton(lua::tostring(L, 1)); + } if (auto entity = get_entity(L, 1)) { return &entity->getSkeleton(); }