mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
[9405] Make all movements instant applied.
* Drop delayed moves list in Map code * Apply movement coords update always at call including movement to different cell/grid. * Instead removed functionality mark creature as need move notify broadcast at next tick, do it. This must resolve porblesm with CreatureRelocation in past not always update position to new expected at call And in resul next code fail or work in strange way. Mark creature for notifier call at next Update let safe main part remopved functionality implemented in another way: prevent cascade (or infinity chain) in move updates. In fiture possible implement move notify call not at each tick for save time.
This commit is contained in:
parent
e74f62ea31
commit
5af05a314e
12 changed files with 68 additions and 106 deletions
|
|
@ -118,7 +118,8 @@ m_lootMoney(0), m_lootRecipient(0),
|
|||
m_deathTimer(0), m_respawnTime(0), m_respawnDelay(25), m_corpseDelay(60), m_respawnradius(0.0f),
|
||||
m_subtype(subtype), m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0),
|
||||
m_AlreadyCallAssistance(false), m_AlreadySearchedAssistance(false),
|
||||
m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),
|
||||
m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false), m_needNotify(false),
|
||||
m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),
|
||||
m_creatureInfo(NULL), m_isActiveObject(false), m_splineFlags(SPLINEFLAG_WALKMODE)
|
||||
{
|
||||
m_regenTimer = 200;
|
||||
|
|
@ -334,6 +335,15 @@ void Creature::Update(uint32 diff)
|
|||
else
|
||||
m_GlobalCooldown -= diff;
|
||||
|
||||
if (m_needNotify)
|
||||
{
|
||||
m_needNotify = false;
|
||||
RelocationNotify();
|
||||
|
||||
if (!IsInWorld())
|
||||
return;
|
||||
}
|
||||
|
||||
switch( m_deathState )
|
||||
{
|
||||
case JUST_ALIVED:
|
||||
|
|
@ -2066,3 +2076,22 @@ void Creature::SendAreaSpiritHealerQueryOpcode(Player *pl)
|
|||
data << GetGUID() << next_resurrect;
|
||||
pl->SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
void Creature::RelocationNotify()
|
||||
{
|
||||
CellPair new_val = MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY());
|
||||
Cell cell(new_val);
|
||||
CellPair cellpair = cell.cellPair();
|
||||
|
||||
MaNGOS::CreatureRelocationNotifier relocationNotifier(*this);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate(); // not trigger load unloaded grids at notifier call
|
||||
|
||||
TypeContainerVisitor<MaNGOS::CreatureRelocationNotifier, WorldTypeMapContainer > c2world_relocation(relocationNotifier);
|
||||
TypeContainerVisitor<MaNGOS::CreatureRelocationNotifier, GridTypeMapContainer > c2grid_relocation(relocationNotifier);
|
||||
|
||||
float radius = MAX_CREATURE_ATTACK_RADIUS * sWorld.getConfig(CONFIG_FLOAT_RATE_CREATURE_AGGRO);
|
||||
|
||||
cell.Visit(cellpair, c2world_relocation, *GetMap(), *this, radius);
|
||||
cell.Visit(cellpair, c2grid_relocation, *GetMap(), *this, radius);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue