mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[10677] Send to creature/etc Update call real diff from last update and use it.
Now in case when creature/etc some tices not updates in result stay in not active (no near players or active objects) cell some important timers (corpse decay, summon timers, group loot expire, aura durations, etc) will updates at real diff time from last prev. update call. Signed-off-by: VladimirMangos <vladimir@getmangos.com> For some systems added exclude use real diff time because current limitations like move generators. So its stay use last tick diff and considered freeze and skip all time while creature in not active map part.
This commit is contained in:
parent
62c0963f37
commit
555c1a9094
35 changed files with 162 additions and 149 deletions
|
|
@ -291,7 +291,7 @@ Unit::~Unit()
|
|||
MANGOS_ASSERT(m_deletedHolders.size() == 0);
|
||||
}
|
||||
|
||||
void Unit::Update( uint32 p_time )
|
||||
void Unit::Update(uint32 update_diff, uint32 tick_diff)
|
||||
{
|
||||
if(!IsInWorld())
|
||||
return;
|
||||
|
|
@ -306,21 +306,21 @@ void Unit::Update( uint32 p_time )
|
|||
// WARNING! Order of execution here is important, do not change.
|
||||
// Spells must be processed with event system BEFORE they go to _UpdateSpells.
|
||||
// Or else we may have some SPELL_STATE_FINISHED spells stalled in pointers, that is bad.
|
||||
m_Events.Update( p_time );
|
||||
_UpdateSpells( p_time );
|
||||
m_Events.Update(update_diff);
|
||||
_UpdateSpells(update_diff);
|
||||
|
||||
CleanupDeletedAuras();
|
||||
|
||||
if (m_lastManaUseTimer)
|
||||
{
|
||||
if (p_time >= m_lastManaUseTimer)
|
||||
if (update_diff >= m_lastManaUseTimer)
|
||||
m_lastManaUseTimer = 0;
|
||||
else
|
||||
m_lastManaUseTimer -= p_time;
|
||||
m_lastManaUseTimer -= update_diff;
|
||||
}
|
||||
|
||||
if (CanHaveThreatList())
|
||||
getThreatManager().UpdateForClient(p_time);
|
||||
getThreatManager().UpdateForClient(update_diff);
|
||||
|
||||
// update combat timer only for players and pets
|
||||
if (isInCombat() && (GetTypeId() == TYPEID_PLAYER || ((Creature*)this)->IsPet() || ((Creature*)this)->isCharmed()))
|
||||
|
|
@ -331,26 +331,24 @@ void Unit::Update( uint32 p_time )
|
|||
if (m_HostileRefManager.isEmpty())
|
||||
{
|
||||
// m_CombatTimer set at aura start and it will be freeze until aura removing
|
||||
if (m_CombatTimer <= p_time)
|
||||
if (m_CombatTimer <= update_diff)
|
||||
CombatStop();
|
||||
else
|
||||
m_CombatTimer -= p_time;
|
||||
m_CombatTimer -= update_diff;
|
||||
}
|
||||
}
|
||||
|
||||
if (uint32 base_att = getAttackTimer(BASE_ATTACK))
|
||||
{
|
||||
setAttackTimer(BASE_ATTACK, (p_time >= base_att ? 0 : base_att - p_time) );
|
||||
}
|
||||
setAttackTimer(BASE_ATTACK, (update_diff >= base_att ? 0 : base_att - update_diff) );
|
||||
|
||||
// update abilities available only for fraction of time
|
||||
UpdateReactives( p_time );
|
||||
UpdateReactives(update_diff);
|
||||
|
||||
ModifyAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, GetHealth() < GetMaxHealth()*0.20f);
|
||||
ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, GetHealth() < GetMaxHealth()*0.35f);
|
||||
ModifyAuraState(AURA_STATE_HEALTH_ABOVE_75_PERCENT, GetHealth() > GetMaxHealth()*0.75f);
|
||||
|
||||
i_motionMaster.UpdateMotion(p_time);
|
||||
i_motionMaster.UpdateMotion(tick_diff); // movegens expected non freeze time diff
|
||||
}
|
||||
|
||||
bool Unit::haveOffhandWeapon() const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue