Core/BattlegroundMap: Load all cells when created & mark all creatures as active

Port From (https://github.com/TrinityCore/TrinityCore/commit/e72bde5236d41a7f66abb25ce9e118eeb1c5aa92)
This commit is contained in:
hondacrx
2024-02-03 11:15:25 -05:00
parent 7557fac40c
commit 226e12890e
5 changed files with 27 additions and 0 deletions
@@ -1517,6 +1517,7 @@ namespace Framework.Constants
BasemapLoadGrids,
BattlegroundCastDeserter,
BattlegroundInvitationType,
BattlegroundMapLoadGrids,
BattlegroundPremadeGroupWaitForMatch,
BattlegroundPrematureFinishTimer,
BattlegroundQueueAnnouncerEnable,
+12
View File
@@ -423,6 +423,9 @@ namespace Game.Maps
return false; //Should delete object
}
if (IsAlwaysActive())
obj.SetActive(true);
var cell = new Cell(cellCoord);
if (obj.IsActiveObject())
EnsureGridLoadedForActiveObject(cell, obj);
@@ -3345,6 +3348,15 @@ namespace Game.Maps
return i_mapRecord != null && i_mapRecord.IsGarrison();
}
/// <summary>
/// Currently, this means that every entity added to this map will be marked as active
/// </summary>
/// <returns></returns>
bool IsAlwaysActive()
{
return IsBattlegroundOrArena();
}
private bool GetEntrancePos(out uint mapid, out float x, out float y)
{
mapid = 0;
+4
View File
@@ -97,6 +97,10 @@ namespace Game.Entities
Cypher.Assert(map.IsBattlegroundOrArena());
map.SetBG(bg);
bg.SetBgMap(map);
if (WorldConfig.GetBoolValue(WorldCfg.BattlegroundMapLoadGrids))
map.LoadAllCells();
return map;
}
+1
View File
@@ -227,6 +227,7 @@ namespace Game
Values[WorldCfg.InstancemapLoadGrids] = false;
}
Values[WorldCfg.BattlegroundMapLoadGrids] = GetDefaultValue("BattlegroundMapLoadAllGrids", true);
Values[WorldCfg.IntervalSave] = GetDefaultValue("PlayerSaveInterval", 15 * Time.Minute * Time.InMilliseconds);
Values[WorldCfg.IntervalDisconnectTolerance] = GetDefaultValue("DisconnectToleranceInterval", 0);
Values[WorldCfg.StatsSaveOnlyOnLogout] = GetDefaultValue("PlayerSave.Stats.SaveOnlyOnLogout", true);
+9
View File
@@ -324,6 +324,15 @@ BaseMapLoadAllGrids = 0
InstanceMapLoadAllGrids = 0
#
# BattlegroundMapLoadAllGrids
# Description: Load all grids for battleground maps upon load.
# Upon loading an battleground map, all creatures/objects in the map will be pre-loaded
# Default: 1 - (Preload all grids in the instance upon load)
# 0 - (Don't preload all base maps, dynamically load as used)
BattlegroundMapLoadAllGrids = 1
#
# SocketTimeOutTime
# Description: Time (in milliseconds) after which a connection being idle on the character