Skip to content

Commit

Permalink
Add isObjectMoving to server side (multitheftauto#3378)
Browse files Browse the repository at this point in the history
* Added isObjectMoving to server side

* Remove unnecessary definition

* Add missing OOP variable

* Change NULL to nullptr
  • Loading branch information
FileEX authored May 23, 2024
1 parent 12c50ee commit 7c939ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Server/mods/deathmatch/logic/luadefs/CLuaObjectDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ void CLuaObjectDefs::LoadFunctions()
{"getObjectRotation", GetObjectRotation},
{"getObjectScale", GetObjectScale},
{"isObjectBreakable", ArgumentParser<IsObjectBreakable>},
{"isObjectMoving", ArgumentParser<IsObjectMoving>},

// Object set funcs
{"setObjectRotation", SetObjectRotation},
Expand All @@ -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");
}
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions Server/mods/deathmatch/logic/luadefs/CLuaObjectDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7c939ad

Please sign in to comment.