Made vote not fire every tick, added "force" option that pops as soon as vote starts

This commit is contained in:
Putnam
2019-12-21 08:59:48 -08:00
parent 32ec9d6f50
commit e38396e984
2 changed files with 14 additions and 5 deletions
+2 -2
View File
@@ -481,9 +481,9 @@ SUBSYSTEM_DEF(ticker)
SSticker.modevoted = TRUE
var/dynamic = CONFIG_GET(flag/dynamic_voting)
if(dynamic)
SSvote.initiate_vote("dynamic","server",TRUE,RANKED_CHOICE_VOTING)
SSvote.initiate_vote("dynamic","server",hideresults=TRUE,votesystem=RANKED_CHOICE_VOTING,forced=TRUE)
else
SSvote.initiate_vote("roundtype","server",TRUE,PLURALITY_VOTING)
SSvote.initiate_vote("roundtype","server",hideresults=TRUE,votesystem=PLURALITY_VOTING,forced=TRUE)
/datum/controller/subsystem/ticker/Recover()
current_state = SSticker.current_state
+12 -3
View File
@@ -1,3 +1,5 @@
#define VOTE_COOLDOWN 5
SUBSYSTEM_DEF(vote)
name = "Vote"
wait = 10
@@ -17,6 +19,7 @@ SUBSYSTEM_DEF(vote)
var/list/voted = list()
var/list/voting = list()
var/list/generated_actions = list()
var/next_pop = 0
var/obfuscated = FALSE//CIT CHANGE - adds obfuscated/admin-only votes
@@ -31,13 +34,14 @@ SUBSYSTEM_DEF(vote)
for(var/client/C in voting)
C << browse(null, "window=vote;can_close=0")
reset()
else
else if(next_pop < world.time)
var/datum/browser/client_popup
for(var/client/C in voting)
client_popup = new(C, "vote", "Voting Panel")
client_popup = new(C, "vote", "Voting Panel", nwidth=600,nheight=600)
client_popup.set_window_options("can_close=0")
client_popup.set_content(interface(C))
client_popup.open(0)
next_pop = world.time+VOTE_COOLDOWN
/datum/controller/subsystem/vote/proc/reset()
@@ -263,7 +267,7 @@ SUBSYSTEM_DEF(vote)
voted[usr.ckey] += vote
return 0
/datum/controller/subsystem/vote/proc/initiate_vote(vote_type, initiator_key, hideresults, votesystem = PLURALITY_VOTING)//CIT CHANGE - adds hideresults argument to votes to allow for obfuscated votes
/datum/controller/subsystem/vote/proc/initiate_vote(vote_type, initiator_key, hideresults, votesystem = PLURALITY_VOTING, forced = FALSE)//CIT CHANGE - adds hideresults argument to votes to allow for obfuscated votes
vote_system = votesystem
if(!mode)
if(started_time)
@@ -342,6 +346,11 @@ SUBSYSTEM_DEF(vote)
C.player_details.player_actions += V
V.Grant(C.mob)
generated_actions += V
if(forced)
var/datum/browser/popup = new(C, "vote", "Voting Panel",nwidth=600,nheight=600)
popup.set_window_options("can_close=0")
popup.set_content(SSvote.interface(C))
popup.open(0)
return 1
return 0