From 99a222027a28767afc7d638b5e07a796071a7a4d Mon Sep 17 00:00:00 2001 From: FileEX Date: Wed, 1 May 2024 18:17:17 +0200 Subject: [PATCH] Added isObjectMoving to server side --- .../deathmatch/logic/CStaticFunctionDefinitions.cpp | 11 +++++++++++ .../deathmatch/logic/CStaticFunctionDefinitions.h | 1 + .../mods/deathmatch/logic/luadefs/CLuaObjectDefs.cpp | 7 +++++++ Server/mods/deathmatch/logic/luadefs/CLuaObjectDefs.h | 1 + 4 files changed, 20 insertions(+) diff --git a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp index 0542dce5fd..6c01962247 100644 --- a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp +++ b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp @@ -8155,6 +8155,17 @@ bool CStaticFunctionDefinitions::SetObjectScale(CElement* pElement, const CVecto return false; } +bool CStaticFunctionDefinitions::IsObjectMoving(CElement* pElement) +{ + if (IS_OBJECT(pElement)) + { + CObject* pObject = static_cast(pElement); + return pObject->IsMoving(); + } + + return false; +} + bool CStaticFunctionDefinitions::MoveObject(CResource* pResource, CElement* pElement, unsigned long ulTime, const CVector& vecPosition, const CVector& vecRotation, CEasingCurve::eType a_easingType, double a_fEasingPeriod, double a_fEasingAmplitude, double a_fEasingOvershoot) diff --git a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.h b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.h index fe9d20ebf8..5ed0a37c55 100644 --- a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.h +++ b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.h @@ -412,6 +412,7 @@ class CStaticFunctionDefinitions static bool GetObjectRotation(CObject* pObject, CVector& vecRotation); static bool IsObjectVisibleInAllDimensions(CElement* pElement); static bool IsObjectBreakable(CElement* pElement); + static bool IsObjectMoving(CElement* pElement); // Object set functions static bool SetObjectRotation(CElement* pElement, const CVector& vecRotation); diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaObjectDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaObjectDefs.cpp index 948ed90a0d..db006f7624 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaObjectDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaObjectDefs.cpp @@ -24,6 +24,7 @@ void CLuaObjectDefs::LoadFunctions() {"getObjectRotation", GetObjectRotation}, {"getObjectScale", GetObjectScale}, {"isObjectBreakable", ArgumentParser}, + {"isObjectMoving", ArgumentParser}, // Object set funcs {"setObjectRotation", SetObjectRotation}, @@ -50,6 +51,7 @@ void CLuaObjectDefs::AddClass(lua_State* luaVM) lua_classfunction(luaVM, "setScale", "setObjectScale"); lua_classfunction(luaVM, "isBreakable", "isObjectBreakable"); lua_classfunction(luaVM, "setBreakable", "setObjectBreakable"); + lua_classfunction(luaVM, "isMoving", "isObjectMoving"); lua_classvariable(luaVM, "scale", "setObjectScale", "getObjectScale"); lua_classvariable(luaVM, "breakable", "setObjectBreakable", "isObjectBreakable"); @@ -222,6 +224,11 @@ int CLuaObjectDefs::SetObjectScale(lua_State* luaVM) return 1; } +bool CLuaObjectDefs::IsObjectMoving(CObject* const pObject) +{ + return pObject->IsMoving(); +} + int CLuaObjectDefs::MoveObject(lua_State* luaVM) { // bool moveObject ( object theObject, int time, diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaObjectDefs.h b/Server/mods/deathmatch/logic/luadefs/CLuaObjectDefs.h index ac4be795d0..bef8a4af45 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaObjectDefs.h +++ b/Server/mods/deathmatch/logic/luadefs/CLuaObjectDefs.h @@ -26,6 +26,7 @@ class CLuaObjectDefs : public CLuaDefs LUA_DECLARE(GetObjectRotation); LUA_DECLARE(GetObjectScale); static bool IsObjectBreakable(CObject* const pObject); + static bool IsObjectMoving(CObject* const pObject); // Object set functions LUA_DECLARE(SetObjectName);