Cleans up drop_organ() to use drop_location() (#68772)

Standardizes drop_organ with drop_location()
This commit is contained in:
ShizCalev
2022-07-27 17:53:30 -04:00
committed by GitHub
parent 1a2dba6a6f
commit 030ada2513
3 changed files with 12 additions and 10 deletions
+3 -3
View File
@@ -243,14 +243,14 @@
/obj/item/bodypart/proc/drop_organs(mob/user, violent_removal)
SHOULD_CALL_PARENT(TRUE)
var/turf/bodypart_turf = get_turf(src)
var/atom/drop_loc = drop_location()
if(IS_ORGANIC_LIMB(src))
playsound(bodypart_turf, 'sound/misc/splort.ogg', 50, TRUE, -1)
playsound(drop_loc, 'sound/misc/splort.ogg', 50, TRUE, -1)
seep_gauze(9999) // destroy any existing gauze if any exists
for(var/obj/item/organ/bodypart_organ in get_organs())
bodypart_organ.transfer_to_limb(src, owner)
for(var/obj/item/item_in_bodypart in src)
item_in_bodypart.forceMove(bodypart_turf)
item_in_bodypart.forceMove(drop_loc)
///since organs aren't actually stored in the bodypart themselves while attached to a person, we have to query the owner for what we should have
/obj/item/bodypart/proc/get_organs()
+3 -3
View File
@@ -135,7 +135,7 @@
return ..()
/obj/item/bodypart/head/drop_organs(mob/user, violent_removal)
var/turf/head_turf = get_turf(src)
var/atom/drop_loc = drop_location()
for(var/obj/item/head_item in src)
if(head_item == brain)
if(user)
@@ -148,7 +148,7 @@
if(violent_removal && prob(rand(80, 100))) //ghetto surgery can damage the brain.
to_chat(user, span_warning("[brain] was damaged in the process!"))
brain.setOrganDamage(brain.maxHealth)
brain.forceMove(head_turf)
brain.forceMove(drop_loc)
brain = null
update_icon_dropped()
else
@@ -159,7 +159,7 @@
var/obj/item/organ/organ = head_item
if(organ.organ_flags & ORGAN_UNREMOVABLE)
continue
head_item.forceMove(head_turf)
head_item.forceMove(drop_loc)
eyes = null
ears = null
tongue = null
@@ -213,11 +213,12 @@
. += span_info("It has a couple spots that still need to be <b>wired</b>.")
/obj/item/bodypart/chest/robot/drop_organs(mob/user, violent_removal)
var/atom/drop_loc = drop_location()
if(wired)
new /obj/item/stack/cable_coil(drop_location(), 1)
new /obj/item/stack/cable_coil(drop_loc, 1)
wired = FALSE
if(cell)
cell.forceMove(drop_location())
cell.forceMove(drop_loc)
cell = null
..()
@@ -313,11 +314,12 @@
/obj/item/bodypart/head/robot/drop_organs(mob/user, violent_removal)
var/atom/drop_loc = drop_location()
if(flash1)
flash1.forceMove(user.loc)
flash1.forceMove(drop_loc)
flash1 = null
if(flash2)
flash2.forceMove(user.loc)
flash2.forceMove(drop_loc)
flash2 = null
..()