Core/GameObjects: Properly set GO_FLAG_MAP_OBJECT during gameobject creation

Port From (https://github.com/TrinityCore/TrinityCore/commit/e3cf94d4fdbfae5ce99aa754bd29a0b77cd1b73d)
This commit is contained in:
hondacrx
2020-08-07 12:28:41 -04:00
parent bc91e3492e
commit 301c9a2f62
2 changed files with 10 additions and 12 deletions
+9 -11
View File
@@ -266,9 +266,7 @@ namespace Game.Entities
SetDisplayId(goInfo.displayId);
m_model = CreateModel();
if (m_model != null && m_model.IsMapObject())
AddFlag(GameObjectFlags.MapObject);
CreateModel();
// GAMEOBJECT_BYTES_1, index at 0, 1, 2 and 3
SetGoType(goInfo.type);
@@ -2410,14 +2408,12 @@ namespace Game.Entities
if (GetMap().ContainsGameObjectModel(m_model))
GetMap().RemoveGameObjectModel(m_model);
m_model = CreateModel();
RemoveFlag(GameObjectFlags.MapObject);
m_model = null;
CreateModel();
if (m_model != null)
GetMap().InsertGameObjectModel(m_model);
if (m_model != null && m_model.IsMapObject())
AddFlag(GameObjectFlags.MapObject);
else
RemoveFlag(GameObjectFlags.MapObject);
}
Player GetLootRecipient()
@@ -2763,9 +2759,11 @@ namespace Game.Entities
return IsInRange(obj.GetPositionX(), obj.GetPositionY(), obj.GetPositionZ(), dist2compare);
}
public GameObjectModel CreateModel()
public void CreateModel()
{
return GameObjectModel.Create(new GameObjectModelOwnerImpl(this));
m_model = GameObjectModel.Create(new GameObjectModelOwnerImpl(this));
if (m_model != null && m_model.IsMapObject())
AddFlag(GameObjectFlags.MapObject);
}
#region Fields
+1 -1
View File
@@ -133,7 +133,7 @@ namespace Game.Entities
SetWorldRotation(0.0f, 0.0f, 0.0f, 1.0f);
SetParentRotation(Quaternion.WAxis);
m_model = CreateModel();
CreateModel();
return true;
}