From ca7e0ca11bb88be82230fe908c797d9730987297 Mon Sep 17 00:00:00 2001 From: Trilby Date: Mon, 13 Mar 2023 22:22:06 -0400 Subject: [PATCH 01/10] experimental end round voting --- code/controllers/subsystems/voting/poll.dm | 2 +- .../subsystems/voting/poll_types.dm | 46 +++++++++++++++---- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/code/controllers/subsystems/voting/poll.dm b/code/controllers/subsystems/voting/poll.dm index 5887c13faba..081657dc11c 100644 --- a/code/controllers/subsystems/voting/poll.dm +++ b/code/controllers/subsystems/voting/poll.dm @@ -1,6 +1,6 @@ /datum/poll var/name = "Voting" - var/question = "Voting, voting, candidates are faggots!" + var/question = "Voting, voting, candidates!" var/description = "" var/time = 60 //in seconds var/list/choice_types = list(/datum/vote_choice) //Choices will be initialized from this list diff --git a/code/controllers/subsystems/voting/poll_types.dm b/code/controllers/subsystems/voting/poll_types.dm index b98ae0a8bdb..8ed1baef1ee 100755 --- a/code/controllers/subsystems/voting/poll_types.dm +++ b/code/controllers/subsystems/voting/poll_types.dm @@ -3,6 +3,12 @@ ///////////////////VOTES////////////////////// ////////////////////////////////////////////// +#define VOTE_WEIGHT_LOW 0.6 +#define VOTE_WEIGHT_NORMAL 1 +#define VOTE_WEIGHT_HIGH 1.2 //To tie 2 dead votes but not over-rule 2 living +#define MINIMUM_VOTE_LIFETIME 15 MINUTES +#define MIN_WIN_PERCENTAGE 0.6 //at the 4 hour round we need 60% Majority to end + /datum/poll/restart name = "End Round" question = "End Shift?" @@ -17,18 +23,32 @@ multiple_votes = TRUE //Duel votes are fun can_revote = TRUE can_unvote = TRUE //In case you heck up + only_admin = TRUE see_votes = FALSE //No swaying + minimum_win_percentage = MIN_WIN_PERCENTAGE + var/non_admin = TRUE + +/datum/poll/restart/proc/lower_minium() + minimum_win_percentage -= 0.1 + + if(MIN_WIN_PERCENTAGE <= 0.2) + SSticker.shift_end(15 MINUTES) + for (var/mob/M as mob in SSmobs.mob_list) + to_chat(M, "
The round is ending do to exceeding 8 hours.

") + +/datum/poll/restart/admin + non_admin = FALSE + name = "ADMIN: End Round" + question = "End Shift?" + choice_types = list(/datum/vote_choice/restart, /datum/vote_choice/countinue_round/admin) + /*To prevent abuse and rule-by-salt, the evac vote weights each player's vote based on a few parameters If you are alive and have been for a while, then you have the normal 1 vote If you are dead, or just spawned, you get only 0.6 votes If you are an antag or a head of staff, you get 1.2 votes */ -#define VOTE_WEIGHT_LOW 0.6 -#define VOTE_WEIGHT_NORMAL 1 -#define VOTE_WEIGHT_HIGH 1.2 //To tie 2 dead votes but not over-rule 2 living -#define MINIMUM_VOTE_LIFETIME 15 MINUTES /datum/poll/restart/get_vote_power(var/client/C) if (!istype(C)) @@ -67,6 +87,18 @@ //If we get here, its just a normal player who's been playing for at least 15 minutes. Normal weight return VOTE_WEIGHT_NORMAL +/datum/poll/restart/on_end() + if(non_admin) + lower_minium() + + addtimer(CALLBACK(src, /datum/poll/restart/proc/recall_vote), 60 MINUTES) + ..() + +/datum/poll/restart/proc/recall_vote() + SSvote.start_vote(/datum/poll/restart) + + + #undef VOTE_WEIGHT_LOW #undef VOTE_WEIGHT_NORMAL #undef VOTE_WEIGHT_HIGH @@ -88,10 +120,8 @@ /datum/vote_choice/countinue_round text = "Continue Shift" - - - - +/datum/vote_choice/countinue_round/admin + text = "Continue Shift" /********************* From 485eb272e95ffb3a583aee85070ff278e354c7c5 Mon Sep 17 00:00:00 2001 From: Trilby Date: Mon, 13 Mar 2023 22:34:39 -0400 Subject: [PATCH 02/10] start the loop --- code/controllers/subsystems/ticker.dm | 2 ++ code/controllers/subsystems/vote.dm | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/code/controllers/subsystems/ticker.dm b/code/controllers/subsystems/ticker.dm index bf32b9a47bd..5385a3c2635 100644 --- a/code/controllers/subsystems/ticker.dm +++ b/code/controllers/subsystems/ticker.dm @@ -264,6 +264,8 @@ SUBSYSTEM_DEF(ticker) SEND_SOUND(world, sound('sound/AI/welcome.ogg')) // Skie //Holiday Round-start stuff ~Carn Holiday_Game_Start() + SSvote.start_restart_vote_loop() + for(var/mob/new_player/N in SSmobs.mob_list) N.new_player_panel_proc() diff --git a/code/controllers/subsystems/vote.dm b/code/controllers/subsystems/vote.dm index 293ef1c0ee7..f3217c12897 100755 --- a/code/controllers/subsystems/vote.dm +++ b/code/controllers/subsystems/vote.dm @@ -44,6 +44,12 @@ SUBSYSTEM_DEF(vote) /datum/controller/subsystem/vote/proc/autostoryteller() start_vote(/datum/poll/storyteller) +/datum/controller/subsystem/vote/proc/start_restart_vote_loop() + addtimer(CALLBACK(src, /datum/controller/subsystem/vote/proc/recall_vote), 240 MINUTES) + +/datum/controller/subsystem/vote/proc/recall_vote() + start_vote(/datum/poll/restart) + /datum/controller/subsystem/vote/proc/start_vote(newvote) if(active_vote) return FALSE From c50bf77dbaf6a48d1d9448b9e1278f7e8824e506 Mon Sep 17 00:00:00 2001 From: Trilby Date: Mon, 13 Mar 2023 22:38:15 -0400 Subject: [PATCH 03/10] Super majority end round --- code/controllers/subsystems/voting/poll_types.dm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/controllers/subsystems/voting/poll_types.dm b/code/controllers/subsystems/voting/poll_types.dm index 8ed1baef1ee..7c5b6ecc951 100755 --- a/code/controllers/subsystems/voting/poll_types.dm +++ b/code/controllers/subsystems/voting/poll_types.dm @@ -39,9 +39,13 @@ /datum/poll/restart/admin non_admin = FALSE - name = "ADMIN: End Round" + name = "Supper Majority: End Round" question = "End Shift?" choice_types = list(/datum/vote_choice/restart, /datum/vote_choice/countinue_round/admin) + minimum_win_percentage = 0.75 + next_vote = 255 MINUTES //Minimum round length before it can be called for the first time + cooldown = 30 MINUTES //Cooldown is set to 30 mins as 1 hour is a bit much when things change so much in so little time + maxium 8 hour rounds means we should be a bit more forgiven. + only_admin = FALSE /*To prevent abuse and rule-by-salt, the evac vote weights each player's vote based on a few parameters From b42088a75e0c6f0bd86ac705bcce9a999b6ddcc3 Mon Sep 17 00:00:00 2001 From: Trilbyspaceclone <30435998+Trilbyspaceclone@users.noreply.github.com> Date: Mon, 13 Mar 2023 22:43:20 -0400 Subject: [PATCH 04/10] Apply suggestions from code review --- code/controllers/subsystems/voting/poll_types.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystems/voting/poll_types.dm b/code/controllers/subsystems/voting/poll_types.dm index 7c5b6ecc951..10af2979702 100755 --- a/code/controllers/subsystems/voting/poll_types.dm +++ b/code/controllers/subsystems/voting/poll_types.dm @@ -32,7 +32,7 @@ /datum/poll/restart/proc/lower_minium() minimum_win_percentage -= 0.1 - if(MIN_WIN_PERCENTAGE <= 0.2) + if(minimum_win_percentage <= 0.2) SSticker.shift_end(15 MINUTES) for (var/mob/M as mob in SSmobs.mob_list) to_chat(M, "
The round is ending do to exceeding 8 hours.

") From 75e0fb5e8e7f202b9ce3b01b526e3964a93379b9 Mon Sep 17 00:00:00 2001 From: Trilbyspaceclone <30435998+Trilbyspaceclone@users.noreply.github.com> Date: Mon, 13 Mar 2023 22:44:16 -0400 Subject: [PATCH 05/10] Update poll_types.dm --- code/controllers/subsystems/voting/poll_types.dm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/controllers/subsystems/voting/poll_types.dm b/code/controllers/subsystems/voting/poll_types.dm index 10af2979702..6b0c799c4f3 100755 --- a/code/controllers/subsystems/voting/poll_types.dm +++ b/code/controllers/subsystems/voting/poll_types.dm @@ -7,7 +7,6 @@ #define VOTE_WEIGHT_NORMAL 1 #define VOTE_WEIGHT_HIGH 1.2 //To tie 2 dead votes but not over-rule 2 living #define MINIMUM_VOTE_LIFETIME 15 MINUTES -#define MIN_WIN_PERCENTAGE 0.6 //at the 4 hour round we need 60% Majority to end /datum/poll/restart name = "End Round" @@ -26,7 +25,7 @@ only_admin = TRUE see_votes = FALSE //No swaying - minimum_win_percentage = MIN_WIN_PERCENTAGE + minimum_win_percentage = 0.6 var/non_admin = TRUE /datum/poll/restart/proc/lower_minium() From 10eb64c3bc19dd9c1a11d54f92adab16bcd8a21e Mon Sep 17 00:00:00 2001 From: Trilbyspaceclone <30435998+Trilbyspaceclone@users.noreply.github.com> Date: Wed, 15 Mar 2023 18:40:23 -0400 Subject: [PATCH 06/10] Small fix --- code/controllers/subsystems/voting/poll_types.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/controllers/subsystems/voting/poll_types.dm b/code/controllers/subsystems/voting/poll_types.dm index 6b0c799c4f3..2aef237f371 100755 --- a/code/controllers/subsystems/voting/poll_types.dm +++ b/code/controllers/subsystems/voting/poll_types.dm @@ -108,10 +108,10 @@ #undef MINIMUM_VOTE_LIFETIME /datum/poll/restart/IsAdminOnly() - if(config.allow_vote_restart) - return FALSE - else + if(only_admin) //config.allow_vote_restart return TRUE + else + return FALSE /datum/vote_choice/restart From 80b6cb9b5e394d8d3f0b88f2badc325dd7203ad1 Mon Sep 17 00:00:00 2001 From: Trilby Date: Sat, 18 Mar 2023 21:25:25 -0400 Subject: [PATCH 07/10] stop active_votes --- code/controllers/subsystems/vote.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/controllers/subsystems/vote.dm b/code/controllers/subsystems/vote.dm index f3217c12897..9dd238b4c2b 100755 --- a/code/controllers/subsystems/vote.dm +++ b/code/controllers/subsystems/vote.dm @@ -48,6 +48,8 @@ SUBSYSTEM_DEF(vote) addtimer(CALLBACK(src, /datum/controller/subsystem/vote/proc/recall_vote), 240 MINUTES) /datum/controller/subsystem/vote/proc/recall_vote() + if(active_vote) //No sneaky attempt to stop the recall vote + stop_vote() start_vote(/datum/poll/restart) /datum/controller/subsystem/vote/proc/start_vote(newvote) From 4e5773a8f04a157f29d1fdcda840328bc87310c4 Mon Sep 17 00:00:00 2001 From: Trilbyspaceclone <30435998+Trilbyspaceclone@users.noreply.github.com> Date: Sun, 19 Mar 2023 04:06:24 -0400 Subject: [PATCH 08/10] Apply suggestions from code review --- code/controllers/subsystems/vote.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystems/vote.dm b/code/controllers/subsystems/vote.dm index 9dd238b4c2b..9b7be850151 100755 --- a/code/controllers/subsystems/vote.dm +++ b/code/controllers/subsystems/vote.dm @@ -48,7 +48,7 @@ SUBSYSTEM_DEF(vote) addtimer(CALLBACK(src, /datum/controller/subsystem/vote/proc/recall_vote), 240 MINUTES) /datum/controller/subsystem/vote/proc/recall_vote() - if(active_vote) //No sneaky attempt to stop the recall vote + if(SSvote.active_vote) //No sneaky attempt to stop the recall vote stop_vote() start_vote(/datum/poll/restart) From 6c61a298978cc32c44b713564ef357432dee7ab5 Mon Sep 17 00:00:00 2001 From: Trilby Date: Sat, 25 Mar 2023 16:48:55 -0400 Subject: [PATCH 09/10] cleaner code --- code/controllers/subsystems/vote.dm | 3 +++ .../subsystems/voting/poll_types.dm | 27 ++++++------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/code/controllers/subsystems/vote.dm b/code/controllers/subsystems/vote.dm index 9b7be850151..ca0bc10029f 100755 --- a/code/controllers/subsystems/vote.dm +++ b/code/controllers/subsystems/vote.dm @@ -47,6 +47,9 @@ SUBSYSTEM_DEF(vote) /datum/controller/subsystem/vote/proc/start_restart_vote_loop() addtimer(CALLBACK(src, /datum/controller/subsystem/vote/proc/recall_vote), 240 MINUTES) +/datum/controller/subsystem/vote/proc/recall_vote_loop() + addtimer(CALLBACK(src, /datum/controller/subsystem/vote/proc/recall_vote), 60 MINUTES) + /datum/controller/subsystem/vote/proc/recall_vote() if(SSvote.active_vote) //No sneaky attempt to stop the recall vote stop_vote() diff --git a/code/controllers/subsystems/voting/poll_types.dm b/code/controllers/subsystems/voting/poll_types.dm index 2aef237f371..60ab482ee7a 100755 --- a/code/controllers/subsystems/voting/poll_types.dm +++ b/code/controllers/subsystems/voting/poll_types.dm @@ -3,6 +3,12 @@ ///////////////////VOTES////////////////////// ////////////////////////////////////////////// +/*To prevent abuse and rule-by-salt, the evac vote weights each player's vote based on a few parameters + If you are alive and have been for a while, then you have the normal 1 vote + If you are dead, or just spawned, you get only 0.6 votes + If you are an antag or a head of staff, you get 1.2 votes +*/ + #define VOTE_WEIGHT_LOW 0.6 #define VOTE_WEIGHT_NORMAL 1 #define VOTE_WEIGHT_HIGH 1.2 //To tie 2 dead votes but not over-rule 2 living @@ -40,19 +46,12 @@ non_admin = FALSE name = "Supper Majority: End Round" question = "End Shift?" - choice_types = list(/datum/vote_choice/restart, /datum/vote_choice/countinue_round/admin) + choice_types = list(/datum/vote_choice/restart, /datum/vote_choice/countinue_round) minimum_win_percentage = 0.75 next_vote = 255 MINUTES //Minimum round length before it can be called for the first time cooldown = 30 MINUTES //Cooldown is set to 30 mins as 1 hour is a bit much when things change so much in so little time + maxium 8 hour rounds means we should be a bit more forgiven. only_admin = FALSE - -/*To prevent abuse and rule-by-salt, the evac vote weights each player's vote based on a few parameters - If you are alive and have been for a while, then you have the normal 1 vote - If you are dead, or just spawned, you get only 0.6 votes - If you are an antag or a head of staff, you get 1.2 votes -*/ - /datum/poll/restart/get_vote_power(var/client/C) if (!istype(C)) return 0 //Shouldnt be possible, but safety @@ -93,15 +92,9 @@ /datum/poll/restart/on_end() if(non_admin) lower_minium() - - addtimer(CALLBACK(src, /datum/poll/restart/proc/recall_vote), 60 MINUTES) + SSvote.recall_vote_loop() ..() -/datum/poll/restart/proc/recall_vote() - SSvote.start_vote(/datum/poll/restart) - - - #undef VOTE_WEIGHT_LOW #undef VOTE_WEIGHT_NORMAL #undef VOTE_WEIGHT_HIGH @@ -123,10 +116,6 @@ /datum/vote_choice/countinue_round text = "Continue Shift" -/datum/vote_choice/countinue_round/admin - text = "Continue Shift" - - /********************* Storyteller **********************/ From e41a5e0f1fd90c6d9e6a6de4ad3c084fdcee9619 Mon Sep 17 00:00:00 2001 From: Trilbyspaceclone <30435998+Trilbyspaceclone@users.noreply.github.com> Date: Sat, 17 Aug 2024 16:28:48 -0400 Subject: [PATCH 10/10] Apply suggestions from code review Co-authored-by: Shadow-Quill <44811257+Shadow-Quill@users.noreply.github.com> --- code/controllers/subsystems/vote.dm | 2 +- code/controllers/subsystems/voting/poll_types.dm | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/code/controllers/subsystems/vote.dm b/code/controllers/subsystems/vote.dm index ca0bc10029f..3e4306deadb 100755 --- a/code/controllers/subsystems/vote.dm +++ b/code/controllers/subsystems/vote.dm @@ -45,7 +45,7 @@ SUBSYSTEM_DEF(vote) start_vote(/datum/poll/storyteller) /datum/controller/subsystem/vote/proc/start_restart_vote_loop() - addtimer(CALLBACK(src, /datum/controller/subsystem/vote/proc/recall_vote), 240 MINUTES) + addtimer(CALLBACK(src, /datum/controller/subsystem/vote/proc/recall_vote), 4 HOURS) /datum/controller/subsystem/vote/proc/recall_vote_loop() addtimer(CALLBACK(src, /datum/controller/subsystem/vote/proc/recall_vote), 60 MINUTES) diff --git a/code/controllers/subsystems/voting/poll_types.dm b/code/controllers/subsystems/voting/poll_types.dm index 60ab482ee7a..6a4fb348a0e 100755 --- a/code/controllers/subsystems/voting/poll_types.dm +++ b/code/controllers/subsystems/voting/poll_types.dm @@ -39,16 +39,16 @@ if(minimum_win_percentage <= 0.2) SSticker.shift_end(15 MINUTES) - for (var/mob/M as mob in SSmobs.mob_list) - to_chat(M, "
The round is ending do to exceeding 8 hours.

") + for(var/mob/M as mob in SSmobs.mob_list) + to_chat(M, "
The round is ending due to exceeding 8 hours.

") /datum/poll/restart/admin non_admin = FALSE - name = "Supper Majority: End Round" + name = "Super Majority: End Round" question = "End Shift?" choice_types = list(/datum/vote_choice/restart, /datum/vote_choice/countinue_round) minimum_win_percentage = 0.75 - next_vote = 255 MINUTES //Minimum round length before it can be called for the first time + next_vote = 4 HOURS + 15 MINUTES //Minimum round length before it can be called for the first time cooldown = 30 MINUTES //Cooldown is set to 30 mins as 1 hour is a bit much when things change so much in so little time + maxium 8 hour rounds means we should be a bit more forgiven. only_admin = FALSE