mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 17:19:07 +00:00
fix(Core/GameObject): Spawn linked traps when gameobjects are created (#8572)
This commit is contained in:
@@ -384,6 +384,20 @@ bool GameObject::Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, u
|
||||
LastUsedScriptID = GetGOInfo()->ScriptId;
|
||||
AIM_Initialize();
|
||||
|
||||
if (uint32 linkedEntry = GetGOInfo()->GetLinkedGameObjectEntry())
|
||||
{
|
||||
GameObject* linkedGO = new GameObject();
|
||||
if (linkedGO->Create(map->GenerateLowGuid<HighGuid::GameObject>(), linkedEntry, map, phaseMask, x, y, z, ang, rotation, 255, GO_STATE_READY))
|
||||
{
|
||||
SetLinkedTrap(linkedGO);
|
||||
map->AddToMap(linkedGO);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete linkedGO;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if GameObject is Large
|
||||
if (goinfo->IsLargeGameObject())
|
||||
SetVisibilityDistanceOverride(true);
|
||||
@@ -735,7 +749,7 @@ void GameObject::Update(uint32 diff)
|
||||
// If nearby linked trap exists, despawn it
|
||||
if (GameObject* linkedTrap = GetLinkedTrap())
|
||||
{
|
||||
linkedTrap->Delete();
|
||||
linkedTrap->DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
//if Gameobject should cast spell, then this, but some GOs (type = 10) should be destroyed
|
||||
@@ -853,6 +867,11 @@ void GameObject::DespawnOrUnsummon(Milliseconds delay, Seconds forceRespawnTime)
|
||||
SendObjectDeSpawnAnim(GetGUID());
|
||||
SetGoState(GO_STATE_READY);
|
||||
|
||||
if (GameObject* trap = GetLinkedTrap())
|
||||
{
|
||||
trap->DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
if (GameObjectTemplateAddon const* addon = GetTemplateAddon())
|
||||
{
|
||||
SetUInt32Value(GAMEOBJECT_FLAGS, addon->flags);
|
||||
|
||||
Reference in New Issue
Block a user