From 1b995319fa87cecd8bbc87031b444e1fbd736cdf Mon Sep 17 00:00:00 2001 From: Kyep Date: Sun, 11 Jun 2017 21:29:59 -0700 Subject: [PATCH 1/6] Admin 'Cryo SSDs' Verb Adds a 'Cryo SSDs' verb for admins. This takes all humans on the station who have been SSD for 10 minutes or more, and are not immune, and puts them in the cryopods. The idea is that it allows admins an easily way to clean up large numbers of SSD crew on the station. SSD crew who are off-station, dead, or pulled/restrained in some way are immune to this. As a side benefit, this PR also refactors cryopod.dm, removing "loc =" calls, and turning the process of entering a cryopod into a proc. --- code/game/machinery/cryopod.dm | 68 ++++++++++++------------- code/modules/admin/admin_verbs.dm | 1 + code/modules/admin/verbs/randomverbs.dm | 52 +++++++++++++++++++ code/modules/mob/living/logout.dm | 1 + code/modules/mob/mob_defines.dm | 2 + 5 files changed, 88 insertions(+), 36 deletions(-) diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index 1e31207b574..d1fa3e999c5 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -101,7 +101,7 @@ visible_message("The console beeps happily as it disgorges \the [I].") - I.loc = get_turf(src) + I.forceMove(get_turf(src)) frozen_items -= I else if(href_list["allitems"]) @@ -117,7 +117,7 @@ visible_message("The console beeps happily as it disgorges the desired objects.") for(var/obj/item/I in frozen_items) - I.loc = get_turf(src) + I.forceMove(get_turf(src)) frozen_items -= I updateUsrDialog() @@ -281,7 +281,7 @@ //Drop all items into the pod. for(var/obj/item/W in occupant) occupant.unEquip(W) - W.loc = src + W.forceMove(src) if(W.contents.len) //Make sure we catch anything not handled by qdel() on the items. var/preserve = null @@ -294,7 +294,7 @@ for(var/obj/item/O in W.contents) if(istype(O,/obj/item/weapon/tank)) //Stop eating pockets, you fuck! continue - O.loc = src + O.forceMove(src) for(var/obj/machinery/computer/cloning/cloner in machines) for(var/datum/dna2/record/R in cloner.records) @@ -328,7 +328,7 @@ control_computer.frozen_items += W W.loc = null else - W.loc = loc + W.forceMove(loc) // Skip past any cult sacrifice objective using this person if(GAMEMODE_IS_CULT && is_sacrifice_target(occupant.mind)) @@ -466,9 +466,7 @@ to_chat(user, "\The [src] is in use.") return - M.forceMove(src) - - time_till_despawn = initial(time_till_despawn) / willing + take_occupant(M, willing) else //because why the fuck would you keep going if the mob isn't in the pod to_chat(user, "You stop putting [M] into the cryopod.") @@ -563,38 +561,36 @@ if(occupant) to_chat(user, "\The [src] is in use.") return - L.forceMove(src) - time_till_despawn = initial(time_till_despawn) / willing + take_occupant(L, willing) else to_chat(user, "You stop [L == user ? "climbing into the cryo pod." : "putting [L] into the cryo pod."]") - return - if(orient_right) - icon_state = "[occupied_icon_state]-r" - else - icon_state = occupied_icon_state +/obj/machinery/cryopod/proc/take_occupant(var/mob/living/carbon/E, var/willing_factor = 1) + if(src.occupant) + return + if(!E) + return + E.forceMove(src) + time_till_despawn = initial(time_till_despawn) / willing_factor + if(orient_right) + icon_state = "[occupied_icon_state]-r" + else + icon_state = occupied_icon_state + to_chat(E, "[on_enter_occupant_message]") + to_chat(E, "If you ghost, log out or close your client now, your character will shortly be permanently removed from the round.") + occupant = E + name = "[name] ([occupant.name])" + time_entered = world.time + if(findtext("[E.key]","@",1,2)) + var/FT = replacetext(E.key, "@", "") + for(var/mob/dead/observer/Gh in respawnable_list) //this may not be foolproof but it seemed like a better option than 'in world' + if(Gh.key == FT) + if(Gh.client && Gh.client.holder) //just in case someone has a byond name with @ at the start, which I don't think is even possible but whatever + to_chat(Gh, "Warning: Your body has entered cryostorage.") + log_admin("[key_name(E)] entered a stasis pod.") + message_admins("[key_name_admin(E)] entered a stasis pod. (JMP)") + add_fingerprint(E) - to_chat(L, "[on_enter_occupant_message]") - to_chat(L, "If you ghost, log out or close your client now, your character will shortly be permanently removed from the round.") - occupant = L - name = "[name] ([occupant.name])" - time_entered = world.time - - if(findtext("[L.key]","@",1,2)) - var/FT = replacetext(L.key, "@", "") - for(var/mob/dead/observer/Gh in respawnable_list) //this may not be foolproof but it seemed like a better option than 'in world' - if(Gh.key == FT) - if(Gh.client && Gh.client.holder) //just in case someone has a byond name with @ at the start, which I don't think is even possible but whatever - to_chat(Gh, "Warning: Your body has entered cryostorage.") - - // Book keeping! - log_admin("[key_name_admin(L)] has entered a stasis pod. (JMP)") - message_admins("[key_name_admin(L)] has entered a stasis pod.") - - //Despawning occurs when process() is called with an occupant without a client. - add_fingerprint(L) - - return /obj/machinery/cryopod/verb/eject() set name = "Eject Pod" diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 4c9194d1225..07328008574 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -79,6 +79,7 @@ var/list/admin_verbs_admin = list( /client/proc/reset_all_tcs, /*resets all telecomms scripts*/ /client/proc/toggle_mentor_chat, /client/proc/toggle_advanced_interaction, /*toggle admin ability to interact with not only machines, but also atoms such as buttons and doors*/ + /client/proc/cryo_ssds, ) var/list/admin_verbs_ban = list( /client/proc/unban_panel, diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index af865f7f5c8..da2c998dc79 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -882,6 +882,58 @@ Traitors and the like can also be revived with the previous role mostly intact. message_admins("[key_name_admin(usr)] blanked all telecomms scripts.") feedback_add_details("admin_verb","RAT") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! +/client/proc/cryo_ssds() + set category = "Admin" + set name = "Cryo SSDs" + set desc = "Sends SSD players to cryo" + + if(!check_rights(R_ADMIN)) + return + + var/confirm = alert(src, "You sure you want to teleport 10+m SSD players into cryo?", "Confirm", "Yes", "No") + if(confirm != "Yes") + return + + var/list/people_to_cryo = list() + for(var/mob/living/carbon/human/H in living_mob_list) + if(!H.player_logged) + continue + if(!H.last_logout) + continue + if((H.last_logout + 6000) > world.time) + continue + if(!is_station_level(H.z)) + continue + if(!isLivingSSD(H)) + continue + if(H.anchored) + continue + if(H.stunned) + continue + if(H.handcuffed) + continue + if(H.buckled) + continue + if(H.pulledby) + continue + people_to_cryo += H + var/list/free_cryopods = list() + for(var/obj/machinery/cryopod/P in machines) + if(!P.occupant && istype(get_area(P), /area/crew_quarters/sleep)) + free_cryopods += P + var/obj/machinery/cryopod/target_cryopod = null + var/people_cryoed = 0 + for(var/mob/living/carbon/human/T in people_to_cryo) + if(free_cryopods.len) + target_cryopod = safepick(free_cryopods) + if(target_cryopod.check_occupant_allowed(T)) + target_cryopod.take_occupant(T, 1) + people_cryoed++ + to_chat(usr, "Sent [people_cryoed] people to cryostorage.") + log_admin("[key_name(usr)] sent SSDs to cryo.") + message_admins("[key_name_admin(usr)] sent SSDs to cryo.") + feedback_add_details("admin_verb","SSDCRY") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + /client/proc/toggle_ert_calling() set category = "Event" set name = "Toggle ERT" diff --git a/code/modules/mob/living/logout.dm b/code/modules/mob/living/logout.dm index 6235aecf2c4..910a72aeca3 100644 --- a/code/modules/mob/living/logout.dm +++ b/code/modules/mob/living/logout.dm @@ -9,3 +9,4 @@ if(mind.active) Sleeping(2) player_logged = 1 + last_logout = world.time diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 959913972fa..1e65b368ef0 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -189,6 +189,8 @@ var/last_movement = -100 // Last world.time the mob actually moved of its own accord. + var/last_logout = 0 + var/resize = 1 //Badminnery resize var/datum/vision_override/vision_type = null //Vision override datum. From 763c9fb84b7c2095b027f152c0fe94333f03bc27 Mon Sep 17 00:00:00 2001 From: Kyep Date: Sun, 11 Jun 2017 21:35:18 -0700 Subject: [PATCH 2/6] More duplicate code removal from cryopod.dm --- code/game/machinery/cryopod.dm | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index d1fa3e999c5..1eaed483f8e 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -480,23 +480,7 @@ to_chat(M, "[on_enter_occupant_message]") to_chat(M, "If you ghost, log out or close your client now, your character will shortly be permanently removed from the round.") - occupant = M - name = "[name] ([occupant.name])" - time_entered = world.time - - if(findtext("[M.key]","@",1,2)) - var/FT = replacetext(M.key, "@", "") - for(var/mob/dead/observer/Gh in respawnable_list) //this may not be foolproof but it seemed like a better option than 'in world' - if(Gh.key == FT) - if(Gh.client && Gh.client.holder) //just in case someone has a byond name with @ at the start, which I don't think is even possible but whatever - to_chat(Gh, "Warning: Your body has entered cryostorage.") - - // Book keeping! - log_admin("[key_name(M)] has entered a stasis pod.") - message_admins("[key_name_admin(M)] has entered a stasis pod. (JMP)") - - //Despawning occurs when process() is called with an occupant without a client. - add_fingerprint(M) + take_occupant(M, willing) /obj/machinery/cryopod/MouseDrop_T(atom/movable/O as mob|obj, mob/user as mob) From 5c2aa2208e263112f16b12ea91b6cc4d5bd6be21 Mon Sep 17 00:00:00 2001 From: Kyep Date: Mon, 12 Jun 2017 00:20:18 -0700 Subject: [PATCH 3/6] Changed to list players, and have individual cryo buttons --- code/game/machinery/cryopod.dm | 15 +++++++ code/modules/admin/admin.dm | 3 ++ code/modules/admin/admin_verbs.dm | 2 +- code/modules/admin/topic.dm | 14 +++++++ code/modules/admin/verbs/randomverbs.dm | 52 ++++++------------------- 5 files changed, 44 insertions(+), 42 deletions(-) diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index 1eaed483f8e..274e238c182 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -716,3 +716,18 @@ qdel(R.module) return ..() + +/proc/cryo_ssd(var/mob/living/carbon/person_to_cryo) + if(istype(person_to_cryo.loc, /obj/machinery/cryopod)) + return 0 + var/list/free_cryopods = list() + for(var/obj/machinery/cryopod/P in machines) + if(!P.occupant && istype(get_area(P), /area/crew_quarters/sleep)) + free_cryopods += P + var/obj/machinery/cryopod/target_cryopod = null + if(free_cryopods.len) + target_cryopod = safepick(free_cryopods) + if(target_cryopod.check_occupant_allowed(person_to_cryo)) + target_cryopod.take_occupant(person_to_cryo, 1) + return 1 + return 0 \ No newline at end of file diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index d7de6dd6844..ed8d8d1d7a9 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -105,6 +105,9 @@ var/global/nologevent = 0 Bless | Smite "} + if(isLivingSSD(M)) + if(!istype(M.loc, /obj/machinery/cryopod)) + body += {" | Cryo "} if(M.client) if(!istype(M, /mob/new_player)) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 07328008574..db1c39aeb1a 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -79,7 +79,7 @@ var/list/admin_verbs_admin = list( /client/proc/reset_all_tcs, /*resets all telecomms scripts*/ /client/proc/toggle_mentor_chat, /client/proc/toggle_advanced_interaction, /*toggle admin ability to interact with not only machines, but also atoms such as buttons and doors*/ - /client/proc/cryo_ssds, + /client/proc/list_ssds, ) var/list/admin_verbs_ban = list( /client/proc/unban_panel, diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index b43001f3abc..d3c95454c33 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1944,6 +1944,20 @@ if(logmsg) log_admin("[key_name(owner)] answered [key_name(M)]'s prayer with a smiting: [logmsg]") message_admins("[key_name_admin(owner)] answered [key_name_admin(M)]'s prayer with a smiting: [logmsg]") + else if(href_list["cryossd"]) + if(!check_rights(R_ADMIN)) + return + var/mob/living/carbon/human/H = locateUID(href_list["cryossd"]) + if(!istype(H)) + to_chat(usr, "This can only be used on instances of type /mob/living/carbon/human") + return + if(!isLivingSSD(H)) + to_chat(usr, "This can only be used on living, SSD players.") + return + var/success = cryo_ssd(H) + if(success) + log_admin("[key_name(usr)] sent [H.job] [H] to cryo.") + message_admins("[key_name_admin(usr)] sent [H.job] [H] to cryo.") else if(href_list["FaxReplyTemplate"]) if(!check_rights(R_ADMIN)) return diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index da2c998dc79..997589c2e9e 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -882,57 +882,27 @@ Traitors and the like can also be revived with the previous role mostly intact. message_admins("[key_name_admin(usr)] blanked all telecomms scripts.") feedback_add_details("admin_verb","RAT") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! -/client/proc/cryo_ssds() +/client/proc/list_ssds() set category = "Admin" - set name = "Cryo SSDs" - set desc = "Sends SSD players to cryo" + set name = "List SSDs" + set desc = "Lists SSD players" if(!check_rights(R_ADMIN)) return - var/confirm = alert(src, "You sure you want to teleport 10+m SSD players into cryo?", "Confirm", "Yes", "No") - if(confirm != "Yes") - return - - var/list/people_to_cryo = list() + var/msg = "SSD Report" + msg += "SSD Players:" + var/mins_ssd for(var/mob/living/carbon/human/H in living_mob_list) if(!H.player_logged) continue if(!H.last_logout) continue - if((H.last_logout + 6000) > world.time) - continue - if(!is_station_level(H.z)) - continue - if(!isLivingSSD(H)) - continue - if(H.anchored) - continue - if(H.stunned) - continue - if(H.handcuffed) - continue - if(H.buckled) - continue - if(H.pulledby) - continue - people_to_cryo += H - var/list/free_cryopods = list() - for(var/obj/machinery/cryopod/P in machines) - if(!P.occupant && istype(get_area(P), /area/crew_quarters/sleep)) - free_cryopods += P - var/obj/machinery/cryopod/target_cryopod = null - var/people_cryoed = 0 - for(var/mob/living/carbon/human/T in people_to_cryo) - if(free_cryopods.len) - target_cryopod = safepick(free_cryopods) - if(target_cryopod.check_occupant_allowed(T)) - target_cryopod.take_occupant(T, 1) - people_cryoed++ - to_chat(usr, "Sent [people_cryoed] people to cryostorage.") - log_admin("[key_name(usr)] sent SSDs to cryo.") - message_admins("[key_name_admin(usr)] sent SSDs to cryo.") - feedback_add_details("admin_verb","SSDCRY") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + mins_ssd = round((world.time - H.last_logout) / 600) + msg += "" + msg += "" + msg += "
[H.key][H][H.job][mins_ssd] mins[get_area(H)]PPCryo
" + src << browse(msg, "window=Player_ssd_check") /client/proc/toggle_ert_calling() set category = "Event" From 46bc0a93bcc4f2087f08dd53facab6ceb4c8a8a4 Mon Sep 17 00:00:00 2001 From: Kyep Date: Mon, 12 Jun 2017 23:21:26 -0700 Subject: [PATCH 4/6] Neca Requests Head jobs are now highlighted. Antags are now highlighted. Fixes some table formatting. Removes a src. No longer permits cryoing mobs already in cryo. --- code/game/machinery/cryopod.dm | 2 +- code/modules/admin/verbs/randomverbs.dm | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index 274e238c182..6a336a5f55e 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -550,7 +550,7 @@ to_chat(user, "You stop [L == user ? "climbing into the cryo pod." : "putting [L] into the cryo pod."]") /obj/machinery/cryopod/proc/take_occupant(var/mob/living/carbon/E, var/willing_factor = 1) - if(src.occupant) + if(occupant) return if(!E) return diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 997589c2e9e..107ae846026 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -891,16 +891,34 @@ Traitors and the like can also be revived with the previous role mostly intact. return var/msg = "SSD Report" - msg += "SSD Players:" + msg += "SSD Players:
" + msg += "" var/mins_ssd + var/job_string + var/key_string + var/role_string for(var/mob/living/carbon/human/H in living_mob_list) if(!H.player_logged) continue if(!H.last_logout) continue mins_ssd = round((world.time - H.last_logout) / 600) - msg += "" - msg += "" + job_string = H.job + key_string = H.key + if(job_string in command_positions) + job_string = "" + job_string + "" + role_string = "" + if(H.mind) + role_string = "[H.mind.special_role]" + if(!H.key && H.mind.key) + key_string = H.mind.key + msg += "" + msg += "" + if(istype(H.loc, /obj/machinery/cryopod)) + msg += "" + else + msg += "" + msg += "" msg += "
KeyReal NameJobMins SSDSpecial RoleAreaPPNCryo
[H.key][H][H.job][mins_ssd] mins[get_area(H)]PPCryo
[key_string][H.real_name][job_string][mins_ssd][role_string][get_area(H)]PPIn CryoCryo
" src << browse(msg, "window=Player_ssd_check") From dd31646cf2ccc045f68d40d6e4a680d16dd83f44 Mon Sep 17 00:00:00 2001 From: Kyep Date: Sat, 17 Jun 2017 19:25:19 -0700 Subject: [PATCH 5/6] Formatting --- code/modules/admin/verbs/randomverbs.dm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 107ae846026..47985688a46 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -898,21 +898,23 @@ Traitors and the like can also be revived with the previous role mostly intact. var/key_string var/role_string for(var/mob/living/carbon/human/H in living_mob_list) - if(!H.player_logged) - continue - if(!H.last_logout) + if(!isLivingSSD(H)) continue mins_ssd = round((world.time - H.last_logout) / 600) - job_string = H.job + if(H.job) + job_string = H.job + else + job_string = "-" key_string = H.key if(job_string in command_positions) job_string = "" + job_string + "" - role_string = "" + role_string = "-" if(H.mind) - role_string = "[H.mind.special_role]" + if(H.mind.special_role) + role_string = "[H.mind.special_role]" if(!H.key && H.mind.key) key_string = H.mind.key - msg += "[key_string][H.real_name][job_string][mins_ssd][role_string]" + msg += "[key_string][H.real_name][job_string][mins_ssd][role_string]" msg += "[get_area(H)]PP" if(istype(H.loc, /obj/machinery/cryopod)) msg += "In Cryo" From b00ca3045a4ef487f5b16a282b64788c00cf65cf Mon Sep 17 00:00:00 2001 From: Kyep Date: Wed, 28 Jun 2017 00:34:54 -0700 Subject: [PATCH 6/6] Fixes rogue characters --- code/modules/admin/admin.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 14080c75728..d05cc25a476 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -1,4 +1,3 @@ - var/global/BSACooldown = 0 var/global/nologevent = 0