Skip to content

Commit

Permalink
feat(Map): Add open world LOS settings (#18816)
Browse files Browse the repository at this point in the history
* chore. Add open world LOS settings

* Name change and conditional deny

* modify information in worldserver.conf.dist

* Remove pvp from variables and constants
  • Loading branch information
pangolp committed May 4, 2024
1 parent 1621d6b commit 715b290
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/server/apps/worldserver/worldserver.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,15 @@ vmap.petLOS = 1

vmap.BlizzlikePvPLOS = 1

#
# vmap.BlizzlikeLOSInOpenWorld
# Description: Check line of sight to see game objects in the open world.
# Default: 1 (Enabled, Players will be able to cast spells through tree stumps and other objects in the open world).
# 0 (Disabled, Players will not be able to cast spells through tree stumps and other objects in the open world).
#

vmap.BlizzlikeLOSInOpenWorld = 1

#
# vmap.enableIndoorCheck
# Description: VMap based indoor check to remove outdoor-only auras (mounts etc.).
Expand Down
8 changes: 8 additions & 0 deletions src/server/game/Maps/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2445,6 +2445,14 @@ bool Map::isInLineOfSight(float x1, float y1, float z1, float x2, float y2, floa
}
}

if (!sWorld->getBoolConfig(CONFIG_VMAP_BLIZZLIKE_LOS_OPEN_WORLD))
{
if (IsWorldMap())
{
ignoreFlags = VMAP::ModelIgnoreFlags::Nothing;
}
}

if ((checks & LINEOFSIGHT_CHECK_VMAP) && !VMAP::VMapFactory::createOrGetVMapMgr()->isInLineOfSight(GetId(), x1, y1, z1, x2, y2, z2, ignoreFlags))
{
return false;
Expand Down
1 change: 1 addition & 0 deletions src/server/game/Maps/Map.h
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ class Map : public GridRefMgr<NGridType>
[[nodiscard]] bool IsBattleground() const { return i_mapEntry && i_mapEntry->IsBattleground(); }
[[nodiscard]] bool IsBattleArena() const { return i_mapEntry && i_mapEntry->IsBattleArena(); }
[[nodiscard]] bool IsBattlegroundOrArena() const { return i_mapEntry && i_mapEntry->IsBattlegroundOrArena(); }
[[nodiscard]] bool IsWorldMap() const { return i_mapEntry && i_mapEntry->IsWorldMap(); }

bool GetEntrancePos(int32& mapid, float& x, float& y)
{
Expand Down
1 change: 1 addition & 0 deletions src/server/game/World/IWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ enum WorldBoolConfigs
CONFIG_LEAVE_GROUP_ON_LOGOUT,
CONFIG_QUEST_POI_ENABLED,
CONFIG_VMAP_BLIZZLIKE_PVP_LOS,
CONFIG_VMAP_BLIZZLIKE_LOS_OPEN_WORLD,
CONFIG_OBJECT_SPARKLES,
CONFIG_LOW_LEVEL_REGEN_BOOST,
CONFIG_OBJECT_QUEST_MARKERS,
Expand Down
1 change: 1 addition & 0 deletions src/server/game/World/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,7 @@ void World::LoadConfigSettings(bool reload)
bool enableHeight = sConfigMgr->GetOption<bool>("vmap.enableHeight", true);
bool enablePetLOS = sConfigMgr->GetOption<bool>("vmap.petLOS", true);
_bool_configs[CONFIG_VMAP_BLIZZLIKE_PVP_LOS] = sConfigMgr->GetOption<bool>("vmap.BlizzlikePvPLOS", true);
_bool_configs[CONFIG_VMAP_BLIZZLIKE_LOS_OPEN_WORLD] = sConfigMgr->GetOption<bool>("vmap.BlizzlikeLOSInOpenWorld", true);

if (!enableHeight)
LOG_ERROR("server.loading", "VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support.");
Expand Down

0 comments on commit 715b290

Please sign in to comment.