diff --git a/code/_onclick/hud/action_button.dm b/code/_onclick/hud/action_button.dm index 73a1576deeb..106baedf8a1 100644 --- a/code/_onclick/hud/action_button.dm +++ b/code/_onclick/hud/action_button.dm @@ -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 diff --git a/code/controllers/subsystem/voting.dm b/code/controllers/subsystem/voting.dm index 6279e25fc84..87ec63891c9 100644 --- a/code/controllers/subsystem/voting.dm +++ b/code/controllers/subsystem/voting.dm @@ -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 += "Vote Result: Inconclusive - No Votes!" log_vote(text) + remove_action_buttons() world << "\n[text]" return . @@ -186,6 +189,10 @@ var/datum/subsystem/vote/SSvote log_vote(text) world << "\n[text]\nType vote or click here to place your votes.\nYou have [config.vote_period/10] seconds to vote." 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 \ No newline at end of file diff --git a/code/datums/action.dm b/code/datums/action.dm index 91e30b03a2e..4f3bc9ee301 100644 --- a/code/datums/action.dm +++ b/code/datums/action.dm @@ -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 << "Research analyzer is now [owner.research_scanner ? "active" : "deactivated"]." 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 ..() diff --git a/icons/mob/actions.dmi b/icons/mob/actions.dmi index d9724cd6f16..08dc8e19428 100644 Binary files a/icons/mob/actions.dmi and b/icons/mob/actions.dmi differ