Doesn't delete the old auto transfer behavior.

This commit is contained in:
Ghommie
2020-03-12 21:15:12 +01:00
parent 663a849afe
commit 0602e728c0
3 changed files with 21 additions and 10 deletions

View File

@@ -88,13 +88,17 @@
config_entry_value = 72000
min_val = 0
/datum/config_entry/number/vote_autotransfer_interval //length of time to wait before subsequent autotransfer votes (deciseconds, default 30 minutes)
///length of time to wait before subsequent autotransfer votes (deciseconds, default 30 minutes)
/datum/config_entry/number/vote_autotransfer_interval
config_entry_value = 18000
min_val = 0
/datum/config_entry/number/vote_autotransfer_maximum // maximum extensions until the round autoends, set to 0 to disable.
/// maximum extensions until the round autoends.
/// Set to 0 to force automatic crew transfer after the 'vote_autotransfer_initial' elapsed.
/// Set to -1 to disable the maximum extensions cap.
/datum/config_entry/number/vote_autotransfer_maximum
config_entry_value = 4
min_val = 0
min_val = -1
/datum/config_entry/flag/default_no_vote // vote does not default to nochange/norestart

View File

@@ -1,3 +1,5 @@
#define NO_MAXVOTES_CAP -1
SUBSYSTEM_DEF(autotransfer)
name = "Autotransfer Vote"
flags = SS_KEEP_TIMING | SS_BACKGROUND
@@ -11,7 +13,7 @@ SUBSYSTEM_DEF(autotransfer)
/datum/controller/subsystem/autotransfer/Initialize(timeofday)
var/init_vote = CONFIG_GET(number/vote_autotransfer_initial)
if(init_vote == 0) //Autotransfer voting disabled.
if(!init_vote) //Autotransfer voting disabled.
can_fire = FALSE
return ..()
starttime = world.time
@@ -27,10 +29,13 @@ SUBSYSTEM_DEF(autotransfer)
curvotes = SSautotransfer.curvotes
/datum/controller/subsystem/autotransfer/fire()
if(!maxvotes || maxvotes > curvotes)
if(world.time > targettime)
SSvote.initiate_vote("transfer","server")
targettime = targettime + voteinterval
curvotes += 1
if(world.time < targettime)
return
if(maxvotes == NO_MAXVOTES_CAP || maxvotes > curvotes)
SSvote.initiate_vote("transfer","server")
targettime = targettime + voteinterval
curvotes++
else
SSshuttle.autoEnd()
#undef NO_MAXVOTES_CAP

View File

@@ -191,7 +191,9 @@ VOTE_AUTOTRANSFER_INITIAL 72000
## autovote delay (deciseconds) before sequential automatic transfer votes are called (default 30 minutes)
VOTE_AUTOTRANSFER_INTERVAL 18000
## autovote maximum votes until automatic transfer call, set to 0 to disable. (default 4)
## autovote maximum votes until automatic transfer call. (default 4)
## Set to 0 to force automatic crew transfer after the 'vote_autotransfer_initial' elapsed.
## Set to -1 to disable the maximum votes cap.
VOTE_AUTOTRANSFER_MAXIMUM 4
## prevents dead players from voting or starting votes