From 6c15f0c6f8a979867fb7fafb3b73b895b76afb64 Mon Sep 17 00:00:00 2001 From: Penelope Haze Date: Thu, 4 Jul 2024 17:39:13 -0400 Subject: [PATCH 1/7] Rename variables in VV topic proc --- code/modules/admin/view_variables/topic.dm | 445 ++++++++++----------- 1 file changed, 222 insertions(+), 223 deletions(-) diff --git a/code/modules/admin/view_variables/topic.dm b/code/modules/admin/view_variables/topic.dm index 63188f399eb..0170ec02871 100644 --- a/code/modules/admin/view_variables/topic.dm +++ b/code/modules/admin/view_variables/topic.dm @@ -10,255 +10,255 @@ else if(href_list["rename"]) if(!check_rights(R_VAREDIT)) return - var/mob/M = locate(href_list["rename"]) - if(!istype(M)) + var/mob/victim = locate(href_list["rename"]) + if(!istype(victim)) to_chat(usr, "This can only be used on instances of type /mob") return - var/new_name = sanitize(input(usr,"What would you like to name this mob?","Input a name",M.real_name) as text|null, MAX_NAME_LEN) - if(!new_name || !M) return + var/new_name = sanitize(input(usr,"What would you like to name this mob?","Input a name",victim.real_name) as text|null, MAX_NAME_LEN) + if(!new_name || !victim) return - message_admins("Admin [key_name_admin(usr)] renamed [key_name_admin(M)] to [new_name].") - M.fully_replace_character_name(new_name) + message_admins("Admin [key_name_admin(usr)] renamed [key_name_admin(victim)] to [new_name].") + victim.fully_replace_character_name(new_name) href_list["datumrefresh"] = href_list["rename"] else if(href_list["dressup"]) if(!check_rights(R_VAREDIT)) return - var/mob/living/human/H = locate(href_list["dressup"]) - if(!istype(H)) + var/mob/living/human/victim = locate(href_list["dressup"]) + if(!istype(victim)) to_chat(usr, "This can only be used on instances of type /mob/living/human") return var/decl/hierarchy/outfit/outfit = input("Select outfit.", "Select equipment.") as null|anything in outfits() if(!outfit) return - dressup_human(H, outfit, TRUE) + dressup_human(victim, outfit, TRUE) else if(href_list["varnameedit"] && href_list["datumedit"]) if(!check_rights(R_VAREDIT)) return - var/D = locate(href_list["datumedit"]) - if(!istype(D,/datum) && !istype(D,/client)) + var/datum_to_edit = locate(href_list["datumedit"]) + if(!istype(datum_to_edit, /datum) && !istype(datum_to_edit, /client)) to_chat(usr, "This can only be used on instances of types /client or /datum") return - modify_variables(D, href_list["varnameedit"], 1) + modify_variables(datum_to_edit, href_list["varnameedit"], 1) else if(href_list["varnamechange"] && href_list["datumchange"]) if(!check_rights(R_VAREDIT)) return - var/D = locate(href_list["datumchange"]) - if(!istype(D,/datum) && !istype(D,/client)) + var/datum_to_edit = locate(href_list["datumchange"]) + if(!istype(datum_to_edit,/datum) && !istype(datum_to_edit,/client)) to_chat(usr, "This can only be used on instances of types /client or /datum") return - modify_variables(D, href_list["varnamechange"], 0) + modify_variables(datum_to_edit, href_list["varnamechange"], 0) else if(href_list["varnamemass"] && href_list["datummass"]) if(!check_rights(R_VAREDIT)) return - var/atom/A = locate(href_list["datummass"]) - if(!istype(A)) + var/atom/atom_to_edit = locate(href_list["datummass"]) + if(!isatom(atom_to_edit)) to_chat(usr, "This can only be used on instances of type /atom") return - cmd_mass_modify_object_variables(A, href_list["varnamemass"]) + cmd_mass_modify_object_variables(atom_to_edit, href_list["varnamemass"]) else if(href_list["datumwatch"] && href_list["varnamewatch"]) - var/datum/D = locate(href_list["datumwatch"]) - if(D) - if(!watched_variables[D]) - watched_variables[D] = list() - watched_variables[D] |= href_list["varnamewatch"] + var/datum/datum_to_edit = locate(href_list["datumwatch"]) + if(datum_to_edit) + if(!watched_variables[datum_to_edit]) + watched_variables[datum_to_edit] = list() + watched_variables[datum_to_edit] |= href_list["varnamewatch"] watched_variables() if(!watched_variables_window.is_processing) START_PROCESSING(SSprocessing, watched_variables_window) else if(href_list["datumunwatch"] && href_list["varnameunwatch"]) - var/datum/D = locate(href_list["datumunwatch"]) - if(D && watched_variables[D]) - watched_variables[D] -= href_list["varnameunwatch"] - var/list/datums_watched_vars = watched_variables[D] + var/datum/datum_to_edit = locate(href_list["datumunwatch"]) + if(datum_to_edit && watched_variables[datum_to_edit]) + watched_variables[datum_to_edit] -= href_list["varnameunwatch"] + var/list/datums_watched_vars = watched_variables[datum_to_edit] if(!datums_watched_vars.len) - watched_variables -= D + watched_variables -= datum_to_edit if(!watched_variables.len && watched_variables_window.is_processing) STOP_PROCESSING(SSprocessing, watched_variables_window) else if(href_list["mob_player_panel"]) if(!check_rights(0)) return - var/mob/M = locate(href_list["mob_player_panel"]) - if(!istype(M)) + var/mob/victim = locate(href_list["mob_player_panel"]) + if(!istype(victim)) to_chat(usr, "This can only be used on instances of type /mob") return - src.holder.show_player_panel(M) + src.holder.show_player_panel(victim) href_list["datumrefresh"] = href_list["mob_player_panel"] else if(href_list["give_spell"]) if(!check_rights(R_ADMIN|R_FUN)) return - var/mob/M = locate(href_list["give_spell"]) - if(!istype(M)) + var/mob/victim = locate(href_list["give_spell"]) + if(!istype(victim)) to_chat(usr, "This can only be used on instances of type /mob") return - src.give_spell(M) + src.give_spell(victim) href_list["datumrefresh"] = href_list["give_spell"] else if(href_list["godmode"]) if(!check_rights(R_REJUVENATE)) return - var/mob/M = locate(href_list["godmode"]) - if(!istype(M)) + var/mob/victim = locate(href_list["godmode"]) + if(!istype(victim)) to_chat(usr, "This can only be used on instances of type /mob") return - src.cmd_admin_godmode(M) + src.cmd_admin_godmode(victim) href_list["datumrefresh"] = href_list["godmode"] else if(href_list["gib"]) if(!check_rights(0)) return - var/mob/M = locate(href_list["gib"]) - if(!istype(M)) + var/mob/victim = locate(href_list["gib"]) + if(!istype(victim)) to_chat(usr, "This can only be used on instances of type /mob") return - src.cmd_admin_gib(M) + src.cmd_admin_gib(victim) else if(href_list["drop_everything"]) if(!check_rights(R_DEBUG|R_ADMIN)) return - var/mob/M = locate(href_list["drop_everything"]) - if(!istype(M)) + var/mob/victim = locate(href_list["drop_everything"]) + if(!istype(victim)) to_chat(usr, "This can only be used on instances of type /mob") return if(usr.client) - usr.client.cmd_admin_drop_everything(M) + usr.client.cmd_admin_drop_everything(victim) else if(href_list["direct_control"]) if(!check_rights(0)) return - var/mob/M = locate(href_list["direct_control"]) - if(!istype(M)) + var/mob/victim = locate(href_list["direct_control"]) + if(!istype(victim)) to_chat(usr, "This can only be used on instances of type /mob") return if(usr.client) - usr.client.cmd_assume_direct_control(M) + usr.client.cmd_assume_direct_control(victim) else if(href_list["delthis"]) if(!check_rights(R_DEBUG|R_SERVER)) return - var/obj/O = locate(href_list["delthis"]) - if(!isobj(O)) + var/obj/object = locate(href_list["delthis"]) + if(!isobj(object)) to_chat(usr, "This can only be used on instances of type /obj") return - cmd_admin_delete(O) + cmd_admin_delete(object) else if(href_list["delall"]) if(!check_rights(R_DEBUG|R_SERVER)) return - var/obj/O = locate(href_list["delall"]) - if(!isobj(O)) + var/obj/object = locate(href_list["delall"]) + if(!isobj(object)) to_chat(usr, "This can only be used on instances of type /obj") return - var/action_type = alert("Strict type ([O.type]) or type and all subtypes?",,"Strict type","Type and subtypes","Cancel") + var/action_type = alert("Strict type ([object.type]) or type and all subtypes?",,"Strict type","Type and subtypes","Cancel") if(action_type == "Cancel" || !action_type) return - if(alert("Are you really sure you want to delete all objects of type [O.type]?",,"Yes","No") != "Yes") + if(alert("Are you really sure you want to delete all objects of type [object.type]?",,"Yes","No") != "Yes") return if(alert("Second confirmation required. Delete?",,"Yes","No") != "Yes") return - var/O_type = O.type + var/type_to_delete = object.type switch(action_type) if("Strict type") - var/i = 0 - for(var/obj/Obj in world) - if(Obj.type == O_type) - i++ - qdel(Obj) - if(!i) + var/count = 0 + for(var/obj/deleted_object in world) + if(deleted_object.type == type_to_delete) + count++ + qdel(deleted_object) + if(!count) to_chat(usr, "No objects of this type exist") return - log_admin("[key_name(usr)] deleted all objects of type [O_type] ([i] objects deleted)") - message_admins("[key_name(usr)] deleted all objects of type [O_type] ([i] objects deleted)") + log_admin("[key_name(usr)] deleted all objects of type [type_to_delete] ([count] objects deleted)") + message_admins("[key_name(usr)] deleted all objects of type [type_to_delete] ([count] objects deleted)") if("Type and subtypes") - var/i = 0 - for(var/obj/Obj in world) - if(istype(Obj,O_type)) - i++ - qdel(Obj) - if(!i) + var/count = 0 + for(var/obj/deleted_object in world) + if(istype(deleted_object, type_to_delete)) + count++ + qdel(deleted_object) + if(!count) to_chat(usr, "No objects of this type exist") return - log_admin("[key_name(usr)] deleted all objects of type or subtype of [O_type] ([i] objects deleted)") - message_admins("[key_name(usr)] deleted all objects of type or subtype of [O_type] ([i] objects deleted)") + log_admin("[key_name(usr)] deleted all objects of type or subtype of [type_to_delete] ([count] objects deleted)") + message_admins("[key_name(usr)] deleted all objects of type or subtype of [type_to_delete] ([count] objects deleted)") else if(href_list["explode"]) if(!check_rights(R_DEBUG|R_FUN)) return - var/atom/A = locate(href_list["explode"]) - if(!isobj(A) && !ismob(A) && !isturf(A)) + var/atom/atom_to_explode = locate(href_list["explode"]) + if(!isobj(atom_to_explode) && !ismob(atom_to_explode) && !isturf(atom_to_explode)) to_chat(usr, "This can only be done to instances of type /obj, /mob and /turf") return - src.cmd_admin_explosion(A) + src.cmd_admin_explosion(atom_to_explode) href_list["datumrefresh"] = href_list["explode"] else if(href_list["emp"]) if(!check_rights(R_DEBUG|R_FUN)) return - var/atom/A = locate(href_list["emp"]) - if(!isobj(A) && !ismob(A) && !isturf(A)) + var/atom/atom_to_emp = locate(href_list["emp"]) + if(!isobj(atom_to_emp) && !ismob(atom_to_emp) && !isturf(atom_to_emp)) to_chat(usr, "This can only be done to instances of type /obj, /mob and /turf") return - src.cmd_admin_emp(A) + src.cmd_admin_emp(atom_to_emp) href_list["datumrefresh"] = href_list["emp"] else if(href_list["mark_object"]) if(!check_rights(0)) return - var/datum/D = locate(href_list["mark_object"]) - if(!istype(D)) + var/datum/datum_to_mark = locate(href_list["mark_object"]) + if(!istype(datum_to_mark)) to_chat(usr, "This can only be done to instances of type /datum") return - src.holder.marked_datum_weak = weakref(D) + src.holder.marked_datum_weak = weakref(datum_to_mark) href_list["datumrefresh"] = href_list["mark_object"] else if(href_list["rotatedatum"]) if(!check_rights(0)) return - var/atom/A = locate(href_list["rotatedatum"]) - if(!istype(A)) + var/atom/atom_to_rotate = locate(href_list["rotatedatum"]) + if(!isatom(atom_to_rotate)) to_chat(usr, "This can only be done to instances of type /atom") return switch(href_list["rotatedir"]) - if("right") A.set_dir(turn(A.dir, -45)) - if("left") A.set_dir(turn(A.dir, 45)) + if("right") atom_to_rotate.set_dir(turn(atom_to_rotate.dir, -45)) + if("left") atom_to_rotate.set_dir(turn(atom_to_rotate.dir, 45)) href_list["datumrefresh"] = href_list["rotatedatum"] else if(href_list["makemonkey"]) if(!check_rights(R_SPAWN)) return - var/mob/living/human/H = locate(href_list["makemonkey"]) - if(!istype(H)) + var/mob/living/human/victim = locate(href_list["makemonkey"]) + if(!istype(victim)) to_chat(usr, "This can only be done to instances of type /mob/living/human") return if(alert("Confirm mob type change?",,"Transform","Cancel") != "Transform") return - if(!H) + if(!victim) to_chat(usr, "Mob doesn't exist anymore") return holder.Topic(href, list("monkeyone"=href_list["makemonkey"])) @@ -266,13 +266,13 @@ else if(href_list["makerobot"]) if(!check_rights(R_SPAWN)) return - var/mob/living/human/H = locate(href_list["makerobot"]) - if(!istype(H)) + var/mob/living/human/victim = locate(href_list["makerobot"]) + if(!istype(victim)) to_chat(usr, "This can only be done to instances of type /mob/living/human") return if(alert("Confirm mob type change?",,"Transform","Cancel") != "Transform") return - if(!H) + if(!victim) to_chat(usr, "Mob doesn't exist anymore") return holder.Topic(href, list("makerobot"=href_list["makerobot"])) @@ -280,114 +280,114 @@ else if(href_list["makeai"]) if(!check_rights(R_SPAWN)) return - var/mob/living/human/H = locate(href_list["makeai"]) - if(!istype(H)) + var/mob/living/human/victim = locate(href_list["makeai"]) + if(!istype(victim)) to_chat(usr, "This can only be done to instances of type /mob/living/human") return if(alert("Confirm mob type change?",,"Transform","Cancel") != "Transform") return - if(!H) + if(!victim) to_chat(usr, "Mob doesn't exist anymore") return holder.Topic(href, list("makeai"=href_list["makeai"])) else if(href_list["addailment"]) - var/mob/living/human/H = locate(href_list["addailment"]) - if(!istype(H)) + var/mob/living/human/victim = locate(href_list["addailment"]) + if(!istype(victim)) to_chat(usr, "This can only be done to instances of type /mob/living/human") return - var/obj/item/organ/O = input("Select a limb to add the ailment to.", "Add Ailment") as null|anything in H.get_organs() - if(QDELETED(H) || QDELETED(O) || O.owner != H) + var/obj/item/organ/limb = input("Select a limb to add the ailment to.", "Add Ailment") as null|anything in victim.get_organs() + if(QDELETED(victim) || QDELETED(limb) || limb.owner != victim) return var/list/possible_ailments = list() for(var/atype in subtypesof(/datum/ailment)) var/datum/ailment/ailment = get_ailment_reference(atype) - if(ailment && ailment.category != ailment.type && ailment.can_apply_to(O)) + if(ailment && ailment.category != ailment.type && ailment.can_apply_to(limb)) possible_ailments |= ailment var/datum/ailment/ailment = input("Select an ailment type to add.", "Add Ailment") as null|anything in possible_ailments if(!istype(ailment)) return - if(!QDELETED(H) && !QDELETED(O) && O.owner == H && O.add_ailment(ailment)) - to_chat(usr, SPAN_NOTICE("Added [ailment] to \the [H].")) + if(!QDELETED(victim) && !QDELETED(limb) && limb.owner == victim && limb.add_ailment(ailment)) + to_chat(usr, SPAN_NOTICE("Added [ailment] to \the [victim].")) else - to_chat(usr, SPAN_WARNING("Failed to add [ailment] to \the [H].")) + to_chat(usr, SPAN_WARNING("Failed to add [ailment] to \the [victim].")) return else if(href_list["remailment"]) - var/mob/living/human/H = locate(href_list["remailment"]) - if(!istype(H)) + var/mob/living/human/victim = locate(href_list["remailment"]) + if(!istype(victim)) to_chat(usr, "This can only be done to instances of type /mob/living/human") return var/list/all_ailments = list() - for(var/obj/item/organ/O in H.get_organs()) - for(var/datum/ailment/ailment in O.ailments) - all_ailments["[ailment.name] - [O.name]"] = ailment + for(var/obj/item/organ/limb in victim.get_organs()) + for(var/datum/ailment/ailment in limb.ailments) + all_ailments["[ailment.name] - [limb.name]"] = ailment var/datum/ailment/ailment = input("Which ailment do you wish to remove?", "Removing Ailment") as null|anything in all_ailments if(!ailment) return ailment = all_ailments[ailment] - if(istype(ailment) && ailment.organ && ailment.organ.owner == H && ailment.organ.remove_ailment(ailment)) - to_chat(usr, SPAN_NOTICE("Removed [ailment] from \the [H].")) + if(istype(ailment) && ailment.organ && ailment.organ.owner == victim && ailment.organ.remove_ailment(ailment)) + to_chat(usr, SPAN_NOTICE("Removed [ailment] from \the [victim].")) else - to_chat(usr, SPAN_WARNING("Failed to remove [ailment] from \the [H].")) + to_chat(usr, SPAN_WARNING("Failed to remove [ailment] from \the [victim].")) return else if(href_list["setspecies"]) if(!check_rights(R_SPAWN)) return - var/mob/living/human/H = locate(href_list["setspecies"]) - if(!istype(H)) + var/mob/living/human/victim = locate(href_list["setspecies"]) + if(!istype(victim)) to_chat(usr, SPAN_WARNING("This can only be done to instances of type /mob/living/human")) return var/new_species = input("Please choose a new species.","Species",null) as null|anything in get_all_species() - if(!H) + if(!victim) to_chat(usr, SPAN_WARNING("Mob doesn't exist anymore")) return if(!new_species) return - if(H.change_species(new_species)) - to_chat(usr, SPAN_NOTICE("Set species of [H] to [H.species].")) + if(victim.change_species(new_species)) + to_chat(usr, SPAN_NOTICE("Set species of [victim] to [victim.species].")) else to_chat(usr, SPAN_WARNING("Failed! Something went wrong.")) else if(href_list["setbodytype"]) if(!check_rights(R_SPAWN)) return - var/mob/living/human/H = locate(href_list["setbodytype"]) - if(!istype(H)) + var/mob/living/human/victim = locate(href_list["setbodytype"]) + if(!istype(victim)) to_chat(usr, SPAN_WARNING("This can only be done to instances of type /mob/living/human")) return - var/new_bodytype = input("Please choose a new bodytype.","Bodytype",null) as null|anything in H.species.available_bodytypes + var/new_bodytype = input("Please choose a new bodytype.","Bodytype",null) as null|anything in victim.species.available_bodytypes if(!new_bodytype) return - if(!H) + if(!victim) to_chat(usr, SPAN_WARNING("Mob doesn't exist anymore")) return - if(!(new_bodytype in H.species.available_bodytypes)) + if(!(new_bodytype in victim.species.available_bodytypes)) to_chat(usr, SPAN_WARNING("Bodytype is no longer available to the mob species.")) - if(H.set_bodytype(new_bodytype)) - to_chat(usr, SPAN_NOTICE("Set bodytype of [H] to [H.get_bodytype()].")) + if(victim.set_bodytype(new_bodytype)) + to_chat(usr, SPAN_NOTICE("Set bodytype of [victim] to [victim.get_bodytype()].")) else to_chat(usr, SPAN_WARNING("Failed! Something went wrong.")) else if(href_list["addlanguage"]) if(!check_rights(R_SPAWN)) return - var/mob/H = locate(href_list["addlanguage"]) - if(!istype(H)) + var/mob/victim = locate(href_list["addlanguage"]) + if(!istype(victim)) to_chat(usr, "This can only be done to instances of type /mob") return @@ -397,238 +397,237 @@ if(!new_language) return - if(!H) + if(!victim) to_chat(usr, "Mob doesn't exist anymore") return - if(H.add_language(new_language)) - to_chat(usr, "Added [new_language] to [H].") + if(victim.add_language(new_language)) + to_chat(usr, "Added [new_language] to [victim].") else to_chat(usr, "Mob already knows that language.") else if(href_list["remlanguage"]) if(!check_rights(R_SPAWN)) return - var/mob/H = locate(href_list["remlanguage"]) - if(!istype(H)) + var/mob/victim = locate(href_list["remlanguage"]) + if(!istype(victim)) to_chat(usr, "This can only be done to instances of type /mob") return - if(!H.languages.len) + if(!victim.languages.len) to_chat(usr, "This mob knows no languages.") return - var/decl/language/rem_language = input("Please choose a language to remove.","Language",null) as null|anything in H.languages + var/decl/language/rem_language = input("Please choose a language to remove.","Language",null) as null|anything in victim.languages if(!rem_language) return - if(!H) + if(!victim) to_chat(usr, "Mob doesn't exist anymore") return - if(H.remove_language(rem_language.name)) - to_chat(usr, "Removed [rem_language] from [H].") + if(victim.remove_language(rem_language.name)) + to_chat(usr, "Removed [rem_language] from [victim].") else to_chat(usr, "Mob doesn't know that language.") else if(href_list["addverb"]) if(!check_rights(R_DEBUG)) return - var/mob/living/H = locate(href_list["addverb"]) + var/mob/living/victim = locate(href_list["addverb"]) - if(!istype(H)) + if(!istype(victim)) to_chat(usr, "This can only be done to instances of type /mob/living") return var/list/possibleverbs = list() possibleverbs += "Cancel" // One for the top... possibleverbs += typesof(/mob/proc, /mob/verb, /mob/living/proc, /mob/living/verb) - switch(H.type) - if(/mob/living/human) - possibleverbs += typesof(/mob/living/human/verb, /mob/living/human/proc) - if(/mob/living/silicon/robot) - possibleverbs += typesof(/mob/living/silicon/proc, /mob/living/silicon/robot/proc, /mob/living/silicon/robot/verb) - if(/mob/living/silicon/ai) - possibleverbs += typesof(/mob/living/silicon/proc, /mob/living/silicon/ai/proc, /mob/living/silicon/ai/verb) - possibleverbs -= H.verbs + if(ishuman(victim)) + possibleverbs += typesof(/mob/living/human/verb, /mob/living/human/proc) + else if(isrobot(victim)) + possibleverbs += typesof(/mob/living/silicon/proc, /mob/living/silicon/robot/proc, /mob/living/silicon/robot/verb) + else if(isAI(victim)) + possibleverbs += typesof(/mob/living/silicon/proc, /mob/living/silicon/ai/proc, /mob/living/silicon/ai/verb) + possibleverbs -= victim.verbs possibleverbs += "Cancel" // ...And one for the bottom var/verb = input("Select a verb!", "Verbs",null) as null|anything in possibleverbs - if(!H) + if(!victim) to_chat(usr, "Mob doesn't exist anymore") return if(!verb || verb == "Cancel") return else - H.verbs += verb + victim.verbs += verb else if(href_list["remverb"]) if(!check_rights(R_DEBUG)) return - var/mob/H = locate(href_list["remverb"]) + var/mob/victim = locate(href_list["remverb"]) - if(!istype(H)) + if(!istype(victim)) to_chat(usr, "This can only be done to instances of type /mob") return - var/verb = input("Please choose a verb to remove.","Verbs",null) as null|anything in H.verbs - if(!H) + var/verb = input("Please choose a verb to remove.","Verbs",null) as null|anything in victim.verbs + if(!victim) to_chat(usr, "Mob doesn't exist anymore") return if(!verb) return else - H.verbs -= verb + victim.verbs -= verb else if(href_list["addorgan"]) if(!check_rights(R_SPAWN)) return - var/mob/living/M = locate(href_list["addorgan"]) - if(!istype(M)) + var/mob/living/victim = locate(href_list["addorgan"]) + if(!istype(victim)) to_chat(usr, "This can only be done to instances of type /mob/living") return - if(!length(M.get_external_organs())) // quick and dirty check for organs; should always be >0 for humanlike mobs. + if(!length(victim.get_external_organs())) // quick and dirty check for organs; should always be >0 for humanlike mobs. to_chat(usr, "This can only be done to mobs that implement organs!") return var/obj/item/organ/new_organ = input("Please choose an organ to add.","Organ",null) as null|anything in subtypesof(/obj/item/organ) if(!new_organ) return - if(!M) + if(!victim) to_chat(usr, "Mob doesn't exist anymore") return - if(locate(new_organ) in M.get_internal_organs()) + if(locate(new_organ) in victim.get_internal_organs()) to_chat(usr, "Mob already has that organ.") return - var/obj/item/organ/target_organ = M.get_organ(initial(new_organ.parent_organ)) + var/obj/item/organ/target_organ = victim.get_organ(initial(new_organ.parent_organ)) if(!target_organ) to_chat(usr, "Mob doesn't have \a [target_organ] to install that in.") return - var/obj/item/organ/organ_instance = new new_organ(M) - M.add_organ(organ_instance, target_organ) + var/obj/item/organ/organ_instance = new new_organ(victim) + victim.add_organ(organ_instance, target_organ) else if(href_list["remorgan"]) if(!check_rights(R_SPAWN)) return - var/mob/living/M = locate(href_list["remorgan"]) - if(!istype(M)) + var/mob/living/victim = locate(href_list["remorgan"]) + if(!istype(victim)) to_chat(usr, "This can only be done to instances of type /mob/living") return - if(!length(M.get_external_organs())) // quick and dirty check for organs; should always be >0 for humanlike mobs. + if(!length(victim.get_external_organs())) // quick and dirty check for organs; should always be >0 for humanlike mobs. to_chat(usr, "This can only be done to mobs that implement organs!") return - var/obj/item/organ/rem_organ = input("Please choose an organ to remove.","Organ",null) as null|anything in M.get_internal_organs() + var/obj/item/organ/rem_organ = input("Please choose an organ to remove.","Organ",null) as null|anything in victim.get_internal_organs() - if(!M) + if(!victim) to_chat(usr, "Mob doesn't exist anymore") return - if(!(locate(rem_organ) in M.get_internal_organs())) + if(!(locate(rem_organ) in victim.get_internal_organs())) to_chat(usr, "Mob does not have that organ.") return - to_chat(usr, "Removed [rem_organ] from [M].") - M.remove_organ(rem_organ) + to_chat(usr, "Removed [rem_organ] from [victim].") + victim.remove_organ(rem_organ) if(!QDELETED(rem_organ)) qdel(rem_organ) else if(href_list["fix_nano"]) if(!check_rights(R_DEBUG)) return - var/mob/H = locate(href_list["fix_nano"]) + var/mob/victim = locate(href_list["fix_nano"]) - if(!istype(H) || !H.client) + if(!istype(victim) || !victim.client) to_chat(usr, "This can only be done on mobs with clients") return - SSnano.close_uis(H) - H.client.cache.Cut() + SSnano.close_uis(victim) + victim.client.cache.Cut() var/datum/asset/assets = get_asset_datum(/datum/asset/nanoui) - assets.send(H) + assets.send(victim) to_chat(usr, "Resource files sent") - to_chat(H, "Your NanoUI Resource files have been refreshed") + to_chat(victim, "Your NanoUI Resource files have been refreshed") - log_admin("[key_name(usr)] resent the NanoUI resource files to [key_name(H)] ") + log_admin("[key_name(usr)] resent the NanoUI resource files to [key_name(victim)] ") else if(href_list["updateicon"]) if(!check_rights(0)) return - var/mob/M = locate(href_list["updateicon"]) - if(!ismob(M)) + var/mob/victim = locate(href_list["updateicon"]) + if(!ismob(victim)) to_chat(usr, "This can only be done to instances of type /mob") return - M.update_icon() + victim.update_icon() else if(href_list["refreshoverlays"]) if(!check_rights(0)) return - var/mob/living/human/H = locate(href_list["refreshoverlays"]) - if(!istype(H)) + var/mob/living/human/victim = locate(href_list["refreshoverlays"]) + if(!istype(victim)) to_chat(usr, "This can only be done to instances of type /mob/living/human") return - H.try_refresh_visible_overlays() + victim.try_refresh_visible_overlays() else if(href_list["adjustDamage"] && href_list["mobToDamage"]) if(!check_rights(R_DEBUG|R_ADMIN|R_FUN)) return - var/mob/living/L = locate(href_list["mobToDamage"]) - if(!istype(L)) return + var/mob/living/victim = locate(href_list["mobToDamage"]) + if(!istype(victim)) return var/Text = href_list["adjustDamage"] var/amount = input("Deal how much damage to mob? (Negative values here heal)","Adjust [Text]loss",0) as num - if(!L) + if(!victim) to_chat(usr, "Mob doesn't exist anymore") return if(istext(Text)) - L.take_damage(amount, Text) + victim.take_damage(amount, Text) else - to_chat(usr, "You caused an error. DEBUG: Text:[Text] Mob:[L]") + to_chat(usr, "You caused an error. DEBUG: Text:[Text] Mob:[victim]") return if(amount != 0) - log_admin("[key_name(usr)] dealt [amount] amount of [Text] damage to [L]") - message_admins("[key_name(usr)] dealt [amount] amount of [Text] damage to [L]") + log_admin("[key_name(usr)] dealt [amount] amount of [Text] damage to [victim]") + message_admins("[key_name(usr)] dealt [amount] amount of [Text] damage to [victim]") href_list["datumrefresh"] = href_list["mobToDamage"] else if(href_list["call_proc"]) - var/datum/D = locate(href_list["call_proc"]) - if(istype(D) || istype(D, /client)) // can call on clients too, not just datums - callproc_targetpicked(1, D) + var/datum/callee = locate(href_list["call_proc"]) + if(istype(callee) || istype(callee, /client)) // can call on clients too, not just datums + callproc_targetpicked(1, callee) else if(href_list["addaura"]) if(!check_rights(R_DEBUG|R_ADMIN|R_FUN)) return - var/mob/living/L = locate(href_list["addaura"]) - if(!istype(L)) + var/mob/living/victim = locate(href_list["addaura"]) + if(!istype(victim)) return var/choice = input("Please choose an aura to add", "Auras", null) as null|anything in typesof(/obj/aura) - if(!choice || !L) + if(!choice || !victim) return - var/obj/o = new choice(L) - log_and_message_admins("added \the [o] to \the [L]") + var/obj/new_aura = new choice(victim) + log_and_message_admins("added \the [new_aura] to \the [victim]") else if(href_list["removeaura"]) if(!check_rights(R_DEBUG|R_ADMIN|R_FUN)) return - var/mob/living/L = locate(href_list["removeaura"]) - if(!istype(L)) + var/mob/living/victim = locate(href_list["removeaura"]) + if(!istype(victim)) return - var/choice = input("Please choose an aura to remove", "Auras", null) as null|anything in L.auras - if(!choice || !L) + var/choice = input("Please choose an aura to remove", "Auras", null) as null|anything in victim.auras + if(!choice || !victim) return - log_and_message_admins("removed \the [choice] to \the [L]") + log_and_message_admins("removed \the [choice] to \the [victim]") qdel(choice) else if(href_list["addstressor"]) if(!check_rights(R_DEBUG)) return - var/mob/living/L = locate(href_list["addstressor"]) - if(!istype(L)) + var/mob/living/victim = locate(href_list["addstressor"]) + if(!istype(victim)) return var/static/list/_all_stressors if(!_all_stressors) @@ -637,63 +636,63 @@ if(!stressor) return var/duration = clamp(input("Enter a duration ([STRESSOR_DURATION_INDEFINITE] for permanent).", "Add Stressor") as num|null, STRESSOR_DURATION_INDEFINITE, INFINITY) - if(duration && L.add_stressor(stressor, duration)) - log_and_message_admins("added [stressor] to \the [L] for duration [duration].") + if(duration && victim.add_stressor(stressor, duration)) + log_and_message_admins("added [stressor] to \the [victim] for duration [duration].") else if(href_list["removestressor"]) if(!check_rights(R_DEBUG)) return - var/mob/living/L = locate(href_list["removestressor"]) - if(!istype(L)) + var/mob/living/victim = locate(href_list["removestressor"]) + if(!istype(victim)) return - if(!length(L.stressors)) + if(!length(victim.stressors)) to_chat(usr, "Nothing to remove.") return - var/datum/stressor/stressor = input("Select a stressor to remove.", "Remove Stressor") as null|anything in L.stressors - if(L.remove_stressor(stressor)) - log_and_message_admins("removed [stressor] from \the [L].") + var/datum/stressor/stressor = input("Select a stressor to remove.", "Remove Stressor") as null|anything in victim.stressors + if(victim.remove_stressor(stressor)) + log_and_message_admins("removed [stressor] from \the [victim].") else if(href_list["setstatuscond"]) if(!check_rights(R_DEBUG)) return - var/mob/living/L = locate(href_list["setstatuscond"]) - if(!istype(L)) + var/mob/living/victim = locate(href_list["setstatuscond"]) + if(!istype(victim)) return var/list/all_status_conditions = decls_repository.get_decls_of_subtype(/decl/status_condition) var/list/select_from_conditions = list() for(var/status_cond in all_status_conditions) select_from_conditions += all_status_conditions[status_cond] var/decl/status_condition/selected_condition = input("Select a status condition to set.", "Set Status Condition") as null|anything in select_from_conditions - if(!selected_condition || QDELETED(L) || !check_rights(R_DEBUG)) + if(!selected_condition || QDELETED(victim) || !check_rights(R_DEBUG)) return var/amt = input("Enter an amount to set the condition to.", "Set Status Condition") as num|null - if(isnull(amt) || QDELETED(L) || !check_rights(R_DEBUG)) + if(isnull(amt) || QDELETED(victim) || !check_rights(R_DEBUG)) return if(amt < 0) - amt += GET_STATUS(L, selected_condition.type) - L.set_status(selected_condition.type, amt) - log_and_message_admins("set [selected_condition.name] to [amt] on \the [L].") + amt += GET_STATUS(victim, selected_condition.type) + victim.set_status(selected_condition.type, amt) + log_and_message_admins("set [selected_condition.name] to [amt] on \the [victim].") else if(href_list["setmaterial"]) if(!check_rights(R_DEBUG)) return - var/obj/item/I = locate(href_list["setmaterial"]) - if(!istype(I)) + var/obj/item/item = locate(href_list["setmaterial"]) + if(!istype(item)) to_chat(usr, "This can only be done to instances of type /obj/item") return var/decl/material/new_material = input("Please choose a new material.","Materials",null) as null|anything in decls_repository.get_decls_of_subtype_unassociated(/decl/material) if(!istype(new_material)) return - if(QDELETED(I)) + if(QDELETED(item)) to_chat(usr, "Item doesn't exist anymore") return - I.set_material(new_material.type) - to_chat(usr, "Set material of [I] to [I.get_material()].") + item.set_material(new_material.type) + to_chat(usr, "Set material of [item] to [item.get_material()].") if(href_list["datumrefresh"]) - var/datum/DAT = locate(href_list["datumrefresh"]) - if(istype(DAT, /datum) || istype(DAT, /client)) - debug_variables(DAT) + var/datum/datum_to_refresh = locate(href_list["datumrefresh"]) + if(istype(datum_to_refresh, /datum) || istype(datum_to_refresh, /client)) + debug_variables(datum_to_refresh) return From 7c82a669b5d0dc1fe98715846a814065f9134499 Mon Sep 17 00:00:00 2001 From: Penelope Haze Date: Thu, 4 Jul 2024 18:15:23 -0400 Subject: [PATCH 2/7] Rename variables in external organ code --- code/_macros.dm | 1 + code/modules/organs/external/_external.dm | 517 +++++++++++----------- 2 files changed, 259 insertions(+), 259 deletions(-) diff --git a/code/_macros.dm b/code/_macros.dm index 31458da86e5..5cba5893825 100644 --- a/code/_macros.dm +++ b/code/_macros.dm @@ -169,6 +169,7 @@ #define SPAN_PINK(X) SPAN_CLASS("font_pink", X) #define SPAN_PALEPINK(X) SPAN_CLASS("font_palepink", X) #define SPAN_SINISTER(X) SPAN_CLASS("sinister", X) +#define SPAN_MODERATE(X) SPAN_CLASS("moderate", X) // placeholders #define SPAN_GOOD(X) SPAN_GREEN(X) #define SPAN_NEUTRAL(X) SPAN_BLUE(X) diff --git a/code/modules/organs/external/_external.dm b/code/modules/organs/external/_external.dm index 39673c2f03e..3d11169ef4a 100644 --- a/code/modules/organs/external/_external.dm +++ b/code/modules/organs/external/_external.dm @@ -85,8 +85,8 @@ if((limb_flags & ORGAN_FLAG_FINGERPRINT) && !BP_IS_PROSTHETIC(src)) fingerprint = value else - for(var/obj/item/organ/external/E in children) - E.set_fingerprint(value) + for(var/obj/item/organ/external/child in children) + child.set_fingerprint(value) /obj/item/organ/external/proc/get_fingerprint() @@ -95,19 +95,19 @@ fingerprint = md5(sequential_id(/mob)) return fingerprint - for(var/obj/item/organ/external/E in children) - var/print = E.get_fingerprint() + for(var/obj/item/organ/external/child in children) + var/print = child.get_fingerprint() if(print) return print -/obj/item/organ/external/afterattack(atom/A, mob/user, proximity) +/obj/item/organ/external/afterattack(atom/target, mob/user, proximity) ..() if(proximity && get_fingerprint()) var/datum/extension/forensic_evidence/forensics = get_or_create_extension(src, /datum/extension/forensic_evidence) - var/datum/fingerprint/F = new() - F.full_print = get_fingerprint() - F.completeness = rand(10,90) - forensics.add_data(/datum/forensics/fingerprints, F) + var/datum/fingerprint/fingerprint = new() + fingerprint.full_print = get_fingerprint() + fingerprint.completeness = rand(10,90) + forensics.add_data(/datum/forensics/fingerprints, fingerprint) /obj/item/organ/external/Initialize(mapload, material_key, datum/mob_snapshot/supplied_appearance, decl/bodytype/new_bodytype) . = ..() @@ -197,9 +197,9 @@ burn_damage = 7.5 var/power = 4 - severity //stupid reverse severity - for(var/obj/item/I in implants) - if(I.obj_flags & OBJ_FLAG_CONDUCTIBLE) - burn_damage += I.w_class * rand(power, 3*power) + for(var/obj/item/implanted_item in implants) + if(implanted_item.obj_flags & OBJ_FLAG_CONDUCTIBLE) + burn_damage += implanted_item.w_class * rand(power, 3*power) if(owner && burn_damage) owner.custom_pain("Something inside your [src] burns a [severity < 2 ? "bit" : "lot"]!", power * 15) //robotic organs won't feel it anyway @@ -213,32 +213,30 @@ if((owner && loc == owner) || !contents.len) return ..() var/list/removable_objects = list() - for(var/obj/item/organ/external/E in (contents + src)) - if(!istype(E)) - continue - for(var/obj/item/I in E.contents) - if(istype(I,/obj/item/organ)) + for(var/obj/item/organ/external/child_organ in (contents + src)) + for(var/obj/item/embedded in child_organ.contents) + if(istype(embedded, /obj/item/organ)) continue - removable_objects |= I + removable_objects |= embedded if(removable_objects.len) - var/obj/item/I = pick(removable_objects) - I.forceMove(get_turf(user)) //just in case something was embedded that is not an item - if(istype(I) && user.get_empty_hand_slot()) - user.put_in_hands(I) - user.visible_message(SPAN_DANGER("\The [user] rips \the [I] out of \the [src]!")) + var/obj/item/embedded = pick(removable_objects) + embedded.forceMove(get_turf(user)) //just in case something was embedded that is not an item + if(istype(embedded) && user.get_empty_hand_slot()) + user.put_in_hands(embedded) + user.visible_message(SPAN_DANGER("\The [user] rips \the [embedded] out of \the [src]!")) return //no eating the limb until everything's been removed return ..() /obj/item/organ/external/examine(mob/user, distance) . = ..() if(distance <= 1 || isghost(user)) - for(var/obj/item/I in contents) - if(istype(I, /obj/item/organ)) + for(var/obj/item/embedded in contents) + if(istype(embedded, /obj/item/organ)) continue - to_chat(user, "There is \a [I] sticking out of it.") + to_chat(user, SPAN_DANGER("There is \a [embedded] sticking out of it.")) var/ouchies = get_wounds_desc() if(ouchies != "nothing") - to_chat(user, "There is [ouchies] visible on it.") + to_chat(user, SPAN_NOTICE("There is [ouchies] visible on it.")) return @@ -247,105 +245,105 @@ for(var/obj/item/organ/external/child in children) child.show_decay_status(user) -/obj/item/organ/external/attackby(obj/item/W, mob/user) +/obj/item/organ/external/attackby(obj/item/used_item, mob/user) - var/obj/item/organ/external/E = W - if(BP_IS_PROSTHETIC(src) && istype(E) && BP_IS_PROSTHETIC(E)) + var/obj/item/organ/external/connecting_limb = used_item + if(BP_IS_PROSTHETIC(src) && istype(connecting_limb) && BP_IS_PROSTHETIC(connecting_limb)) var/combined = FALSE - if(E.organ_tag == parent_organ) + if(connecting_limb.organ_tag == parent_organ) - if(length(E.children)) - to_chat(usr, SPAN_WARNING("You cannot connect additional limbs to \the [E].")) + if(length(connecting_limb.children)) + to_chat(usr, SPAN_WARNING("You cannot connect additional limbs to \the [connecting_limb].")) return - var/mob/M = loc - if(istype(M)) - M.try_unequip(src, E) + var/mob/holder = loc + if(istype(holder)) + holder.try_unequip(src, connecting_limb) else dropInto(loc) - forceMove(E) + forceMove(connecting_limb) - if(loc != E) + if(loc != connecting_limb) return - if(istype(E.owner)) - E.owner.add_organ(src, E) + if(istype(connecting_limb.owner)) + connecting_limb.owner.add_organ(src, connecting_limb) else - do_install(null, E) + do_install(null, connecting_limb) combined = TRUE - else if(E.parent_organ == organ_tag) + else if(connecting_limb.parent_organ == organ_tag) if(LAZYLEN(children)) to_chat(usr, SPAN_WARNING("You cannot connect additional limbs to \the [src].")) return - if(!user.try_unequip(E, src)) + if(!user.try_unequip(connecting_limb, src)) return - if(istype(E.owner)) - E.owner.add_organ(E, src) + if(istype(connecting_limb.owner)) + connecting_limb.owner.add_organ(connecting_limb, src) else - E.do_install(null, src) + connecting_limb.do_install(null, src) combined = TRUE else - to_chat(user, SPAN_WARNING("\The [E] cannot be connected to \the [src].")) + to_chat(user, SPAN_WARNING("\The [connecting_limb] cannot be connected to \the [src].")) return if(combined) - to_chat(user, SPAN_NOTICE("You connect \the [E] to \the [src].")) + to_chat(user, SPAN_NOTICE("You connect \the [connecting_limb] to \the [src].")) compile_icon() update_icon() - E.compile_icon() - E.update_icon() + connecting_limb.compile_icon() + connecting_limb.update_icon() return //Remove sub-limbs - if(W.get_tool_quality(TOOL_SAW) && LAZYLEN(children) && try_saw_off_child(W, user)) + if(used_item.get_tool_quality(TOOL_SAW) && LAZYLEN(children) && try_saw_off_child(used_item, user)) return //Remove internal items/organs/implants - if(try_remove_internal_item(W, user)) + if(try_remove_internal_item(used_item, user)) return ..() //Handles removing internal organs/implants/items still in the detached limb. -/obj/item/organ/external/proc/try_remove_internal_item(var/obj/item/W, var/mob/user) +/obj/item/organ/external/proc/try_remove_internal_item(var/obj/item/used_item, var/mob/user) - if(stage == 0 && W.sharp) - user.visible_message(SPAN_NOTICE("\The [user] cuts \the [src] open with \the [W].")) + if(stage == 0 && used_item.sharp) + user.visible_message(SPAN_NOTICE("\The [user] cuts \the [src] open with \the [used_item].")) stage++ return TRUE - if(stage == 1 && IS_RETRACTOR(W)) - user.visible_message(SPAN_NOTICE("\The [user] levers \the [src] open with \the [W].")) + if(stage == 1 && IS_RETRACTOR(used_item)) + user.visible_message(SPAN_NOTICE("\The [user] levers \the [src] open with \the [used_item].")) stage++ return TRUE - if(stage == 2 && (W.sharp || IS_HEMOSTAT(W) || IS_WIRECUTTER(W))) + if(stage == 2 && (used_item.sharp || IS_HEMOSTAT(used_item) || IS_WIRECUTTER(used_item))) var/list/radial_buttons = make_item_radial_menu_choices(get_contents_recursive()) if(LAZYLEN(radial_buttons)) var/obj/item/removing = show_radial_menu(user, src, radial_buttons, radius = 42, require_near = TRUE, use_labels = TRUE, check_locs = list(src)) if(removing) if(istype(removing, /obj/item/organ)) - var/obj/item/organ/O = removing - O.do_uninstall() + var/obj/item/organ/removed_organ = removing + removed_organ.do_uninstall() removing.forceMove(get_turf(user)) if(user.get_empty_hand_slot()) user.put_in_hands(removing) - user.visible_message(SPAN_NOTICE("\The [user] extracts [removing] from \the [src] with \the [W]!")) + user.visible_message(SPAN_NOTICE("\The [user] extracts [removing] from \the [src] with \the [used_item]!")) else - user.visible_message(SPAN_NOTICE("\The [user] fishes around fruitlessly in \the [src] with \the [W].")) + user.visible_message(SPAN_NOTICE("\The [user] fishes around fruitlessly in \the [src] with \the [used_item].")) return TRUE return FALSE //Handles removing child limbs from the detached limb. -/obj/item/organ/external/proc/try_saw_off_child(var/obj/item/W, var/mob/user) +/obj/item/organ/external/proc/try_saw_off_child(var/obj/item/used_item, var/mob/user) //Add icons to radial menu var/list/radial_buttons = make_item_radial_menu_choices(get_limbs_recursive()) @@ -357,7 +355,7 @@ if(!istype(removing)) return TRUE - var/cutting_result = !W.do_tool_interaction(TOOL_SAW, user, src, 3 SECONDS, "cutting \the [removing] off") + var/cutting_result = !used_item.do_tool_interaction(TOOL_SAW, user, src, 3 SECONDS, "cutting \the [removing] off") //Check if the limb is still in the hierarchy if(cutting_result == 1 || !(removing in get_limbs_recursive())) if(cutting_result != -1) @@ -373,7 +371,7 @@ removing.update_icon() if(user.get_empty_hand_slot()) user.put_in_hands(removing) - user.visible_message(SPAN_DANGER("[user] cuts off \the [removing] from [src] with [W]!")) + user.visible_message(SPAN_DANGER("[user] cuts off \the [removing] from [src] with [used_item]!")) return TRUE /** @@ -405,11 +403,11 @@ return (status & ORGAN_DISLOCATED) || is_parent_dislocated() //if any parent is dislocated, we are considered dislocated as well /obj/item/organ/external/proc/is_parent_dislocated() - var/obj/item/organ/external/O = parent - while(O && (O.limb_flags & ORGAN_FLAG_CAN_DISLOCATE)) - if(O.status & ORGAN_DISLOCATED) + var/obj/item/organ/external/current_limb = parent + while(current_limb && (current_limb.limb_flags & ORGAN_FLAG_CAN_DISLOCATE)) + if(current_limb.status & ORGAN_DISLOCATED) return TRUE - O = O.parent + current_limb = current_limb.parent return FALSE /obj/item/organ/external/proc/update_internal_organs_cost() @@ -475,15 +473,15 @@ // //Add any existing organs in the owner that have us as parent // - for(var/obj/item/organ/internal/I in owner.get_internal_organs()) - if(I.parent_organ == organ_tag) - LAZYDISTINCTADD(internal_organs, I) + for(var/obj/item/organ/internal/internal_organ in owner.get_internal_organs()) + if(internal_organ.parent_organ == organ_tag) + LAZYDISTINCTADD(internal_organs, internal_organ) update_internal_organs_cost() - for(var/obj/item/organ/external/E in owner.get_external_organs()) - if(E.parent_organ == organ_tag) - E.parent = src - LAZYDISTINCTADD(children, E) + for(var/obj/item/organ/external/external_organ in owner.get_external_organs()) + if(external_organ.parent_organ == organ_tag) + external_organ.parent = src + LAZYDISTINCTADD(children, external_organ) //Add any existing implants that should be refering us for(var/obj/implant in implants) @@ -496,10 +494,10 @@ //Since limbs attached during surgery have their internal organs detached, we want to re-attach them if we're doing the proper install of the parent limb else if(istype(implant, /obj/item/organ) && !detached) - var/obj/item/organ/O = implant - if(O.parent_organ == organ_tag) + var/obj/item/organ/detached_organ = implant + if(detached_organ.parent_organ == organ_tag) //The add_organ chain will automatically handle properly removing the detached flag, and moving it to the proper lists - owner.add_organ(O, src, in_place, update_icon, detached) + owner.add_organ(detached_organ, src, in_place, update_icon, detached) else //Handle installing into a stand-alone parent limb to keep dropped limbs in some kind of coherent state if(!affected) @@ -523,9 +521,9 @@ LAZYDISTINCTADD(parent.children, src) //Even when detached the limb has to be in the children list, because of the way limbs icon are handled //Remove any stump wound for this slot - for(var/datum/wound/lost_limb/W in parent.wounds) - if(W.limb_tag == organ_tag) - qdel(W) //Removes itself from parent.wounds + for(var/datum/wound/lost_limb/stump in parent.wounds) + if(stump.limb_tag == organ_tag) + qdel(stump) //Removes itself from parent.wounds break if(!in_place) @@ -586,8 +584,8 @@ if(BURN) src.heal_damage(0, repair_amount, 0, 1) owner.try_refresh_visible_overlays() if(user == src.owner) - var/decl/pronouns/G = user.get_pronouns() - user.visible_message(SPAN_NOTICE("\The [user] patches [damage_desc] on [G.his] [name] with \the [tool].")) + var/decl/pronouns/user_pronouns = user.get_pronouns() + user.visible_message(SPAN_NOTICE("\The [user] patches [damage_desc] on [user_pronouns.his] [name] with \the [tool].")) else user.visible_message(SPAN_NOTICE("\The [user] patches [damage_desc] on \the [owner]'s [name] with \the [tool].")) return 1 @@ -631,11 +629,11 @@ This function completely restores a damaged organ to perfect condition. /obj/item/organ/external/remove_rejuv() if(owner) owner.remove_organ(src, FALSE, FALSE, TRUE, TRUE, FALSE) - for(var/obj/item/organ/external/E in children) - E.remove_rejuv() + for(var/obj/item/organ/external/child in children) + child.remove_rejuv() LAZYCLEARLIST(children) - for(var/obj/item/organ/internal/I in internal_organs) - I.remove_rejuv() + for(var/obj/item/organ/internal/internal_organ in internal_organs) + internal_organ.remove_rejuv() ..() /obj/item/organ/external/proc/createwound(var/type = CUT, var/damage, var/surgical) @@ -680,44 +678,44 @@ This function completely restores a damaged organ to perfect condition. if((type == CUT || type == BRUISE) && damage >= 5) //we need to make sure that the wound we are going to worsen is compatible with the type of damage... var/list/compatible_wounds = list() - for (var/datum/wound/W in wounds) - if (W.can_worsen(type, damage)) - compatible_wounds += W + for (var/datum/wound/wound in wounds) + if (wound.can_worsen(type, damage)) + compatible_wounds += wound if(compatible_wounds.len) - var/datum/wound/W = pick(compatible_wounds) - W.open_wound(damage) + var/datum/wound/wound = pick(compatible_wounds) + wound.open_wound(damage) if(owner && prob(25)) if(BP_IS_CRYSTAL(src)) - owner.visible_message("The cracks in \the [owner]'s [name] spread.",\ - "The cracks in your [name] spread.",\ - "You hear the cracking of crystal.") + owner.visible_message(SPAN_DANGER("The cracks in \the [owner]'s [name] spread."),\ + SPAN_DANGER("The cracks in your [name] spread."),\ + SPAN_DANGER("You hear the cracking of crystal.")) else if(BP_IS_PROSTHETIC(src)) - owner.visible_message("The damage to \the [owner]'s [name] worsens.",\ - "The damage to your [name] worsens.",\ - "You hear the screech of abused metal.") + owner.visible_message(SPAN_DANGER("The damage to \the [owner]'s [name] worsens."),\ + SPAN_DANGER("The damage to your [name] worsens."),\ + SPAN_DANGER("You hear the screech of abused metal.")) else - owner.visible_message("The wound on \the [owner]'s [name] widens with a nasty ripping noise.",\ - "The wound on your [name] widens with a nasty ripping noise.",\ - "You hear a nasty ripping noise, as if flesh is being torn apart.") - return W + owner.visible_message(SPAN_DANGER("The wound on \the [owner]'s [name] widens with a nasty ripping noise."),\ + SPAN_DANGER("The wound on your [name] widens with a nasty ripping noise."),\ + SPAN_DANGER("You hear a nasty ripping noise, as if flesh is being torn apart.")) + return wound //Creating wound var/wound_type = get_wound_type(type, damage) if(wound_type) - var/datum/wound/W = new wound_type(damage, src, surgical) + var/datum/wound/wound = new wound_type(damage, src, surgical) //Check whether we can add the wound to an existing wound if(surgical) - W.autoheal_cutoff = 0 + wound.autoheal_cutoff = 0 else for(var/datum/wound/other in wounds) - if(other.can_merge_wounds(W)) - other.merge_wound(W) + if(other.can_merge_wounds(wound)) + other.merge_wound(wound) return - LAZYADD(wounds, W) - return W + LAZYADD(wounds, wound) + return wound /**************************************************** PROCESSING & UPDATING @@ -742,8 +740,8 @@ This function completely restores a damaged organ to perfect condition. if(get_genetic_damage()) return TRUE - for(var/obj/item/organ/internal/I in internal_organs) - if(I.getToxLoss()) + for(var/obj/item/organ/internal/internal_organ in internal_organs) + if(internal_organ.getToxLoss()) return TRUE if(last_dam != brute_dam + burn_dam) // Process when we are fully healed up. @@ -806,18 +804,18 @@ Note that amputating the affected organ does in fact remove the infection from t handle_germ_effects() /obj/item/organ/external/proc/handle_germ_sync() - var/turf/T = get_turf(owner) - for(var/datum/wound/W in wounds) + var/turf/current_turf = get_turf(owner) + for(var/datum/wound/wound in wounds) //Open wounds can become infected - // what in the hell is this doing with T? - if(max(istype(T) && T.simulated && T.get_dirt()*10, 2*owner.germ_level) > W.germ_level && W.infection_check()) - W.germ_level++ + // what in the hell is this doing with current_turf? + if(max(istype(current_turf) && current_turf.simulated && current_turf.get_dirt()*10, 2*owner.germ_level) > wound.germ_level && wound.infection_check()) + wound.germ_level++ var/antibiotics = GET_CHEMICAL_EFFECT(owner, CE_ANTIBIOTIC) if (!antibiotics) - for(var/datum/wound/W in wounds) + for(var/datum/wound/wound in wounds) //Infected wounds raise the organ's germ level - if (W.germ_level > germ_level || prob(min(W.germ_level, 30))) + if (wound.germ_level > germ_level || prob(min(wound.germ_level, 30))) germ_level++ break //limit increase to a maximum of one per second @@ -831,17 +829,17 @@ Note that amputating the affected organ does in fact remove the infection from t if(germ_level >= INFECTION_LEVEL_TWO) //spread the infection to internal organs var/obj/item/organ/target_organ = null //make internal organs become infected one at a time instead of all at once - for (var/obj/item/organ/I in internal_organs) - if (I.germ_level > 0 && I.germ_level < min(germ_level, INFECTION_LEVEL_TWO)) //once the organ reaches whatever we can give it, or level two, switch to a different one - if (!target_organ || I.germ_level > target_organ.germ_level) //choose the organ with the highest germ_level - target_organ = I + for (var/obj/item/organ/internal_organ in internal_organs) + if (internal_organ.germ_level > 0 && internal_organ.germ_level < min(germ_level, INFECTION_LEVEL_TWO)) //once the organ reaches whatever we can give it, or level two, switch to a different one + if (!target_organ || internal_organ.germ_level > target_organ.germ_level) //choose the organ with the highest germ_level + target_organ = internal_organ if (!target_organ) //figure out which organs we can spread germs to and pick one at random var/list/candidate_organs = list() - for (var/obj/item/organ/I in internal_organs) - if (I.germ_level < germ_level) - candidate_organs |= I + for (var/obj/item/organ/internal_organ in internal_organs) + if (internal_organ.germ_level < germ_level) + candidate_organs |= internal_organ if (candidate_organs.len) target_organ = pick(candidate_organs) @@ -862,7 +860,7 @@ Note that amputating the affected organ does in fact remove the infection from t if(germ_level >= INFECTION_LEVEL_THREE && antibiotics < REAGENTS_OVERDOSE) //overdosing is necessary to stop severe infections if (!(status & ORGAN_DEAD)) status |= ORGAN_DEAD - to_chat(owner, "You can't feel your [name] anymore...") + to_chat(owner, SPAN_NOTICE("You can't feel your [name] anymore...")) owner.update_body(1) germ_level++ @@ -873,18 +871,18 @@ Note that amputating the affected organ does in fact remove the infection from t var/update_surgery if(BP_IS_PROSTHETIC(src) || BP_IS_CRYSTAL(src)) //Robotic limbs don't heal or get worse. - for(var/datum/wound/W in wounds) //Repaired wounds disappear though - if(W.damage <= 0) //and they disappear right away - qdel(W) //TODO: robot wounds for robot limbs + for(var/datum/wound/wound in wounds) //Repaired wounds disappear though + if(wound.damage <= 0) //and they disappear right away + qdel(wound) //TODO: robot wounds for robot limbs update_surgery = TRUE if(owner && update_surgery) owner.update_surgery() return - for(var/datum/wound/W in wounds) + for(var/datum/wound/wound in wounds) // wounds can disappear after 10 minutes at the earliest - if(W.damage <= 0 && W.created + (10 MINUTES) <= world.time) - qdel(W) + if(wound.damage <= 0 && wound.created + (10 MINUTES) <= world.time) + qdel(wound) update_surgery = TRUE continue // let the GC handle the deletion of the wound @@ -892,7 +890,7 @@ Note that amputating the affected organ does in fact remove the infection from t // slow healing var/heal_amt = 0 // if damage >= 50 AFTER treatment then it's probably too severe to heal within the timeframe of a round. - if (owner && !GET_CHEMICAL_EFFECT(owner, CE_TOXIN) && W.can_autoheal() && W.wound_damage() && brute_ratio < 0.5 && burn_ratio < 0.5) + if (owner && !GET_CHEMICAL_EFFECT(owner, CE_TOXIN) && wound.can_autoheal() && wound.wound_damage() && brute_ratio < 0.5 && burn_ratio < 0.5) heal_amt += 0.5 // we only update wounds once in [wound_update_accuracy] ticks so have to emulate realtime @@ -909,10 +907,10 @@ Note that amputating the affected organ does in fact remove the infection from t // making it look prettier on scanners heal_amt = round(heal_amt,0.1) var/dam_type = BRUTE - if(W.damage_type == BURN) + if(wound.damage_type == BURN) dam_type = BURN if(owner?.can_autoheal(dam_type)) - W.heal_damage(heal_amt) + wound.heal_damage(heal_amt) // sync the organ's damage with its wounds update_damages() @@ -930,29 +928,30 @@ Note that amputating the affected organ does in fact remove the infection from t status &= ~ORGAN_BLEEDING var/clamped = 0 - var/mob/living/human/H + // This is defined outside of the loop as an optimization for a large number of wounds. + var/mob/living/human/human_owner if(ishuman(owner)) - H = owner + human_owner = owner //update damage counts var/bleeds = (!BP_IS_PROSTHETIC(src) && !BP_IS_CRYSTAL(src)) - for(var/datum/wound/W in wounds) + for(var/datum/wound/wound in wounds) - if(W.damage <= 0) - qdel(W) + if(wound.damage <= 0) + qdel(wound) continue - if(W.damage_type == BURN) - burn_dam += W.damage + if(wound.damage_type == BURN) + burn_dam += wound.damage else - brute_dam += W.damage + brute_dam += wound.damage - if(bleeds && W.bleeding() && (H && H.should_have_organ(BP_HEART))) - W.bleed_timer-- + if(bleeds && wound.bleeding() && (human_owner && human_owner.should_have_organ(BP_HEART))) + wound.bleed_timer-- status |= ORGAN_BLEEDING - clamped |= W.clamped - number_wounds += W.amount + clamped |= wound.clamped + number_wounds += wound.amount damage = brute_dam + burn_dam update_damage_ratios() @@ -1057,10 +1056,10 @@ Note that amputating the affected organ does in fact remove the infection from t . = new /obj/effect/decal/cleanable/blood/gibs(dropturf) if(species && istype(., /obj/effect/decal/cleanable/blood/gibs)) - var/obj/effect/decal/cleanable/blood/gibs/G = . - G.fleshcolor = species.get_species_flesh_color(owner) - G.basecolor = species.get_species_blood_color(owner) - G.update_icon() + var/obj/effect/decal/cleanable/blood/gibs/gibs = . + gibs.fleshcolor = species.get_species_flesh_color(owner) + gibs.basecolor = species.get_species_blood_color(owner) + gibs.update_icon() //Handles dismemberment /obj/item/organ/external/proc/dismember(var/clean, var/disintegrate = DISMEMBER_METHOD_EDGE, var/ignore_children, var/silent, var/ignore_last_organ) @@ -1075,9 +1074,9 @@ Note that amputating the affected organ does in fact remove the infection from t var/list/organ_msgs = get_droplimb_messages_for(disintegrate, clean) if(LAZYLEN(organ_msgs) >= 3) - owner.visible_message("[organ_msgs[1]]", \ - "[organ_msgs[2]]", \ - "[organ_msgs[3]]") + owner.visible_message(SPAN_DANGER("[organ_msgs[1]]"), \ + SPAN_MODERATE("[organ_msgs[2]]"), \ + SPAN_DANGER("[organ_msgs[3]]")) add_pain(60) if(!clean) @@ -1107,9 +1106,9 @@ Note that amputating the affected organ does in fact remove the infection from t original_parent.sever_artery() // Leave a big ol hole. - var/datum/wound/lost_limb/W = new(src, disintegrate, clean) - W.parent_organ = original_parent - LAZYADD(original_parent.wounds, W) + var/datum/wound/lost_limb/stump = new(src, disintegrate, clean) + stump.parent_organ = original_parent + LAZYADD(original_parent.wounds, stump) original_parent.update_damages() if(QDELETED(src)) @@ -1132,19 +1131,19 @@ Note that amputating the affected organ does in fact remove the infection from t var/atom/movable/gore = place_remains_from_dismember_method(disintegrate) if(gore) if(disintegrate == DISMEMBER_METHOD_BURN || disintegrate == DISMEMBER_METHOD_ACID) - for(var/obj/item/I in src) - if(I.w_class > ITEM_SIZE_SMALL && !istype(I,/obj/item/organ)) - I.dropInto(loc) + for(var/obj/item/contained_item in src) + if(contained_item.w_class > ITEM_SIZE_SMALL && !istype(contained_item, /obj/item/organ)) + contained_item.dropInto(loc) else if(disintegrate == DISMEMBER_METHOD_BLUNT) gore.throw_at(get_edge_target_turf(src,pick(global.alldirs)), rand(1,3), THROWFORCE_GIBS) - for(var/obj/item/organ/I in internal_organs) - I.do_uninstall() //No owner so run uninstall directly - I.dropInto(get_turf(loc)) - if(!QDELETED(I) && isturf(loc)) - I.throw_at(get_edge_target_turf(src,pick(global.alldirs)), rand(1,3), THROWFORCE_GIBS) - for(var/obj/item/I in src) - I.dropInto(loc) - I.throw_at(get_edge_target_turf(src,pick(global.alldirs)), rand(1,3), THROWFORCE_GIBS) + for(var/obj/item/organ/internal_organ in internal_organs) + internal_organ.do_uninstall() //No owner so run uninstall directly + internal_organ.dropInto(get_turf(loc)) + if(!QDELETED(internal_organ) && isturf(loc)) + internal_organ.throw_at(get_edge_target_turf(src,pick(global.alldirs)), rand(1,3), THROWFORCE_GIBS) + for(var/obj/item/contained_item in src) + contained_item.dropInto(loc) + contained_item.throw_at(get_edge_target_turf(src,pick(global.alldirs)), rand(1,3), THROWFORCE_GIBS) if(!QDELETED(src)) qdel(src) @@ -1166,70 +1165,70 @@ Note that amputating the affected organ does in fact remove the infection from t // checks if all wounds on the organ are bandaged /obj/item/organ/external/proc/is_bandaged() - for(var/datum/wound/W in wounds) - if(!W.bandaged) + for(var/datum/wound/wound in wounds) + if(!wound.bandaged) return 0 return 1 // checks if all wounds on the organ are salved /obj/item/organ/external/proc/is_salved() - for(var/datum/wound/W in wounds) - if(!W.salved) + for(var/datum/wound/wound in wounds) + if(!wound.salved) return 0 return 1 // checks if all wounds on the organ are disinfected /obj/item/organ/external/proc/is_disinfected() - for(var/datum/wound/W in wounds) - if(!W.disinfected) + for(var/datum/wound/wound in wounds) + if(!wound.disinfected) return 0 return 1 /obj/item/organ/external/proc/salve() var/rval = 0 - for(var/datum/wound/W in wounds) - rval |= !W.salved - W.salved = 1 + for(var/datum/wound/wound in wounds) + rval |= !wound.salved + wound.salved = 1 return rval /obj/item/organ/external/proc/disinfect() var/rval = 0 - for(var/datum/wound/W in wounds) - rval |= !W.disinfected - W.disinfected = 1 - W.germ_level = 0 + for(var/datum/wound/wound in wounds) + rval |= !wound.disinfected + wound.disinfected = 1 + wound.germ_level = 0 return rval /obj/item/organ/external/proc/clamp_organ() var/rval = 0 src.status &= ~ORGAN_BLEEDING - for(var/datum/wound/W in wounds) - rval |= !W.clamped - W.clamped = 1 + for(var/datum/wound/wound in wounds) + rval |= !wound.clamped + wound.clamped = 1 return rval /obj/item/organ/external/proc/clamped() - for(var/datum/wound/W in wounds) - if(W.clamped) + for(var/datum/wound/wound in wounds) + if(wound.clamped) return 1 /obj/item/organ/external/proc/remove_clamps() var/rval = 0 - for(var/datum/wound/W in wounds) - rval |= W.clamped - W.clamped = 0 + for(var/datum/wound/wound in wounds) + rval |= wound.clamped + wound.clamped = 0 return rval // open incisions and expose implants // this is the retract step of surgery /obj/item/organ/external/proc/open_incision() - var/datum/wound/W = get_incision() - if(!W) return - W.open_wound(min(W.damage * 2, W.damage_list[1] - W.damage)) + var/datum/wound/incision = get_incision() + if(!incision) return + incision.open_wound(min(incision.damage * 2, incision.damage_list[1] - incision.damage)) if(!encased) - for(var/obj/item/implant/I in implants) - I.exposed() + for(var/obj/item/implant/implant in implants) + implant.exposed() /obj/item/organ/external/proc/fracture() if(!get_config_value(/decl/config/toggle/on/health_bones_can_break)) @@ -1241,9 +1240,9 @@ Note that amputating the affected organ does in fact remove the infection from t if(owner) owner.visible_message(\ - "You hear a loud cracking sound coming from \the [owner].",\ - "Something feels like it shattered in your [name]!",\ - "You hear a sickening crack.") + SPAN_DANGER("You hear a loud cracking sound coming from \the [owner]."),\ + SPAN_DANGER("Something feels like it shattered in your [name]!"),\ + SPAN_DANGER("You hear a sickening crack.")) jostle_bone() if(can_feel_pain()) owner.emote(/decl/emote/audible/scream) @@ -1302,8 +1301,8 @@ Note that amputating the affected organ does in fact remove the infection from t return (brute_dam+burn_dam) //could use max_damage? /obj/item/organ/external/proc/has_infected_wound() - for(var/datum/wound/W in wounds) - if(W.germ_level > INFECTION_LEVEL_ONE) + for(var/datum/wound/wound in wounds) + if(wound.germ_level > INFECTION_LEVEL_ONE) return 1 return 0 @@ -1324,38 +1323,38 @@ Note that amputating the affected organ does in fact remove the infection from t /obj/item/organ/external/proc/is_malfunctioning() return (is_robotic() && (brute_dam + burn_dam) >= 10 && prob(brute_dam + burn_dam)) -/obj/item/organ/external/proc/embed_in_organ(var/obj/item/W, var/silent = FALSE, var/supplied_message, var/datum/wound/supplied_wound) +/obj/item/organ/external/proc/embed_in_organ(var/obj/item/embedding, var/silent = FALSE, var/supplied_message, var/datum/wound/supplied_wound) if(!owner || loc != owner) return if(species.species_flags & SPECIES_FLAG_NO_EMBED) return if(!silent) if(supplied_message) - owner.visible_message("[supplied_message]") + owner.visible_message(SPAN_DANGER("[supplied_message]")) else - owner.visible_message("\The [W] sticks in the wound!") + owner.visible_message(SPAN_DANGER("\The [embedding] sticks in the wound!")) if(!supplied_wound) for(var/datum/wound/wound in wounds) - if((wound.damage_type == CUT || wound.damage_type == PIERCE) && wound.damage >= W.w_class * 5) + if((wound.damage_type == CUT || wound.damage_type == PIERCE) && wound.damage >= embedding.w_class * 5) supplied_wound = wound break if(!supplied_wound) - supplied_wound = createwound(PIERCE, W.w_class * 5) + supplied_wound = createwound(PIERCE, embedding.w_class * 5) - if(!supplied_wound || (W in supplied_wound.embedded_objects)) // Just in case. + if(!supplied_wound || (embedding in supplied_wound.embedded_objects)) // Just in case. return - LAZYDISTINCTADD(supplied_wound.embedded_objects, W) - LAZYDISTINCTADD(implants, W) + LAZYDISTINCTADD(supplied_wound.embedded_objects, embedding) + LAZYDISTINCTADD(implants, embedding) owner.embedded_flag = 1 owner.verbs += /mob/proc/yank_out_object - W.add_blood(owner) - if(ismob(W.loc)) - var/mob/living/H = W.loc - H.drop_from_inventory(W) - W.forceMove(owner) + embedding.add_blood(owner) + if(ismob(embedding.loc)) + var/mob/living/holder = embedding.loc + holder.drop_from_inventory(embedding) + embedding.forceMove(owner) /obj/item/organ/external/do_uninstall(in_place, detach, ignore_children, update_icon) @@ -1366,11 +1365,11 @@ Note that amputating the affected organ does in fact remove the infection from t if(victim) if(in_place) //When removing in place, we don't bother with moving child organs and implants, we just clear the refs - for(var/obj/item/implant/I in implants) - I.removed() + for(var/obj/item/implant/implant in implants) + implant.removed() //Remove the parent ref from all childs limbs until we replace the organ in place - for(var/obj/item/organ/external/E in children) - E.parent = null + for(var/obj/item/organ/external/child in children) + child.parent = null implants = null children = null @@ -1379,28 +1378,28 @@ Note that amputating the affected organ does in fact remove the infection from t //Move over our implants/items into us, and drop whatever else is too big or not an object(??) for(var/atom/movable/implant in implants) //large items and non-item objs fall to the floor, everything else stays - var/obj/item/I = implant + var/obj/item/item_implant = implant if(QDELETED(implant)) LAZYREMOVE(implants, implant) continue - if(istype(I) && I.w_class < ITEM_SIZE_NORMAL) - if(istype(I, /obj/item/implant)) - var/obj/item/implant/imp = I + if(istype(item_implant) && item_implant.w_class < ITEM_SIZE_NORMAL) + if(istype(item_implant, /obj/item/implant)) + var/obj/item/implant/imp = item_implant imp.removed() implant.forceMove(src) - else - //Dumpt the rest on the turf + else // Is this even necessary? What non-items can even get added to implants? + //Dump the rest on the turf LAZYREMOVE(implants, implant) implant.forceMove(get_turf(src)) if(!ignore_children) //Move our chilren limb into our contents - for(var/obj/item/organ/external/O in children) - victim.remove_organ(O, FALSE, FALSE, FALSE, in_place, update_icon) - if(QDELETED(O)) - LAZYREMOVE(children, O) + for(var/obj/item/organ/external/child in children) + victim.remove_organ(child, FALSE, FALSE, FALSE, in_place, update_icon) + if(QDELETED(child)) + LAZYREMOVE(children, child) continue - O.do_install(null, src, FALSE, update_icon, FALSE) //Forcemove the organ and properly set it up in our internal data + child.do_install(null, src, FALSE, update_icon, FALSE) //Forcemove the organ and properly set it up in our internal data // Grab all the children internal organs for(var/obj/item/organ/internal/organ in internal_organs) @@ -1445,13 +1444,13 @@ Note that amputating the affected organ does in fact remove the infection from t return if(owner) if(type == BRUTE) - owner.visible_message("You hear a sickening cracking sound coming from \the [owner]'s [name].", \ - "Your [name] becomes a mangled mess!", \ - "You hear a sickening crack.") + owner.visible_message(SPAN_DANGER("You hear a sickening cracking sound coming from \the [owner]'s [name]."), \ + SPAN_DANGER("Your [name] becomes a mangled mess!"), \ + SPAN_DANGER("You hear a sickening crack.")) else - owner.visible_message("\The [owner]'s [name] melts away, turning into mangled mess!", \ - "Your [name] melts away!", \ - "You hear a sickening sizzle.") + owner.visible_message(SPAN_DANGER("\The [owner]'s [name] melts away, turning into mangled mess!"), \ + SPAN_DANGER("Your [name] melts away!"), \ + SPAN_DANGER("You hear a sickening sizzle.")) status |= ORGAN_DISFIGURED /obj/item/organ/external/proc/get_incision(var/strict) @@ -1462,20 +1461,20 @@ Note that amputating the affected organ does in fact remove the infection from t if(!incision || incision.damage < other.damage) incision = other else - for(var/datum/wound/cut/W in wounds) - if(!W.is_open()) // Shit's unusable + for(var/datum/wound/cut/candidate_incision in wounds) + if(!candidate_incision.is_open()) // Shit's unusable continue - if(strict && !W.is_surgical()) //We don't need dirty ones + if(strict && !candidate_incision.is_surgical()) //We don't need dirty ones continue if(!incision) - incision = W + incision = candidate_incision continue - var/same = W.is_surgical() == incision.is_surgical() + var/same = candidate_incision.is_surgical() == incision.is_surgical() if(same) //If they're both dirty or both are surgical, just get bigger one - if(W.damage > incision.damage) - incision = W - else if(W.is_surgical()) //otherwise surgical one takes priority - incision = W + if(candidate_incision.damage > incision.damage) + incision = candidate_incision + else if(candidate_incision.is_surgical()) //otherwise surgical one takes priority + incision = candidate_incision return incision /obj/item/organ/external/proc/how_open() @@ -1507,8 +1506,8 @@ Note that amputating the affected organ does in fact remove the infection from t return if(LAZYLEN(internal_organs) && prob(brute_dam + force)) owner.custom_pain("A piece of bone in your [encased ? encased : name] moves painfully!", 50, affecting = src) - var/obj/item/organ/internal/I = pick(internal_organs) - I.take_internal_damage(rand(3,5)) + var/obj/item/organ/internal/internal_organ = pick(internal_organs) + internal_organ.take_internal_damage(rand(3,5)) /obj/item/organ/external/proc/jointlock(mob/attacker) if(!can_feel_pain()) @@ -1516,7 +1515,7 @@ Note that amputating the affected organ does in fact remove the infection from t var/armor = 100 * owner.get_blocked_ratio(owner, BRUTE, damage = 30) if(armor < 70) - to_chat(owner, "You feel extreme pain!") + to_chat(owner, SPAN_DANGER("You feel extreme pain!")) var/max_halloss = round(owner.species.total_health * 0.8 * ((100 - armor) / 100)) //up to 80% of passing out, further reduced by armour add_pain(clamp(0, max_halloss - owner.get_damage(PAIN), 30)) @@ -1526,18 +1525,18 @@ Note that amputating the affected organ does in fact remove the infection from t var/key = used_weapon var/data = used_weapon if(istype(used_weapon, /obj/item)) - var/obj/item/I = used_weapon - key = I.name - data = english_list(I.get_autopsy_descriptors()) - var/datum/autopsy_data/W = LAZYACCESS(autopsy_data, key) - if(!W) - W = new() - W.weapon = data - LAZYSET(autopsy_data, key, W) - - W.hits += 1 - W.damage += damage - W.time_inflicted = world.time + var/obj/item/used_item = used_weapon + key = used_item.name + data = english_list(used_item.get_autopsy_descriptors()) + var/datum/autopsy_data/autopsy_datum = LAZYACCESS(autopsy_data, key) + if(!autopsy_datum) + autopsy_datum = new() + autopsy_datum.weapon = data + LAZYSET(autopsy_data, key, autopsy_datum) + + autopsy_datum.hits += 1 + autopsy_datum.damage += damage + autopsy_datum.time_inflicted = world.time /obj/item/organ/external/proc/has_genitals() return !BP_IS_PROSTHETIC(src) && bodytype?.get_vulnerable_location() == organ_tag @@ -1597,8 +1596,8 @@ Note that amputating the affected organ does in fact remove the infection from t if(isnull(vital_to_owner)) . = ..() if(!.) - for(var/obj/item/organ/O in children) - if(O.is_vital_to_owner()) + for(var/obj/item/organ/child in children) + if(child.is_vital_to_owner()) vital_to_owner = TRUE break return vital_to_owner From 778463845a25d6037cb5aef385797bce374a5cd4 Mon Sep 17 00:00:00 2001 From: Penelope Haze Date: Thu, 4 Jul 2024 18:22:21 -0400 Subject: [PATCH 3/7] Rename one-letter variables in disposal holder code --- code/modules/recycling/disposalholder.dm | 54 ++++++++++++------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/code/modules/recycling/disposalholder.dm b/code/modules/recycling/disposalholder.dm index 120782aaff4..4f3546d06a6 100644 --- a/code/modules/recycling/disposalholder.dm +++ b/code/modules/recycling/disposalholder.dm @@ -18,9 +18,9 @@ var/partialTag = "" //set by a partial tagger the first time round, then put in destinationTag if it goes through again. // initialize a holder from the contents of a disposal unit -/obj/structure/disposalholder/proc/init(var/obj/machinery/disposal/D, var/datum/gas_mixture/flush_gas) +/obj/structure/disposalholder/proc/init(var/obj/machinery/disposal/disposal_unit, var/datum/gas_mixture/flush_gas) gas = flush_gas// transfer gas resv. into holder object -- let's be explicit about the data this proc consumes, please. - var/stuff = D.get_contained_external_atoms() + var/stuff = disposal_unit.get_contained_external_atoms() //Check for any living mobs trigger hasmob. //hasmob effects whether the package goes to cargo or its tagged destination. hasmob = length(check_mob(stuff)) @@ -36,20 +36,20 @@ /obj/structure/disposalholder/proc/check_mob(list/stuff, max_depth = 1) . = list() if(max_depth > 0) - for(var/mob/living/M in stuff) - if (!isdrone(M)) - . += M - for(var/obj/O in stuff) - . += check_mob(O.contents, max_depth - 1) + for(var/mob/living/victim in stuff) + if (!isdrone(victim)) + . += victim + for(var/obj/container in stuff) + . += check_mob(container.contents, max_depth - 1) // start the movement process // argument is the disposal unit the holder started in -/obj/structure/disposalholder/proc/start(var/obj/machinery/disposal/D) - if(!D.trunk) - D.expel(src) // no trunk connected, so expel immediately +/obj/structure/disposalholder/proc/start(var/obj/machinery/disposal/disposal_unit) + if(!disposal_unit.trunk) + disposal_unit.expel(src) // no trunk connected, so expel immediately return - forceMove(D.trunk) + forceMove(disposal_unit.trunk) active = 1 set_dir(DOWN) START_PROCESSING(SSdisposals, src) @@ -65,8 +65,8 @@ var/obj/structure/disposalpipe/last if(hasmob && prob(3)) - for(var/mob/living/H in check_mob(src)) - H.apply_damage(30, BRUTE, null, DAM_DISPERSED, "Blunt Trauma", ARMOR_MELEE_MAJOR)//horribly maim any living creature jumping down disposals. c'est la vie + for(var/mob/living/victim in check_mob(src)) + victim.apply_damage(30, BRUTE, null, DAM_DISPERSED, "Blunt Trauma", ARMOR_MELEE_MAJOR)//horribly maim any living creature jumping down disposals. c'est la vie var/obj/structure/disposalpipe/curr = loc if(!istype(curr)) @@ -87,26 +87,26 @@ return get_step(loc,dir) // find a matching pipe on a turf -/obj/structure/disposalholder/proc/findpipe(var/turf/T) - if(!T) +/obj/structure/disposalholder/proc/findpipe(var/turf/containing_turf) + if(!containing_turf) return null var/fdir = turn(dir, 180) // flip the movement direction - for(var/obj/structure/disposalpipe/P in T) - if(fdir & P.dpdir) // find pipe direction mask that matches flipped dir - return P + for(var/obj/structure/disposalpipe/pipe in containing_turf) + if(fdir & pipe.dpdir) // find pipe direction mask that matches flipped dir + return pipe // if no matching pipe, return null return null // merge two holder objects // used when a a holder meets a stuck holder /obj/structure/disposalholder/proc/merge(var/obj/structure/disposalholder/other) - for(var/atom/movable/AM in other) - AM.forceMove(src) // move everything in other holder to this one - if(ismob(AM)) - var/mob/M = AM - if(M.client) // if a client mob, update eye to follow this holder - M.client.eye = src + for(var/atom/movable/other_movable in other) + other_movable.forceMove(src) // move everything in other holder to this one + if(ismob(other_movable)) + var/mob/other_mob = other_movable + if(other_mob.client) // if a client mob, update eye to follow this holder + other_mob.client.eye = src qdel(other) /obj/structure/disposalholder/proc/settag(var/new_tag) @@ -124,12 +124,12 @@ if(!isliving(user)) return - var/mob/living/U = user + var/mob/living/living_user = user - if (U.stat || U.is_on_special_ability_cooldown()) + if (living_user.stat || living_user.is_on_special_ability_cooldown()) return - U.set_special_ability_cooldown(10 SECONDS) + living_user.set_special_ability_cooldown(10 SECONDS) var/turf/our_turf = get_turf(src) if (our_turf) From 7fb56f17eea270c3032440b595dad78e553ea8f4 Mon Sep 17 00:00:00 2001 From: Penelope Haze Date: Thu, 4 Jul 2024 18:26:39 -0400 Subject: [PATCH 4/7] Rename one-letter variables in sealant code --- code/modules/sealant_gun/sealant.dm | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/code/modules/sealant_gun/sealant.dm b/code/modules/sealant_gun/sealant.dm index 33e4b8d4a00..bd3abc985a2 100644 --- a/code/modules/sealant_gun/sealant.dm +++ b/code/modules/sealant_gun/sealant.dm @@ -38,7 +38,7 @@ break_apart(user) return TRUE -/obj/item/sealant/attackby(obj/item/W, mob/user) +/obj/item/sealant/attackby(obj/item/used_item, mob/user) break_apart(user) return TRUE @@ -54,9 +54,9 @@ user.setClickCooldown(1 SECOND) qdel(src) -/obj/item/sealant/Bump(atom/A, forced) +/obj/item/sealant/Bump(atom/bumped, forced) . = ..() - splat(A) + splat(bumped) /obj/item/sealant/throw_impact(atom/hit_atom) . = ..() @@ -66,18 +66,18 @@ if(splatted) return splatted = TRUE - var/turf/T = get_turf(target) || get_turf(src) - if(T) - new /obj/effect/sealant(T) + var/turf/target_turf = get_turf(target) || get_turf(src) + if(target_turf) + new /obj/effect/sealant(target_turf) if(isliving(target)) - var/mob/living/H = target + var/mob/living/living_target = target for(var/slot in shuffle(splat_try_equip_slots)) - if(!H.get_equipped_item(slot)) - H.equip_to_slot_if_possible(src, slot) - if(H.get_equipped_item(slot) == src) + if(!living_target.get_equipped_item(slot)) + living_target.equip_to_slot_if_possible(src, slot) + if(living_target.get_equipped_item(slot) == src) return - if(!T.density && !(locate(foam_type) in T)) - new foam_type(T) + if(!target_turf.density && !(locate(foam_type) in target_turf)) + new foam_type(target_turf) if(!QDELETED(src)) qdel(src) From b4e481dd450dd733229f6d7ec7cbd998e9fbff57 Mon Sep 17 00:00:00 2001 From: Penelope Haze Date: Thu, 4 Jul 2024 18:35:24 -0400 Subject: [PATCH 5/7] Rename one- and two-letter variables in hoist code --- code/modules/multiz/hoist.dm | 51 +++++++++++++++--------------------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/code/modules/multiz/hoist.dm b/code/modules/multiz/hoist.dm index 02c3988c4a6..6a3c80e71fe 100644 --- a/code/modules/multiz/hoist.dm +++ b/code/modules/multiz/hoist.dm @@ -48,15 +48,14 @@ /obj/effect/hoist_hook/receive_mouse_drop(atom/dropping, mob/user, params) // skip the parent buckle logic, handle climbing directly - var/mob/living/H = user - if(istype(H) && !H.anchored && can_climb(H) && dropping == user) + if(isliving(user) && !user.anchored && can_climb(user) && dropping == user) do_climb(dropping) return TRUE // end copypasta'd code if(istype(dropping, /atom/movable)) - var/atom/movable/AM = dropping - if(!AM.simulated || AM.anchored) - to_chat(user, SPAN_WARNING("You can't do that with \the [AM].")) + var/atom/movable/dropped_movable = dropping + if(!dropped_movable.simulated || dropped_movable.anchored) + to_chat(user, SPAN_WARNING("You can't do that with \the [dropped_movable].")) return TRUE if(source_hoist.hoistee) to_chat(user, SPAN_NOTICE("\The [source_hoist.hoistee] is already attached to \the [src]!")) @@ -66,24 +65,24 @@ return if (!user.check_dexterity(DEXTERITY_HOLD_ITEM)) return - source_hoist.attach_hoistee(AM) + source_hoist.attach_hoistee(dropped_movable) user.visible_message( - SPAN_NOTICE("[user] attaches \the [AM] to \the [src]."), - SPAN_NOTICE("You attach \the [AM] to \the [src]."), + SPAN_NOTICE("[user] attaches \the [dropped_movable] to \the [src]."), + SPAN_NOTICE("You attach \the [dropped_movable] to \the [src]."), "You hear something clamp into place.") return TRUE -/obj/structure/hoist/proc/attach_hoistee(atom/movable/AM) - hoistee = AM - if(ismob(AM)) - source_hook.buckle_mob(AM) +/obj/structure/hoist/proc/attach_hoistee(atom/movable/victim) + hoistee = victim + if(ismob(victim)) + source_hook.buckle_mob(victim) else - AM.anchored = TRUE // can't buckle non-mobs at the moment - source_hook.layer = AM.layer + 0.1 - if (get_turf(AM) != get_turf(source_hook)) - AM.forceMove(get_turf(source_hook)) + victim.anchored = TRUE // can't buckle non-mobs at the moment + source_hook.layer = victim.layer + 0.1 + if (get_turf(victim) != get_turf(source_hook)) + victim.forceMove(get_turf(source_hook)) - events_repository.register(/decl/observ/destroyed, AM, src, PROC_REF(release_hoistee)) + events_repository.register(/decl/observ/destroyed, victim, src, PROC_REF(release_hoistee)) /obj/effect/hoist_hook/handle_mouse_drop(atom/over, mob/user, params) if(source_hoist.hoistee && isturf(over) && over.Adjacent(source_hoist.hoistee)) @@ -105,9 +104,9 @@ /obj/effect/hoist_hook/unbuckle_mob() . = ..() if (. && !QDELETED(source_hoist)) - var/mob/M = . + var/mob/victim = . source_hoist.hoistee = null - M.fall(get_turf(src)) // fuck you, you fall now! + victim.fall(get_turf(src)) // fuck you, you fall now! /obj/structure/hoist name = "hoist" @@ -210,19 +209,11 @@ check_consistency() - var/size - if (ismob(hoistee)) - var/mob/M = hoistee - size = M.mob_size - else if (isobj(hoistee)) - var/obj/O = hoistee - size = O.w_class - user.visible_message( SPAN_NOTICE("[user] begins to [movtext] \the [hoistee]!"), SPAN_NOTICE("You begin to [movtext] \the [hoistee]!"), SPAN_NOTICE("You hear the sound of a crank.")) - if (do_after(user, (1 SECONDS) * size / 4, src)) + if (do_after(user, (1 SECONDS) * get_object_size(hoistee) / 4, src)) move_dir(movedir, 1) return TRUE @@ -265,8 +256,8 @@ if (source_hook in get_step(src, dir)) // you don't get to move above the hoist return FALSE if (DOWN) - var/turf/T = get_turf(source_hook) - if(!istype(T) || !T.is_open()) // can't move down through a solid tile + var/turf/current_turf = get_turf(source_hook) + if(!current_turf || !current_turf.is_open()) // can't move down through a solid tile or if not on a turf return FALSE return TRUE // i thought i could trust myself to write something as simple as this, guess i was wrong From 02b4baa28e1d4e52a07f1858fbbcd035a4a5a886 Mon Sep 17 00:00:00 2001 From: Penelope Haze Date: Thu, 4 Jul 2024 18:41:31 -0400 Subject: [PATCH 6/7] Rename one- and two-letter variables in crew record code --- .../file_system/reports/crew_record.dm | 194 +++++++++--------- 1 file changed, 97 insertions(+), 97 deletions(-) diff --git a/code/modules/modular_computers/file_system/reports/crew_record.dm b/code/modules/modular_computers/file_system/reports/crew_record.dm index 6364d2c4bca..8138483f2ad 100644 --- a/code/modules/modular_computers/file_system/reports/crew_record.dm +++ b/code/modules/modular_computers/file_system/reports/crew_record.dm @@ -23,11 +23,11 @@ var/global/arrest_security_status = "Arrest" . = ..() global.all_crew_records.Remove(src) -/datum/computer_file/report/crew_record/proc/load_from_mob(var/mob/living/human/H) +/datum/computer_file/report/crew_record/proc/load_from_mob(var/mob/living/human/crewmember) - if(istype(H)) - photo_front = getFlatIcon(H, SOUTH, always_use_defdir = 1) - photo_side = getFlatIcon(H, WEST, always_use_defdir = 1) + if(istype(crewmember)) + photo_front = getFlatIcon(crewmember, SOUTH, always_use_defdir = 1) + photo_side = getFlatIcon(crewmember, WEST, always_use_defdir = 1) else var/mob/living/human/dummy = new() photo_front = getFlatIcon(dummy, SOUTH, always_use_defdir = 1) @@ -35,73 +35,73 @@ var/global/arrest_security_status = "Arrest" qdel(dummy) // Load records from the client. - var/list/records = H?.client?.prefs?.records || list() + var/list/records = crewmember?.client?.prefs?.records || list() // Add honorifics, etc. var/formal_name = "Unset" - if(H) - formal_name = H.real_name - if(H.client && H.client.prefs) - for(var/culturetag in H.client.prefs.cultural_info) - var/decl/cultural_info/culture = GET_DECL(H.client.prefs.cultural_info[culturetag]) - if(H.char_rank && H.char_rank.name_short) + if(crewmember) + formal_name = crewmember.real_name + if(crewmember.client && crewmember.client.prefs) + for(var/culturetag in crewmember.client.prefs.cultural_info) + var/decl/cultural_info/culture = GET_DECL(crewmember.client.prefs.cultural_info[culturetag]) + if(crewmember.char_rank && crewmember.char_rank.name_short) formal_name = "[formal_name][culture.get_formal_name_suffix()]" else formal_name = "[culture.get_formal_name_prefix()][formal_name][culture.get_formal_name_suffix()]" // Generic record - set_name(H ? H.real_name : "Unset") + set_name(crewmember ? crewmember.real_name : "Unset") set_formal_name(formal_name) - set_job(H ? GetAssignment(H) : "Unset") + set_job(crewmember ? GetAssignment(crewmember) : "Unset") var/gender_term = "Unset" - if(H) - var/decl/pronouns/G = H.get_pronouns(ignore_coverings = TRUE) - if(G && G.bureaucratic_term ) - gender_term = G.bureaucratic_term + if(crewmember) + var/decl/pronouns/gender = crewmember.get_pronouns(ignore_coverings = TRUE) + if(gender?.bureaucratic_term) + gender_term = gender.bureaucratic_term set_gender(gender_term) - set_age(H?.get_age() || 30) + set_age(crewmember?.get_age() || 30) set_status(global.default_physical_status) - set_species_name(H ? H.get_species_name() : global.using_map.default_species) - set_branch(H ? (H.char_branch && H.char_branch.name) : "None") - set_rank(H ? (H.char_rank && H.char_rank.name) : "None") + set_species_name(crewmember ? crewmember.get_species_name() : global.using_map.default_species) + set_branch(crewmember ? (crewmember.char_branch && crewmember.char_branch.name) : "None") + set_rank(crewmember ? (crewmember.char_rank && crewmember.char_rank.name) : "None") var/public_record = records[PREF_PUB_RECORD] - set_public_record((public_record && !jobban_isbanned(H, "Records")) ? html_decode(public_record) : "No record supplied") + set_public_record((public_record && !jobban_isbanned(crewmember, "Records")) ? html_decode(public_record) : "No record supplied") // Medical record - set_bloodtype(H?.get_blood_type() || "Unset") + set_bloodtype(crewmember?.get_blood_type() || "Unset") var/medical_record = records[PREF_MED_RECORD] - set_medical_record((medical_record && !jobban_isbanned(H, "Records")) ? html_decode(medical_record) : "No record supplied") + set_medical_record((medical_record && !jobban_isbanned(crewmember, "Records")) ? html_decode(medical_record) : "No record supplied") - if(H) - var/decl/bodytype/root_bodytype = H.get_bodytype() + if(crewmember) + var/decl/bodytype/root_bodytype = crewmember.get_bodytype() var/organ_data = list("\[*\]") - for(var/obj/item/organ/external/E in H.get_external_organs()) - if(E.bodytype != root_bodytype) - organ_data += "[E.bodytype] [E.name] [BP_IS_PROSTHETIC(E) ? "prosthetic" : "graft"]" - for(var/obj/item/organ/internal/I in H.get_internal_organs()) - if(I.bodytype != root_bodytype) - organ_data += "[I.bodytype] [I.name] [BP_IS_PROSTHETIC(I) ? "prosthetic" : "graft"]" + for(var/obj/item/organ/external/child in crewmember.get_external_organs()) + if(child.bodytype != root_bodytype) + organ_data += "[child.bodytype] [child.name] [BP_IS_PROSTHETIC(child) ? "prosthetic" : "graft"]" + for(var/obj/item/organ/internal/internal_organ in crewmember.get_internal_organs()) + if(internal_organ.bodytype != root_bodytype) + organ_data += "[internal_organ.bodytype] [internal_organ.name] [BP_IS_PROSTHETIC(internal_organ) ? "prosthetic" : "graft"]" set_implants(jointext(organ_data, "\[*\]")) // Security record set_criminalStatus(global.default_security_status) - set_dna(H?.get_unique_enzymes() || "") - set_fingerprint(H?.get_full_print(ignore_blockers = TRUE) || "") + set_dna(crewmember?.get_unique_enzymes() || "") + set_fingerprint(crewmember?.get_full_print(ignore_blockers = TRUE) || "") var/security_record = records[PREF_SEC_RECORD] - set_security_record((security_record && !jobban_isbanned(H, "Records")) ? html_decode(security_record) : "No record supplied") + set_security_record((security_record && !jobban_isbanned(crewmember, "Records")) ? html_decode(security_record) : "No record supplied") // Employment record var/employment_record = "No record supplied" - if(H) + if(crewmember) var/gen_record = records[PREF_GEN_RECORD] - if(gen_record && !jobban_isbanned(H, "Records")) + if(gen_record && !jobban_isbanned(crewmember, "Records")) employment_record = html_decode(gen_record) - if(H.client && H.client.prefs) + if(crewmember.client && crewmember.client.prefs) var/list/qualifications - for(var/culturetag in H.client.prefs.cultural_info) - var/decl/cultural_info/culture = GET_DECL(H.client.prefs.cultural_info[culturetag]) + for(var/culturetag in crewmember.client.prefs.cultural_info) + var/decl/cultural_info/culture = GET_DECL(crewmember.client.prefs.cultural_info[culturetag]) var/extra_note = culture.get_qualifications() if(extra_note) LAZYADD(qualifications, extra_note) @@ -110,46 +110,46 @@ var/global/arrest_security_status = "Arrest" set_employment_record(employment_record) // Misc cultural info. - set_residence(H ? html_decode(H.get_cultural_value(TAG_HOMEWORLD)) : "Unset") - set_faction(H ? html_decode(H.get_cultural_value(TAG_FACTION)) : "Unset") - set_religion(H ? html_decode(H.get_cultural_value(TAG_RELIGION)) : "Unset") + set_residence(crewmember ? html_decode(crewmember.get_cultural_value(TAG_HOMEWORLD)) : "Unset") + set_faction(crewmember ? html_decode(crewmember.get_cultural_value(TAG_FACTION)) : "Unset") + set_religion(crewmember ? html_decode(crewmember.get_cultural_value(TAG_RELIGION)) : "Unset") - if(H) + if(crewmember) var/skills = list() - for(var/decl/hierarchy/skill/S in global.using_map.get_available_skills()) - var/level = H.get_skill_value(S.type) + for(var/decl/hierarchy/skill/skill in global.using_map.get_available_skills()) + var/level = crewmember.get_skill_value(skill.type) if(level > SKILL_NONE) - skills += "[S.name], [S.levels[level]]" + skills += "[skill.name], [skill.levels[level]]" set_skillset(jointext(skills,"\n")) // Antag record - if(H?.client?.prefs) - var/exploit_record = H.client.prefs.exploit_record - set_antag_record((exploit_record && !jobban_isbanned(H, "Records")) ? html_decode(exploit_record) : "") + if(crewmember?.client?.prefs) + var/exploit_record = crewmember.client.prefs.exploit_record + set_antag_record((exploit_record && !jobban_isbanned(crewmember, "Records")) ? html_decode(exploit_record) : "") // Cut down version for silicons -/datum/computer_file/report/crew_record/synth/load_from_mob(var/mob/living/silicon/S) - if(istype(S)) - photo_front = getFlatIcon(S, SOUTH, always_use_defdir = 1) - photo_side = getFlatIcon(S, WEST, always_use_defdir = 1) +/datum/computer_file/report/crew_record/synth/load_from_mob(var/mob/living/silicon/silicon_crewmember) + if(istype(silicon_crewmember)) + photo_front = getFlatIcon(silicon_crewmember, SOUTH, always_use_defdir = 1) + photo_side = getFlatIcon(silicon_crewmember, WEST, always_use_defdir = 1) // Generic record - set_name(S ? S.real_name : "Unset") - set_formal_name(S ? S.real_name : "Unset") + set_name(silicon_crewmember ? silicon_crewmember.real_name : "Unset") + set_formal_name(silicon_crewmember ? silicon_crewmember.real_name : "Unset") set_gender("Unset") set_status(global.default_physical_status) var/silicon_type = "Synthetic Lifeform" - var/robojob = GetAssignment(S) - if(isrobot(S)) - var/mob/living/silicon/robot/R = S - silicon_type = R.braintype - if(R.module) - robojob = "[R.module.display_name] [silicon_type]" - if(isAI(S)) + var/robojob = GetAssignment(silicon_crewmember) + if(isrobot(silicon_crewmember)) + var/mob/living/silicon/robot/robot = silicon_crewmember + silicon_type = robot.braintype + if(robot.module) + robojob = "[robot.module.display_name] [silicon_type]" + if(isAI(silicon_crewmember)) silicon_type = "AI" robojob = "Artificial Intelligence" - set_job(S ? robojob : "Unset") + set_job(silicon_crewmember ? robojob : "Unset") set_species_name(silicon_type) set_implants("Robotic body") @@ -159,57 +159,57 @@ var/global/arrest_security_status = "Arrest" // Global methods // Used by character creation to create a record for new arrivals. -/proc/CreateModularRecord(var/mob/living/H, record_type = /datum/computer_file/report/crew_record) - var/datum/computer_file/report/crew_record/CR = new record_type() - global.all_crew_records.Add(CR) - CR.load_from_mob(H) - var/datum/computer_network/network = get_local_network_at(get_turf(H)) +/proc/CreateModularRecord(var/mob/living/crewmember, record_type = /datum/computer_file/report/crew_record) + var/datum/computer_file/report/crew_record/crew_record = new record_type() + global.all_crew_records.Add(crew_record) + crew_record.load_from_mob(crewmember) + var/datum/computer_network/network = get_local_network_at(get_turf(crewmember)) if(network) - network.store_file(CR, OS_RECORDS_DIR, TRUE, mainframe_role = MF_ROLE_CREW_RECORDS) - return CR + network.store_file(crew_record, OS_RECORDS_DIR, TRUE, mainframe_role = MF_ROLE_CREW_RECORDS) + return crew_record // Gets crew records filtered by set of positions /proc/department_crew_manifest(var/list/filter_positions, var/blacklist = FALSE) var/list/matches = list() - for(var/datum/computer_file/report/crew_record/CR in global.all_crew_records) - var/rank = CR.get_job() + for(var/datum/computer_file/report/crew_record/crew_record in global.all_crew_records) + var/rank = crew_record.get_job() if(blacklist) if(!(rank in filter_positions)) - matches.Add(CR) + matches.Add(crew_record) else if(rank in filter_positions) - matches.Add(CR) + matches.Add(crew_record) return matches // Simple record to HTML (for paper purposes) conversion. // Not visually that nice, but it gets the work done, feel free to tweak it visually -/proc/record_to_html(var/datum/computer_file/report/crew_record/CR, var/access) +/proc/record_to_html(var/datum/computer_file/report/crew_record/crew_record, var/access) var/dat = "

RECORD DATABASE DATA DUMP

Generated on: [stationdate2text()] [stationtime2text()]
******************************
" dat += "" - for(var/datum/report_field/F in CR.fields) - if(F.get_perms(access) & OS_READ_ACCESS) - dat += "" - dat += "
[F.display_name()]" - if(F.needs_big_box) + for(var/datum/report_field/field in crew_record.fields) + if(field.get_perms(access) & OS_READ_ACCESS) + dat += "
[field.display_name()]" + if(field.needs_big_box) dat += "
[F.get_value()]" + dat += "[field.get_value()]" dat += "" return dat //Should only be used for OOC stuff, for player-facing stuff you must go through the network. /proc/get_crewmember_record(var/name) - for(var/datum/computer_file/report/crew_record/CR in global.all_crew_records) - if(CR.get_name() == name) - return CR + for(var/datum/computer_file/report/crew_record/crew_record in global.all_crew_records) + if(crew_record.get_name() == name) + return crew_record return null -/proc/GetAssignment(var/mob/living/human/H) - if(!H) +/proc/GetAssignment(var/mob/living/crewmember) + if(!crewmember) return "Unassigned" - if(!H.mind) - return H.job - if(H.mind.role_alt_title) - return H.mind.role_alt_title - return H.mind.assigned_role + if(!crewmember.mind) + return crewmember.job + if(crewmember.mind.role_alt_title) + return crewmember.mind.role_alt_title + return crewmember.mind.assigned_role #define GETTER_SETTER(PATH, KEY) /datum/computer_file/report/crew_record/proc/get_##KEY(){var/datum/report_field/F = locate(/datum/report_field/##PATH/##KEY) in fields; if(F) return F.get_value()} \ /datum/computer_file/report/crew_record/proc/set_##KEY(given_value){var/datum/report_field/F = locate(/datum/report_field/##PATH/##KEY) in fields; if(F) F.set_value(given_value)} @@ -279,16 +279,16 @@ FIELD_LONG("Exploitable Information", antag_record, access_hacked, access_hacked . |= "Unset" var/list/all_genders = decls_repository.get_decls_of_type(/decl/pronouns) for(var/thing in all_genders) - var/decl/pronouns/G = all_genders[thing] - if(G.bureaucratic_term ) - . |= G.bureaucratic_term + var/decl/pronouns/gender = all_genders[thing] + if(gender.bureaucratic_term ) + . |= gender.bureaucratic_term /datum/report_field/options/crew_record/branch/proc/record_branches() . = list() . |= "Unset" - for(var/B in mil_branches.branches) - var/datum/mil_branch/BR = mil_branches.branches[B] - . |= BR.name + for(var/branch in mil_branches.branches) + var/datum/mil_branch/branch_datum = mil_branches.branches[branch] + . |= branch_datum.name #undef GETTER_SETTER #undef SETUP_FIELD From a174990d81400dcfa3b55726ed7d5dcd835f866e Mon Sep 17 00:00:00 2001 From: Penelope Haze Date: Thu, 4 Jul 2024 18:43:46 -0400 Subject: [PATCH 7/7] Rename miscellaneous mob/living/H variables and parameters --- code/_onclick/drag_drop.dm | 3 +- code/datums/hostility/hostility.dm | 8 ++--- code/modules/admin/admin.dm | 18 +++++------ .../clothing/spacesuits/rig/modules/combat.dm | 30 +++++++++---------- code/modules/species/species_bodytype.dm | 6 ++-- mods/content/psionics/machines/psimeter.dm | 4 +-- mods/gamemodes/deity/spells/open_gateway.dm | 14 ++++----- mods/mobs/borers/mob/borer/borer.dm | 4 +-- mods/species/ascent/items/id_control.dm | 6 ++-- .../ascent/mobs/bodyparts_insectoid.dm | 20 ++++++------- 10 files changed, 55 insertions(+), 58 deletions(-) diff --git a/code/_onclick/drag_drop.dm b/code/_onclick/drag_drop.dm index 9d4437eac49..ec0965a969f 100644 --- a/code/_onclick/drag_drop.dm +++ b/code/_onclick/drag_drop.dm @@ -39,8 +39,7 @@ // Receive a mouse drop. // Returns false if the atom is valid for dropping further up the chain, true if the drop has been handled. /atom/proc/receive_mouse_drop(atom/dropping, mob/user, params) - var/mob/living/H = user - if(istype(H) && !H.anchored && can_climb(H) && dropping == user) + if(isliving(user) && !user.anchored && can_climb(user) && dropping == user) do_climb(dropping) return TRUE return FALSE diff --git a/code/datums/hostility/hostility.dm b/code/datums/hostility/hostility.dm index 2af98770ec3..b17ad114bd7 100644 --- a/code/datums/hostility/hostility.dm +++ b/code/datums/hostility/hostility.dm @@ -12,13 +12,13 @@ return FALSE if(isliving(target)) - var/mob/living/L = target - if(L.stat) + var/mob/living/target_mob = target + if(target_mob.stat) return FALSE if(isliving(holder)) - var/mob/living/H = holder - if(L.faction == H.faction) + var/mob/holder_mob = holder + if(target_mob.faction == holder_mob.faction) return FALSE return can_special_target(holder, target) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 000078e5a79..42aa0a029b9 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -961,24 +961,24 @@ var/global/BSACooldown = 0 /proc/is_special_character(var/character) // returns 1 for special characters and 2 for heroes of gamemode if(!SSticker.mode) return 0 - var/datum/mind/M + var/datum/mind/mind if (ismob(character)) - var/mob/C = character - M = C.mind + var/mob/character_mob = character + mind = character_mob.mind else if(istype(character, /datum/mind)) - M = character + mind = character - if(M) + if(mind) if(SSticker.mode.antag_templates && SSticker.mode.antag_templates.len) for(var/decl/special_role/antag in SSticker.mode.antag_templates) - if(antag.is_antagonist(M)) + if(antag.is_antagonist(mind)) return 2 - if(M.assigned_special_role) + if(mind.assigned_special_role) return 1 if(isrobot(character)) - var/mob/living/silicon/robot/R = character - if(R.emagged) + var/mob/living/silicon/robot/robot = character + if(robot.emagged) return 1 return 0 diff --git a/code/modules/clothing/spacesuits/rig/modules/combat.dm b/code/modules/clothing/spacesuits/rig/modules/combat.dm index e359be5afd3..a06b83ab8f6 100644 --- a/code/modules/clothing/spacesuits/rig/modules/combat.dm +++ b/code/modules/clothing/spacesuits/rig/modules/combat.dm @@ -62,7 +62,7 @@ return 0 if(!holder.cell.check_charge(use_power_cost * CELLRATE)) - to_chat(holder.wearer,"Not enough stored power.") + to_chat(holder.wearer,SPAN_WARNING("Not enough stored power.")) return 0 if(!target) @@ -123,7 +123,7 @@ return 0 if(accepted_item.charges >= 5) - to_chat(user, "Another grenade of that type will not fit into the module.") + to_chat(user, SPAN_DANGER("Another grenade of that type will not fit into the module.")) return 0 to_chat(user, SPAN_BLUE("You slot \the [input_device] into the suit module.")) @@ -139,10 +139,10 @@ if(!target) return 0 - var/mob/living/human/H = holder.wearer + var/mob/living/human/wearer = holder.wearer if(!charge_selected) - to_chat(H, "You have not selected a grenade type.") + to_chat(wearer, SPAN_DANGER("You have not selected a grenade type.")) return 0 var/datum/rig_charge/charge = charges[charge_selected] @@ -151,14 +151,14 @@ return 0 if(charge.charges <= 0) - to_chat(H, "Insufficient grenades!") + to_chat(wearer, SPAN_DANGER("Insufficient grenades!")) return 0 charge.charges-- - var/obj/item/grenade/new_grenade = new charge.product_type(get_turf(H)) - H.visible_message("[H] launches \a [new_grenade]!") + var/obj/item/grenade/new_grenade = new charge.product_type(get_turf(wearer)) + wearer.visible_message(SPAN_DANGER("[wearer] launches \a [new_grenade]!"), SPAN_DANGER("You launch \a [new_grenade]!")) log_and_message_admins("fired a grenade ([new_grenade.name]) from a rigsuit grenade launcher.") - new_grenade.activate(H) + new_grenade.activate(wearer) new_grenade.throw_at(target,fire_force,fire_distance) /obj/item/rig_module/grenade_launcher/cleaner @@ -402,21 +402,21 @@ if(!..()) return FALSE - var/mob/living/H = holder.wearer + var/mob/living/wearer = holder.wearer if(target) var/obj/item/firing = new fabrication_type() firing.dropInto(loc) - H.visible_message(SPAN_DANGER("\The [H] launches \a [firing]!")) + wearer.visible_message(SPAN_DANGER("\The [wearer] launches \a [firing]!"), SPAN_DANGER("You launch \a [firing]!")) firing.throw_at(target,fire_force,fire_distance) else - if(!H.get_empty_hand_slot()) - to_chat(H, SPAN_WARNING("Your hands are full.")) + if(!wearer.get_empty_hand_slot()) + to_chat(wearer, SPAN_WARNING("Your hands are full.")) else var/obj/item/new_weapon = new fabrication_type() - new_weapon.forceMove(H) - to_chat(H, SPAN_BLUE("You quickly fabricate \a [new_weapon].")) - H.put_in_hands(new_weapon) + new_weapon.forceMove(wearer) + to_chat(wearer, SPAN_BLUE("You quickly fabricate \a [new_weapon].")) + wearer.put_in_hands(new_weapon) return TRUE diff --git a/code/modules/species/species_bodytype.dm b/code/modules/species/species_bodytype.dm index 8169aa70bbb..2601b22ef1e 100644 --- a/code/modules/species/species_bodytype.dm +++ b/code/modules/species/species_bodytype.dm @@ -614,11 +614,11 @@ var/global/list/bodytypes_by_category = list() /decl/bodytype/proc/get_limb_from_zone(limb) . = length(LAZYACCESS(limb_mapping, limb)) ? pick(limb_mapping[limb]) : limb -/decl/bodytype/proc/check_vital_organ_missing(mob/living/H) +/decl/bodytype/proc/check_vital_organ_missing(mob/living/patient) if(length(vital_organs)) for(var/organ_tag in vital_organs) - var/obj/item/organ/O = H.get_organ(organ_tag, /obj/item/organ) - if(!O || (O.status & ORGAN_DEAD)) + var/obj/item/organ/vital_organ = patient.get_organ(organ_tag, /obj/item/organ) + if(!vital_organ || (vital_organ.status & ORGAN_DEAD)) return TRUE return FALSE diff --git a/mods/content/psionics/machines/psimeter.dm b/mods/content/psionics/machines/psimeter.dm index 22b1de43259..b3abc2cb9c5 100644 --- a/mods/content/psionics/machines/psimeter.dm +++ b/mods/content/psionics/machines/psimeter.dm @@ -31,9 +31,9 @@ else dat += "

TELESTO Mark I Psi-Meter


" var/found - for(var/mob/living/H in range(1, src)) + for(var/mob/living/subject in range(1, src)) found = TRUE - dat += "" dat += "
Candidates
[H.name]Conduct Assay" + dat += "
[subject.name]Conduct Assay" if(!found) dat += "
No candidates found.
" diff --git a/mods/gamemodes/deity/spells/open_gateway.dm b/mods/gamemodes/deity/spells/open_gateway.dm index 1038d03c6a1..db83a05c891 100644 --- a/mods/gamemodes/deity/spells/open_gateway.dm +++ b/mods/gamemodes/deity/spells/open_gateway.dm @@ -13,14 +13,14 @@ cast_sound = 'sound/effects/meteorimpact.ogg' /spell/open_gateway/choose_targets() - var/mob/living/H = holder - var/turf/T = get_turf(H) - holder.visible_message(SPAN_NOTICE("A gateway opens up underneath \the [H]!")) - var/g + var/mob/living/spellcaster = holder + var/turf/source_turf = get_turf(spellcaster) + holder.visible_message(SPAN_NOTICE("A gateway opens up underneath \the [spellcaster]!")) + var/deity var/decl/special_role/godcultist/godcult = GET_DECL(/decl/special_role/godcultist) - if(H.mind && (H.mind in godcult.current_antagonists)) - g = godcult.get_deity(H.mind) - return list(new /obj/structure/deity/gateway(T,g)) + if(spellcaster.mind && (spellcaster.mind in godcult.current_antagonists)) + deity = godcult.get_deity(spellcaster.mind) + return list(new /obj/structure/deity/gateway(source_turf, deity)) /spell/open_gateway/cast(var/list/targets, var/mob/holder, var/channel_count) if(prob((channel_count / 5) * 100)) diff --git a/mods/mobs/borers/mob/borer/borer.dm b/mods/mobs/borers/mob/borer/borer.dm index 41ace823dc9..1e467e1b889 100644 --- a/mods/mobs/borers/mob/borer/borer.dm +++ b/mods/mobs/borers/mob/borer/borer.dm @@ -235,9 +235,7 @@ host.reset_view(null) host.machine = null - - var/mob/living/H = host - H.status_flags &= ~PASSEMOTES + host.status_flags &= ~PASSEMOTES host = null return diff --git a/mods/species/ascent/items/id_control.dm b/mods/species/ascent/items/id_control.dm index ac465c63b3d..a3fb7a4b25f 100644 --- a/mods/species/ascent/items/id_control.dm +++ b/mods/species/ascent/items/id_control.dm @@ -51,10 +51,10 @@ if(owner) var/datum/extension/access_provider/owner_access = get_extension(owner, /datum/extension/access_provider) owner_access?.unregister_id(src) - var/mob/living/H = owner + var/mob/living/old_owner = owner . = ..() - if(H && !(locate(type) in H.get_internal_organs())) - H.remove_language(/decl/language/mantid/worldnet) + if(old_owner && !(locate(type) in old_owner.get_internal_organs())) + old_owner.remove_language(/decl/language/mantid/worldnet) /obj/item/organ/internal/controller/Initialize() if(ispath(id_card)) diff --git a/mods/species/ascent/mobs/bodyparts_insectoid.dm b/mods/species/ascent/mobs/bodyparts_insectoid.dm index 1b88459a1f1..d0053d8587e 100644 --- a/mods/species/ascent/mobs/bodyparts_insectoid.dm +++ b/mods/species/ascent/mobs/bodyparts_insectoid.dm @@ -12,19 +12,19 @@ /obj/item/organ/internal/egg_sac/insectoid/attack_self(var/mob/user) . = ..() - var/mob/living/H = user + var/mob/living/living_user = user if(.) - if(H.incapacitated()) - to_chat(H, SPAN_WARNING("You can't produce eggs in your current state.")) + if(living_user.incapacitated()) + to_chat(living_user, SPAN_WARNING("You can't produce eggs in your current state.")) return - if(H.nutrition < egg_metabolic_cost) - to_chat(H, SPAN_WARNING("You are too ravenously hungry to produce more eggs.")) + if(living_user.nutrition < egg_metabolic_cost) + to_chat(living_user, SPAN_WARNING("You are too ravenously hungry to produce more eggs.")) return - if(do_after(H, 5 SECONDS, H, FALSE)) - H.adjust_nutrition(-1 * egg_metabolic_cost) - H.visible_message(SPAN_NOTICE("\icon[H] [H] carelessly deposits an egg on \the [get_turf(src)].")) - var/obj/structure/insectoid_egg/egg = new(get_turf(H)) // splorp - egg.lineage = H.get_gyne_lineage() + if(do_after(living_user, 5 SECONDS, living_user, FALSE)) + living_user.adjust_nutrition(-1 * egg_metabolic_cost) + living_user.visible_message(SPAN_NOTICE("\icon[living_user] [living_user] carelessly deposits an egg on \the [get_turf(src)].")) + var/obj/structure/insectoid_egg/egg = new(get_turf(living_user)) // splorp + egg.lineage = living_user.get_gyne_lineage() /obj/item/organ/external/foot/insectoid/mantid name = "left tail tip"