diff --git a/code/datums/vote.dm b/code/datums/vote.dm
index 8856cb51935..dc193540d32 100644
--- a/code/datums/vote.dm
+++ b/code/datums/vote.dm
@@ -5,3 +5,7 @@
var/mode = 0 // 0 = restart vote, 1 = mode vote
// modes which can be voted for
var/winner = null // the vote winner
+
+ var/customname
+ var/choices = list()
+ var/enteringchoices = 0
\ No newline at end of file
diff --git a/code/game/vote.dm b/code/game/vote.dm
index 2c3b57034bc..cd627866172 100644
--- a/code/game/vote.dm
+++ b/code/game/vote.dm
@@ -58,7 +58,14 @@
calcwin()
- if(mode)
+ if(mode == 2)
+ var/wintext = capitalize(winner)
+ world << "Result is [wintext]"
+ for(var/md in vote.choices)
+ vote.choices -= md
+ return
+
+ else if(mode == 1)
if(ticker.current_state == 1)
if(!going)
world << "The game will start soon."
@@ -191,12 +198,38 @@
if(vote.voting)
// vote in progress, do the current
- text += "Vote to [vote.mode?"change mode":"restart round"] in progress.
"
- text += "[vote.endwait()] until voting is closed.
"
-
var/list/votes = vote.getvotes()
+ if(vote.mode == 2)
+ text += "A custom vote is in progress.
"
+ text += "[vote.endwait()] until voting is closed.
"
+ text += "[vote.customname]"
- if(vote.mode) // true if changing mode
+ for(var/md in vote.choices)
+ var/disp = capitalize(md)
+ if(md=="default")
+ disp = "No change"
+
+ //world << "[md]|[disp]|[src.client.vote]|[votes[md]]"
+
+ if(src.client.vote == md)
+ text += "
[disp]"
+ else
+ text += "[disp]"
+
+ text += "[votes[md]>0?" - [votes[md]] vote\s":null]
"
+
+ text += ""
+
+ text +="Current winner: [vote.calcwin()]
"
+
+ text += footer
+
+ usr << browse(text, "window=vote")
+
+ else if(vote.mode == 1) // true if changing mode
+
+ text += "Vote to change mode in progress.
"
+ text += "[vote.endwait()] until voting is closed.
"
text += "Current game mode is: [master_mode].
Select the mode to change to:
"
@@ -223,6 +256,8 @@
usr << browse(text, "window=vote")
else // voting to restart
+ text += "Vote to restart round in progress.
"
+ text += "[vote.endwait()] until voting is closed.
"
text += "Restart the world?
"
@@ -279,12 +314,13 @@
text += "Begin change mode vote.
"
else
text += "Change mode votes are disabled while a round is in progress, vote to restart first.
"
-
+ if(src.client.holder) //Strumpetplaya Add - Custom Votes for Admins
+ text += "Begin custom vote.
"
text += footer
usr << browse(text, "window=vote")
spawn(20)
- if(usr.client && usr.client.showvote)
+ if(usr.client && usr.client.showvote && !vote.enteringchoices)
usr.vote()
else
usr << browse(null, "window=vote")
@@ -312,6 +348,48 @@
return
vote.mode = text2num(href_list["vmode"])-1 // hack to yield 0=restart, 1=changemode
+
+ if(vote.mode == 2)
+ vote.enteringchoices = 1
+ vote.voting = 1
+ vote.customname = input(usr, "What are you voting for?", "Custom Vote") as text
+ if(!vote.customname)
+ vote.enteringchoices = 0
+ vote.voting = 0
+ return
+
+ var/N = input(usr, "How many options does this vote have?", "Custom Vote", 0) as num
+ if(!N)
+ vote.enteringchoices = 0
+ vote.voting = 0
+ return
+ //world << "You're voting for [N] options!"
+ var/i
+ for(i=1; i<=N; i++)
+ var/addvote = input(usr, "What is option #[i]?", "Enter Option #[i]") as text
+ vote.choices += addvote
+ //for(var/O in vote.choices)
+ //world << "[O]"
+ vote.enteringchoices = 0
+ vote.votetime = world.timeofday + config.vote_period*10 // when the vote will end
+
+ spawn(config.vote_period * 10)
+ vote.endvote()
+
+ world << "\red*** A custom vote has been initiated by [M.key]."
+ world << "\red You have [vote.timetext(config.vote_period)] to vote."
+
+ //log_vote("Voting to [vote.mode ? "change mode" : "restart round"] started by [M.name]/[M.key]")
+
+ for(var/client/C)
+ if(config.vote_no_default || (config.vote_no_dead && C.mob.stat == 2))
+ C.vote = "none"
+ else
+ C.vote = "default"
+
+ if(M) M.vote()
+ return
+
if(!ticker && vote.mode == 1)
if(going)
world << "The game start has been delayed."
diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm
index b2efa177b5a..6730f0a6116 100644
--- a/code/modules/admin/admin.dm
+++ b/code/modules/admin/admin.dm
@@ -2195,18 +2195,40 @@
set desc="Starts vote"
if (!usr.client.holder)
return
- var/confirm = alert("What vote would you like to start?", "Vote", "Restart", "Change Game Mode", "Cancel")
- if(confirm == "Cancel")
- return
- if(confirm == "Restart")
- vote.mode = 0
- // hack to yield 0=restart, 1=changemode
- if(confirm == "Change Game Mode")
- vote.mode = 1
- if(!ticker)
- if(going)
- world << "The game start has been delayed."
- going = 0
+ var/confirm = alert("What vote would you like to start?", "Vote", "Restart", "Custom Vote", "Change Game Mode", "Cancel")
+ switch(confirm)
+ if("Cancel")
+ return
+ if("Restart")
+ vote.mode = 0
+ // hack to yield 0=restart, 1=changemode
+ if("Change Game Mode")
+ vote.mode = 1
+ if(!ticker)
+ if(going)
+ world << "The game start has been delayed."
+ going = 0
+ if("Custom Vote")
+ vote.mode = 2
+ vote.enteringchoices = 1
+ vote.customname = input(usr, "What are you voting for?", "Custom Vote") as text
+ if(!vote.customname)
+ vote.enteringchoices = 0
+ vote.voting = 0
+ return
+
+ var/N = input(usr, "How many options does this vote have?", "Custom Vote", 0) as num
+ if(!N)
+ vote.enteringchoices = 0
+ vote.voting = 0
+ return
+
+ var/i
+ for(i=1; i<=N; i++)
+ var/addvote = input(usr, "What is option #[i]?", "Enter Option #[i]") as text
+ vote.choices += addvote
+ vote.enteringchoices = 0
+
vote.voting = 1
// now voting
vote.votetime = world.timeofday + config.vote_period*10