Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More map system updates + misc dev #339

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open

More map system updates + misc dev #339

wants to merge 27 commits into from

Conversation

Vauff
Copy link
Contributor

@Vauff Vauff commented Jan 28, 2025

  • Simplified unnecessary complexity in !nominate & !setnextmap code
  • Moved !map to be fully within map system, for simplicity sake
  • Fixed not being able to use substrings of default maps defined in maplist config with !map
  • Fixed !map output printing argument substrings instead of full map names
  • Added colour formatting to !map output
  • Added a shared map lookup function for !map, !setnextmap & !nominate to all use
  • Added workshop ID support to !setnextmap
  • Added !nextmap command
  • Added an error response to !nominate & !nomlist if a next map is already forced
  • Fixed maps with more nominations not being taken to the map vote
  • Fixed !nominate grammar for nomination count
  • Added errors to !nomlist & !mapcooldowns if they have nothing to display
  • Migrated maplist KeyValues1 config to JSONC for better array support
    • After updating, maplist.cfg will be auto-converted to maplist.jsonc
    • A copy of the original config will be saved as maplist_old.cfg in case something goes wrong
    • The auto-converter will be removed in the future once all servers have had a chance to update
  • Fixed ZR crashing if player class config JSON parsing failed
  • Fixed c_reload_map_list crashing if loading map list failed
  • Added nomination status messages for nomination owners when vote starts
  • Generally moved away from engine data classes/raw pointers, instead opting for std alternatives
  • Added a shared function for gathering nominations
  • Updated vote manager code to be contained within a class
  • Fixed case of RTV getting stuck at max votes after a player disconnects
  • Added config to ExtendMap for not allowing extra time, not utilized but intended for forks
  • Removed map list sorting by workshop ID, this was a holdover from back when the config had to exactly match a workshop collection
  • Improved current map detection by checking workshop ID as well
  • Added cs2f_vote_max_maps cvar to control total amount of maps in vote
  • Disabled map vote UI if a next map is forced
  • Disabled map vote UI if mp_endmatch_votenextmap is disabled
  • Fixed map vote breaking when not enough maps are available
  • Added min/max clamp to cs2f_vote_max_nominations cvar
  • Moved cs_win_panel_match event listener to events.cpp
  • Switched to time-based cooldowns, more predictable over long periods of time (maps being rtv'd/extended)
  • Fixed maps not going on cooldown if map change happened outside of a map vote
  • Added cooldown tracking for maps not in maplist config, allowing the cooldown to be used if added later
  • Added group cooldowns, a feature that allows a group of maps to go on cooldown when any are played
  • Re-added !maplist command
  • Fixed memory safety issues from badly storing several game pointers

This is the promised follow up to #327, but yet again, there are still a few more changes I want to do in a later PR. However, the map system is in a very good place now, and I probably won't work on it again for a while.

Vauff added 26 commits January 19, 2025 22:48
I should've just committed to this in the previous map system updates, but foolishly tried to keep the old setup in place, and just complicated the code in the process
Though less complex, it also had a similar setup to !nominate
- Now fully within map vote system, for simplicity sake
- Fixed not being able to use substrings of default maps defined in maplist.cfg
- Fixed map change prints using substrings instead of full map names
- Added colour formatting
Sets us up for a good group cooldown format

Additionally:
- Fixed ZR crashing if player class config JSON parsing failed
- Fixed c_reload_map_list crashing if loading map list failed
- Added nomination status messages when vote starts
- Migrated nomination handling code to std containers
- Added a shared function for gathering nominations
I can't come up with a good reason why ID ordering was even needed (not added by me). Additionally, support for default maps (with no ID) was added in the time since, so not really sure this makes sense anymore.
- Added cs2f_vote_max_maps cvar to control total amount of maps in vote
- Disabled map vote UI if a next map is forced
- Disabled map vote UI if mp_endmatch_votenextmap is disabled
- Fixed map vote breaking when not enough maps are available
- Added min/max clamp to cs2f_vote_max_nominations cvar
- Fixed regressions with current map detection from previous commit
Also remove endmatch_mapvote_selecting_map, this event never actually fires
- Switched to time-based cooldowns, more predictable over long periods of time (maps being rtv'd/extended)
- Fixed maps not going on cooldown if map change happened outside of a map vote
- Added cooldown tracking for maps not in maplist.cfg, allowing the cooldown to be used if added later
g_pNetworkGameServer gets free'd by the game pre-OnLevelShutdown, so in the period up until StartupServer, we were storing a bad pointer. The engine's GetIGameServer() function always returns a nullptr in this state we can check for, so we just always call it directly now.
GetClientList apparently depends on the type being correct
Same deal as g_pNetworkGameServer, it gets free'd by the game between map changes
@Vauff Vauff changed the title More map system updates + bit of misc dev More map system updates + misc dev Jan 30, 2025
For gamerules, we have to null our own definition, since no getter is available from the game
@xLeviNx
Copy link

xLeviNx commented Feb 5, 2025

Is there plans for maplife.jsonc to just pull the maps from the collection ID?

@Vauff
Copy link
Contributor Author

Vauff commented Feb 7, 2025

Is there plans for maplife.jsonc to just pull the maps from the collection ID?

No, we dropped the idea of syncing with collections ever since the 100 map limit bug in CS2 was found. Also, it wouldn't really make sense to do so anymore given all the additional config options that can only be defined in maplist.jsonc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants