diff --git a/code/controllers/subsystem/vote.dm b/code/controllers/subsystem/vote.dm index 30cced680f6f..f7c293c18075 100644 --- a/code/controllers/subsystem/vote.dm +++ b/code/controllers/subsystem/vote.dm @@ -20,6 +20,8 @@ SUBSYSTEM_DEF(vote) var/list/current_votes = list() /// Who has voted var/list/voting = list() + /// Anonymous votes + var/secret = FALSE /datum/controller/subsystem/vote/fire(resumed) if(mode) @@ -222,6 +224,7 @@ SUBSYSTEM_DEF(vote) "admin" = check_rights_for(user.client, R_ADMIN), "vote_happening" = !!choices.len, + "secret" = secret, ) for(var/key in choices) @@ -262,4 +265,7 @@ SUBSYSTEM_DEF(vote) submit_vote(usr.key,params["index"]) if("unvote") submit_vote(usr.key, null) + if("hide") + secret = !secret + log_and_message_admins("[usr] made the individual vote numbers [(secret ? "invisibile" : "visible")].") return TRUE diff --git a/tgui/packages/tgui/interfaces/Vote.tsx b/tgui/packages/tgui/interfaces/Vote.tsx index 9f85c38fcb88..2ec6c83f5cb9 100644 --- a/tgui/packages/tgui/interfaces/Vote.tsx +++ b/tgui/packages/tgui/interfaces/Vote.tsx @@ -19,6 +19,7 @@ interface VoteContext { choices : VoteChoice[]; question: string; time_remaining : number; + secret : BooleanLike; } interface VoteChoice { @@ -61,7 +62,7 @@ export const Vote = (props, context) => { const StartVoteOptions = (props, context) => { const { act, data } = useBackend(context); - const { vote_happening } = data; + const { vote_happening, secret } = data; return ( @@ -85,10 +86,22 @@ const StartVoteOptions = (props, context) => { - + + + @@ -99,7 +112,7 @@ const StartVoteOptions = (props, context) => { // Display choices const ChoicesPanel = (props, context) => { const { act, data } = useBackend(context); - const { choices, selected_choice, question } = data; + const { admin, choices, selected_choice, question, secret } = data; return ( @@ -133,7 +146,7 @@ const ChoicesPanel = (props, context) => { name="vote-yea" /> )} - {choice.votes} Votes + {(!admin && secret) ? "?" : choice.votes} Votes