Merge pull request #11 from Crazylemon64/OrganRefactor

Fixes organ DNA and transfer
This commit is contained in:
Aurorablade
2016-02-15 22:20:00 -05:00
6 changed files with 36 additions and 27 deletions
@@ -72,7 +72,7 @@
..()
/obj/item/organ/internal/brain/insert(var/mob/living/target,special = 0)
/obj/item/organ/internal/brain/insert(var/mob/living/target)
var/brain_already_exists = 0
if(istype(target,/mob/living/carbon/human)) // No more IPC multibrain shenanigans
@@ -148,7 +148,7 @@
/mob/living/carbon/human/proc/sync_organ_dna()
var/list/all_bits = internal_organs|organs
for(var/obj/item/organ/internal/O in all_bits)
for(var/obj/item/organ/O in all_bits)
O.set_dna(dna)
/*
@@ -166,7 +166,7 @@
for(var/index in has_organ)
var/organ = has_organ[index]
H.internal_organs += new organ(H)
H.internal_organs |= new organ(H)
for(var/obj/item/organ/internal/I in H.internal_organs)
I.insert(H)
+10 -18
View File
@@ -60,13 +60,12 @@ var/list/organ_cache = list()
/obj/item/organ/proc/update_health()
return
/obj/item/organ/New(var/mob/living/carbon/holder, var/internal)
/obj/item/organ/New(var/mob/living/carbon/holder)
..(holder)
create_reagents(5)
if(!max_damage)
max_damage = min_broken_damage * 2
if(istype(holder))
src.owner = holder
species = all_species["Human"]
if(holder.dna)
dna = holder.dna.Clone()
@@ -75,18 +74,10 @@ var/list/organ_cache = list()
log_to_dd("[src] at [loc] spawned without a proper DNA.")
var/mob/living/carbon/human/H = holder
if(istype(H))
if(internal)
var/obj/item/organ/external/E = H.organs_by_name[src.parent_organ]
if(E)
if(E.internal_organs == null)
E.internal_organs = list()
E.internal_organs |= src
if(dna)
if(!blood_DNA)
blood_DNA = list()
blood_DNA[dna.unique_enzymes] = dna.b_type
if(internal)
holder.internal_organs |= src
/obj/item/organ/proc/set_dna(var/datum/dna/new_dna)
if(new_dna)
@@ -296,14 +287,15 @@ var/list/organ_cache = list()
if(!istype(owner))
return
var/obj/item/organ/internal/O = owner.get_int_organ_tag(organ_tag)
world << "[O]"
if(O)
owner.internal_organs -= O
//O.forceMove(src)
//if(is_primary_organ())//Toddo from fethas:Do i need to move ths?
// owner.internal_organs_by_name[organ_tag] = null
// owner.internal_organs_by_name -= organ_tag
// owner.internal_organs_by_name -= null // uh what does this line even do this seems silly
owner.internal_organs -= src
var/obj/item/organ/external/affected = owner.get_organ(parent_organ)
if(affected) affected.internal_organs -= O
if(affected) affected.internal_organs -= src
loc = get_turf(owner)
processing_objects |= src
@@ -312,7 +304,7 @@ var/list/organ_cache = list()
if(!organ_blood || !organ_blood.data["blood_DNA"])
owner.vessel.trans_to(src, 5, 1, 1)
if(owner && vital) // I'd do another check for species or whatever so that you couldn't "kill" an IPC by removing a human head from them, but it doesn't matter since they'll come right back from the dead
if(owner && vital && is_primary_organ()) // I'd do another check for species or whatever so that you couldn't "kill" an IPC by removing a human head from them, but it doesn't matter since they'll come right back from the dead
if(user)
user.attack_log += "\[[time_stamp()]\]<font color='red'> removed a vital organ ([src]) from [key_name(owner)] (INTENT: [uppertext(user.a_intent)])</font>"
owner.attack_log += "\[[time_stamp()]\]<font color='orange'> had a vital organ ([src]) removed by [key_name(user)] (INTENT: [uppertext(user.a_intent)])</font>"
@@ -347,4 +339,4 @@ I use this so that this can be made better once the organ overhaul rolls out --
O = owner
if (!istype(owner)) // You're not the primary organ of ANYTHING, bucko
return 0
return src == O.get_int_organ_tag(organ_tag)
return src == O.get_int_organ(organ_tag)
@@ -117,11 +117,11 @@
return
/obj/item/organ/external/New(var/mob/living/carbon/holder, var/internal)
/obj/item/organ/external/New(var/mob/living/carbon/holder)
..()
if(owner)
replaced(owner)
sync_colour_to_human(owner)
if(istype(holder, /mob/living/carbon/human))
replaced(holder)
sync_colour_to_human(holder)
spawn(1)
get_icon()
@@ -867,8 +867,8 @@ Note that amputating the affected organ does in fact remove the infection from t
O.forceMove(src)
// Grab all the internal giblets too.
for(var/obj/item/organ/internal/organ in internal_organs)
organ.remove(victim)
for(var/obj/item/organ/organ in internal_organs)
organ.removed()
organ.forceMove(src)
release_restraints(victim)
@@ -10,6 +10,11 @@
vital = 0
var/organ_action_name = null
/obj/item/organ/internal/New(var/mob/living/carbon/holder)
if(istype(holder))
insert(holder)
..()
/obj/item/organ/internal/proc/insert(mob/living/carbon/M, special = 0)
if(!iscarbon(M) || owner == M)
return
@@ -21,6 +26,14 @@
owner = M
M.internal_organs |= src
var/obj/item/organ/external/parent
if(istype(M, /mob/living/carbon/human))
var/mob/living/carbon/human/H = M
parent = H.get_organ(check_zone(parent_organ))
if(!istype(parent))
log_to_dd("[src] attempted to insert into a [parent], but [parent] wasn't an organ! Area: [get_area(M)]")
else
parent.internal_organs |= src
//M.internal_organs_by_name[src] |= src(H,1)
loc = null
if(organ_action_name)
@@ -37,6 +50,10 @@
if(organ_action_name)
action_button_name = null
/obj/item/organ/internal/removed(mob/living/carbon/M)
remove(owner)
..()
/obj/item/organ/internal/proc/on_find(mob/living/finder)
return