Offer control to ghosts option

This commit is contained in:
Markolie
2015-09-23 04:44:12 +02:00
parent 4b2dcf2394
commit 9d49985e1c
2 changed files with 73 additions and 1 deletions
+44 -1
View File
@@ -426,4 +426,47 @@ proc/isInSight(var/atom/A, var/atom/B)
return minutes * 60 * 10
/proc/SecondsToTicks(var/seconds)
return seconds * 10
return seconds * 10
proc/pollCandidates(var/Question, var/jobbanType, var/antag_age_check = 0, var/be_special_flag = 0, var/poll_time = 300)
var/list/mob/dead/observer/candidates = list()
var/time_passed = world.time
if (!Question)
Question = "Would you like to be a special role?"
for(var/mob/dead/observer/G in player_list)
if(!G.key || !G.client)
continue
if(be_special_flag)
if(!(G.client.prefs.be_special & be_special_flag))
continue
if (antag_age_check && be_special_flag)
if(!player_old_enough_antag(G.client,be_special_flag))
continue
if (jobbanType)
if(jobban_isbanned(G, jobbanType) || jobban_isbanned(G, "Syndicate"))
continue
spawn(0)
G << 'sound/misc/notice2.ogg' //Alerting them to their consideration
switch(alert(G,Question,"Please answer in [poll_time/10] seconds!","Yes","No"))
if("Yes")
G << "<span class='notice'>Choice registered: Yes.</span>"
if((world.time-time_passed)>poll_time)//If more than 30 game seconds passed.
G << "<span class='danger'>Sorry, you were too late for the consideration!</span>"
G << 'sound/machines/buzz-sigh.ogg'
return
candidates += G
if("No")
G << "<span class='danger'>Choice registered: No.</span>"
return
else
return
sleep(poll_time)
//Check all our candidates, to make sure they didn't log off during the 30 second wait period.
for(var/mob/dead/observer/G in candidates)
if(!G.key || !G.client)
candidates.Remove(G)
return candidates
+29
View File
@@ -253,6 +253,7 @@ client
body += "<option value='?_src_=vars;make_skeleton=\ref[D]'>Make 2spooky</option>"
body += "<option value='?_src_=vars;direct_control=\ref[D]'>Assume Direct Control</option>"
body += "<option value='?_src_=vars;offer_control=\ref[D]'>Offer Control to Ghosts</option>"
body += "<option value='?_src_=vars;drop_everything=\ref[D]'>Drop Everything</option>"
body += "<option value='?_src_=vars;regenerateicons=\ref[D]'>Regenerate Icons</option>"
@@ -591,9 +592,37 @@ client
if(!istype(H))
usr << "This can only be used on instances of type /mob/living/carbon/human"
return
var/confirm = alert("Are you sure you want to turn this mob into a skeleton?","Confirm Skeleton Transformation","Yes","No")
if(confirm != "Yes")
return
H.makeSkeleton()
href_list["datumrefresh"] = href_list["make_skeleton"]
else if(href_list["offer_control"])
if(!check_rights(R_ADMIN)) return
var/mob/M = locate(href_list["offer_control"])
if(!istype(M))
usr << "This can only be used on instances of type /mob"
return
M << "Control of your mob has been offered to dead players."
log_admin("[key_name(usr)] has offered control of ([key_name(M)]) to ghosts.")
message_admins("[key_name_admin(usr)] has offered control of ([key_name_admin(M)]) to ghosts")
var/list/mob/dead/observer/candidates = pollCandidates("Do you want to play as [M.real_name]?", "Player Control", null, FALSE, 100)
var/mob/dead/observer/theghost = null
if(candidates.len)
theghost = pick(candidates)
M << "Your mob has been taken over by a ghost!"
message_admins("[key_name_admin(theghost)] has taken control of ([key_name_admin(M)])")
M.ghostize()
M.key = theghost.key
else
M << "There were no ghosts willing to take control."
message_admins("No ghosts were willing to take control of [key_name_admin(M)])")
else if(href_list["delall"])
if(!check_rights(R_DEBUG|R_SERVER)) return