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
-8
View File
@@ -60,21 +60,13 @@
closeToolTip(usr)
//used to update the buttons icon.
/mob/proc/update_action_buttons_icon()
return
/mob/living/update_action_buttons_icon()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
//This is the proc used to update all the action buttons.
/mob/proc/update_action_buttons(reload_screen)
return
/mob/living/update_action_buttons(reload_screen)
if(!hud_used || !client)
return
+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
+14 -14
View File
@@ -13,7 +13,7 @@
var/button_icon = 'icons/mob/actions.dmi'
var/button_icon_state = "default"
var/background_icon_state = "bg_default"
var/mob/living/owner
var/mob/owner
/datum/action/New(Target)
target = Target
@@ -29,23 +29,23 @@
button = null
return ..()
/datum/action/proc/Grant(mob/living/L)
/datum/action/proc/Grant(mob/M)
if(owner)
if(owner == L)
if(owner == M)
return
Remove(owner)
owner = L
L.actions += src
if(L.client)
L.client.screen += button
L.update_action_buttons()
owner = M
M.actions += src
if(M.client)
M.client.screen += button
M.update_action_buttons()
/datum/action/proc/Remove(mob/living/L)
if(L.client)
L.client.screen -= button
/datum/action/proc/Remove(mob/M)
if(M.client)
M.client.screen -= button
button.moved = FALSE //so the button appears in its normal position when given to another owner.
L.actions -= src
L.update_action_buttons()
M.actions -= src
M.update_action_buttons()
owner = null
/datum/action/proc/Trigger()
@@ -256,7 +256,7 @@
owner << "<span class='notice'>Research analyzer is now [owner.research_scanner ? "active" : "deactivated"].</span>"
return 1
/datum/action/item_action/toggle_research_scanner/Remove(mob/living/L)
/datum/action/item_action/toggle_research_scanner/Remove(mob/M)
if(owner)
owner.research_scanner = 0
..()
Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 82 KiB