fix(Scripts/Vehicles): The next player entering Salvaged Siege Engine… (#10987)

… should control turret if it's not occupied.
This commit is contained in:
UltraNix
2022-03-27 06:16:12 +02:00
committed by GitHub
parent e7299c6e36
commit df89bbafe4
4 changed files with 43 additions and 1 deletions

View File

@@ -18899,6 +18899,15 @@ void Unit::JumpTo(WorldObject* obj, float speedZ)
bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
{
Creature* creature = ToCreature();
if (creature && creature->IsAIEnabled)
{
if (!creature->AI()->BeforeSpellClick(clicker))
{
return false;
}
}
bool result = false;
uint32 spellClickEntry = GetVehicleKit() ? GetVehicleKit()->GetCreatureEntry() : GetEntry();
SpellClickInfoMapBounds clickPair = sObjectMgr->GetSpellClickInfoMapBounds(spellClickEntry);
@@ -18967,7 +18976,6 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
result = true;
}
Creature* creature = ToCreature();
if (creature && creature->IsAIEnabled)
creature->AI()->OnSpellClick(clicker, result);