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

experimental end round voting #4559

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
2 changes: 2 additions & 0 deletions code/controllers/subsystems/ticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,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()
Expand Down
11 changes: 11 additions & 0 deletions code/controllers/subsystems/vote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ 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), 4 HOURS)

/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()
start_vote(/datum/poll/restart)

/datum/controller/subsystem/vote/proc/start_vote(newvote)
if(active_vote)
return FALSE
Expand Down
58 changes: 40 additions & 18 deletions code/controllers/subsystems/voting/poll_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
///////////////////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
#define MINIMUM_VOTE_LIFETIME 15 MINUTES

/datum/poll/restart
name = "End Round"
question = "End Shift?"
Expand All @@ -17,18 +28,29 @@
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 = 0.6
var/non_admin = TRUE

/*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/proc/lower_minium()
minimum_win_percentage -= 0.1

if(minimum_win_percentage <= 0.2)
SSticker.shift_end(15 MINUTES)
for(var/mob/M as mob in SSmobs.mob_list)
to_chat(M, "<br><center><span class='danger'><b><font size=4>The round is ending due to exceeding 8 hours.</font></b><br></span></center><br>")

/datum/poll/restart/admin
non_admin = FALSE
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 = 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

/datum/poll/restart/get_vote_power(var/client/C)
if (!istype(C))
Expand Down Expand Up @@ -67,16 +89,22 @@
//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()
SSvote.recall_vote_loop()
..()

#undef VOTE_WEIGHT_LOW
#undef VOTE_WEIGHT_NORMAL
#undef VOTE_WEIGHT_HIGH
#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
Expand All @@ -88,12 +116,6 @@
/datum/vote_choice/countinue_round
text = "Continue Shift"







/*********************
Storyteller
**********************/
Expand Down
Loading