diff --git a/code/modules/mob/living/carbon/human/death.dm b/code/modules/mob/living/carbon/human/death.dm
index 4ab5c0b37c4..3db0610781d 100644
--- a/code/modules/mob/living/carbon/human/death.dm
+++ b/code/modules/mob/living/carbon/human/death.dm
@@ -1,11 +1,9 @@
/mob/living/carbon/human/gib()
for(var/obj/item/organ/I in internal_organs)
- var/obj/item/organ/current_organ = I.remove()
- if(current_organ)
- if(istype(loc,/turf))
- current_organ.throw_at(get_edge_target_turf(src,pick(alldirs)),rand(1,3),30)
- current_organ.removed(src)
+ I.removed()
+ if(istype(loc,/turf))
+ I.throw_at(get_edge_target_turf(src,pick(alldirs)),rand(1,3),30)
for(var/obj/item/organ/external/E in src.organs)
if(istype(E, /obj/item/organ/external/chest))
diff --git a/code/modules/mob/living/carbon/human/human_organs.dm b/code/modules/mob/living/carbon/human/human_organs.dm
index b377e6f46e0..7f1b796bed8 100644
--- a/code/modules/mob/living/carbon/human/human_organs.dm
+++ b/code/modules/mob/living/carbon/human/human_organs.dm
@@ -64,10 +64,11 @@
for (var/organ in list("l_leg","l_foot","r_leg","r_foot"))
var/obj/item/organ/external/E = organs_by_name[organ]
- if (E.status & ORGAN_DESTROYED)
- stance_damage += 2 // let it fail even if just foot&leg
- else if (E.is_malfunctioning() || (E.is_broken() && !(E.status & ORGAN_SPLINTED)) || !E.is_usable())
- stance_damage += 1
+ if(E)
+ if (E.status & ORGAN_DESTROYED)
+ stance_damage += 2 // let it fail even if just foot&leg
+ else if (E.is_malfunctioning() || (E.is_broken() && !(E.status & ORGAN_SPLINTED)) || !E.is_usable())
+ stance_damage += 1
// Canes and crutches help you stand (if the latter is ever added)
// One cane mitigates a broken leg+foot, or a missing foot.
diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm
index 6a3dd71d199..d53710d3956 100644
--- a/code/modules/mob/living/carbon/human/species/species.dm
+++ b/code/modules/mob/living/carbon/human/species/species.dm
@@ -142,7 +142,10 @@
/datum/species/proc/create_organs(var/mob/living/carbon/human/H) //Handles creation of mob organs.
- //Trying to work out why species changes aren't fixing organs properly.
+ for(var/obj/item/organ/organ in H.contents)
+ if((organ in H.organs) || (organ in H.internal_organs))
+ del(organ)
+
if(H.organs) H.organs.Cut()
if(H.internal_organs) H.internal_organs.Cut()
if(H.organs_by_name) H.organs_by_name.Cut()
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index 5978d0df530..399b1ce5ca7 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -593,7 +593,7 @@ var/list/slot_equipment_priority = list( \
if(H.health - H.halloss <= config.health_threshold_softcrit)
for(var/name in H.organs_by_name)
var/obj/item/organ/external/e = H.organs_by_name[name]
- if(H.lying)
+ if(e && H.lying)
if(((e.status & ORGAN_BROKEN && !(e.status & ORGAN_SPLINTED)) || e.status & ORGAN_BLEEDING) && (H.getBruteLoss() + H.getFireLoss() >= 100))
return 1
break
diff --git a/code/modules/organs/organ.dm b/code/modules/organs/organ.dm
index b0f79ce602b..9562fcb41df 100644
--- a/code/modules/organs/organ.dm
+++ b/code/modules/organs/organ.dm
@@ -226,29 +226,29 @@ var/list/organ_cache = list()
take_damage(10,0)
return
-/obj/item/organ/proc/removed(var/mob/living/carbon/human/target,var/mob/living/user)
+/obj/item/organ/proc/removed(var/mob/living/user)
- if(!istype(target))
+ if(!istype(owner))
return
- target.internal_organs_by_name[organ_tag] = null
- target.internal_organs_by_name -= organ_tag
- target.internal_organs -= src
+ owner.internal_organs_by_name[organ_tag] = null
+ owner.internal_organs_by_name -= organ_tag
+ owner.internal_organs -= src
- var/obj/item/organ/external/affected = target.get_organ(parent_organ)
- affected.internal_organs -= src
+ var/obj/item/organ/external/affected = owner.get_organ(parent_organ)
+ if(affected) affected.internal_organs -= src
- loc = target.loc
+ loc = owner.loc
rejecting = null
var/datum/reagent/blood/organ_blood = locate(/datum/reagent/blood) in reagents.reagent_list
if(!organ_blood || !organ_blood.data["blood_DNA"])
- target.vessel.trans_to(src, 5, 1, 1)
+ owner.vessel.trans_to(src, 5, 1, 1)
- if(target && user && vital)
- user.attack_log += "\[[time_stamp()]\] removed a vital organ ([src]) from [target.name] ([target.ckey]) (INTENT: [uppertext(user.a_intent)])"
- target.attack_log += "\[[time_stamp()]\] had a vital organ ([src]) removed by [user.name] ([user.ckey]) (INTENT: [uppertext(user.a_intent)])"
- msg_admin_attack("[user.name] ([user.ckey]) removed a vital organ ([src]) from [target.name] ([target.ckey]) (INTENT: [uppertext(user.a_intent)]) (JMP)")
- target.death()
+ if(owner && user && vital)
+ user.attack_log += "\[[time_stamp()]\] removed a vital organ ([src]) from [owner.name] ([owner.ckey]) (INTENT: [uppertext(user.a_intent)])"
+ owner.attack_log += "\[[time_stamp()]\] had a vital organ ([src]) removed by [user.name] ([user.ckey]) (INTENT: [uppertext(user.a_intent)])"
+ msg_admin_attack("[user.name] ([user.ckey]) removed a vital organ ([src]) from [owner.name] ([owner.ckey]) (INTENT: [uppertext(user.a_intent)]) (JMP)")
+ owner.death()
/obj/item/organ/proc/replaced(var/mob/living/carbon/human/target,var/obj/item/organ/external/affected)
@@ -314,10 +314,3 @@ var/list/organ_cache = list()
if(!robotic && user.a_intent == "help" && user.zone_sel.selecting == "mouth")
bitten(user)
return
-
-/obj/item/organ/proc/remove(var/mob/user)
- if(user)
- src.loc = get_turf(user)
- else
- src.loc = get_turf(owner)
- return src
diff --git a/code/modules/organs/organ_alien.dm b/code/modules/organs/organ_alien.dm
index c8fd93ea781..e5f91c6b412 100644
--- a/code/modules/organs/organ_alien.dm
+++ b/code/modules/organs/organ_alien.dm
@@ -107,14 +107,14 @@
organ_tag = "brain"
desc = "A disgusting space slug."
-/obj/item/organ/borer/removed(var/mob/living/target,var/mob/living/user)
+/obj/item/organ/borer/removed(var/mob/living/user)
..()
- var/mob/living/simple_animal/borer/B = target.has_brain_worms()
+ var/mob/living/simple_animal/borer/B = owner.has_brain_worms()
if(B)
B.leave_host()
- B.ckey = target.ckey
+ B.ckey = owner.ckey
spawn(0)
del(src)
diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm
index 6e1b7c5c34b..e5ba05eef28 100644
--- a/code/modules/organs/organ_external.dm
+++ b/code/modules/organs/organ_external.dm
@@ -28,7 +28,7 @@
var/list/obj/item/organ/external/children
// Internal organs of this body part
- var/list/obj/item/organ/internal_organs
+ var/list/internal_organs = list()
var/damage_msg = "\red You feel an intense pain"
var/broken_description
@@ -620,7 +620,7 @@ Note that amputating the affected organ does in fact remove the infection from t
if(parent)
parent.children -= src
- src.removed(owner)
+ src.removed()
if(parent)
spawn(1)
@@ -808,7 +808,7 @@ Note that amputating the affected organ does in fact remove the infection from t
H.drop_item()
W.loc = owner
-/obj/item/organ/external/removed(var/mob/living/user)
+/obj/item/organ/external/removed()
var/is_robotic = status & ORGAN_ROBOT
..()
@@ -823,12 +823,12 @@ Note that amputating the affected organ does in fact remove the infection from t
// Attached organs also fly off.
for(var/obj/item/organ/external/O in children)
- O.removed(owner)
+ O.removed()
O.loc = src //TODO: generate entire limb icons from contents.
// Grab all the internal giblets too.
for(var/obj/item/organ/organ in internal_organs)
- organ.removed(user)
+ organ.removed()
organ.loc = src
release_restraints()
diff --git a/code/modules/projectiles/guns/launcher/crossbow.dm b/code/modules/projectiles/guns/launcher/crossbow.dm
index 860169d7b27..917d3c338e3 100644
--- a/code/modules/projectiles/guns/launcher/crossbow.dm
+++ b/code/modules/projectiles/guns/launcher/crossbow.dm
@@ -105,14 +105,14 @@
current_user = user
user.visible_message("[user] begins to draw back the string of [src].","You begin to draw back the string of [src].")
tension = 1
-
+
while(bolt && tension && current_user == user)
if(!do_after(user, 25)) //crossbow strings don't just magically pull back on their own.
user.visible_message("[usr] stops drawing and relaxes the string of [src].","You stop drawing back and relax the string of [src].")
tension = 0
icon_state = "crossbow"
return
-
+
tension++
icon_state = "crossbow-drawn"
@@ -120,7 +120,7 @@
tension = max_tension
usr << "[src] clunks as you draw the string to its maximum tension!"
return
-
+
user.visible_message("[usr] draws back the string of [src]!","You continue drawing back the string of [src]!")
/obj/item/weapon/gun/launcher/crossbow/proc/increase_tension(var/mob/user as mob)
diff --git a/code/modules/surgery/organs_internal.dm b/code/modules/surgery/organs_internal.dm
index 6057e06a7f3..8107a0548ad 100644
--- a/code/modules/surgery/organs_internal.dm
+++ b/code/modules/surgery/organs_internal.dm
@@ -304,12 +304,9 @@
// Extract the organ!
if(target.op_stage.current_organ)
- var/obj/item/organ/I = target.internal_organs_by_name[target.op_stage.current_organ]
- var/obj/item/organ/O
- if(I && istype(I))
- O = I.remove(user)
- if(O && istype(O))
- O.removed(target,user)
+ var/obj/item/organ/O = target.internal_organs_by_name[target.op_stage.current_organ]
+ if(O && istype(O))
+ O.removed(user)
target.op_stage.current_organ = null
fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)