From a80063cf7b181920931cbfa6c51d85bd97d2b763 Mon Sep 17 00:00:00 2001 From: Mr-Auto <36127424+Mr-Auto@users.noreply.github.com> Date: Mon, 1 Jul 2024 18:32:59 +0200 Subject: [PATCH 01/12] fix issue with returning self reference not counting as lua owned object --- src/game_api/math.hpp | 5 ++- src/game_api/script/sol_helper.hpp | 39 +++++++++++++++++ src/game_api/script/usertypes/hitbox_lua.cpp | 45 +++++++++++--------- 3 files changed, 68 insertions(+), 21 deletions(-) diff --git a/src/game_api/math.hpp b/src/game_api/math.hpp index 7cf3593ec..bd2a400d5 100644 --- a/src/game_api/math.hpp +++ b/src/game_api/math.hpp @@ -442,7 +442,10 @@ struct Quad result.bottom = std::min({bottom_left_y, bottom_right_y, top_right_y, top_left_y}); return result; } - + Quad& offset(const Vec2& vec) + { + return offset(vec.x, vec.y); + } Quad& offset(float off_x, float off_y) { bottom_left_x += off_x; diff --git a/src/game_api/script/sol_helper.hpp b/src/game_api/script/sol_helper.hpp index d50334f27..668d4b158 100644 --- a/src/game_api/script/sol_helper.hpp +++ b/src/game_api/script/sol_helper.hpp @@ -93,3 +93,42 @@ struct usertype_container> } }; } // namespace sol + +namespace detail +{ +template +struct extract; +template +struct extract +{ + using BaseType = C; + using ReturnType = R; + using Params = std::tuple; +}; +} // namespace detail + +namespace +{ +template +struct proFunc; + +template