Skip to content

Commit fd091cd

Browse files
Synchronize changes from 1.6 master branch [ci skip]
1e7893c Fix false positive in `onPlayerTeleport` event when using `spawnPlayer` (PR #3990) 5dceaf3 Fix jetpack crash (PR #3989)
2 parents 397b526 + 1e7893c commit fd091cd

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

Client/game_sa/CBuildingsPoolSA.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ inline bool CBuildingsPoolSA::AddBuildingToPool(CClientBuilding* pClientBuilding
5151

5252
CClientEntity* CBuildingsPoolSA::GetClientBuilding(CBuildingSAInterface* pGameInterface) const noexcept
5353
{
54-
std::uint32_t poolIndex = (*m_ppBuildingPoolInterface)->GetObjectIndex(pGameInterface);
54+
std::uint32_t poolIndex = (*m_ppBuildingPoolInterface)->GetObjectIndexSafe(pGameInterface);
5555

5656
if (poolIndex == static_cast<std::uint32_t>(-1))
5757
return nullptr;

Server/mods/deathmatch/logic/CMapManager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ void CMapManager::SpawnPlayer(CPlayer& Player, const CVector& vecPosition, float
593593

594594
// Update the player data
595595
Player.SetSpawned(true);
596+
Player.SetTeleported(true);
596597
Player.SetHealth(Player.GetMaxHealth());
597598
Player.SetIsDead(false);
598599
Player.SetWearingGoggles(false);

Server/mods/deathmatch/logic/packets/CPlayerPuresyncPacket.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,20 @@ bool CPlayerPuresyncPacket::Read(NetBitStreamInterface& BitStream)
132132
position.data.vecPosition += vecTempPos;
133133
}
134134

135-
CVector playerPosition = pSourcePlayer->GetPosition();
136-
float playerDistancePosition = DistanceBetweenPoints3D(playerPosition, position.data.vecPosition);
137-
if (playerDistancePosition >= g_TickRateSettings.playerTeleportAlert) {
138-
if (!pSourcePlayer->GetTeleported()) {
139-
CLuaArguments arguments;
140-
pSourcePlayer->CallEvent("onPlayerTeleport", arguments, nullptr);
141-
}
135+
if (position.data.vecPosition.fX != 0.0f && position.data.vecPosition.fY != 0.0f && position.data.vecPosition.fZ != 0.0f)
136+
{
137+
CVector playerPosition = pSourcePlayer->GetPosition();
138+
float playerDistancePosition = DistanceBetweenPoints3D(playerPosition, position.data.vecPosition);
139+
if (playerDistancePosition >= g_TickRateSettings.playerTeleportAlert)
140+
{
141+
if (!pSourcePlayer->GetTeleported())
142+
{
143+
CLuaArguments arguments;
144+
pSourcePlayer->CallEvent("onPlayerTeleport", arguments, nullptr);
145+
}
142146

143-
pSourcePlayer->SetTeleported(false);
147+
pSourcePlayer->SetTeleported(false);
148+
}
144149
}
145150

146151
pSourcePlayer->SetPosition(position.data.vecPosition);

0 commit comments

Comments
 (0)