Skip to content
Closed
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 Server/mods/deathmatch/logic/CGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1548,6 +1548,8 @@ void CGame::AddBuiltInEvents()
m_Events.AddEvent("onPlayerVoiceStop", "", NULL, false);

// Object events
m_Events.AddEvent("onObjectMoveStart", "", nullptr, false);
m_Events.AddEvent("onObjectMoveStop", "", nullptr, false);

// Pickup events
m_Events.AddEvent("onPickupHit", "player", NULL, false);
Expand Down
8 changes: 8 additions & 0 deletions Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8202,6 +8202,10 @@ bool CStaticFunctionDefinitions::MoveObject(CResource* pResource, CElement* pEle
moveAnimation.SetEasing(a_easingType, a_fEasingPeriod, a_fEasingAmplitude, a_fEasingOvershoot);
moveAnimation.SetDuration(ulTime);

CLuaArguments Arguments;
if (!pObject->CallEvent("onObjectMoveStart", Arguments)) // Call Event
return false; // Event cancelled, return false

// Start moving it here so we can keep track of the position/rotation
pObject->Move(moveAnimation);

Expand Down Expand Up @@ -8229,6 +8233,10 @@ bool CStaticFunctionDefinitions::StopObject(CElement* pElement)
{
CObject* pObject = static_cast<CObject*>(pElement);

CLuaArguments Arguments;
if (!pObject->CallEvent("onObjectMoveStop", Arguments))
return false; // Event cancelled, return false

pObject->StopMoving();

// Grab the source position and rotation
Expand Down