From 7c939adb892c08836462a78cd9b987884cdb49ee Mon Sep 17 00:00:00 2001 From: FileEX Date: Thu, 23 May 2024 19:34:07 +0200 Subject: [PATCH] Add isObjectMoving to server side (#3378) * Added isObjectMoving to server side * Remove unnecessary definition * Add missing OOP variable * Change NULL to nullptr --- Server/mods/deathmatch/logic/luadefs/CLuaObjectDefs.cpp | 8 ++++++++ Server/mods/deathmatch/logic/luadefs/CLuaObjectDefs.h | 1 + 2 files changed, 9 insertions(+) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaObjectDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaObjectDefs.cpp index 948ed90a0d..e07f5c7655 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,9 +51,11 @@ 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"); + lua_classvariable(luaVM, "moving", nullptr, "isObjectMoving"); lua_registerclass(luaVM, "Object", "Element"); } @@ -222,6 +225,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);