Impliments a new voting system for weekends and wednesday: Hybrid FPTP weighted random from preferences (#26879)

* temporary wip

* the rest of the fucking owl

* Replaces Nodupes with FPTP, and wensday

* ok you are still a little stupid

* c-c-c-changes

* Create 60-61.sql

* Apply suggestions from code review

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Signed-off-by: Qwertytoforty <52090703+Qwertytoforty@users.noreply.github.com>

* woe up to date apon thee

* make that up to date

* contras changes!

* thanks contra!

* Update code/__DEFINES/misc_defines.dm

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: Qwertytoforty <52090703+Qwertytoforty@users.noreply.github.com>

* last thing

---------

Signed-off-by: Qwertytoforty <52090703+Qwertytoforty@users.noreply.github.com>
Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
This commit is contained in:
Qwertytoforty
2024-11-14 17:57:58 +00:00
committed by GitHub
co-authored by Luc DGamerL
parent ea2db54a3c
commit da630e1b63
11 changed files with 107 additions and 16 deletions
@@ -924,7 +924,20 @@
if(ishuman(usr)) //mid-round preference changes, for aesthetics
var/mob/living/carbon/human/H = usr
H.remake_hud()
if("map_pick")
var/list/potential_maps = list()
for(var/x in subtypesof(/datum/map))
var/datum/map/M = x
if(!initial(M.voteable))
continue
potential_maps += M
var/list/output = tgui_input_ranked_list(usr, "Pick a map, in order of most wanted to least. This will go on until there are no more maps left.", "Maps", potential_maps)
if(!length(output))
return
map_vote_pref_json = list() //Clear it out
for(var/index in 1 to length(output)) //This is an associated list to make blackbox tracking easier
map_vote_pref_json[output[index]] = index
if("tgui")
toggles2 ^= PREFTOGGLE_2_FANCYUI
@@ -132,6 +132,8 @@ GLOBAL_LIST_INIT(special_role_times, list(
var/list/admin_sound_ckey_ignore = list()
/// View range preference for this client
var/viewrange = DEFAULT_CLIENT_VIEWSIZE
/// Map preferences for the first past the post system
var/list/map_vote_pref_json = list()
/datum/preferences/New(client/C, datum/db_query/Q) // Process our query
parent = C
@@ -170,7 +172,7 @@ GLOBAL_LIST_INIT(special_role_times, list(
dat += "<center>"
dat += "<a href='byond://?_src_=prefs;preference=tab;tab=[TAB_CHAR]' [current_tab == TAB_CHAR ? "class='linkOn'" : ""]>Character Settings</a>"
dat += "<a href='byond://?_src_=prefs;preference=tab;tab=[TAB_GAME]' [current_tab == TAB_GAME ? "class='linkOn'" : ""]>Game Preferences</a>"
dat += "<a href='byond://?_src_=prefs;preference=tab;tab=[TAB_ANTAG]' [current_tab == TAB_ANTAG ? "class='linkOn'" : ""]>Antagonists</a>"
dat += "<a href='byond://?_src_=prefs;preference=tab;tab=[TAB_ANTAG]' [current_tab == TAB_ANTAG ? "class='linkOn'" : ""]>Antagonists and Maps</a>"
dat += "<a href='byond://?_src_=prefs;preference=tab;tab=[TAB_KEYS]' [current_tab == TAB_KEYS ? "class='linkOn'" : ""]>Key Bindings</a>"
dat += "<a href='byond://?_src_=prefs;preference=tab;tab=[TAB_TOGGLES]' [current_tab == TAB_TOGGLES ? "class='linkOn'" : ""]>General Preferences</a>"
dat += "</center>"
@@ -482,7 +484,7 @@ GLOBAL_LIST_INIT(special_role_times, list(
dat += "<b> - TGUI Say Theme:</b> <a href='byond://?_src_=prefs;preference=tgui_say_light_mode'>[(toggles2 & PREFTOGGLE_2_ENABLE_TGUI_SAY_LIGHT_MODE) ? "Light" : "Dark"]</a><br>"
dat += "</td></tr></table>"
if(TAB_ANTAG) // Antagonist's Preferences
if(TAB_ANTAG) // Antagonist's Preferences (and maps)
dat += "<table><tr><td width='340px' height='300px' valign='top'>"
dat += "<h2>Special Role Settings</h2>"
if(jobban_isbanned(user, ROLE_SYNDICATE))
@@ -504,12 +506,14 @@ GLOBAL_LIST_INIT(special_role_times, list(
else
var/is_special = (i in src.be_special)
dat += "<b>Be [capitalize(i)]:</b><a class=[is_special ? "green" : "red"] href='byond://?_src_=prefs;preference=be_special;role=[i]'><b>[(is_special) ? "Yes" : "No"]</b></a><br>"
dat += "<h2>Total Playtime:</h2>"
if(!GLOB.configuration.jobs.enable_exp_tracking)
dat += "<span class='warning'>Playtime tracking is not enabled.</span>"
else
dat += "<b>Your [EXP_TYPE_CREW] playtime is [user.client.get_exp_type(EXP_TYPE_CREW)]</b><br>"
dat += "</td><td width='405px' height='300px' valign='top'>"
dat += "<h2>Map Settings</h2>"
dat += " - <b>Choose your map preferences:</b> <a href='byond://?_src_=prefs;preference=map_pick'><b>Click here!</b></a><br>"
dat += "</td></tr></table>"
if(TAB_KEYS)
@@ -4,6 +4,7 @@
//general preferences
var/raw_muted_admins
var/raw_fptp
while(query.NextRow())
ooccolor = query.item[1]
UI_style = query.item[2]
@@ -32,6 +33,7 @@
server_region = query.item[25]
raw_muted_admins = query.item[26]
viewrange = query.item[27]
raw_fptp = query.item[28]
lastchangelog_2 = lastchangelog // Clone please
@@ -60,7 +62,11 @@
admin_sound_ckey_ignore = json_decode(raw_muted_admins)
catch
admin_sound_ckey_ignore = list() // Invalid JSON, handle safely please
if(length(raw_fptp))
try
map_vote_pref_json = json_decode(raw_fptp)
catch
map_vote_pref_json = list()
// Sanitize the region
if(!(server_region in GLOB.configuration.system.region_map))
server_region = null // This region doesnt exist anymore
@@ -104,7 +110,8 @@
keybindings=:keybindings,
server_region=:server_region,
muted_adminsounds_ckeys=:muted_adminsounds_ckeys,
viewrange=:viewrange
viewrange=:viewrange,
map_vote_pref_json=:map_vote_pref_json
WHERE ckey=:ckey"}, list(
// OH GOD THE PARAMETERS
"ooccolour" = ooccolor,
@@ -133,7 +140,8 @@
"ckey" = C.ckey,
"server_region" = server_region,
"muted_adminsounds_ckeys" = json_encode(admin_sound_ckey_ignore),
"viewrange" = viewrange
"viewrange" = viewrange,
"map_vote_pref_json" = json_encode(map_vote_pref_json)
))
if(!query.warn_execute())