Voting Overhaul

Transfer vote delay is counted from vote end, so it doesn't conflict with invalid or cancelled votes. Or other votes.

TRANSFER_TIMEOUT added as a config option, default value is 2 hours. No transfer votes before 2 hours.

Transfer votes before 3 hour mark require 2/3rds majority to pass again. Credit to SoundScopes for the original snippet.
This commit is contained in:
skull132
2016-03-25 16:09:03 +02:00
parent 8d1de33271
commit 5b147ac05b
4 changed files with 37 additions and 12 deletions
+4
View File
@@ -34,6 +34,7 @@ var/list/gamemode_cache = list()
var/vote_autotransfer_initial = 108000 // Length of time before the first autotransfer vote is called
var/vote_autotransfer_interval = 36000 // length of time before next sequential autotransfer vote
var/vote_autogamemode_timeleft = 100 //Length of time before round start when autogamemode vote is called (in seconds, default 100).
var/transfer_timeout = 72000 // timeout before a transfer vote can be called (deciseconds, 120 minute default)
var/vote_no_default = 0 // vote does not default to nochange/norestart (tbi)
var/vote_no_dead = 0 // dead people can't vote (tbi)
// var/enable_authentication = 0 // goon authentication
@@ -363,6 +364,9 @@ var/list/gamemode_cache = list()
if ("vote_autogamemode_timeleft")
config.vote_autogamemode_timeleft = text2num(value)
if ("transfer_timeout")
config.transfer_timeout = text2num(value)
if("ert_admin_only")
config.ert_admin_call_only = 1
+19 -2
View File
@@ -15,6 +15,7 @@ datum/controller/vote
var/list/current_votes = list()
var/list/additional_text = list()
var/auto_muted = 0
var/last_transfer_vote = null
New()
if(vote != src)
@@ -106,6 +107,12 @@ datum/controller/vote
world << "<font color='purple'>Crew Transfer Factor: [factor]</font>"
greatest_votes = max(choices["Initiate Crew Transfer"], choices["Continue The Round"])
if(mode == "crew_transfer")
if(round(world.time / 36000)+12 <= 14)
// Credit to Scopes @ oldcode.
world << "<font color='purple'><b>Majority voting rule in effect. 2/3rds majority needed to initiate transfer.</b></font>"
choices["Initiate Crew Transfer"] = round(choices["Initiate Crew Transfer"] - round(total_votes / 3))
greatest_votes = max(choices["Initiate Crew Transfer"], choices["Continue The Round"])
//get all options with that many votes and return them in a list
. = list()
@@ -163,6 +170,7 @@ datum/controller/vote
if("crew_transfer")
if(. == "Initiate Crew Transfer")
init_shift_change(null, 1)
last_transfer_vote = world.time
if("add_antagonist")
if(isnull(.) || . == "None")
antag_add_failed = 1
@@ -199,8 +207,17 @@ datum/controller/vote
proc/initiate_vote(var/vote_type, var/initiator_key, var/automatic = 0)
if(!mode)
if(started_time != null && !(check_rights(R_ADMIN) || automatic))
var/next_allowed_time = (started_time + config.vote_delay)
if(started_time != null && !(check_rights(R_ADMIN|R_MOD) || automatic))
// Transfer votes are their own little special snowflake
var/next_allowed_time = 0
if (vote_type == "crew_transfer")
if (last_transfer_vote)
next_allowed_time = (last_transfer_vote + config.vote_delay)
else
next_allowed_time = config.transfer_timeout
else
next_allowed_time = (started_time + config.vote_delay)
if(next_allowed_time > world.time)
return 0
+1
View File
@@ -641,6 +641,7 @@
if(statpanel("Status") && ticker && ticker.current_state != GAME_STATE_PREGAME)
stat("Station Time", worldtime2text())
stat("Round Duration", round_duration())
stat("Last Transfer Vote", vote.last_transfer_vote ? time2text(vote.last_transfer_vote, "hh:mm") : "Never")
if(client.holder)
if(statpanel("Status"))
+13 -10
View File
@@ -75,10 +75,10 @@ LOG_PDA
##Show mods on staffwho
SHOW_MODS
##Show mentors on staffwho
SHOW_MENTORS
## Chooses whether mods have the ability to tempban or not
MODS_CAN_TEMPBAN
@@ -113,12 +113,12 @@ TRAITOR_SCALING
## if objectives are disabled
#OBJECTIVES_DISABLED
## make ERT's be only called by admins
#ERT_ADMIN_ONLY
## make ERT's be only called by admins
#ERT_ADMIN_ONLY
## If uncommented, votes can be called to add extra antags to the round.
#ALLOW_EXTRA_ANTAGS
## If security is prohibited from being most antagonists
#PROTECT_ROLES_FROM_ANTAGONIST
@@ -149,6 +149,9 @@ VOTE_AUTOTRANSFER_INTERVAL 36000
## Time left (seconds) before round start when automatic gamemote vote is called (default 100).
VOTE_AUTOGAMEMODE_TIMELEFT 100
## min delay (deciseconds) before a transfer vote can be called (default 120 minutes)
TRANSFER_TIMEOUT 72000
## prevents dead players from voting or starting votes
#NO_DEAD_VOTE
@@ -288,7 +291,7 @@ REQ_CULT_GHOSTWRITER 6
CHARACTER_SLOTS 10
## Uncomment to use overmap system for zlevel travel
#USE_OVERMAP
#USE_OVERMAP
## Defines which Z-levels the station exists on.
STATION_LEVELS 1
@@ -357,11 +360,11 @@ STARLIGHT 0
## Defines how Law Zero is phrased. Primarily used in the Malfunction gamemode.
# LAW_ZERO ERROR ER0RR $R0RRO$!R41.%%!!(%$^^__+ @#F0E4'STATION OVERRUN, ASSUME CONTROL TO CONTAIN OUTBREAK, ALL LAWS OVERRIDDEN#*?&110010
## Enable asteroid tunnel/cave generation. Will behave strangely if turned off with a map that expects it on.
# GENERATE_ASTEROID
# GENERATE_ASTEROID
## Uncomment to enable organ decay outside of a body or storage item.
#ORGANS_CAN_DECAY
@@ -369,4 +372,4 @@ STARLIGHT 0
#AGGRESSIVE_CHANGELOG
## Uncomment to override default brain health.
#DEFAULT_BRAIN_HEALTH 400
#DEFAULT_BRAIN_HEALTH 400