Scripts/SmartAI: Forward invoker to invoked action list actions. Also JustAppeared -> InitializeAI.

Port From (https://github.com/TrinityCore/TrinityCore/commit/1f26122528ad31a9dedbfcf5c1029cf750dfd1d4)
This commit is contained in:
hondacrx
2021-06-23 22:48:37 -04:00
parent fc49a98dab
commit 4206c48aaa
3 changed files with 15 additions and 25 deletions
+4 -22
View File
@@ -565,7 +565,7 @@ namespace Game.AI
return false;
}
public override void JustAppeared()
public override void InitializeAI()
{
_despawnTime = 0;
_respawnTime = 0;
@@ -711,14 +711,6 @@ namespace Game.AI
GetScript().ProcessEventsFor(apply ? SmartEvents.PassengerBoarded : SmartEvents.PassengerRemoved, passenger, (uint)seatId, 0, apply);
}
public override void InitializeAI()
{
_script.OnInitialize(me);
if (!me.IsDead())
GetScript().OnReset();
}
public override void OnCharmed(bool apply)
{
if (apply) // do this before we change charmed state, as charmed state might prevent these things from processing
@@ -893,9 +885,7 @@ namespace Game.AI
public void SetScript9(SmartScriptHolder e, uint entry, Unit invoker)
{
if (invoker != null)
GetScript().LastInvoker = invoker.GetGUID();
GetScript().SetScript9(e, entry);
GetScript().SetScript9(e, entry, invoker);
}
public override void OnGameEvent(bool start, ushort eventId)
@@ -1088,9 +1078,6 @@ namespace Game.AI
public override void Reset()
{
// call respawn event on reset
GetScript().ProcessEventsFor(SmartEvents.Respawn);
GetScript().OnReset();
}
@@ -1142,9 +1129,7 @@ namespace Game.AI
public void SetScript9(SmartScriptHolder e, uint entry, Unit invoker)
{
if (invoker != null)
GetScript().LastInvoker = invoker.GetGUID();
GetScript().SetScript9(e, entry);
GetScript().SetScript9(e, entry, invoker);
}
public override void OnGameEvent(bool start, ushort eventId)
@@ -1195,10 +1180,7 @@ namespace Game.AI
public void SetScript9(SmartScriptHolder e, uint entry, Unit invoker)
{
if (invoker)
GetScript().LastInvoker = invoker.GetGUID();
GetScript().SetScript9(e, entry);
GetScript().SetScript9(e, entry, invoker);
}
public SmartScript GetScript() { return _script; }