Skip to content

Commit 15bdd6d

Browse files
authored
Fixes #551 - onMarkerHit on attached elements (#4571)
Enhance marker handling on element attachment and detachment
1 parent 9997876 commit 15bdd6d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,6 +1628,18 @@ bool CStaticFunctionDefinitions::AttachElements(CElement* pElement, CElement* pA
16281628
pElement->SetAttachedOffsets(vecPosition, vecRotation);
16291629
pElement->AttachTo(pAttachedToElement);
16301630

1631+
if (IS_MARKER(pElement))
1632+
{
1633+
CMarker* pMarker = static_cast<CMarker*>(pElement);
1634+
CVector attachedPosition;
1635+
pMarker->GetAttachedPosition(attachedPosition);
1636+
pMarker->SetPosition(attachedPosition);
1637+
1638+
CColShape* pColShape = pMarker->GetColShape();
1639+
if (pColShape)
1640+
RefreshColShapeColliders(pColShape);
1641+
}
1642+
16311643
CBitStream BitStream;
16321644
BitStream.pBitStream->Write(pAttachedToElement->GetID());
16331645
BitStream.pBitStream->Write(vecPosition.fX);
@@ -1676,6 +1688,14 @@ bool CStaticFunctionDefinitions::DetachElements(CElement* pElement, CElement* pA
16761688
pElement->AttachTo(NULL);
16771689
pElement->GenerateSyncTimeContext();
16781690

1691+
if (IS_MARKER(pElement))
1692+
{
1693+
CMarker* pMarker = static_cast<CMarker*>(pElement);
1694+
CColShape* pColShape = pMarker->GetColShape();
1695+
if (pColShape)
1696+
RefreshColShapeColliders(pColShape);
1697+
}
1698+
16791699
CBitStream BitStream;
16801700
BitStream.pBitStream->Write(pElement->GetSyncTimeContext());
16811701
BitStream.pBitStream->Write(vecPosition.fX);

0 commit comments

Comments
 (0)