Tools/Mapextractor: Implemented liquid object detection
* Core/Vmaps: reverted position and liquid data update function from 3.3.5 and restored master handling in order to fix conflicts between the new phasing and liquid object handlings
This commit is contained in:
1 parent
58d0cd8a8c
commit
98a7ccfab5
17 files changed
+420
-405
No files matched your search
@@ -484,6 +484,7 @@ void Unit::Update(uint32 p_time)
|
||||
|
||||
UpdateSplineMovement(p_time);
|
||||
i_motionMaster->UpdateMotion(p_time);
|
||||
UpdateUnderwaterState(GetMap(), GetPositionX(), GetPositionY(), GetPositionZ());
|
||||
}
|
||||
|
||||
bool Unit::haveOffhandWeapon() const
|
||||
@@ -3177,35 +3178,48 @@ bool Unit::IsUnderWater() const
|
||||
return GetBaseMap()->IsUnderWater(GetPhaseShift(), GetPositionX(), GetPositionY(), GetPositionZ());
|
||||
}
|
||||
|
||||
void Unit::ProcessPositionDataChanged(PositionFullTerrainStatus const& data)
|
||||
void Unit::UpdateUnderwaterState(Map* m, float x, float y, float z)
|
||||
{
|
||||
WorldObject::ProcessPositionDataChanged(data);
|
||||
ProcessTerrainStatusUpdate(data.liquidStatus, data.liquidInfo);
|
||||
}
|
||||
|
||||
void Unit::ProcessTerrainStatusUpdate(ZLiquidStatus status, Optional<LiquidData> const& liquidData)
|
||||
{
|
||||
if (IsFlying() || (!IsControlledByPlayer()))
|
||||
if (IsFlying() || (!IsPet() && !IsVehicle()))
|
||||
return;
|
||||
|
||||
// remove appropriate auras if we are swimming/not swimming respectively
|
||||
if (status & MAP_LIQUID_STATUS_SWIMMING)
|
||||
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_ABOVEWATER);
|
||||
else
|
||||
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_UNDERWATER);
|
||||
|
||||
// liquid aura handling
|
||||
LiquidTypeEntry const* curLiquid = nullptr;
|
||||
if ((status & MAP_LIQUID_STATUS_SWIMMING) && liquidData)
|
||||
curLiquid = sLiquidTypeStore.LookupEntry(liquidData->entry);
|
||||
if (curLiquid != _lastLiquid)
|
||||
LiquidData liquid_status;
|
||||
ZLiquidStatus res = m->GetLiquidStatus(GetPhaseShift(), x, y, z, MAP_ALL_LIQUIDS, &liquid_status);
|
||||
if (!res)
|
||||
{
|
||||
if (_lastLiquid && _lastLiquid->SpellId)
|
||||
RemoveAurasDueToSpell(_lastLiquid->SpellId);
|
||||
Player* player = GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
if (curLiquid && curLiquid->SpellId && (!player || !player->IsGameMaster()))
|
||||
CastSpell(this, curLiquid->SpellId, true);
|
||||
_lastLiquid = curLiquid;
|
||||
|
||||
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_UNDERWATER);
|
||||
_lastLiquid = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (uint32 liqEntry = liquid_status.entry)
|
||||
{
|
||||
LiquidTypeEntry const* liquid = sLiquidTypeStore.LookupEntry(liqEntry);
|
||||
if (_lastLiquid && _lastLiquid->SpellId && _lastLiquid->Id != liqEntry)
|
||||
RemoveAurasDueToSpell(_lastLiquid->SpellId);
|
||||
|
||||
if (liquid && liquid->SpellId)
|
||||
{
|
||||
if (res & (LIQUID_MAP_UNDER_WATER | LIQUID_MAP_IN_WATER))
|
||||
{
|
||||
if (!HasAura(liquid->SpellId))
|
||||
CastSpell(this, liquid->SpellId, true);
|
||||
}
|
||||
else
|
||||
RemoveAurasDueToSpell(liquid->SpellId);
|
||||
}
|
||||
|
||||
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_ABOVEWATER);
|
||||
_lastLiquid = liquid;
|
||||
}
|
||||
else if (_lastLiquid && _lastLiquid->SpellId)
|
||||
{
|
||||
RemoveAurasDueToSpell(_lastLiquid->SpellId);
|
||||
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_UNDERWATER);
|
||||
_lastLiquid = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13742,7 +13756,8 @@ bool Unit::UpdatePosition(float x, float y, float z, float orientation, bool tel
|
||||
else if (turn)
|
||||
UpdateOrientation(orientation);
|
||||
|
||||
UpdatePositionData();
|
||||
// code block for underwater state update
|
||||
UpdateUnderwaterState(GetMap(), x, y, z);
|
||||
|
||||
return (relocated || turn);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user