From 692b2617760d0f4ddbcedb6a5ec4a02bb6e7a86a Mon Sep 17 00:00:00 2001 From: MistakeNot4892 Date: Mon, 21 Dec 2020 03:18:57 +1100 Subject: [PATCH 1/2] Merge pull request #1034 from eckff/implanted-items you can remove organs from a person in order to shove more things --- code/modules/organs/external/_external.dm | 6 ++++++ code/modules/organs/internal/_internal.dm | 4 ++++ code/modules/surgery/implant.dm | 4 +++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/code/modules/organs/external/_external.dm b/code/modules/organs/external/_external.dm index 8a6ae7ed48d..fc46018a4f7 100644 --- a/code/modules/organs/external/_external.dm +++ b/code/modules/organs/external/_external.dm @@ -77,6 +77,8 @@ var/atom/movable/applied_pressure var/atom/movable/splinted + var/internal_organs_size = 0 // Currently size cost of internal organs in this body part + // HUD element variable, see organ_icon.dm get_damage_hud_image() var/image/hud_damage_image @@ -298,6 +300,10 @@ O = O.parent return 0 +/obj/item/organ/external/proc/update_internal_organs_cost() + internal_organs_size = 0 + for(var/obj/item/organ/internal/org in internal_organs) + internal_organs_size += org.get_storage_cost() /obj/item/organ/external/proc/dislocate() if(dislocated == -1) diff --git a/code/modules/organs/internal/_internal.dm b/code/modules/organs/internal/_internal.dm index 5c0b6fddbd2..10cc7974ced 100644 --- a/code/modules/organs/internal/_internal.dm +++ b/code/modules/organs/internal/_internal.dm @@ -23,6 +23,8 @@ . = INITIALIZE_HINT_QDEL CRASH("[src] spawned in [holder] without a parent organ: [parent_organ].") E.internal_organs |= src + E.cavity_max_w_class = max(E.cavity_max_w_class, w_class) + E.update_internal_organs_cost() /obj/item/organ/internal/Destroy() if(owner) @@ -53,7 +55,9 @@ owner.internal_organs_by_name[organ_tag] = null owner.internal_organs_by_name -= organ_tag owner.internal_organs_by_name -= null + var/obj/item/organ/external/E = owner.get_organ(parent_organ) owner.internal_organs -= src + E.update_internal_organs_cost() if(detach) var/obj/item/organ/external/affected = owner.get_organ(parent_organ) diff --git a/code/modules/surgery/implant.dm b/code/modules/surgery/implant.dm index d66aebbaf29..94bfff70223 100644 --- a/code/modules/surgery/implant.dm +++ b/code/modules/surgery/implant.dm @@ -106,7 +106,7 @@ /decl/surgery_step/cavity/place_item/pre_surgery_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) var/obj/item/organ/external/affected = target.get_organ(target_zone) if(affected && affected.cavity) - var/max_volume = BASE_STORAGE_CAPACITY(affected.cavity_max_w_class) + var/max_volume = BASE_STORAGE_CAPACITY(affected.cavity_max_w_class) + affected.internal_organs_size if(tool.w_class > affected.cavity_max_w_class) to_chat(user, SPAN_WARNING("\The [tool] is too big for [affected.cavity_name] cavity.")) return FALSE @@ -115,6 +115,8 @@ if(istype(I,/obj/item/implant)) continue total_volume += I.get_storage_cost() + for(var/obj/item/organ/internal/org in affected.internal_organs) + max_volume -= org.get_storage_cost() if(total_volume > max_volume) to_chat(user, SPAN_WARNING("There isn't enough space left in [affected.cavity_name] cavity for [tool].")) return FALSE From 702a40a29d73bfdb86fcdec3157b3d7c4c463a67 Mon Sep 17 00:00:00 2001 From: SkyratBot Date: Sun, 20 Dec 2020 11:19:01 -0500 Subject: [PATCH 2/2] you can remove organs from a person in order to shove more things