Persistent Map Vote Tallies (#86788)

## About The Pull Request

Changes map votes to be based on a persistent tally count.
Tallies for maps are cached between rounds and are added to by map
votes.
When a map is chosen, and it wasn't the only valid one, the tallies for
said chosen map will be reset.

Refactors map vote handling and moves it from SSmapping to SSmap_vote.
Rock the Vote has been removed as a result of this refactor.

## Why It's Good For The Game

Makes it more likely that all maps will be played over the course of a
server instead of always being truly random.
Removes some clutter off of SSmapping.

🆑
refactor: Map Votes are now carried over between rounds. When a map vote
is actually a contest, the winning map will have its votes reset.
/🆑
This commit is contained in:
Zephyr
2024-09-30 13:09:08 +13:00
committed by GitHub
parent ee5911b6d1
commit 0ef5c3d049
33 changed files with 291 additions and 303 deletions
+4 -13
View File
@@ -1,12 +1,3 @@
ADMIN_VERB(force_random_rotate, R_SERVER, "Trigger 'Random' Map Rotation", "Force a map vote.", ADMIN_CATEGORY_SERVER)
var/rotate = tgui_alert(user,"Force a random map rotation to trigger?", "Rotate map?", list("Yes", "Cancel"))
if (rotate != "Yes")
return
message_admins("[key_name_admin(user)] is forcing a random map rotation.")
log_admin("[key_name(user)] is forcing a random map rotation.")
SSmapping.maprotate()
ADMIN_VERB(admin_change_map, R_SERVER, "Change Map", "Set the next map.", ADMIN_CATEGORY_SERVER)
var/list/maprotatechoices = list()
for (var/map in config.maplist)
@@ -119,14 +110,14 @@ ADMIN_VERB(admin_change_map, R_SERVER, "Change Map", "Set the next map.", ADMIN_
fdel(PATH_TO_NEXT_MAP_JSON)
text2file(json_encode(json_value), PATH_TO_NEXT_MAP_JSON)
if(SSmapping.changemap(virtual_map))
if(SSmap_vote.set_next_map(virtual_map))
message_admins("[key_name_admin(user)] has changed the map to [virtual_map.map_name]")
SSmapping.map_force_chosen = TRUE
SSmap_vote.admin_override = TRUE
fdel("data/custom_map_json/[config_file]")
else
var/datum/map_config/virtual_map = maprotatechoices[chosenmap]
message_admins("[key_name_admin(user)] is changing the map to [virtual_map.map_name]")
log_admin("[key_name(user)] is changing the map to [virtual_map.map_name]")
if (SSmapping.changemap(virtual_map))
if (SSmap_vote.set_next_map(virtual_map))
message_admins("[key_name_admin(user)] has changed the map to [virtual_map.map_name]")
SSmapping.map_force_chosen = TRUE
SSmap_vote.admin_override = TRUE