Rooted vehicle movement (#13342 for example)
Corrects issue where certain combinations of actions would cause vehicles (usually cannons/artillary) that should be rooted, to be fully movable
This commit is contained in:
1 parent
5d2cee1c2e
commit
cdb16c5181
4 files changed
+37
-4
No files matched your search
@@ -16975,6 +16975,12 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a
|
||||
}
|
||||
}
|
||||
|
||||
// If vehicle flag for fixed position set (cannons), or if the following hardcoded units, then set state rooted
|
||||
// 30236 | Argent Cannon
|
||||
// 39759 | Tankbuster Cannon
|
||||
if ((vehicle->GetVehicleInfo()->m_flags & VEHICLE_FLAG_FIXED_POSITION) || vehicle->GetBase()->GetEntry() == 30236 || vehicle->GetBase()->GetEntry() == 39759)
|
||||
SetControlled(true, UNIT_STATE_ROOT);
|
||||
|
||||
ASSERT(!m_vehicle);
|
||||
(void)vehicle->AddPassenger(this, seatId);
|
||||
}
|
||||
|
||||
@@ -192,6 +192,12 @@ void Vehicle::ApplyAllImmunities()
|
||||
_me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, true);
|
||||
}
|
||||
|
||||
// If vehicle flag for fixed position set (cannons), or if the following hardcoded units, then set state rooted
|
||||
// 30236 | Argent Cannon
|
||||
// 39759 | Tankbuster Cannon
|
||||
if ((GetVehicleInfo()->m_flags & VEHICLE_FLAG_FIXED_POSITION) || GetBase()->GetEntry() == 30236 || GetBase()->GetEntry() == 39759)
|
||||
_me->SetControlled(true, UNIT_STATE_ROOT);
|
||||
|
||||
// Different immunities for vehicles goes below
|
||||
switch (GetVehicleInfo()->m_ID)
|
||||
{
|
||||
|
||||
@@ -44,7 +44,8 @@ enum VehicleFlags
|
||||
VEHICLE_FLAG_FULLSPEEDPITCHING = 0x00000020, // Sets MOVEFLAG2_FULLSPEEDPITCHING
|
||||
VEHICLE_FLAG_CUSTOM_PITCH = 0x00000040, // If set use pitchMin and pitchMax from DBC, otherwise pitchMin = -pi/2, pitchMax = pi/2
|
||||
VEHICLE_FLAG_ADJUST_AIM_ANGLE = 0x00000400, // Lua_IsVehicleAimAngleAdjustable
|
||||
VEHICLE_FLAG_ADJUST_AIM_POWER = 0x00000800 // Lua_IsVehicleAimPowerAdjustable
|
||||
VEHICLE_FLAG_ADJUST_AIM_POWER = 0x00000800, // Lua_IsVehicleAimPowerAdjustable
|
||||
VEHICLE_FLAG_FIXED_POSITION = 0x00200000 // Used for cannons, when they should be rooted
|
||||
};
|
||||
|
||||
enum VehicleSpells
|
||||
|
||||
@@ -840,13 +840,33 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo* mi)
|
||||
mi->RemoveMovementFlag((maskToRemove));
|
||||
#endif
|
||||
|
||||
|
||||
/*! This must be a packet spoofing attempt. MOVEMENTFLAG_ROOT sent from the client is not valid
|
||||
in conjunction with any of the moving movement flags such as MOVEMENTFLAG_FORWARD.
|
||||
It will freeze clients that receive this player's movement info.
|
||||
*/
|
||||
REMOVE_VIOLATING_FLAGS(mi->HasMovementFlag(MOVEMENTFLAG_ROOT),
|
||||
MOVEMENTFLAG_ROOT);
|
||||
// Only adjust movement flag removal for vehicles with the VEHICLE_FLAG_FIXED_POSITION flag, or the hard coded exceptions below:
|
||||
// 30236 | Argent Cannon
|
||||
// 39759 | Tankbuster Cannon
|
||||
if (GetPlayer()->GetVehicleBase() && ((GetPlayer()->GetVehicle()->GetVehicleInfo()->m_flags & VEHICLE_FLAG_FIXED_POSITION) || GetPlayer()->GetVehicleBase()->GetEntry() == 30236 || GetPlayer()->GetVehicleBase()->GetEntry() == 39759))
|
||||
{
|
||||
// Actually players in rooted vehicles still send commands, don't clear root for these!
|
||||
// Check specifically for the following conditions:
|
||||
// MOVEMENTFLAG_ROOT + no other flags (0x800)
|
||||
// MOVEMENTFLAG_ROOT + MOVEMENTFLAG_LEFT (0x810)
|
||||
// MOVEMENTFLAG_ROOT + MOVEMENTFLAG_RIGHT (0x820)
|
||||
// MOVEMENTFLAG_ROOT + MOVEMENTFLAG_PITCH_UP (0x840)
|
||||
// MOVEMENTFLAG_ROOT + MOVEMENTFLAG_PITCH_DOWN (0x880)
|
||||
// If none of these are true, clear the root
|
||||
if (mi->HasMovementFlag(MOVEMENTFLAG_ROOT) && mi->HasMovementFlag(MOVEMENTFLAG_LEFT | MOVEMENTFLAG_RIGHT | MOVEMENTFLAG_PITCH_UP | MOVEMENTFLAG_PITCH_DOWN))
|
||||
REMOVE_VIOLATING_FLAGS(mi->HasMovementFlag(MOVEMENTFLAG_ROOT),
|
||||
MOVEMENTFLAG_MASK_MOVING);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Only remove here for non vehicles
|
||||
REMOVE_VIOLATING_FLAGS(mi->HasMovementFlag(MOVEMENTFLAG_ROOT),
|
||||
MOVEMENTFLAG_ROOT);
|
||||
}
|
||||
|
||||
//! Cannot hover without SPELL_AURA_HOVER
|
||||
REMOVE_VIOLATING_FLAGS(mi->HasMovementFlag(MOVEMENTFLAG_HOVER) && !GetPlayer()->HasAuraType(SPELL_AURA_HOVER),
|
||||
|
||||
Reference in new issue
Block a user