mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix swapping with dragger beams and plasmas
The client ID referenced by dragger beams and plasmas must also be swapped when two clients are swapped, as those entities should refer to the same character entity as before the swap. For dragger beams, swapping previously caused the active beams to switch target to another character. For plasmas, swapping previously caused already shot plasmas to not have an effect on their original target character. Closes #5865.
This commit is contained in:
parent
89eb7e6633
commit
aa08cfabc2
|
@ -123,3 +123,8 @@ void CDraggerBeam::Snap(int SnappingClient)
|
||||||
GameServer()->SnapLaserObject(CSnapContext(SnappingClientVersion), GetID(),
|
GameServer()->SnapLaserObject(CSnapContext(SnappingClientVersion), GetID(),
|
||||||
m_Pos, TargetPos, StartTick, -1, LASERTYPE_DOOR);
|
m_Pos, TargetPos, StartTick, -1, LASERTYPE_DOOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CDraggerBeam::SwapClients(int Client1, int Client2)
|
||||||
|
{
|
||||||
|
m_ForClientID = m_ForClientID == Client1 ? Client2 : m_ForClientID == Client2 ? Client1 : m_ForClientID;
|
||||||
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ public:
|
||||||
void Reset() override;
|
void Reset() override;
|
||||||
void Tick() override;
|
void Tick() override;
|
||||||
void Snap(int SnappingClient) override;
|
void Snap(int SnappingClient) override;
|
||||||
|
void SwapClients(int Client1, int Client2) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GAME_SERVER_ENTITIES_DRAGGER_BEAM_H
|
#endif // GAME_SERVER_ENTITIES_DRAGGER_BEAM_H
|
||||||
|
|
|
@ -122,3 +122,8 @@ void CPlasma::Snap(int SnappingClient)
|
||||||
GameServer()->SnapLaserObject(CSnapContext(SnappingClientVersion), GetID(),
|
GameServer()->SnapLaserObject(CSnapContext(SnappingClientVersion), GetID(),
|
||||||
m_Pos, m_Pos, m_EvalTick, -1, m_Freeze ? LASERTYPE_FREEZE : LASERTYPE_RIFLE);
|
m_Pos, m_Pos, m_EvalTick, -1, m_Freeze ? LASERTYPE_FREEZE : LASERTYPE_RIFLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPlasma::SwapClients(int Client1, int Client2)
|
||||||
|
{
|
||||||
|
m_ForClientID = m_ForClientID == Client1 ? Client2 : m_ForClientID == Client2 ? Client1 : m_ForClientID;
|
||||||
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ public:
|
||||||
void Reset() override;
|
void Reset() override;
|
||||||
void Tick() override;
|
void Tick() override;
|
||||||
void Snap(int SnappingClient) override;
|
void Snap(int SnappingClient) override;
|
||||||
|
void SwapClients(int Client1, int Client2) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GAME_SERVER_ENTITIES_PLASMA_H
|
#endif // GAME_SERVER_ENTITIES_PLASMA_H
|
||||||
|
|
Loading…
Reference in a new issue