From 926d4842772ab2fbe0cb47b0f295a5714f7ad4bf Mon Sep 17 00:00:00 2001 From: Fox McCloud Date: Wed, 3 Mar 2021 16:34:49 -0500 Subject: [PATCH] Moves External Organs to Nullspace (#15548) * Moves External Organs to Nullspace * additions * oops * further cleanup --- code/datums/mind.dm | 10 ++-------- code/datums/outfits/vv_outfit.dm | 6 +++--- code/game/dna/mutations/monkey.dm | 8 ++------ .../gamemodes/changeling/powers/headslug.dm | 4 ++-- .../shadowling/special_shadowling_abilities.dm | 2 +- code/game/machinery/transformer.dm | 2 -- .../objects/items/devices/traitordevices.dm | 2 +- code/modules/admin/topic.dm | 3 --- code/modules/admin/verbs/onlyone.dm | 2 -- code/modules/admin/verbs/onlyoneteam.dm | 2 -- .../awaymissions/mission_code/academy.dm | 2 +- .../kitchen_machinery/gibber.dm | 2 -- code/modules/mob/living/carbon/carbon.dm | 2 -- .../mob/living/carbon/human/human_defense.dm | 6 ++++++ .../mob/living/carbon/human/inventory.dm | 8 -------- .../reagents/chemistry/reagents/water.dm | 2 +- code/modules/surgery/organs/lungs.dm | 2 +- code/modules/surgery/organs/organ.dm | 2 +- code/modules/surgery/organs/organ_external.dm | 5 ++--- code/modules/surgery/organs/subtypes/kidan.dm | 9 +++------ code/modules/surgery/organs/subtypes/skrell.dm | 18 +++++++++++++----- 21 files changed, 39 insertions(+), 60 deletions(-) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 1e5da319f0f..591a487598e 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -1515,14 +1515,8 @@ else if(href_list["common"]) switch(href_list["common"]) if("undress") - if(ishuman(current)) - var/mob/living/carbon/human/H = current - // Don't "undress" organs right out of the body - for(var/obj/item/W in H.contents - (H.bodyparts | H.internal_organs)) - current.unEquip(W, 1) - else - for(var/obj/item/W in current) - current.unEquip(W, 1) + for(var/obj/item/I in current) + current.unEquip(I, TRUE) log_admin("[key_name(usr)] has unequipped [key_name(current)]") message_admins("[key_name_admin(usr)] has unequipped [key_name_admin(current)]") if("takeuplink") diff --git a/code/datums/outfits/vv_outfit.dm b/code/datums/outfits/vv_outfit.dm index 95c91318bb8..a8162a04dec 100644 --- a/code/datums/outfits/vv_outfit.dm +++ b/code/datums/outfits/vv_outfit.dm @@ -125,9 +125,9 @@ // Copy cybernetic implants O.cybernetic_implants = list() - for(var/obj/item/organ/internal/CI in contents) - if(istype(CI)) - O.cybernetic_implants |= CI.type + for(var/org in internal_organs) + var/obj/item/organ/internal/aug = org + O.cybernetic_implants |= aug.type // Copy accessories var/obj/item/clothing/under/uniform_slot = get_item_by_slot(slot_w_uniform) diff --git a/code/game/dna/mutations/monkey.dm b/code/game/dna/mutations/monkey.dm index 8939ee31e00..4ebe366bfb7 100644 --- a/code/game/dna/mutations/monkey.dm +++ b/code/game/dna/mutations/monkey.dm @@ -14,9 +14,7 @@ if(issmall(H)) return for(var/obj/item/W in H) - if(istype(W,/obj/item/organ)) - continue - if(istype(W,/obj/item/implant)) + if(istype(W, /obj/item/implant)) continue H.unEquip(W) @@ -51,9 +49,7 @@ for(var/obj/item/W in H) if(W == H.w_uniform) // will be torn continue - if(istype(W,/obj/item/organ)) - continue - if(istype(W,/obj/item/implant)) + if(istype(W, /obj/item/implant)) continue H.unEquip(W) H.regenerate_icons() diff --git a/code/game/gamemodes/changeling/powers/headslug.dm b/code/game/gamemodes/changeling/powers/headslug.dm index d67ad36a80e..e37f97269e4 100644 --- a/code/game/gamemodes/changeling/powers/headslug.dm +++ b/code/game/gamemodes/changeling/powers/headslug.dm @@ -17,7 +17,7 @@ var/list/organs = user.get_organs_zone("head", 1) for(var/obj/item/organ/internal/I in organs) - I.remove(user, 1) + I.remove(user, TRUE) explosion(get_turf(user),0,0,2,0,silent=1) for(var/mob/living/carbon/human/H in range(2,user)) @@ -35,7 +35,7 @@ spawn(5) // So it's not killed in explosion var/mob/living/simple_animal/hostile/headslug/crab = new(new_location) for(var/obj/item/organ/internal/I in organs) - I.loc = crab + I.forceMove(crab) crab.origin = M if(crab.origin) crab.origin.active = 1 diff --git a/code/game/gamemodes/shadowling/special_shadowling_abilities.dm b/code/game/gamemodes/shadowling/special_shadowling_abilities.dm index 2b84136fb04..9fb234a27ff 100644 --- a/code/game/gamemodes/shadowling/special_shadowling_abilities.dm +++ b/code/game/gamemodes/shadowling/special_shadowling_abilities.dm @@ -30,7 +30,7 @@ GLOBAL_LIST_INIT(possibleShadowlingNames, list("U'ruan", "Y`shej", "Nex", "Hel-u H.visible_message("[H]'s things suddenly slip off. They hunch over and vomit up a copious amount of purple goo which begins to shape around them!", \ "You remove any equipment which would hinder your hatching and begin regurgitating the resin which will protect you.") - for(var/obj/item/I in H.contents - (H.bodyparts | H.internal_organs)) //drops all items except organs + for(var/obj/item/I in H.contents) H.unEquip(I) sleep(50) diff --git a/code/game/machinery/transformer.dm b/code/game/machinery/transformer.dm index 04822a8014f..d03536e8f5b 100644 --- a/code/game/machinery/transformer.dm +++ b/code/game/machinery/transformer.dm @@ -252,8 +252,6 @@ for(var/obj/item/I in H) if(istype(I, /obj/item/implant)) continue - if(istype(I, /obj/item/organ)) - continue qdel(I) H.equipOutfit(selected_outfit) diff --git a/code/game/objects/items/devices/traitordevices.dm b/code/game/objects/items/devices/traitordevices.dm index 8178beca64c..ea9f7200177 100644 --- a/code/game/objects/items/devices/traitordevices.dm +++ b/code/game/objects/items/devices/traitordevices.dm @@ -333,7 +333,7 @@ effective or pretty fucking useless. playsound(destination, "sound/magic/disintegrate.ogg", 50, TRUE) destination.ex_act(rand(1,2)) for(var/obj/item/W in user) - if(istype(W, /obj/item/organ)|| istype(W, /obj/item/implant)) + if(istype(W, /obj/item/implant)) continue if(!user.unEquip(W)) qdel(W) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 46a67e32a98..aa10d51ce1d 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -2967,9 +2967,6 @@ if(!security) //strip their stuff before they teleport into a cell :downs: for(var/obj/item/W in H) - if(istype(W, /obj/item/organ/external)) - continue - //don't strip organs H.unEquip(W) if(H.client) H.client.screen -= W diff --git a/code/modules/admin/verbs/onlyone.dm b/code/modules/admin/verbs/onlyone.dm index ccb1c8a315a..32ec86541ab 100644 --- a/code/modules/admin/verbs/onlyone.dm +++ b/code/modules/admin/verbs/onlyone.dm @@ -30,8 +30,6 @@ for(var/obj/item/I in H) if(istype(I, /obj/item/implant)) continue - if(istype(I, /obj/item/organ)) - continue qdel(I) H.equip_to_slot_or_del(new /obj/item/clothing/under/kilt(H), slot_w_uniform) diff --git a/code/modules/admin/verbs/onlyoneteam.dm b/code/modules/admin/verbs/onlyoneteam.dm index 974b65e05d2..a822367b68c 100644 --- a/code/modules/admin/verbs/onlyoneteam.dm +++ b/code/modules/admin/verbs/onlyoneteam.dm @@ -18,8 +18,6 @@ for(var/obj/item/I in H) if(istype(I, /obj/item/implant)) continue - if(istype (I, /obj/item/organ)) - continue qdel(I) to_chat(H, "You are part of the [station_name()] dodgeball tournament. Throw dodgeballs at crewmembers wearing a different color than you. OOC: Use THROW on an EMPTY-HAND to catch thrown dodgeballs.") diff --git a/code/modules/awaymissions/mission_code/academy.dm b/code/modules/awaymissions/mission_code/academy.dm index 40c4975505d..4421bc9c232 100644 --- a/code/modules/awaymissions/mission_code/academy.dm +++ b/code/modules/awaymissions/mission_code/academy.dm @@ -114,7 +114,7 @@ //Destroy Equipment T.visible_message("Everything [user] is holding and wearing disappears!") for(var/obj/item/I in user) - if(istype(I, /obj/item/implant) || istype(I, /obj/item/organ)) + if(istype(I, /obj/item/implant)) continue qdel(I) if(5) diff --git a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm index f65b78f3ca2..4336c870bf3 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm @@ -387,8 +387,6 @@ var/obj/item/implant/I = O if(I.implanted) continue - if(istype(O,/obj/item/organ)) - continue if(O.flags & NODROP || stealthmode) qdel(O) //they are already dead by now H.unEquip(O) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 34e819c4bf7..f04e7766eb6 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -482,8 +482,6 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven var/failed = 0 if(istype(I, /obj/item/implant)) continue - if(istype(I, /obj/item/organ)) - continue if(I.flags & ABSTRACT) continue else diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 7e45c9c81cc..5c5d5bc652b 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -226,6 +226,12 @@ emp_act if(mind && mind.martial_art && prob(mind.martial_art.block_chance) && mind.martial_art.can_use(src) && in_throw_mode && !incapacitated(FALSE, TRUE)) return TRUE +/mob/living/carbon/human/emp_act(severity) + ..() + for(var/X in bodyparts) + var/obj/item/organ/external/L = X + L.emp_act(severity) + /mob/living/carbon/human/acid_act(acidpwr, acid_volume, bodyzone_hit) //todo: update this to utilize check_obscured_slots() //and make sure it's check_obscured_slots(TRUE) to stop aciding through visors etc var/list/damaged = list() var/list/inventory_items_to_kill = list() diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index 56bed537c20..92752c3669c 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -66,14 +66,6 @@ if(slot_tie) return TRUE -// The actual dropping happens at the mob level - checks to prevent drops should -// come here -/mob/living/carbon/human/canUnEquip(obj/item/I, force) - . = ..() - var/obj/item/organ/O = I - if(istype(O) && O.owner == src) - . = 0 // keep a good grip on your heart - /mob/living/carbon/human/unEquip(obj/item/I, force, silent = FALSE) . = ..() //See mob.dm for an explanation on this and some rage about people copypasting instead of calling ..() like they should. if(!. || !I) diff --git a/code/modules/reagents/chemistry/reagents/water.dm b/code/modules/reagents/chemistry/reagents/water.dm index f01325c4242..cb69f3b7b31 100644 --- a/code/modules/reagents/chemistry/reagents/water.dm +++ b/code/modules/reagents/chemistry/reagents/water.dm @@ -272,7 +272,7 @@ M.SetConfused(0) if(ishuman(M)) // Unequip all cult clothing var/mob/living/carbon/human/H = M - for(var/I in H.contents - (H.bodyparts | H.internal_organs)) // Satanic liver NYI + for(var/I in H.contents) if(is_type_in_list(I, CULT_CLOTHING)) H.unEquip(I) return diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm index 1f1529bd7b5..12cc87aeb3f 100644 --- a/code/modules/surgery/organs/lungs.dm +++ b/code/modules/surgery/organs/lungs.dm @@ -91,7 +91,7 @@ return if(!breath || (breath.total_moles() == 0)) - if(isspaceturf(loc)) + if(isspaceturf(H.loc)) H.adjustOxyLoss(10) else H.adjustOxyLoss(5) diff --git a/code/modules/surgery/organs/organ.dm b/code/modules/surgery/organs/organ.dm index 8c07bd97433..0ccbae57471 100644 --- a/code/modules/surgery/organs/organ.dm +++ b/code/modules/surgery/organs/organ.dm @@ -239,7 +239,7 @@ var/obj/item/organ/external/affected = owner.get_organ(parent_organ) if(affected) affected.internal_organs -= src - loc = get_turf(owner) + forceMove(get_turf(owner)) START_PROCESSING(SSobj, src) if(owner && vital && is_primary_organ()) // I'd do another check for species or whatever so that you couldn't "kill" an IPC by removing a human head from them, but it doesn't matter since they'll come right back from the dead diff --git a/code/modules/surgery/organs/organ_external.dm b/code/modules/surgery/organs/organ_external.dm index e15fc28f2f8..b1adcae26ca 100644 --- a/code/modules/surgery/organs/organ_external.dm +++ b/code/modules/surgery/organs/organ_external.dm @@ -7,7 +7,6 @@ max_damage = 0 dir = SOUTH organ_tag = "limb" - flags_2 = RAD_PROTECT_CONTENTS_2 | RAD_NO_CONTAMINATE_2 // On Para, external organs have a loc, ergo they need this. var/brute_mod = 1 var/burn_mod = 1 @@ -115,7 +114,7 @@ /obj/item/organ/external/replaced(var/mob/living/carbon/human/target) owner = target - forceMove(owner) + loc = null if(istype(owner)) if(!isnull(owner.bodyparts_by_name[limb_name])) log_debug("Duplicate organ in slot \"[limb_name]\", mob '[target]'") @@ -227,7 +226,7 @@ check_fracture(brute) var/mob/living/carbon/owner_old = owner //Need to update health, but need a reference in case the below check cuts off a limb. //If limb took enough damage, try to cut or tear it off - if(owner && loc == owner) + if(owner) if(!cannot_amputate && (brute_dam) >= (max_damage)) if(prob(brute / 2)) if(sharp) diff --git a/code/modules/surgery/organs/subtypes/kidan.dm b/code/modules/surgery/organs/subtypes/kidan.dm index 6407917bcae..33574ef8104 100644 --- a/code/modules/surgery/organs/subtypes/kidan.dm +++ b/code/modules/surgery/organs/subtypes/kidan.dm @@ -49,8 +49,7 @@ colour = BlendRGB(owner.m_colours["body"], owner.m_colours["head"], 0.65) //then again im pretty bad at theoretics if(new_light != glowing) - var/obj/item/organ/external/groin/lbody = owner.get_organ(check_zone(parent_organ)) - lbody.set_light(new_light,l_color = colour) + owner.set_light(new_light, l_color = colour) glowing = new_light return @@ -73,14 +72,12 @@ if(!glowing) var/light = calculate_glow(KIDAN_LANTERN_LIGHT) - var/obj/item/organ/external/groin/lbody = owner.get_organ(check_zone(parent_organ)) - lbody.set_light(light,l_color = colour) + owner.set_light(light, l_color = colour) glowing = light return 1 else - var/obj/item/organ/external/groin/lbody = owner.get_organ(check_zone(parent_organ)) - lbody.set_light(0) + owner.set_light(0) glowing = 0 return 1 diff --git a/code/modules/surgery/organs/subtypes/skrell.dm b/code/modules/surgery/organs/subtypes/skrell.dm index 32a416fc887..6a332953bf1 100644 --- a/code/modules/surgery/organs/subtypes/skrell.dm +++ b/code/modules/surgery/organs/subtypes/skrell.dm @@ -16,14 +16,24 @@ var/obj/item/storage/internal/pocket /obj/item/organ/internal/headpocket/New() - ..() pocket = new /obj/item/storage/internal(src) pocket.storage_slots = 1 - // Allow adjacency calculation to work properly - loc = owner // Fit only pocket sized items pocket.max_w_class = WEIGHT_CLASS_SMALL pocket.max_combined_w_class = 2 + ..() + +/obj/item/organ/internal/headpocket/Destroy() + QDEL_NULL(pocket) + return ..() + +/obj/item/organ/internal/headpocket/insert(mob/living/carbon/M, special = FALSE, dont_remove_slot = 0) + . = ..() + pocket.master_item = M // So headpockets work with adjacency checks + +/obj/item/organ/internal/headpocket/remove(mob/living/carbon/M, special = 0) + pocket.master_item = src + return ..() /obj/item/organ/internal/headpocket/on_life() ..() @@ -34,8 +44,6 @@ empty_contents() /obj/item/organ/internal/headpocket/ui_action_click() - if(!loc) - loc = owner pocket.MouseDrop(owner) /obj/item/organ/internal/headpocket/on_owner_death()