Skip to content

Commit 18d02a8

Browse files
authored
Merge branch 'master' into fix/refresh-aclrequest
2 parents 15665f4 + 76b02d2 commit 18d02a8

File tree

5 files changed

+7850
-7839
lines changed

5 files changed

+7850
-7839
lines changed

Client/mods/deathmatch/logic/CClientGame.cpp

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6477,20 +6477,26 @@ bool CClientGame::WorldSoundHandler(const SWorldSoundEvent& event)
64776477
// Audio events without a game entity could default to the root element, but the
64786478
// best approach is to avoid spamming the event with the barely notable sounds (without a source).
64796479
// Warning: Canceling sounds emitted by an audio entity (like vehicles do) will cause massive spam
6480+
CClientEntity* pEntity = nullptr;
6481+
64806482
if (event.pGameEntity)
64816483
{
6482-
CPools* pPools = g_pGame->GetPools();
6483-
CClientEntity* pEntity = pPools->GetClientEntity((DWORD*)event.pGameEntity);
6484-
if (pEntity)
6485-
{
6486-
CLuaArguments Arguments;
6487-
Arguments.PushNumber(event.uiGroup);
6488-
Arguments.PushNumber(event.uiIndex);
6489-
Arguments.PushNumber(event.vecPosition.fX);
6490-
Arguments.PushNumber(event.vecPosition.fY);
6491-
Arguments.PushNumber(event.vecPosition.fZ);
6492-
return pEntity->CallEvent("onClientWorldSound", Arguments, true);
6493-
}
6484+
CPools* pPools = g_pGame->GetPools();
6485+
pEntity = pPools->GetClientEntity((DWORD*)event.pGameEntity);
6486+
}
6487+
6488+
if (!pEntity)
6489+
pEntity = GetRootEntity();
6490+
6491+
if (pEntity)
6492+
{
6493+
CLuaArguments Arguments;
6494+
Arguments.PushNumber(event.uiGroup);
6495+
Arguments.PushNumber(event.uiIndex);
6496+
Arguments.PushNumber(event.vecPosition.fX);
6497+
Arguments.PushNumber(event.vecPosition.fY);
6498+
Arguments.PushNumber(event.vecPosition.fZ);
6499+
return pEntity->CallEvent("onClientWorldSound", Arguments, true);
64946500
}
64956501

64966502
return true;

Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5442,8 +5442,7 @@ bool CStaticFunctionDefinitions::GetTrainSpeed(CVehicle* pVehicle, float& fSpeed
54425442
if (pVehicle->GetVehicleType() != VEHICLE_TRAIN)
54435443
return false;
54445444

5445-
const CVector& vecVelocity = pVehicle->GetVelocity();
5446-
fSpeed = vecVelocity.Length();
5445+
fSpeed = pVehicle->GetTrainSpeed();
54475446
return true;
54485447
}
54495448

@@ -7330,6 +7329,7 @@ bool CStaticFunctionDefinitions::SetTrainSpeed(CVehicle* pVehicle, float fSpeed)
73307329
vecVelocity.Normalize();
73317330
vecVelocity *= fSpeed;
73327331
pVehicle->SetVelocity(vecVelocity);
7332+
pVehicle->SetTrainSpeed(fSpeed);
73337333

73347334
CBitStream BitStream;
73357335
BitStream.pBitStream->Write(fSpeed);

0 commit comments

Comments
 (0)