Makes DNA swapping methods more reliable

- Makes heads keep hair on removal
- Amputated limbs from a DNA-injected individual now will keep their
  appearance of the DNA-injected person
- Wounds will now vanish on their own now
- Admins now have an "incarnate" option on the player panel when viewing
  ghosts for quick player instantiation
- Fixes a runtime regarding failing a limb reconnection surgery
- Copying a client's preferences now overrides the previous mob's DNA
This commit is contained in:
Crazylemon64
2016-03-17 23:07:45 -07:00
parent bb4580fee5
commit d748ef23b8
12 changed files with 84 additions and 26 deletions
+1 -1
View File
@@ -57,7 +57,7 @@ var/list/organ_cache = list()
/obj/item/organ/proc/set_dna(var/datum/dna/new_dna)
if(new_dna)
dna = new_dna.Clone()
blood_DNA.Cut()
blood_DNA = list()
blood_DNA[dna.unique_enzymes] = dna.b_type
/obj/item/organ/proc/die()
+26 -9
View File
@@ -30,8 +30,9 @@
var/cannot_amputate
var/cannot_break
var/s_tone
var/list/s_col = list()
var/list/s_col = null // If this is instantiated, it should be a list of length 3
var/list/wounds = list()
var/list/child_icons = list()
var/number_wounds = 0 // cache the number of wounds, which is NOT wounds.len!
var/perma_injury = 0
// 0: Don't fail when at full damage
@@ -64,6 +65,7 @@
var/amputation_point // Descriptive string used in amputation.
var/can_grasp
var/can_stand
var/wound_cleanup_timer
/obj/item/organ/external/Destroy()
if(parent && parent.children)
@@ -78,6 +80,10 @@
for(var/obj/item/organ/external/C in children)
qdel(C)
if(wound_cleanup_timer)
deltimer(wound_cleanup_timer)
wound_cleanup_timer = null
return ..()
/obj/item/organ/external/attackby(obj/item/weapon/W as obj, mob/user as mob)
@@ -105,7 +111,7 @@
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(src)
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]!")
@@ -392,6 +398,11 @@ This function completely restores a damaged organ to perfect condition.
last_dam = brute_dam + burn_dam
if(germ_level)
return 1
if(!wound_cleanup_timer)
wound_cleanup_timer = addtimer(src, "cleanup_wounds", SecondsToTicks(600), 1, wounds)
if (update_icon())
owner.UpdateDamageIcon(1)
return 0
/obj/item/organ/external/process()
@@ -525,11 +536,6 @@ Note that amputating the affected organ does in fact remove the infection from t
return
for(var/datum/wound/W in wounds)
// wounds can disappear after 10 minutes at the earliest
if(W.damage <= 0 && W.created + 10 * 10 * 60 <= world.time)
wounds -= W
continue
// let the GC handle the deletion of the wound
// Internal wounds get worse over time. Low temperatures (cryo) stop them.
if(W.internal && !W.can_autoheal() && owner.bodytemperature >= 170)
@@ -892,13 +898,13 @@ 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()
O.remove(victim)
if(O)
O.forceMove(src)
// Grab all the internal giblets too.
for(var/obj/item/organ/internal/organ in internal_organs)
organ.remove()
organ.remove(victim)
organ.forceMove(src)
release_restraints(victim)
@@ -941,3 +947,14 @@ Note that amputating the affected organ does in fact remove the infection from t
if (!istype(O)) // You're not the primary organ of ANYTHING, bucko
return 0
return src == O.organs_by_name[limb_name]
// The callback we use to remove wounds from an un-processed limb
/obj/item/organ/external/proc/cleanup_wounds(var/list/slated_wounds)
wound_cleanup_timer = null
for(var/datum/wound/W in slated_wounds)
if(!W)
continue
if(W.damage > 0)
continue
wounds -= W
qdel(W)
+13 -5
View File
@@ -1,34 +1,42 @@
var/global/list/limb_icon_cache = list()
/obj/item/organ/external/proc/compile_icon()
overlays.Cut()
// I do this so the head's overlays don't get obliterated
for(var/child_i in child_icons)
overlays -= child_i
child_icons.Cut()
// This is a kludge, only one icon has more than one generation of children though.
for(var/obj/item/organ/external/organ in contents)
if(organ.children && organ.children.len)
for(var/obj/item/organ/external/child in organ.children)
overlays += child.mob_icon
child_icons += child.mob_icon
overlays += organ.mob_icon
child_icons += organ.mob_icon
/obj/item/organ/external/proc/sync_colour_to_human(var/mob/living/carbon/human/human)
s_tone = null
s_col = null
if(status & ORGAN_ROBOT && !(species && species.name == "Machine")) //machine people get skin color
return
if(species && human.species && species.name != human.species.name)
return
if(dna.unique_enzymes != human.dna.unique_enzymes) // This isn't MY arm
sync_colour_to_dna()
return
if(!isnull(human.s_tone) && (human.species.bodyflags & HAS_SKIN_TONE))
s_col = null
s_tone = human.s_tone
if(human.species.bodyflags & HAS_SKIN_COLOR)
s_tone = null
s_col = list(human.r_skin, human.g_skin, human.b_skin)
/obj/item/organ/external/proc/sync_colour_to_dna()
s_tone = null
s_col = null
if(status & ORGAN_ROBOT)
return
if(!isnull(dna.GetUIValue(DNA_UI_SKIN_TONE)) && (species.flags & HAS_SKIN_TONE))
s_col = null
s_tone = dna.GetUIValue(DNA_UI_SKIN_TONE)
if(species.flags & HAS_SKIN_COLOR)
s_tone = null
s_col = list(dna.GetUIValue(DNA_UI_SKIN_R), dna.GetUIValue(DNA_UI_SKIN_G), dna.GetUIValue(DNA_UI_SKIN_B))
/obj/item/organ/external/head/sync_colour_to_human(var/mob/living/carbon/human/human)