Core/Quest: Threat From Above

Port From (https://github.com/TrinityCore/TrinityCore/commit/8202dc28c2dae613c14a52ef4e84932d8c1c9e39)
This commit is contained in:
hondacrx
2022-05-26 16:48:38 -04:00
parent 30aaad290f
commit 0368d5c9c3
3 changed files with 38 additions and 1 deletions
@@ -1126,6 +1126,15 @@ namespace Game.Entities
return $"{base.GetDebugInfo()}\nAIName: {GetAIName()} ScriptName: {GetScriptName()} WaypointPath: {GetWaypointPath()} SpawnId: {GetSpawnId()}";
}
public override void ExitVehicle(Position exitPosition = null)
{
base.ExitVehicle();
// if the creature exits a vehicle, set it's home position to the
// exited position so it won't run away (home) and evade if it's hostile
SetHomePosition(GetPosition());
}
public override bool IsMovementPreventedByCasting()
{
// first check if currently a movement allowed channel is active and we're not casting
+1 -1
View File
@@ -999,7 +999,7 @@ namespace Game.Entities
rideVehicleEffect.ChangeAmount((seatId < 0 ? GetTransSeat() : seatId) + 1);
}
public void ExitVehicle(Position exitPosition = null)
public virtual void ExitVehicle(Position exitPosition = null)
{
//! This function can be called at upper level code to initialize an exit from the passenger's side.
if (m_vehicle == null)
+28
View File
@@ -3445,6 +3445,34 @@ namespace Scripts.Spells.Generic
}
}
[Script("spell_gen_eject_passenger_1", 0)]
[Script("spell_gen_eject_passenger_3", 2)]
class spell_gen_eject_passenger_with_seatId : SpellScript
{
sbyte _seatId;
public spell_gen_eject_passenger_with_seatId(sbyte seatId)
{
_seatId = seatId;
}
void EjectPassenger(uint effIndex)
{
Vehicle vehicle = GetHitUnit().GetVehicleKit();
if (vehicle != null)
{
Unit passenger = vehicle.GetPassenger(_seatId);
if (passenger != null)
passenger.ExitVehicle();
}
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(EjectPassenger, 0, SpellEffectName.ScriptEffect));
}
}
[Script]
class spell_gen_gm_freeze : AuraScript
{