fix(Script/HellfirePeninsula): Beacons not attracting mobs. (#15296)
* fix(Script/Zone): Hellfire Peninsula - Beacons not attracting mobs. * update * add HOME_MOTION_TYPE check to prevent yoyo effect * Use GetNearPosition
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
-- Hellfire Beacons
|
||||||
|
UPDATE `gameobject_template` SET `ScriptName` = 'go_beacon' WHERE `entry` IN (181579, 181580, 181581);
|
||||||
@@ -15,20 +15,7 @@
|
|||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* ScriptData
|
#include "GameObjectAI.h"
|
||||||
SDName: Hellfire_Peninsula
|
|
||||||
SD%Complete: 100
|
|
||||||
SDComment: Quest support: 9375, 9410, 9418, 10129, 10146, 10162, 10163, 10340, 10346, 10347, 10382 (Special flight paths) "Needs update"
|
|
||||||
SDCategory: Hellfire Peninsula
|
|
||||||
EndScriptData */
|
|
||||||
|
|
||||||
/* ContentData
|
|
||||||
npc_aeranas
|
|
||||||
npc_ancestral_wolf
|
|
||||||
npc_wounded_blood_elf
|
|
||||||
npc_fel_guard_hound
|
|
||||||
EndContentData */
|
|
||||||
|
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "ScriptMgr.h"
|
#include "ScriptMgr.h"
|
||||||
#include "ScriptedCreature.h"
|
#include "ScriptedCreature.h"
|
||||||
@@ -403,6 +390,62 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum Beacon
|
||||||
|
{
|
||||||
|
NPC_STONESCHYE_WHELP = 16927,
|
||||||
|
};
|
||||||
|
|
||||||
|
class go_beacon : public GameObjectScript
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
go_beacon() : GameObjectScript("go_beacon") { }
|
||||||
|
|
||||||
|
struct go_beaconAI : public GameObjectAI
|
||||||
|
{
|
||||||
|
go_beaconAI(GameObject* gameObject) : GameObjectAI(gameObject) { }
|
||||||
|
|
||||||
|
std::list<Creature*> creatureList;
|
||||||
|
|
||||||
|
void OnStateChanged(uint32 state, Unit* /*unit*/) override
|
||||||
|
{
|
||||||
|
if (state == GO_ACTIVATED)
|
||||||
|
{
|
||||||
|
me->GetCreaturesWithEntryInRange(creatureList, 40, NPC_STONESCHYE_WHELP);
|
||||||
|
{
|
||||||
|
for (Creature* whelp : creatureList)
|
||||||
|
{
|
||||||
|
if (whelp->IsAlive() && !whelp->IsInCombat() && whelp->GetMotionMaster()->GetCurrentMovementGeneratorType() != HOME_MOTION_TYPE)
|
||||||
|
{
|
||||||
|
whelp->GetMotionMaster()->MovePoint(0, me->GetNearPosition(4.0f, whelp->GetOrientation()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (state == GO_JUST_DEACTIVATED)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
for (Creature* whelp : creatureList)
|
||||||
|
{
|
||||||
|
if (whelp->IsAlive() && !whelp->IsInCombat() && whelp->GetMotionMaster()->GetCurrentMovementGeneratorType() != HOME_MOTION_TYPE)
|
||||||
|
{
|
||||||
|
whelp->GetMotionMaster()->MoveTargetedHome();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
creatureList.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
GameObjectAI* GetAI(GameObject* go) const override
|
||||||
|
{
|
||||||
|
return new go_beaconAI(go);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void AddSC_hellfire_peninsula()
|
void AddSC_hellfire_peninsula()
|
||||||
{
|
{
|
||||||
// Ours
|
// Ours
|
||||||
@@ -413,4 +456,5 @@ void AddSC_hellfire_peninsula()
|
|||||||
new npc_ancestral_wolf();
|
new npc_ancestral_wolf();
|
||||||
new npc_wounded_blood_elf();
|
new npc_wounded_blood_elf();
|
||||||
new npc_fel_guard_hound();
|
new npc_fel_guard_hound();
|
||||||
|
new go_beacon();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user