Core/Scripts: dynamic_spawning follow-up, I had forgotten JustRespawned existed.
Port From (https://github.com/TrinityCore/TrinityCore/commit/129dd7c9091d3fafc0f5e10b795224bc9418d006)
This commit is contained in:
@@ -437,8 +437,8 @@ namespace Game.AI
|
||||
|
||||
public virtual bool IsEscorted() { return false; }
|
||||
|
||||
// Called when creature is spawned or respawned
|
||||
public virtual void JustRespawned() { }
|
||||
// Called when creature appears in the world (spawn, respawn, grid load etc...)
|
||||
public virtual void JustAppeared() { }
|
||||
|
||||
public virtual void MovementInform(MovementGeneratorType type, uint id) { }
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace Game.AI
|
||||
}
|
||||
}
|
||||
|
||||
public override void JustRespawned()
|
||||
public override void JustAppeared()
|
||||
{
|
||||
m_uiEscortState = EscortState.None;
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace Game.AI
|
||||
}
|
||||
}
|
||||
|
||||
public override void JustRespawned()
|
||||
public override void JustAppeared()
|
||||
{
|
||||
m_uiFollowState = FollowState.None;
|
||||
|
||||
|
||||
@@ -551,7 +551,7 @@ namespace Game.AI
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void JustRespawned()
|
||||
public override void JustAppeared()
|
||||
{
|
||||
mDespawnTime = 0;
|
||||
mRespawnTime = 0;
|
||||
|
||||
@@ -661,7 +661,7 @@ namespace Game.Chat.Commands
|
||||
Map map = player.GetMap();
|
||||
uint mapId = map.GetId();
|
||||
bool showAll = map.IsBattlegroundOrArena() || map.IsDungeon();
|
||||
handler.SendSysMessage("Listing all spawn points in map %u (%s)%s:", mapId, map.GetMapName(), showAll ? "" : " within 5000yd");
|
||||
handler.SendSysMessage($"Listing all spawn points in map {mapId} ({map.GetMapName()}){(showAll ? "" : " within 5000yd")}:");
|
||||
|
||||
foreach (var pair in Global.ObjectMgr.GetAllCreatureData())
|
||||
{
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Game.Entities
|
||||
|
||||
//Formation var
|
||||
CreatureGroup m_formation;
|
||||
bool TriggerJustRespawned;
|
||||
bool triggerJustAppeared;
|
||||
bool m_respawnCompatibilityMode;
|
||||
|
||||
public uint[] m_spells = new uint[SharedConst.MaxCreatureSpells];
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace Game.Entities
|
||||
DefaultMovementType = MovementGeneratorType.Idle;
|
||||
m_regenHealth = true;
|
||||
m_meleeDamageSchoolMask = SpellSchoolMask.Normal;
|
||||
triggerJustAppeared = true;
|
||||
|
||||
RegenTimer = SharedConst.CreatureRegenInterval;
|
||||
|
||||
@@ -378,10 +379,10 @@ namespace Game.Entities
|
||||
|
||||
public override void Update(uint diff)
|
||||
{
|
||||
if (IsAIEnabled && TriggerJustRespawned)
|
||||
if (IsAIEnabled && triggerJustAppeared && m_deathState == DeathState.Alive)
|
||||
{
|
||||
TriggerJustRespawned = false;
|
||||
GetAI().JustRespawned();
|
||||
triggerJustAppeared = false;
|
||||
GetAI().JustAppeared();
|
||||
if (VehicleKit != null)
|
||||
VehicleKit.Reset();
|
||||
}
|
||||
@@ -1736,13 +1737,10 @@ namespace Game.Entities
|
||||
//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
|
||||
GetAI().Reset();
|
||||
TriggerJustRespawned = true;//delay event to next tick so all creatures are created on the map before processing
|
||||
}
|
||||
|
||||
triggerJustAppeared = true;
|
||||
|
||||
uint poolid = GetSpawnId() != 0 ? Global.PoolMgr.IsPartOfAPool<Creature>(GetSpawnId()) : 0;
|
||||
if (poolid != 0)
|
||||
|
||||
@@ -16,16 +16,16 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Framework.GameMath;
|
||||
using Game.BattleGrounds;
|
||||
using Game.DataStorage;
|
||||
using Game.Maps;
|
||||
using Game.Movement;
|
||||
using Game.Networking.Packets;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Game.Spells;
|
||||
using Framework.Dynamic;
|
||||
|
||||
namespace Game.Entities
|
||||
{
|
||||
|
||||
@@ -784,7 +784,7 @@ namespace Game
|
||||
Log.outError(LogFilter.ServerLoading, $"Invalid value for Respawn.DynamicMode ({Values[WorldCfg.RespawnDynamicMode]}). Set to 0.");
|
||||
Values[WorldCfg.RespawnDynamicMode] = 0;
|
||||
}
|
||||
Values[WorldCfg.RespawnDynamicEscortNpc] = GetDefaultValue("Respawn.DynamicEscortNPC", true);
|
||||
Values[WorldCfg.RespawnDynamicEscortNpc] = GetDefaultValue("Respawn.DynamicEscortNPC", false);
|
||||
Values[WorldCfg.RespawnGuidWarnLevel] = GetDefaultValue("Respawn.GuidWarnLevel", 12000000);
|
||||
if ((int)Values[WorldCfg.RespawnGuidWarnLevel] > 16777215)
|
||||
{
|
||||
|
||||
@@ -131,9 +131,9 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.KrikthirTheGatewatcher
|
||||
SummonAdds();
|
||||
}
|
||||
|
||||
public override void JustRespawned()
|
||||
public override void JustAppeared()
|
||||
{
|
||||
base.JustRespawned();
|
||||
base.JustAppeared();
|
||||
SummonAdds();
|
||||
}
|
||||
|
||||
|
||||
@@ -373,9 +373,9 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.Nadronox
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public override void JustRespawned()
|
||||
public override void JustAppeared()
|
||||
{
|
||||
base.JustRespawned();
|
||||
base.JustAppeared();
|
||||
Initialize();
|
||||
}
|
||||
|
||||
|
||||
@@ -486,7 +486,7 @@ namespace Scripts.Northrend.Ulduar
|
||||
_events.ScheduleEvent(Events.Outtro1, 7000);
|
||||
}
|
||||
|
||||
public override void JustRespawned()
|
||||
public override void JustAppeared()
|
||||
{
|
||||
//SetupEncounter();
|
||||
}
|
||||
@@ -922,7 +922,7 @@ namespace Scripts.Northrend.Ulduar
|
||||
}
|
||||
}
|
||||
|
||||
public override void JustRespawned()
|
||||
public override void JustAppeared()
|
||||
{
|
||||
SetupEncounter();
|
||||
}
|
||||
|
||||
@@ -1740,7 +1740,7 @@ Respawn.DynamicMode = 0
|
||||
# 1 - Enabled
|
||||
# Default: 0 - Disabled
|
||||
|
||||
Respawn.DynamicEscortNPC = 1
|
||||
Respawn.DynamicEscortNPC = 0
|
||||
|
||||
#
|
||||
# Respawn.DynamicRateCreature
|
||||
|
||||
Reference in New Issue
Block a user