Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Client/mods/deathmatch/logic/CClientGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2598,6 +2598,8 @@ void CClientGame::AddBuiltInEvents()
// Object events
m_Events.AddEvent("onClientObjectDamage", "loss, attacker", NULL, false);
m_Events.AddEvent("onClientObjectBreak", "attacker", NULL, false);
m_Events.AddEvent("onClientObjectMoveStart", "", NULL, false);
m_Events.AddEvent("onClientObjectMoveStop", "", NULL, false);

// Web events
m_Events.AddEvent("onClientBrowserWhitelistChange", "newPages", NULL, false);
Expand Down
4 changes: 4 additions & 0 deletions Client/mods/deathmatch/logic/CDeathmatchObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ void CDeathmatchObject::StartMovement(const CPositionRotationAnimation& a_rMoveA
a_rMoveAnimation.GetFinalValue(positionRotation);
SetOrientation(positionRotation.m_vecPosition, positionRotation.m_vecRotation);
}
CLuaArguments Arguments;
this->CallEvent("onClientObjectMoveStart", Arguments, true);
}

void CDeathmatchObject::StopMovement()
Expand All @@ -86,6 +88,8 @@ void CDeathmatchObject::_StopMovement(bool a_bUnregister)
}
delete m_pMoveAnimation;
m_pMoveAnimation = NULL;
CLuaArguments Arguments;
this->CallEvent("onClientObjectMoveStop", Arguments, true);
}
}

Expand Down
6 changes: 6 additions & 0 deletions Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3865,6 +3865,12 @@ bool CStaticFunctionDefinitions::IsObjectBreakable(CClientObject& Object, bool&
return true;
}

bool CStaticFunctionDefinitions::IsObjectMoving(CClientEntity& Entity)
{
CDeathmatchObject& Object = static_cast<CDeathmatchObject&>(Entity);
return Object.IsMoving();
}

bool CStaticFunctionDefinitions::GetObjectMass(CClientObject& Object, float& fMass)
{
fMass = Object.GetMass();
Expand Down
1 change: 1 addition & 0 deletions Client/mods/deathmatch/logic/CStaticFunctionDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ class CStaticFunctionDefinitions
static CClientObject* CreateObject(CResource& Resource, unsigned short usModelID, const CVector& vecPosition, const CVector& vecRotation, bool bLowLod);
static bool GetObjectScale(CClientObject& Object, CVector& vecScale);
static bool IsObjectBreakable(CClientObject& Object, bool& bBreakable);
static bool IsObjectMoving(CClientEntity& Entity);
static bool GetObjectMass(CClientObject& Object, float& fMass);
static bool GetObjectTurnMass(CClientObject& Object, float& fTurnMass);
static bool GetObjectAirResistance(CClientObject& Object, float& fAirResistance);
Expand Down
9 changes: 9 additions & 0 deletions Client/mods/deathmatch/logic/luadefs/CLuaObjectDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*****************************************************************************/

#include "StdInc.h"
#include <lua/CLuaFunctionParser.h>

void CLuaObjectDefs::LoadFunctions()
{
Expand All @@ -23,6 +24,7 @@ void CLuaObjectDefs::LoadFunctions()
{"isObjectBreakable", IsObjectBreakable},
{"getObjectMass", GetObjectMass},
{"getObjectProperty", GetObjectProperty},
{"isObjectMoving", ArgumentParser<IsObjectMoving>},

// Object set funcs
{"moveObject", MoveObject},
Expand Down Expand Up @@ -58,12 +60,14 @@ void CLuaObjectDefs::AddClass(lua_State* luaVM)
lua_classfunction(luaVM, "getMass", "getObjectMass");
lua_classfunction(luaVM, "getProperties", GetObjectProperties);
lua_classfunction(luaVM, "getProperty", "getObjectProperty");
lua_classfunction(luaVM, "isMoving", "isObjectMoving");

lua_classfunction(luaVM, "setScale", "setObjectScale");
lua_classfunction(luaVM, "setBreakable", "setObjectBreakable");
lua_classfunction(luaVM, "setMass", "setObjectMass");
lua_classfunction(luaVM, "setProperty", "setObjectProperty");

lua_classvariable(luaVM, "moving", nullptr, "isObjectMoving");
lua_classvariable(luaVM, "scale", "setObjectScale", "getObjectScale");
lua_classvariable(luaVM, "breakable", "setObjectBreakable", "isObjectBreakable");
lua_classvariable(luaVM, "mass", "setObjectMass", "getObjectMass");
Expand Down Expand Up @@ -209,6 +213,11 @@ int CLuaObjectDefs::IsObjectBreakable(lua_State* luaVM)
return 1;
}

bool CLuaObjectDefs::IsObjectMoving(CClientEntity* pEntity)
{
return CStaticFunctionDefinitions::IsObjectMoving(*pEntity);
}

int CLuaObjectDefs::GetObjectMass(lua_State* luaVM)
{
// float getObjectMass ( object theObject )
Expand Down
1 change: 1 addition & 0 deletions Client/mods/deathmatch/logic/luadefs/CLuaObjectDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class CLuaObjectDefs : public CLuaDefs

// Object get funcs
LUA_DECLARE(IsObjectStatic);
static bool IsObjectMoving(CClientEntity* pEntity);
LUA_DECLARE(GetObjectScale);
LUA_DECLARE(IsObjectBreakable);
LUA_DECLARE(GetObjectMass);
Expand Down