Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #3310: Improved client-side markers & Fix logic #3324

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
5 changes: 4 additions & 1 deletion Client/mods/deathmatch/logic/CClientGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2729,7 +2729,10 @@ void CClientGame::AddBuiltInEvents()
m_Events.AddEvent("onClientMarkerHit", "entity, matchingDimension", NULL, false);
m_Events.AddEvent("onClientMarkerLeave", "entity, matchingDimension", NULL, false);

// Marker events
m_Events.AddEvent("onClientPlayerMarkerHit", "marker, matchingDimension", NULL, false);
m_Events.AddEvent("onClientPlayerMarkerLeave", "marker, matchingDimension", NULL, false);
Nico8340 marked this conversation as resolved.
Show resolved Hide resolved

// Pickup events
m_Events.AddEvent("onClientPickupHit", "entity, matchingDimension", NULL, false);
m_Events.AddEvent("onClientPickupLeave", "entity, matchingDimension", NULL, false);

Expand Down
28 changes: 22 additions & 6 deletions Client/mods/deathmatch/logic/CClientMarker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,25 +412,41 @@ void CClientMarker::StreamOut()

void CClientMarker::Callback_OnCollision(CClientColShape& Shape, CClientEntity& Entity)
{
if (IS_PLAYER(&Entity))
if (GetInterior() == Entity.GetInterior())
{
// Call the marker hit event
CLuaArguments Arguments;
Arguments.PushElement(&Entity); // player that hit it
Arguments.PushBoolean((GetDimension() == Entity.GetDimension())); // matching dimension?
Arguments.PushElement(&Entity); // Hit element
Arguments.PushBoolean(GetDimension() == Entity.GetDimension()); // Matching dimension?
CallEvent("onClientMarkerHit", Arguments, true);

if (IS_PLAYER(&Entity))
{
CLuaArguments Arguments2;
Arguments2.PushElement(this); // marker
Arguments2.PushBoolean(GetDimension() == Entity.GetDimension()); // Matching dimension?
Entity.CallEvent("onClientPlayerMarkerHit", Arguments2, false);
}
Nico8340 marked this conversation as resolved.
Show resolved Hide resolved
}
}

void CClientMarker::Callback_OnLeave(CClientColShape& Shape, CClientEntity& Entity)
{
if (IS_PLAYER(&Entity))
if (GetInterior() == Entity.GetInterior())
{
// Call the marker hit event
CLuaArguments Arguments;
Arguments.PushElement(&Entity); // player that hit it
Arguments.PushBoolean((GetDimension() == Entity.GetDimension())); // matching dimension?
Arguments.PushElement(&Entity); // Hit element
Arguments.PushBoolean(GetDimension() == Entity.GetDimension()); // Matching dimension?
CallEvent("onClientMarkerLeave", Arguments, true);

if (IS_PLAYER(&Entity))
{
CLuaArguments Arguments2;
Arguments2.PushElement(this); // marker
Arguments2.PushBoolean(GetDimension() == Entity.GetDimension()); // Matching dimension?
Entity.CallEvent("onPlayerMarkerLeave", Arguments2, false);
}
Nico8340 marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
Loading