Skip to content

Commit 08fc24a

Browse files
committed
The end of synchronization for blowVehicle and a few other functions
1 parent 9e62309 commit 08fc24a

File tree

2 files changed

+17
-33
lines changed

2 files changed

+17
-33
lines changed

Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,9 @@ bool CStaticFunctionDefinitions::SetElementPosition(CClientEntity& Entity, const
10761076
{
10771077
RUN_CHILDREN(SetElementPosition(**iter, vecPosition))
10781078

1079+
if (!Entity.IsLocalEntity())
1080+
return false;
1081+
10791082
if (bWarp)
10801083
Entity.Teleport(vecPosition);
10811084
else
@@ -1491,6 +1494,9 @@ bool CStaticFunctionDefinitions::SetElementHealth(CClientEntity& Entity, float f
14911494
{
14921495
RUN_CHILDREN(SetElementHealth(**iter, fHealth))
14931496

1497+
if (!Entity.IsLocalEntity())
1498+
return false;
1499+
14941500
switch (Entity.GetType())
14951501
{
14961502
case CCLIENTPED:
@@ -2907,41 +2913,13 @@ bool CStaticFunctionDefinitions::BlowVehicle(CClientEntity& Entity, std::optiona
29072913
return false;
29082914

29092915
CClientVehicle& vehicle = static_cast<CClientVehicle&>(Entity);
2910-
VehicleBlowFlags blow;
2916+
if (!vehicle.IsLocalEntity())
2917+
return false;
29112918

2919+
VehicleBlowFlags blow;
2920+
29122921
blow.withExplosion = withExplosion.value_or(true);
2913-
2914-
if (vehicle.IsLocalEntity())
2915-
{
2916-
vehicle.Blow(blow);
2917-
}
2918-
else
2919-
{
2920-
CVector position;
2921-
vehicle.GetPosition(position);
2922-
2923-
const auto type = vehicle.GetType();
2924-
const auto state = (blow.withExplosion ? VehicleBlowState::AWAITING_EXPLOSION_SYNC : VehicleBlowState::BLOWN);
2925-
eExplosionType explosion;
2926-
2927-
switch (type)
2928-
{
2929-
case CLIENTVEHICLE_CAR:
2930-
explosion = EXP_TYPE_CAR;
2931-
break;
2932-
case CLIENTVEHICLE_HELI:
2933-
explosion = EXP_TYPE_HELI;
2934-
break;
2935-
case CLIENTVEHICLE_BOAT:
2936-
explosion = EXP_TYPE_BOAT;
2937-
break;
2938-
default:
2939-
explosion = EXP_TYPE_CAR;
2940-
}
2941-
2942-
g_pClientGame->SendExplosionSync(position, explosion, &Entity, state);
2943-
}
2944-
2922+
vehicle.Blow(blow);
29452923
return true;
29462924
}
29472925

Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2518,6 +2518,12 @@ int CLuaVehicleDefs::SetVehicleHandling(lua_State* luaVM)
25182518

25192519
if (!argStream.HasErrors())
25202520
{
2521+
if (!pVehicle->IsLocalEntity())
2522+
{
2523+
lua_pushboolean(luaVM, false);
2524+
return 1;
2525+
}
2526+
25212527
if (argStream.NextIsString())
25222528
{
25232529
SString strProperty;

0 commit comments

Comments
 (0)