From 2b17362dff183e4a577821cc58fe1995094500de Mon Sep 17 00:00:00 2001 From: justn <39979049+jvstns@users.noreply.github.com> Date: Tue, 27 Aug 2024 05:51:15 -0400 Subject: [PATCH 1/8] Add SetPaused to timer class --- Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp b/Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp index bd0383222b..63d9b50176 100644 --- a/Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp +++ b/Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp @@ -91,5 +91,9 @@ CTickCount CLuaTimer::GetTimeLeft() CTickCount llCurrentTime = CTickCount::Now(); CTickCount llTimeLeft = m_llStartTime + m_llDelay - llCurrentTime; + + if (IsPaused()) + return m_llPausedRemainingTime; + return llTimeLeft.ToLongLong() < 0LL ? CTickCount(0LL) : llTimeLeft; } From 06f2afd6dc8caab41ad72f9ec52a99c9874d765b Mon Sep 17 00:00:00 2001 From: justn <39979049+jvstns@users.noreply.github.com> Date: Tue, 27 Aug 2024 06:11:34 -0400 Subject: [PATCH 2/8] Add new timer function defs - pauseTimer - isTimerPaused --- Server/mods/deathmatch/logic/luadefs/CLuaTimerDefs.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaTimerDefs.h b/Server/mods/deathmatch/logic/luadefs/CLuaTimerDefs.h index abf1b725d6..7499d07579 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaTimerDefs.h +++ b/Server/mods/deathmatch/logic/luadefs/CLuaTimerDefs.h @@ -20,6 +20,8 @@ class CLuaTimerDefs : public CLuaDefs LUA_DECLARE(SetTimer); LUA_DECLARE(KillTimer); + LUA_DECLARE(IsTimerPaused); + LUA_DECLARE(PauseTimer); LUA_DECLARE(ResetTimer); LUA_DECLARE(GetTimers); LUA_DECLARE(IsTimer); From 4bcf4af5b348b1224d8de699bb33d31e35cb5f8e Mon Sep 17 00:00:00 2001 From: justn <39979049+jvstns@users.noreply.github.com> Date: Tue, 27 Aug 2024 06:18:30 -0400 Subject: [PATCH 3/8] Add new timer function defs --- Client/mods/deathmatch/logic/luadefs/CLuaTimerDefs.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaTimerDefs.h b/Client/mods/deathmatch/logic/luadefs/CLuaTimerDefs.h index db6cac48a9..5c7e32c14b 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaTimerDefs.h +++ b/Client/mods/deathmatch/logic/luadefs/CLuaTimerDefs.h @@ -20,6 +20,8 @@ class CLuaTimerDefs : public CLuaDefs LUA_DECLARE(SetTimer); LUA_DECLARE(KillTimer); + LUA_DECLARE(IsTimerPaused); + LUA_DECLARE(PauseTimer); LUA_DECLARE(ResetTimer); LUA_DECLARE(GetTimers); LUA_DECLARE(IsTimer); From cf73137b83854161068f2e0fe0354fb7234ed7c4 Mon Sep 17 00:00:00 2001 From: justns <39979049+jvstns@users.noreply.github.com> Date: Tue, 27 Aug 2024 11:53:15 -0400 Subject: [PATCH 4/8] A few minor adjustments --- Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp b/Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp index 63d9b50176..bd0383222b 100644 --- a/Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp +++ b/Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp @@ -91,9 +91,5 @@ CTickCount CLuaTimer::GetTimeLeft() CTickCount llCurrentTime = CTickCount::Now(); CTickCount llTimeLeft = m_llStartTime + m_llDelay - llCurrentTime; - - if (IsPaused()) - return m_llPausedRemainingTime; - return llTimeLeft.ToLongLong() < 0LL ? CTickCount(0LL) : llTimeLeft; } From bc0b60ad0a093f9b1cf75865a489f2ba34e1bd0a Mon Sep 17 00:00:00 2001 From: justns <39979049+jvstns@users.noreply.github.com> Date: Tue, 27 Aug 2024 11:56:29 -0400 Subject: [PATCH 5/8] Update to ArgumentParser --- Server/mods/deathmatch/logic/luadefs/CLuaTimerDefs.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaTimerDefs.h b/Server/mods/deathmatch/logic/luadefs/CLuaTimerDefs.h index 7499d07579..abf1b725d6 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaTimerDefs.h +++ b/Server/mods/deathmatch/logic/luadefs/CLuaTimerDefs.h @@ -20,8 +20,6 @@ class CLuaTimerDefs : public CLuaDefs LUA_DECLARE(SetTimer); LUA_DECLARE(KillTimer); - LUA_DECLARE(IsTimerPaused); - LUA_DECLARE(PauseTimer); LUA_DECLARE(ResetTimer); LUA_DECLARE(GetTimers); LUA_DECLARE(IsTimer); From fc287ac8e0bba2ec170962dce8efa404d1e7f84b Mon Sep 17 00:00:00 2001 From: justns <39979049+jvstns@users.noreply.github.com> Date: Tue, 27 Aug 2024 12:01:22 -0400 Subject: [PATCH 6/8] Update to ArgumentParser --- Client/mods/deathmatch/logic/luadefs/CLuaTimerDefs.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaTimerDefs.h b/Client/mods/deathmatch/logic/luadefs/CLuaTimerDefs.h index 5c7e32c14b..db6cac48a9 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaTimerDefs.h +++ b/Client/mods/deathmatch/logic/luadefs/CLuaTimerDefs.h @@ -20,8 +20,6 @@ class CLuaTimerDefs : public CLuaDefs LUA_DECLARE(SetTimer); LUA_DECLARE(KillTimer); - LUA_DECLARE(IsTimerPaused); - LUA_DECLARE(PauseTimer); LUA_DECLARE(ResetTimer); LUA_DECLARE(GetTimers); LUA_DECLARE(IsTimer); From 11d75ab4533f1b92e8439f8c7ece43cd9ab27049 Mon Sep 17 00:00:00 2001 From: TEDERIs Date: Fri, 10 Jan 2025 19:01:10 +0700 Subject: [PATCH 7/8] Fix server-side getColPolygonHeight --- Server/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.cpp | 4 ++-- Server/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.cpp index ec999c4303..49171dbc65 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.cpp @@ -805,11 +805,11 @@ int CLuaColShapeDefs::RemoveColPolygonPoint(lua_State* luaVM) return luaL_error(luaVM, argStream.GetFullErrorMessage()); } -std::tuple CLuaColShapeDefs::GetColPolygonHeight(CColPolygon* pColPolygon) +CLuaMultiReturn CLuaColShapeDefs::GetColPolygonHeight(CColPolygon* pColPolygon) { float fFloor, fCeil; pColPolygon->GetHeight(fFloor, fCeil); - return std::make_tuple(fFloor, fCeil); + return CLuaMultiReturn{fFloor, fCeil}; } bool CLuaColShapeDefs::SetColPolygonHeight(CColPolygon* pColPolygon, std::variant floor, std::variant ceil) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.h b/Server/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.h index 4d055a394d..d484efa763 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.h +++ b/Server/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.h @@ -41,6 +41,6 @@ class CLuaColShapeDefs : public CLuaDefs LUA_DECLARE(IsInsideColShape); LUA_DECLARE(GetColShapeType); - static std::tuple GetColPolygonHeight(CColPolygon* pColPolygon); - static bool SetColPolygonHeight(CColPolygon* pColPolygon, std::variant floor, std::variant ceil); + static CLuaMultiReturn GetColPolygonHeight(CColPolygon* pColPolygon); + static bool SetColPolygonHeight(CColPolygon* pColPolygon, std::variant floor, std::variant ceil); }; From 7a29cac3d6d47c1cae02383d6c65dcf8e1cab539 Mon Sep 17 00:00:00 2001 From: TEDERIs Date: Fri, 10 Jan 2025 19:02:51 +0700 Subject: [PATCH 8/8] Implicit conversion --- Server/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.cpp index 49171dbc65..fad2987803 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.cpp @@ -809,7 +809,7 @@ CLuaMultiReturn CLuaColShapeDefs::GetColPolygonHeight(CColPolygon* { float fFloor, fCeil; pColPolygon->GetHeight(fFloor, fCeil); - return CLuaMultiReturn{fFloor, fCeil}; + return {fFloor, fCeil}; } bool CLuaColShapeDefs::SetColPolygonHeight(CColPolygon* pColPolygon, std::variant floor, std::variant ceil)