This commit is contained in:
LetterJay
2017-05-16 21:36:07 -05:00
parent de10ad3ad2
commit f3e8cd3e2d
+80 -76
View File
@@ -415,68 +415,82 @@
return new /datum/projectile_data(src_x, src_y, time, distance, power_x, power_y, dest_x, dest_y)
/proc/showCandidatePollWindow(mob/dead/observer/G, poll_time, Question, list/candidates, ignore_category, time_passed, flashwindow = TRUE)
/proc/showCandidatePollWindow(mob/M, poll_time, Question, list/candidates, ignore_category, time_passed, flashwindow = TRUE)
set waitfor = 0
G << 'sound/misc/notice2.ogg' //Alerting them to their consideration
M << 'sound/misc/notice2.ogg' //Alerting them to their consideration
if(flashwindow)
window_flash(G.client)
switch(ignore_category ? askuser(G,Question,"Please answer in [poll_time/10] seconds!","Yes","No","Never for this round", StealFocus=0, Timeout=poll_time) : askuser(G,Question,"Please answer in [poll_time/10] seconds!","Yes","No", StealFocus=0, Timeout=poll_time))
window_flash(M.client)
switch(ignore_category ? askuser(M,Question,"Please answer in [poll_time/10] seconds!","Yes","No","Never for this round", StealFocus=0, Timeout=poll_time) : askuser(M,Question,"Please answer in [poll_time/10] seconds!","Yes","No", StealFocus=0, Timeout=poll_time))
if(1)
to_chat(G, "<span class='notice'>Choice registered: Yes.</span>")
to_chat(M, "<span class='notice'>Choice registered: Yes.</span>")
if((world.time-time_passed)>poll_time)
to_chat(G, "<span class='danger'>Sorry, you were too late for the consideration!</span>")
G << 'sound/machines/buzz-sigh.ogg'
to_chat(M, "<span class='danger'>Sorry, you were too late for the consideration!</span>")
M << 'sound/machines/buzz-sigh.ogg'
else
candidates += G
candidates += M
if(2)
to_chat(G, "<span class='danger'>Choice registered: No.</span>")
to_chat(M, "<span class='danger'>Choice registered: No.</span>")
candidates -= M
if(3)
var/list/L = GLOB.poll_ignore[ignore_category]
if(!L)
GLOB.poll_ignore[ignore_category] = list()
GLOB.poll_ignore[ignore_category] += G.ckey
to_chat(G, "<span class='danger'>Choice registered: Never for this round.</span>")
GLOB.poll_ignore[ignore_category] += M.ckey
to_chat(M, "<span class='danger'>Choice registered: Never for this round.</span>")
candidates -= M
else
candidates -= M
/proc/pollCandidates(var/Question, var/jobbanType, var/datum/game_mode/gametypeCheck, var/be_special_flag = 0, var/poll_time = 300, var/ignore_category = null, flashwindow = TRUE)
var/list/mob/dead/observer/candidates = list()
/proc/pollGhostCandidates(Question, jobbanType, datum/game_mode/gametypeCheck, be_special_flag = 0, poll_time = 300, ignore_category = null, flashwindow = TRUE)
var/list/candidates = list()
for(var/mob/dead/observer/G in GLOB.player_list)
candidates += G
pollCandidates(Question, jobbanType, gametypeCheck, be_special_flag, poll_time, ignore_category, flashwindow, candidates)
return candidates
/proc/pollCandidates(Question, jobbanType, datum/game_mode/gametypeCheck, be_special_flag = 0, poll_time = 300, ignore_category = null, flashwindow = TRUE, list/group = null)
var/time_passed = world.time
if (!Question)
Question = "Would you like to be a special role?"
for(var/mob/dead/observer/G in GLOB.player_list)
if(!G.key || !G.client || (ignore_category && GLOB.poll_ignore[ignore_category] && G.ckey in GLOB.poll_ignore[ignore_category]))
for(var/m in group)
var/mob/M = m
if(!M.key || !M.client || (ignore_category && GLOB.poll_ignore[ignore_category] && M.ckey in GLOB.poll_ignore[ignore_category]))
continue
if(be_special_flag)
if(!(G.client.prefs) || !(be_special_flag in G.client.prefs.be_special))
if(!(M.client.prefs) || !(be_special_flag in M.client.prefs.be_special))
continue
if (gametypeCheck)
if(!gametypeCheck.age_check(G.client))
if(gametypeCheck)
if(!gametypeCheck.age_check(M.client))
continue
if (jobbanType)
if(jobban_isbanned(G, jobbanType) || jobban_isbanned(G, "Syndicate"))
if(jobbanType)
if(jobban_isbanned(M, jobbanType) || jobban_isbanned(M, "Syndicate"))
continue
showCandidatePollWindow(G, poll_time, Question, candidates, ignore_category, time_passed, flashwindow)
showCandidatePollWindow(M, poll_time, Question, group, ignore_category, time_passed, flashwindow)
sleep(poll_time)
//Check all our candidates, to make sure they didn't log off during the wait period.
for(var/mob/dead/observer/G in candidates)
if(!G.key || !G.client)
candidates.Remove(G)
//Check all our candidates, to make sure they didn't log off or get deleted during the wait period.
for(var/mob/M in group)
if(!M.key || !M.client)
group -= M
listclearnulls(candidates)
listclearnulls(group)
return candidates
return group
/proc/pollCandidatesForMob(Question, jobbanType, datum/game_mode/gametypeCheck, be_special_flag = 0, poll_time = 300, mob/M, ignore_category = null)
var/list/L = pollCandidates(Question, jobbanType, gametypeCheck, be_special_flag, poll_time, ignore_category)
var/list/L = pollGhostCandidates(Question, jobbanType, gametypeCheck, be_special_flag, poll_time, ignore_category)
if(!M || QDELETED(M) || !M.loc)
return list()
return L
/proc/pollCandidatesForMobs(Question, jobbanType, datum/game_mode/gametypeCheck, be_special_flag = 0, poll_time = 300, list/mobs, ignore_category = null)
var/list/L = pollCandidates(Question, jobbanType, gametypeCheck, be_special_flag, poll_time, ignore_category)
var/list/L = pollGhostCandidates(Question, jobbanType, gametypeCheck, be_special_flag, poll_time, ignore_category)
var/i=1
for(var/v in mobs)
var/atom/A = v
@@ -487,62 +501,52 @@
return L
/proc/pollCultists(var/mob/living/Nominee) // Cult Master Poll
var/time_passed = world.time
var/list/yes_voters = new
var/list/cult_total = new
if(world.time < CULT_POLL_WAIT)
Nominee << "It would be premature to select a leader while everyone is still settling in, try again in [round((CULT_POLL_WAIT-world.time)/10)] seconds"
to_chat(Nominee, "It would be premature to select a leader while everyone is still settling in, try again in [round((CULT_POLL_WAIT-world.time)/10)] seconds.")
return
for(var/datum/mind/B in SSticker.mode.cult)
var/mob/living/M = B.current
if(!M.incapacitated())
M << 'sound/hallucinations/im_here1.ogg'
M.verbs -= /mob/living/proc/cult_master
to_chat(M, "<span class='cultlarge'>Acolyte [Nominee] has asserted that they are worthy of leading the cult. A vote will be called shortly.</span>")
if(B.current)
B.current.verbs -= /mob/living/proc/cult_master
if(!B.current.incapacitated())
B.current << 'sound/hallucinations/im_here1.ogg'
to_chat(B.current, "<span class='cultlarge'>Acolyte [Nominee] has asserted that they are worthy of leading the cult. A vote will be called shortly.</span>")
sleep(250)
var/list/asked_cultists = list()
for(var/datum/mind/B in SSticker.mode.cult)
var/mob/living/M = B.current
if(!M.incapacitated())
M << 'sound/magic/exit_blood.ogg'
switch(askuser(M,"[Nominee] seeks to lead your cult, do you support them?","Please answer in 20 seconds!","Yes","No","Abstain", StealFocus=0, Timeout=200))
if(1)
if((world.time-time_passed)>500)
to_chat(M, "<span class='danger'>Sorry, your vote came too late!</span>")
M << 'sound/machines/buzz-sigh.ogg'
else
M << "<span class='notice'>Choice registered: Yes.</span>"
yes_voters += M
cult_total += M
if(2)
if((world.time-time_passed)>500)
to_chat(M, "<span class='danger'>Sorry, your vote came too late!</span>")
M << 'sound/machines/buzz-sigh.ogg'
else
to_chat(M, "<span class='danger'>Choice registered: No.</span>")
cult_total += M
if(3)
to_chat(M, "<span class='danger'>Choice registered: Abstain.</span>")
if(B.current && B.current != Nominee && !B.current.incapacitated())
B.current << 'sound/magic/exit_blood.ogg'
asked_cultists += B.current
var/list/yes_voters = pollCandidates("[Nominee] seeks to lead your cult, do you support [Nominee.p_them()]?", poll_time = 1200, group = asked_cultists)
sleep(300)
if(yes_voters.len > (cult_total.len/2))
var/datum/action/innate/cultmast/finalreck/FinalReckoning = new()
var/datum/action/innate/cultmast/cultmark/Mark = new()
FinalReckoning.Grant(Nominee)
Mark.Grant(Nominee)
Nominee.mind.special_role = "Cult Master"
Nominee.update_action_buttons_icon()
Nominee.apply_status_effect(/datum/status_effect/cult_master)
SSticker.mode.set_antag_hud(Nominee,"cultmaster")
GLOB.cult_mastered = TRUE
if(QDELETED(Nominee) || Nominee.incapacitated())
for(var/datum/mind/B in SSticker.mode.cult)
if(!B.current.incapacitated())
to_chat(B.current,"<span class='cultlarge'>[Nominee] has the cult's support and is now their master. Follow their orders to the best of your ability!")
return TRUE
else
for(var/datum/mind/B in SSticker.mode.cult)
if(!B.current.incapacitated())
to_chat(B.current, "<span class='cultlarge'>[Nominee] could not win the cult's support and shall continue to serve as an acolyte.")
if(B.current)
B.current.verbs += /mob/living/proc/cult_master
if(!B.current.incapacitated())
to_chat(B.current,"<span class='cultlarge'>[Nominee] has died in the process of attempting to win the cult's support!")
return FALSE
if(!Nominee.mind)
for(var/datum/mind/B in SSticker.mode.cult)
if(B.current)
B.current.verbs += /mob/living/proc/cult_master
if(!B.current.incapacitated())
to_chat(B.current,"<span class='cultlarge'>[Nominee] has gone insane and catatonic in the process of attempting to win the cult's support!")
return FALSE
if(LAZYLEN(yes_voters) <= LAZYLEN(asked_cultists) * 0.5)
for(var/datum/mind/B in SSticker.mode.cult)
if(B.current)
B.current.verbs += /mob/living/proc/cult_master
if(!B.current.incapacitated())
to_chat(B.current, "<span class='cultlarge'>[Nominee] could not win the cult's support and shall continue to serve as an acolyte.")
return FALSE
SSticker.mode.remove_cultist(Nominee.mind, FALSE)
Nominee.mind.add_antag_datum(ANTAG_DATUM_CULT_MASTER)
GLOB.cult_mastered = TRUE
for(var/datum/mind/B in SSticker.mode.cult)
if(!B.current.incapacitated())
to_chat(B.current,"<span class='cultlarge'>[Nominee] has won the cult's support and is now their master. Follow [Nominee.p_their()] orders to the best of your ability!")
return TRUE
/proc/poll_helper(var/mob/living/M)