diff options
| author | Treeston <treeston.mmoc@gmail.com> | 2017-08-06 16:07:15 +0200 |
|---|---|---|
| committer | Treeston <treeston.mmoc@gmail.com> | 2017-08-06 16:07:30 +0200 |
| commit | 184c45cfe0fbe4f3e4fb701f0f99994df98bdc8a (patch) | |
| tree | 97f7e52a1ac5d720007540d9508be2bc9dabcfa7 /src/server/game | |
| parent | dbda060ae7a31135044495470e46276dad0bcc0e (diff) | |
Core/Scripts: dynamic_spawning follow-up, I had forgotten JustRespawned existed.
- Rename JustRespawned to JustAppeared, which better matches its behavior anyway.
- Properly invoke JustAppeared for new (re-)spawns - fixes #20111.
- Fix Thaddius script to work with dynamic_spawning (mostly unrelated to the above) - Feugen/Stalagg should really be a summon group, but I don't have time to fix that right now.
- Fix default value for DynamicEscortNPC to match worldserver.conf.dist.
Diffstat (limited to 'src/server/game')
| -rw-r--r-- | src/server/game/AI/CreatureAI.h | 4 | ||||
| -rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedEscortAI.h | 2 | ||||
| -rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h | 2 | ||||
| -rw-r--r-- | src/server/game/AI/SmartScripts/SmartAI.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/AI/SmartScripts/SmartAI.h | 2 | ||||
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 18 | ||||
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.h | 2 | ||||
| -rw-r--r-- | src/server/game/World/World.cpp | 2 |
10 files changed, 17 insertions, 21 deletions
diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h index c355eaacb58..015e46cccdd 100644 --- a/src/server/game/AI/CreatureAI.h +++ b/src/server/game/AI/CreatureAI.h @@ -134,8 +134,8 @@ class TC_GAME_API CreatureAI : public UnitAI virtual bool IsEscorted() const { return false; } - // Called when creature is spawned or respawned - virtual void JustRespawned() { } + // Called when creature appears in the world (spawn, respawn, grid load etc...) + virtual void JustAppeared() { } // Called at waypoint reached or point movement finished virtual void MovementInform(uint32 /*type*/, uint32 /*id*/) { } diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index 38594446556..68bbcdb1472 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -150,7 +150,7 @@ void npc_escortAI::JustDied(Unit* /*killer*/) } } -void npc_escortAI::JustRespawned() +void npc_escortAI::JustAppeared() { m_uiEscortState = STATE_ESCORT_NONE; diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h index 7d6f210f034..2a745ad999f 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h @@ -65,7 +65,7 @@ struct TC_GAME_API npc_escortAI : public ScriptedAI void JustDied(Unit*) override; - void JustRespawned() override; + void JustAppeared() override; void ReturnToLastPoint(); diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp index b0b332afecd..6f50cdaac10 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -145,7 +145,7 @@ void FollowerAI::JustDied(Unit* /*killer*/) } } -void FollowerAI::JustRespawned() +void FollowerAI::JustAppeared() { m_uiFollowState = STATE_FOLLOW_NONE; diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h index 7fe877a7589..24155db1cdd 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h @@ -53,7 +53,7 @@ class TC_GAME_API FollowerAI : public ScriptedAI void JustDied(Unit*) override; - void JustRespawned() override; + void JustAppeared() override; void UpdateAI(uint32) override; //the "internal" update, calls UpdateFollowerAI() virtual void UpdateFollowerAI(uint32); //used when it's needed to add code in update (abilities, scripted events, etc) diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 5aa2550a704..71cb6f7fdad 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -566,7 +566,7 @@ bool SmartAI::AssistPlayerInCombatAgainst(Unit* who) return false; } -void SmartAI::JustRespawned() +void SmartAI::JustAppeared() { mDespawnTime = 0; mDespawnState = 0; diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index b5ed74c4edb..3834fd01d07 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -71,7 +71,7 @@ class TC_GAME_API SmartAI : public CreatureAI bool IsEscortInvokerInRange(); // Called when creature is spawned or respawned - void JustRespawned() override; + void JustAppeared() override; // Called at reaching home after evade, InitializeAI(), EnterEvadeMode() for resetting variables void JustReachedHome() override; diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index e500d575ab0..f202f70042a 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -239,7 +239,7 @@ m_lootRecipient(), m_lootRecipientGroup(0), _pickpocketLootRestore(0), m_corpseR m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), m_boundaryCheckTime(2500), m_combatPulseTime(0), m_combatPulseDelay(0), m_reactState(REACT_AGGRESSIVE), m_defaultMovementType(IDLE_MOTION_TYPE), m_spawnId(0), m_equipmentId(0), m_originalEquipmentId(0), m_AlreadyCallAssistance(false), m_AlreadySearchedAssistance(false), m_regenHealth(true), m_cannotReachTarget(false), m_cannotReachTimer(0), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), -m_originalEntry(0), m_homePosition(), m_transportHomePosition(), m_creatureInfo(nullptr), m_creatureData(nullptr), m_waypointID(0), m_path_id(0), m_formation(nullptr), m_respawnCompatibilityMode(false), m_focusSpell(nullptr), m_focusDelay(0), m_shouldReacquireTarget(false), m_suppressedOrientation(0.0f), +m_originalEntry(0), m_homePosition(), m_transportHomePosition(), m_creatureInfo(nullptr), m_creatureData(nullptr), m_waypointID(0), m_path_id(0), m_formation(nullptr), m_triggerJustAppeared(true), m_respawnCompatibilityMode(false), m_focusSpell(nullptr), m_focusDelay(0), m_shouldReacquireTarget(false), m_suppressedOrientation(0.0f), _lastDamagedTime(0) { m_regenTimer = CREATURE_REGEN_INTERVAL; @@ -254,7 +254,6 @@ _lastDamagedTime(0) m_CombatDistance = 0;//MELEE_RANGE; ResetLootMode(); // restore default loot mode - m_TriggerJustRespawned = false; m_isTempWorldObject = false; } @@ -578,10 +577,10 @@ bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/, void Creature::Update(uint32 diff) { - if (IsAIEnabled && m_TriggerJustRespawned) + if (IsAIEnabled && m_triggerJustAppeared && m_deathState == ALIVE) { - m_TriggerJustRespawned = false; - AI()->JustRespawned(); + m_triggerJustAppeared = false; + AI()->JustAppeared(); if (m_vehicleKit) m_vehicleKit->Reset(); } @@ -1907,13 +1906,10 @@ void Creature::Respawn(bool force) //Re-initialize reactstate that could be altered by movementgenerators InitializeReactState(); - //Call AI respawn virtual function//Call AI respawn virtual function - if (IsAIEnabled) - { - //reset the AI to be sure no dirty or uninitialized values will be used till next tick + if (IsAIEnabled) // reset the AI to be sure no dirty or uninitialized values will be used till next tick AI()->Reset(); - m_TriggerJustRespawned = true;//delay event to next tick so all creatures are created on the map before processing - } + + m_triggerJustAppeared = true; uint32 poolid = GetSpawnId() ? sPoolMgr->IsPartOfAPool<Creature>(GetSpawnId()) : 0; if (poolid) diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 8de86af1dff..6273c34c04f 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -407,7 +407,7 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma //Formation var CreatureGroup* m_formation; - bool m_TriggerJustRespawned; + bool m_triggerJustAppeared; bool m_respawnCompatibilityMode; /* Spell focus system */ diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index cab8c95dd91..c67b8e4382e 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1258,7 +1258,7 @@ void World::LoadConfigSettings(bool reload) TC_LOG_ERROR("server.loading", "Invalid value for Respawn.DynamicMode (%u). Set to 0.", m_int_configs[CONFIG_RESPAWN_DYNAMICMODE]); m_int_configs[CONFIG_RESPAWN_DYNAMICMODE] = 0; } - m_bool_configs[CONFIG_RESPAWN_DYNAMIC_ESCORTNPC] = sConfigMgr->GetBoolDefault("Respawn.DynamicEscortNPC", true); + m_bool_configs[CONFIG_RESPAWN_DYNAMIC_ESCORTNPC] = sConfigMgr->GetBoolDefault("Respawn.DynamicEscortNPC", false); m_int_configs[CONFIG_RESPAWN_GUIDWARNLEVEL] = sConfigMgr->GetIntDefault("Respawn.GuidWarnLevel", 12000000); if (m_int_configs[CONFIG_RESPAWN_GUIDWARNLEVEL] > 16777215) { |
