Skip to content

Commit 58484be

Browse files
committed
Changes
1 parent 9f29b2a commit 58484be

File tree

1 file changed

+36
-5
lines changed

1 file changed

+36
-5
lines changed

Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2916,13 +2916,44 @@ bool CStaticFunctionDefinitions::BlowVehicle(CClientEntity& Entity, std::optiona
29162916
return false;
29172917

29182918
CClientVehicle& vehicle = static_cast<CClientVehicle&>(Entity);
2919-
if (!vehicle.IsLocalEntity())
2920-
return false;
2921-
29222919
VehicleBlowFlags blow;
2923-
29242920
blow.withExplosion = withExplosion.value_or(true);
2925-
vehicle.Blow(blow);
2921+
2922+
if (vehicle.IsLocalEntity())
2923+
{
2924+
vehicle.Blow(blow);
2925+
}
2926+
else
2927+
{
2928+
CClientPed* driver = vehicle.GetOccupant(0);
2929+
if (!static_cast<CDeathmatchVehicle&>(vehicle).IsSyncing() && (!driver || !driver->IsLocalPlayer()))
2930+
return false;
2931+
2932+
CVector position;
2933+
vehicle.GetPosition(position);
2934+
2935+
const auto type = vehicle.GetType();
2936+
const auto state = (blow.withExplosion ? VehicleBlowState::AWAITING_EXPLOSION_SYNC : VehicleBlowState::BLOWN);
2937+
eExplosionType explosion;
2938+
2939+
switch (type)
2940+
{
2941+
case CLIENTVEHICLE_CAR:
2942+
explosion = EXP_TYPE_CAR;
2943+
break;
2944+
case CLIENTVEHICLE_HELI:
2945+
explosion = EXP_TYPE_HELI;
2946+
break;
2947+
case CLIENTVEHICLE_BOAT:
2948+
explosion = EXP_TYPE_BOAT;
2949+
break;
2950+
default:
2951+
explosion = EXP_TYPE_CAR;
2952+
}
2953+
2954+
g_pClientGame->SendExplosionSync(position, explosion, &Entity, state);
2955+
}
2956+
29262957
return true;
29272958
}
29282959

0 commit comments

Comments
 (0)