Makes IPC surgery much more reliable, object insertion surgery

works better now, and `can_use` is actually called now.
This commit is contained in:
Crazylemon64
2016-08-14 18:12:23 -07:00
parent dbfc4562fa
commit 7d2983b4bf
33 changed files with 564 additions and 461 deletions
+3 -3
View File
@@ -40,7 +40,7 @@
M.sight |= vision_flags
/obj/item/organ/internal/cyberimp/eyes/remove(var/mob/living/carbon/M, var/special = 0)
..()
. = ..()
M.sight ^= vision_flags
if(istype(owner,/mob/living/carbon/human) && eye_colour)
var/mob/living/carbon/human/HMN = owner
@@ -97,7 +97,7 @@
M.permanent_huds |= H
/obj/item/organ/internal/cyberimp/eyes/hud/remove(var/mob/living/carbon/M, var/special = 0)
..()
. = ..()
if(HUD_type)
var/datum/atom_hud/H = huds[HUD_type]
M.permanent_huds ^= H
@@ -132,4 +132,4 @@
// Welding with thermals will still hurt your eyes a bit.
/obj/item/organ/internal/cyberimp/eyes/shield/emp_act(severity)
return
return
@@ -116,7 +116,7 @@
r_hand_obj.flags ^= NODROP
/obj/item/organ/internal/cyberimp/brain/anti_drop/remove(var/mob/living/carbon/M, special = 0)
..()
. = ..()
if(active)
ui_action_click()
+2 -2
View File
@@ -25,7 +25,7 @@
owner.med_hud_set_status()
spawn(0)
RemoveInfectionImages(owner)
..()
. = ..()
/obj/item/organ/internal/body_egg/process()
if(!owner)
@@ -46,4 +46,4 @@
return
/obj/item/organ/internal/body_egg/proc/RemoveInfectionImages()
return
return
+1
View File
@@ -314,6 +314,7 @@ var/list/organ_cache = list()
msg_admin_attack("[key_name_admin(user)] removed a vital organ ([src]) from [key_name_admin(owner)]")
owner.death()
owner = null
return src
/obj/item/organ/proc/replaced(var/mob/living/carbon/human/target,var/obj/item/organ/external/affected)
+33 -30
View File
@@ -51,8 +51,6 @@
var/broken_description
var/open = 0
var/stage = 0
var/cavity = 0
var/sabotaged = 0 //If a prosthetic limb is emagged, it will detonate when it fails.
var/encased // Needs to be opened with a saw to access the organs.
@@ -71,6 +69,9 @@
if(parent && parent.children)
parent.children -= src
if(owner)
owner.organs_by_name[limb_name] = null
if(internal_organs)
for(var/obj/item/organ/internal/O in internal_organs)
internal_organs -= O
@@ -87,38 +88,35 @@
return ..()
/obj/item/organ/external/attackby(obj/item/weapon/W as obj, mob/user as mob)
switch(stage)
switch(open)
if(0)
if(istype(W,/obj/item/weapon/scalpel))
spread_germs_to_organ(src,user)
user.visible_message("<span class='danger'><b>[user]</b> cuts [src] open with [W]!")
stage++
user.visible_message("<span class='danger'><b>[user]</b> cuts [src] open with [W]!</span>")
open++
return
if(1)
if(istype(W,/obj/item/weapon/retractor))
spread_germs_to_organ(src,user)
user.visible_message("<span class='danger'><b>[user]</b> cracks [src] open like an egg with [W]!")
stage++
user.visible_message("<span class='danger'><b>[user]</b> cracks [src] open like an egg with [W]!</span>")
open++
return
if(2)
if(istype(W,/obj/item/weapon/hemostat))
spread_germs_to_organ(src,user)
if(contents.len)
var/obj/item/removing = pick(contents)
removing.loc = get_turf(user.loc)
var/obj/item/organ/internal/O = removing
if(istype(O))
O.status |= ORGAN_CUT_AWAY
if(!O.sterile)
spread_germs_to_organ(O,user) // This wouldn't be any cleaner than the actual surgery
O.forceMove(get_turf(src))
if(!(user.l_hand && user.r_hand))
user.put_in_hands(removing)
user.visible_message("<span class='danger'><b>[user]</b> extracts [removing] from [src] with [W]!")
user.put_in_hands(removing)
user.visible_message("<span class='danger'><b>[user]</b> extracts [removing] from [src] with [W]!</span>")
else
user.visible_message("<span class='danger'><b>[user]</b> fishes around fruitlessly in [src] with [W].")
user.visible_message("<span class='danger'><b>[user]</b> fishes around fruitlessly in [src] with [W].</span>")
return
..()
. = ..()
/obj/item/organ/external/update_health()
@@ -139,14 +137,12 @@
status = status & ~ORGAN_DESTROYED
forceMove(owner)
if(istype(owner))
if(!isnull(owner.organs_by_name[limb_name]))
log_debug("Duplicate organ in slot \"[limb_name]\", mob '[target]'")
owner.organs_by_name[limb_name] = src
owner.organs |= src
for(var/obj/item/organ/organ in src)
if(istype(src, /obj/item/organ/internal))
var/obj/item/organ/internal/I = organ
if(target.get_organ_slot(I.slot))
continue // Just leave it inside its limb, so brains with brainmobs in them don't get voided.
organ.replaced(owner,src)
for(var/atom/movable/stuff in src)
stuff.attempt_become_organ(src, owner)
if(parent_organ)
parent = owner.organs_by_name[src.parent_organ]
@@ -161,6 +157,12 @@
break
parent.update_damages()
/obj/item/organ/external/attempt_become_organ(obj/item/organ/external/parent,mob/living/carbon/human/H)
if(parent_organ != parent.limb_name)
return 0
replaced(H)
return 1
/****************************************************
DAMAGE PROCS
****************************************************/
@@ -691,7 +693,8 @@ Note that amputating the affected organ does in fact remove the infection from t
"<span class='danger'>You hear the [gore_sound].</span>")
var/mob/living/carbon/human/victim = owner //Keep a reference for post-removed().
remove(null, ignore_children)
// Let people make limbs become fun things when removed
var/atom/movable/dropped_part = remove(null, ignore_children)
victim.traumatic_shock += 30
wounds.Cut()
@@ -726,12 +729,12 @@ Note that amputating the affected organ does in fact remove the infection from t
if(!clean)
// Throw limb around.
if(src && istype(loc,/turf))
throw_at(get_edge_target_turf(src,pick(alldirs)),rand(1,3),30)
dropped_part.throw_at(get_edge_target_turf(src,pick(alldirs)),rand(1,3),30)
dir = 2
return
return dropped_part
else
qdel(src) // If you flashed away to ashes, YOU FLASHED AWAY TO ASHES
return
return null
/****************************************************
HELPERS
@@ -903,7 +906,7 @@ Note that amputating the affected organ does in fact remove the infection from t
var/is_robotic = status & ORGAN_ROBOT
var/mob/living/carbon/human/victim = owner
..()
. = ..()
status |= ORGAN_DESTROYED
victim.bad_external_organs -= src
@@ -914,14 +917,14 @@ Note that amputating the affected organ does in fact remove the infection from t
// Attached organs also fly off.
if(!ignore_children)
for(var/obj/item/organ/external/O in children)
O.remove(victim)
if(O)
O.forceMove(src)
var/atom/movable/thing = O.remove(victim)
if(thing)
thing.forceMove(src)
// Grab all the internal giblets too.
for(var/obj/item/organ/internal/organ in internal_organs)
organ.remove(victim)
organ.forceMove(src)
var/atom/movable/thing = organ.remove(victim)
thing.forceMove(src)
release_restraints(victim)
victim.organs -= src
+1 -1
View File
@@ -47,7 +47,7 @@ var/global/list/limb_icon_cache = list()
/obj/item/organ/external/head/remove()
get_icon()
..()
. = ..()
/obj/item/organ/external/head/get_icon()
+20 -12
View File
@@ -15,6 +15,11 @@
insert(holder)
..()
/obj/item/organ/internal/Destroy()
if(owner)
remove(owner, 1)
return ..()
/obj/item/organ/internal/proc/insert(mob/living/carbon/M, special = 0, var/dont_remove_slot = 0)
if(!iscarbon(M) || owner == M)
return
@@ -43,7 +48,9 @@
var/datum/action/A = X
A.Grant(M)
// Removes the given organ from its owner.
// Returns the removed object, which is usually just itself
// However, you MUST set the object's positiion yourself when you call this!
/obj/item/organ/internal/remove(mob/living/carbon/M, special = 0)
owner = null
if(M)
@@ -63,7 +70,7 @@
for(var/X in actions)
var/datum/action/A = X
A.Remove(M)
return src
/obj/item/organ/internal/replaced(var/mob/living/carbon/human/target,var/obj/item/organ/external/affected)
insert(target)
@@ -78,11 +85,6 @@
/obj/item/organ/internal/proc/on_life()
return
/obj/item/organ/internal/Destroy()
if(owner)
remove(owner, 1)
return ..()
/obj/item/organ/internal/proc/prepare_eat()
if(status == ORGAN_ROBOT)
return //no eating cybernetic implants!
@@ -96,6 +98,12 @@
return S
/obj/item/organ/internal/attempt_become_organ(obj/item/organ/external/parent,mob/living/carbon/human/H)
if(parent_organ != parent.limb_name)
return 0
insert(H)
return 1
/obj/item/weapon/reagent_containers/food/snacks/organ
name = "appendix"
icon_state = "appendix"
@@ -149,7 +157,7 @@
icon_state = "[icon_base]-off"
/obj/item/organ/internal/heart/remove(mob/living/carbon/M, special = 0)
..()
. = ..()
if(ishuman(M))
var/mob/living/carbon/human/H = M
if(H.stat == DEAD || H.heart_attack)
@@ -279,7 +287,7 @@
///obj/item/organ/internal/lungs/remove(mob/living/carbon/M, special = 0)
// owner.losebreath += 10
//insert oxy damage extream here.
// ..()
// . = ..()
/obj/item/organ/internal/lungs/process()
@@ -436,7 +444,7 @@
A.cure()
inflamed = 1
update_icon()
..()
. = ..()
/obj/item/organ/internal/appendix/insert(mob/living/carbon/M, special = 0)
..()
@@ -508,7 +516,7 @@
organhonked = world.time
/obj/item/organ/internal/honktumor/remove(mob/living/carbon/M, special = 0)
..()
. = ..()
M.mutations.Remove(CLUMSY)
M.mutations.Remove(COMICBLOCK)
@@ -561,7 +569,7 @@
/obj/item/organ/internal/honktumor/cursed
/obj/item/organ/internal/honktumor/cursed/remove(mob/living/carbon/M, special = 0, clean_remove = 0)
..()
. = ..()
if(!clean_remove)
visible_message("<span class='warning'>[src] vanishes into dust, and a [M] emits a loud honk!</span>", "<span class='notice'>You hear a loud honk.</span>")
insert(M) //You're not getting away that easily!
+1 -1
View File
@@ -22,7 +22,7 @@
/obj/item/organ/external/stump/remove()
..()
qdel(src)
return null
/obj/item/organ/external/stump/is_usable()
return 0
+2 -1
View File
@@ -32,4 +32,5 @@
/obj/item/organ/internal/body_egg/spider_eggs/remove(var/mob/living/carbon/M, var/special = 0)
..()
M.reagents.del_reagent("spidereggs") //purge all remaining spider eggs reagent if caught, in time.
qdel(src) //We don't want people re-implanting these for near instant gibbings.
qdel(src) //We don't want people re-implanting these for near instant gibbings.
return null
+1 -1
View File
@@ -12,5 +12,5 @@
M.add_language("Psionic Communication")
/obj/item/organ/internal/brain/grey/remove(var/mob/living/carbon/M, var/special = 0)
..()
. = ..()
M.remove_language("Psionic Communication")
+25 -22
View File
@@ -117,13 +117,6 @@
robotize()
..()
/obj/item/organ/internal/cell/insert()
..()
// This is very ghetto way of rebooting an IPC. TODO better way.
if(owner && owner.stat == DEAD)
owner.stat = CONSCIOUS
owner.visible_message("<span class='danger'>\The [owner] twitches visibly!</span>")
/obj/item/organ/internal/optical_sensor
name = "optical sensor"
organ_tag = "eyes"
@@ -167,20 +160,29 @@
species = "Machine"
var/obj/item/device/mmi/stored_mmi
/obj/item/organ/internal/brain/mmi_holder/proc/update_from_mmi()
if(!stored_mmi)
return
name = stored_mmi.name
desc = stored_mmi.desc
icon = stored_mmi.icon
icon_state = stored_mmi.icon_state
/obj/item/organ/internal/brain/mmi_holder/Destroy()
if(stored_mmi)
log_debug("Deleting MMI!")
qdel(stored_mmi)
return ..()
/obj/item/organ/internal/brain/mmi_holder/insert(var/mob/living/target,special = 0)
..()
// To supersede the over-writing of the MMI's name from `insert`
update_from_mmi()
/obj/item/organ/internal/brain/mmi_holder/remove(var/mob/living/user,special = 0)
if(!special)
if(stored_mmi)
stored_mmi.forceMove(get_turf(owner))
. = stored_mmi
if(owner.mind)
owner.mind.transfer_to(stored_mmi.brainmob)
log_debug("Releasing MMI!")
// move it to nullspace momentarily. If it STAYS there, we got a problem -
// the caller needs to set the location of the removed organ for this to work
contents -= stored_mmi
stored_mmi = null
..()
var/mob/living/holder_mob = loc
@@ -188,13 +190,14 @@
holder_mob.unEquip(src)
qdel(src)
/obj/item/organ/internal/brain/mmi_holder/New()
..()
// This is very ghetto way of rebooting an IPC. TODO better way.
spawn(1)
if(owner && owner.stat == DEAD)
owner.stat = CONSCIOUS
owner.visible_message("<span class='danger'>\The [owner] twitches visibly!</span>")
/obj/item/organ/internal/brain/mmi_holder/proc/update_from_mmi()
if(!stored_mmi)
return
name = stored_mmi.name
desc = stored_mmi.desc
icon = stored_mmi.icon
icon_state = stored_mmi.icon_state
set_dna(stored_mmi.brainmob.dna)
/obj/item/organ/internal/brain/mmi_holder/posibrain/New()
robotize()
@@ -41,6 +41,7 @@
spawn(0)
qdel(src)
return null
//VOX ORGANS.
/obj/item/organ/internal/stack
@@ -85,7 +85,7 @@
/obj/item/organ/external/foot/remove()
if(owner.shoes) owner.unEquip(owner.shoes)
..()
. = ..()
/obj/item/organ/external/foot/right
limb_name = "r_foot"
@@ -116,7 +116,7 @@
if(owner.r_hand)
owner.unEquip(owner.r_hand,1)
..()
. = ..()
/obj/item/organ/external/hand/right
limb_name = "r_hand"
@@ -178,7 +178,7 @@
if(owner)//runtimer no runtiming
owner.update_hair()
owner.update_fhair()
..()
. = ..()
/obj/item/organ/external/head/replaced()
name = limb_name
@@ -24,7 +24,7 @@
M.verbs -= P
//M.verbs -= alien_powers.Copy()
..()
. = ..()
/obj/item/organ/internal/xenos/prepare_eat()
var/obj/S = ..()
@@ -106,7 +106,7 @@
A.updatePlasmaDisplay()
/obj/item/organ/internal/alien/plasmavessel/remove(mob/living/carbon/M, special = 0)
..()
. =..()
if(isalien(M))
var/mob/living/carbon/alien/A = M
A.updatePlasmaDisplay()
@@ -140,7 +140,7 @@
M.faction -= "alien"
M.remove_language("Hivemind")
M.remove_language("Xenomorph")
..()
. = ..()
/obj/item/organ/internal/xenos/neurotoxin
name = "xeno neurotoxin gland"
@@ -165,4 +165,4 @@
slot = "eggsac"
w_class = 4
origin_tech = "biotech=8"
alien_powers = list(/mob/living/carbon/alien/humanoid/queen/verb/lay_egg)
alien_powers = list(/mob/living/carbon/alien/humanoid/queen/verb/lay_egg)