in game votes now provoke an action button, even as a ghost or a new_player on the title screen

This commit is contained in:
Incoming
2016-06-04 23:57:24 -04:00
parent 1b8f7eaa99
commit 2783ce0a42
4 changed files with 37 additions and 22 deletions
+23
View File
@@ -14,6 +14,7 @@ var/datum/subsystem/vote/SSvote
var/list/choices = list()
var/list/voted = list()
var/list/voting = list()
var/list/generated_actions = list()
/datum/subsystem/vote/New()
NEW_SS_GLOBAL(SSvote)
@@ -44,6 +45,7 @@ var/datum/subsystem/vote/SSvote
choices.Cut()
voted.Cut()
voting.Cut()
remove_action_buttons()
/datum/subsystem/vote/proc/get_result()
//get the highest number of votes
@@ -100,6 +102,7 @@ var/datum/subsystem/vote/SSvote
else
text += "<b>Vote Result: Inconclusive - No Votes!</b>"
log_vote(text)
remove_action_buttons()
world << "\n<font color='purple'>[text]</font>"
return .
@@ -186,6 +189,10 @@ var/datum/subsystem/vote/SSvote
log_vote(text)
world << "\n<font color='purple'><b>[text]</b>\nType <b>vote</b> or click <a href='?src=\ref[src]'>here</a> to place your votes.\nYou have [config.vote_period/10] seconds to vote.</font>"
time_remaining = round(config.vote_period/10)
for(var/client/C in clients)
var/datum/action/vote/V = new
V.Grant(C.mob)
generated_actions += V
return 1
return 0
@@ -271,6 +278,11 @@ var/datum/subsystem/vote/SSvote
submit_vote(round(text2num(href_list["vote"])))
usr.vote()
/datum/subsystem/vote/proc/remove_action_buttons()
for(var/datum/action/vote/V in generated_actions)
if(!qdeleted(V))
V.Remove(V.owner)
generated_actions = list()
/mob/verb/vote()
set category = "OOC"
@@ -281,3 +293,14 @@ var/datum/subsystem/vote/SSvote
popup.set_content(SSvote.interface(client))
popup.open(0)
/datum/action/vote
name = "Vote!"
button_icon_state = "vote"
/datum/action/vote/Trigger()
if(owner)
owner.vote()
Remove(owner)
/datum/action/vote/IsAvailable()
return 1