Skip to content

Commit

Permalink
fix(map): Streamline behaviour for the ttt2_enable_map_prefix_ convars
Browse files Browse the repository at this point in the history
* Unconditionally create gm, ttt and ttt2 prefixes

We can reasonably assume `gm` maps to be present on the server, the same
goes for `ttt` and `ttt2` maps.
Even if either or both of them are not currently installed on the server
creating these unconditionally would allow an admin to configure their
behaviour in that case.

Creating convars dynamically if we find more map prefixes is still
done.

* Disable all map prefixes but `ttt` and `ttt2` by default

We will assume people only want to run maps intended for ttt(2).

Given that the prefix selection can be modified on the same admin
settings page that is (currently) the only one using these convars this
seems fine.

* Drop FCVAR_NOTIFY for all `map_prefix_enabled` convars

Given that these are purely used in an admin context there is no need to
announce changes to all users on the server.

The last changes especially fixes the original Issue #1632
  • Loading branch information
Histalek committed Nov 15, 2024
1 parent 73b4723 commit 25f5b44
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions lua/ttt2/libraries/map.lua
Original file line number Diff line number Diff line change
Expand Up @@ -502,19 +502,32 @@ local mapsPrefixes = {}
local mapsWSIDs = {}

if SERVER then
-- by default cs, de and test maps should be hidden
-- by default cs, de, gm and test maps should be hidden
-- while ttt and ttt2 maps should be shown

---
-- @realm server
CreateConVar("ttt2_enable_map_prefix_cs", "0", { FCVAR_ARCHIVE, FCVAR_NOTIFY })
CreateConVar("ttt2_enable_map_prefix_cs", "0", { FCVAR_ARCHIVE })

---
-- @realm server
CreateConVar("ttt2_enable_map_prefix_de", "0", { FCVAR_ARCHIVE, FCVAR_NOTIFY })
CreateConVar("ttt2_enable_map_prefix_de", "0", { FCVAR_ARCHIVE })

---
-- @realm server
CreateConVar("ttt2_enable_map_prefix_test", "0", { FCVAR_ARCHIVE, FCVAR_NOTIFY })
CreateConVar("ttt2_enable_map_prefix_gm", "0", { FCVAR_ARCHIVE })

---
-- @realm server
CreateConVar("ttt2_enable_map_prefix_test", "0", { FCVAR_ARCHIVE })

---
-- @realm server
CreateConVar("ttt2_enable_map_prefix_ttt", "1", { FCVAR_ARCHIVE })

---
-- @realm server
CreateConVar("ttt2_enable_map_prefix_ttt2", "1", { FCVAR_ARCHIVE })

---
-- Initializes the map list. Searches the file system for available maps, scans those maps
Expand Down Expand Up @@ -570,7 +583,7 @@ if SERVER then

---
-- @realm server
CreateConVar(convarName, "1", { FCVAR_ARCHIVE, FCVAR_NOTIFY })
CreateConVar(convarName, "0", { FCVAR_ARCHIVE })

-- because these convars are generated dynamically, replicated convars do not work here
SetGlobalBool(convarName, GetConVar(convarName):GetBool())
Expand Down

0 comments on commit 25f5b44

Please sign in to comment.