Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] you can remove organs from a person in order to shove more things #298

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions code/modules/organs/external/_external.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions code/modules/organs/internal/_internal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion code/modules/surgery/implant.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down