Organ initialization cleanup

This commit is contained in:
AnturK
2017-10-01 13:32:02 +02:00
committed by CitadelStationBot
parent 06fe1e8da6
commit fd5acc5573
6 changed files with 138 additions and 109 deletions
+7 -3
View File
@@ -18,12 +18,12 @@
vital = FALSE
decoy_override = TRUE
/obj/item/organ/brain/Insert(mob/living/carbon/C, special = 0)
/obj/item/organ/brain/Insert(mob/living/carbon/C, special = 0,no_id_transfer = FALSE)
..()
name = "brain"
if(C.mind && C.mind.changeling) //congrats, you're trapped in a body you don't control
if(C.mind && C.mind.changeling && !no_id_transfer) //congrats, you're trapped in a body you don't control
if(brainmob && !(C.stat == DEAD || (C.status_flags & FAKEDEATH)))
to_chat(brainmob, "<span class = danger>You can't feel your body! You're still just a brain!</span>")
loc = C
@@ -44,13 +44,17 @@
//Update the body's icon so it doesnt appear debrained anymore
C.update_hair()
/obj/item/organ/brain/Remove(mob/living/carbon/C, special = 0)
/obj/item/organ/brain/Remove(mob/living/carbon/C, special = 0,no_id_transfer = FALSE)
..()
<<<<<<< HEAD
if(!special)
if(C.has_brain_worms())
var/mob/living/simple_animal/borer/B = C.has_brain_worms()
B.leave_victim() //Should remove borer if the brain is removed - RR
if(!gc_destroyed || (owner && !owner.gc_destroyed))
=======
if((!gc_destroyed || (owner && !owner.gc_destroyed)) && !no_id_transfer)
>>>>>>> 85cd9e6... Organ initialization cleanup
transfer_identity(C)
C.update_hair()
+1 -30
View File
@@ -21,41 +21,12 @@
set_species(dna.species.type)
//initialise organs
create_internal_organs()
create_internal_organs() //most of it is done in set_species now, this is only for parent call
handcrafting = new()
. = ..()
/mob/living/carbon/human/create_internal_organs()
if(!(NOHUNGER in dna.species.species_traits))
internal_organs += new /obj/item/organ/appendix
if(!(NOBREATH in dna.species.species_traits))
if(dna.species.mutantlungs)
internal_organs += new dna.species.mutantlungs()
else
internal_organs += new /obj/item/organ/lungs()
if(!(NOBLOOD in dna.species.species_traits))
internal_organs += new /obj/item/organ/heart
if(!(NOLIVER in dna.species.species_traits))
if(dna.species.mutantliver)
internal_organs += new dna.species.mutantliver()
else
internal_organs += new /obj/item/organ/liver()
if(!(NOSTOMACH in dna.species.species_traits))
if(dna.species.mutantstomach)
internal_organs += new dna.species.mutantstomach()
else
internal_organs += new /obj/item/organ/stomach()
internal_organs += new dna.species.mutanteyes
internal_organs += new dna.species.mutantears
internal_organs += new dna.species.mutanttongue
internal_organs += new /obj/item/organ/brain
..()
/mob/living/carbon/human/OpenCraftingMenu()
handcrafting.ui_interact(src)
+110 -74
View File
@@ -68,7 +68,8 @@
//Flight and floating
var/override_float = 0
var/obj/item/organ/brain/mutant_brain = /obj/item/organ/brain
var/obj/item/organ/eyes/mutanteyes = /obj/item/organ/eyes
var/obj/item/organ/ears/mutantears = /obj/item/organ/ears
var/obj/item/mutanthands
@@ -123,6 +124,113 @@
return 0
return 1
//Will regenerate missing organs
/datum/species/proc/regenerate_organs(mob/living/carbon/C,datum/species/old_species,replace_current=TRUE)
var/obj/item/organ/brain/brain = C.getorganslot("brain")
var/obj/item/organ/heart/heart = C.getorganslot("heart")
var/obj/item/organ/lungs/lungs = C.getorganslot("lungs")
var/obj/item/organ/appendix/appendix = C.getorganslot("appendix")
var/obj/item/organ/eyes/eyes = C.getorganslot("eye_sight")
var/obj/item/organ/ears/ears = C.getorganslot("ears")
var/obj/item/organ/tongue/tongue = C.getorganslot("tongue")
var/obj/item/organ/liver/liver = C.getorganslot("liver")
var/obj/item/organ/stomach/stomach = C.getorganslot("stomach")
var/should_have_brain = TRUE
var/should_have_heart = !(NOBLOOD in species_traits)
var/should_have_lungs = !(NOBREATH in species_traits)
var/should_have_appendix = !(NOHUNGER in species_traits)
var/should_have_eyes = TRUE
var/should_have_ears = TRUE
var/should_have_tongue = TRUE
var/should_have_liver = !(NOLIVER in species_traits)
var/should_have_stomach = !(NOSTOMACH in species_traits)
if(brain && (replace_current || !should_have_brain))
if(!brain.decoy_override)//Just keep it if it's fake
brain.Remove(C,TRUE,TRUE)
QDEL_NULL(brain)
if(should_have_brain && !brain)
brain = new mutant_brain()
brain.Insert(C, TRUE, TRUE)
if(heart && (!should_have_heart || replace_current))
heart.Remove(C,1)
QDEL_NULL(heart)
if(should_have_heart && !heart)
heart = new()
heart.Insert(C)
if(lungs && (replace_current || !should_have_lungs))
lungs.Remove(C,1)
QDEL_NULL(lungs)
if(should_have_lungs && !lungs)
if(mutantlungs)
lungs = new mutantlungs()
else
lungs = new()
lungs.Insert(C)
if(liver && (!should_have_liver || replace_current))
liver.Remove(C,1)
QDEL_NULL(liver)
if(should_have_liver && !liver)
if(mutantliver)
liver = new mutantliver()
else
liver = new()
liver.Insert(C)
if(stomach && (!should_have_stomach || replace_current))
stomach.Remove(C,1)
QDEL_NULL(stomach)
if(should_have_stomach && !stomach)
if(mutantstomach)
stomach = new mutantstomach()
else
stomach = new()
stomach.Insert(C)
if(appendix && (!should_have_appendix || replace_current))
appendix.Remove(C,1)
QDEL_NULL(appendix)
if(should_have_appendix && !appendix)
appendix = new()
appendix.Insert(C)
if(C.get_bodypart("head"))
if(eyes && (replace_current || !should_have_eyes))
eyes.Remove(C,1)
QDEL_NULL(eyes)
if(should_have_eyes && !eyes)
eyes = new mutanteyes
eyes.Insert(C)
if(ears && (replace_current || !should_have_ears))
ears.Remove(C,1)
QDEL_NULL(ears)
if(should_have_ears && !ears)
ears = new mutantears
ears.Insert(C)
if(tongue && (replace_current || !should_have_tongue))
tongue.Remove(C,1)
QDEL_NULL(tongue)
if(should_have_tongue && !tongue)
tongue = new mutanttongue
tongue.Insert(C)
if(old_species)
for(var/mutantorgan in old_species.mutant_organs)
var/obj/item/organ/I = C.getorgan(mutantorgan)
if(I)
I.Remove(C)
QDEL_NULL(I)
for(var/path in mutant_organs)
var/obj/item/organ/I = new path()
I.Insert(C)
/datum/species/proc/on_species_gain(mob/living/carbon/C, datum/species/old_species)
// Drop the items the new species can't wear
for(var/slot_id in no_equip)
@@ -138,79 +246,7 @@
if(DIGITIGRADE in species_traits)
C.Digitigrade_Leg_Swap(FALSE)
var/obj/item/organ/heart/heart = C.getorganslot("heart")
var/obj/item/organ/lungs/lungs = C.getorganslot("lungs")
var/obj/item/organ/appendix/appendix = C.getorganslot("appendix")
var/obj/item/organ/eyes/eyes = C.getorganslot("eye_sight")
var/obj/item/organ/ears/ears = C.getorganslot("ears")
var/obj/item/organ/tongue/tongue = C.getorganslot("tongue")
var/obj/item/organ/liver/liver = C.getorganslot("liver")
var/obj/item/organ/stomach/stomach = C.getorganslot("stomach")
if((NOBLOOD in species_traits) && heart)
heart.Remove(C)
qdel(heart)
else if((!(NOBLOOD in species_traits)) && (!heart))
heart = new()
heart.Insert(C)
if(lungs)
qdel(lungs)
lungs = null
QDEL_NULL(liver)
QDEL_NULL(stomach)
if(C.get_bodypart("head"))
if(eyes)
qdel(eyes)
eyes = new mutanteyes
eyes.Insert(C)
if(ears)
qdel(ears)
ears = new mutantears
ears.Insert(C)
if(tongue)
qdel(tongue)
tongue = new mutanttongue
tongue.Insert(C)
if((!(NOBREATH in species_traits)) && !lungs)
if(mutantlungs)
lungs = new mutantlungs()
else
lungs = new()
lungs.Insert(C)
if((!(NOLIVER in species_traits)) && (!liver))
if(mutantliver)
liver = new mutantliver()
else
liver = new()
liver.Insert(C)
if((!(NOSTOMACH in species_traits)) && (!stomach))
if(mutantstomach)
stomach = new mutantstomach()
else
stomach = new()
stomach.Insert(C)
if((NOHUNGER in species_traits) && appendix)
qdel(appendix)
else if((!(NOHUNGER in species_traits)) && (!appendix))
appendix = new()
appendix.Insert(C)
for(var/path in mutant_organs)
var/obj/item/organ/I = new path()
I.Insert(C)
regenerate_organs(C,old_species)
if(exotic_bloodtype && C.dna.blood_type != exotic_bloodtype)
C.dna.blood_type = exotic_bloodtype
@@ -1,3 +1,4 @@
<<<<<<< HEAD
/datum/species/skeleton
// 2spooky
name = "Spooky Scary Skeleton"
@@ -11,3 +12,18 @@
damage_overlay_type = ""//let's not show bloody wounds or burns over bones.
disliked_food = NONE
liked_food = NONE
=======
/datum/species/skeleton
// 2spooky
name = "Spooky Scary Skeleton"
id = "skeleton"
say_mod = "rattles"
blacklisted = 1
sexes = 0
meat = /obj/item/reagent_containers/food/snacks/meat/slab/human/mutant/skeleton
species_traits = list(NOBREATH,RESISTHOT,RESISTCOLD,RESISTPRESSURE,NOBLOOD,RADIMMUNE,VIRUSIMMUNE,PIERCEIMMUNE,NOHUNGER,EASYDISMEMBER,EASYLIMBATTACHMENT)
mutanttongue = /obj/item/organ/tongue/bone
damage_overlay_type = ""//let's not show bloody wounds or burns over bones.
disliked_food = NONE
liked_food = GROSS | MEAT | RAW
>>>>>>> 85cd9e6... Organ initialization cleanup
@@ -9,7 +9,7 @@
blacklisted = 1
meat = /obj/item/reagent_containers/food/snacks/meat/slab/human/mutant/zombie
species_traits = list(NOBREATH,RESISTCOLD,RESISTPRESSURE,NOBLOOD,RADIMMUNE,NOZOMBIE,EASYDISMEMBER,EASYLIMBATTACHMENT,NOTRANSSTING)
mutant_organs = list(/obj/item/organ/tongue/zombie)
mutanttongue = /obj/item/organ/tongue/zombie
var/static/list/spooks = list('sound/hallucinations/growl1.ogg','sound/hallucinations/growl2.ogg','sound/hallucinations/growl3.ogg','sound/hallucinations/veryfar_noise.ogg','sound/hallucinations/wail.ogg')
disliked_food = NONE
liked_food = NONE
@@ -64,6 +64,6 @@
limbs_id = "zombie" //They look like zombies
sexes = 0
meat = /obj/item/reagent_containers/food/snacks/meat/slab/human/mutant/zombie
mutant_organs = list(/obj/item/organ/tongue/zombie)
mutanttongue = /obj/item/organ/tongue/zombie
#undef REGENERATION_DELAY
@@ -10,6 +10,8 @@
var/slot
// DO NOT add slots with matching names to different zones - it will break internal_organs_slot list!
var/vital = 0
//Was this organ implanted/inserted/etc, if true will not be removed during species change.
var/external = FALSE
/obj/item/organ/proc/Insert(mob/living/carbon/M, special = 0, drop_if_replaced = TRUE)