feat(Core/Config): Parameter to set all creatures with WP movement active (#2615)

This commit is contained in:
Stoabrogga
2020-02-23 14:08:42 +01:00
committed by GitHub
parent d387bdc695
commit ed243d6911
6 changed files with 22 additions and 7 deletions

View File

@@ -2217,7 +2217,11 @@ bool Creature::LoadCreaturesAddon(bool reload)
//Load Path
if (cainfo->path_id != 0)
{
if (sWorld->getBoolConfig(CONFIG_SET_ALL_CREATURES_WITH_WAYPOINT_MOVEMENT_ACTIVE))
setActive(true);
m_path_id = cainfo->path_id;
}
if (!cainfo->auras.empty())
{

View File

@@ -1520,9 +1520,7 @@ float WorldObject::GetGridActivationRange() const
float WorldObject::GetVisibilityRange() const
{
if (isActiveObject() && !ToPlayer())
return MAX_VISIBILITY_DISTANCE;
else if (IsVisibilityOverridden() && GetTypeId() == TYPEID_UNIT)
if (IsVisibilityOverridden() && GetTypeId() == TYPEID_UNIT)
return MAX_VISIBILITY_DISTANCE;
else if (GetTypeId() == TYPEID_GAMEOBJECT)
{
@@ -1545,9 +1543,7 @@ float WorldObject::GetSightRange(const WorldObject* target) const
{
if (target)
{
if (target->isActiveObject() && !target->ToPlayer())
return MAX_VISIBILITY_DISTANCE;
else if (target->IsVisibilityOverridden() && target->GetTypeId() == TYPEID_UNIT)
if (target->IsVisibilityOverridden() && target->GetTypeId() == TYPEID_UNIT)
return MAX_VISIBILITY_DISTANCE;
else if (target->GetTypeId() == TYPEID_GAMEOBJECT)
{

View File

@@ -977,7 +977,7 @@ class WorldObject : public Object, public WorldLocation
bool isActiveObject() const { return m_isActive; }
void setActive(bool isActiveObject);
bool IsVisibilityOverridden() const { return m_isVisibilityDistanceOverride || m_isActive; }
bool IsVisibilityOverridden() const { return m_isVisibilityDistanceOverride; }
void SetVisibilityDistanceOverride(bool isVisibilityDistanceOverride);
void SetWorldObject(bool apply);
bool IsPermanentWorldObject() const { return m_isWorldObject; }

View File

@@ -1349,6 +1349,8 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_ICC_BUFF_HORDE] = sConfigMgr->GetIntDefault("ICC.Buff.Horde", 73822);
m_int_configs[CONFIG_ICC_BUFF_ALLIANCE] = sConfigMgr->GetIntDefault("ICC.Buff.Alliance", 73828);
m_bool_configs[CONFIG_SET_ALL_CREATURES_WITH_WAYPOINT_MOVEMENT_ACTIVE] = sConfigMgr->GetBoolDefault("SetAllCreaturesWithWaypointMovementActive", false);
// call ScriptMgr if we're reloading the configuration
sScriptMgr->OnAfterConfigLoad(reload);
}

View File

@@ -172,6 +172,7 @@ enum WorldBoolConfigs
CONFIG_ALLOW_TWO_SIDE_INTERACTION_EMOTE,
CONFIG_ITEMDELETE_METHOD,
CONFIG_ITEMDELETE_VENDOR,
CONFIG_SET_ALL_CREATURES_WITH_WAYPOINT_MOVEMENT_ACTIVE,
BOOL_CONFIG_VALUE_COUNT
};

View File

@@ -422,6 +422,18 @@ PersistentCharacterCleanFlags = 0
PreloadAllNonInstancedMapGrids = 0
#
# SetAllCreaturesWithWaypointMovementActive
# Description: Set all creatures with waypoint movement active. This means that they will start
# movement once they are loaded (which happens on grid load) and keep moving even
# when no player is near. This will increase CPU usage significantly and can be
# used with enabled "PreloadAllNonInstancedMapGrids" to start waypoint movement on
# server startup.
# Default: 0 - (Disabled)
# 1 - (Enabled)
SetAllCreaturesWithWaypointMovementActive = 0
#
###################################################################################################