diff --git a/code/game/dna/dna2_helpers.dm b/code/game/dna/dna2_helpers.dm index f4b6a24c6a..e94befcd8b 100644 --- a/code/game/dna/dna2_helpers.dm +++ b/code/game/dna/dna2_helpers.dm @@ -243,7 +243,7 @@ H.custom_exclaim = dna.custom_exclaim H.species.blood_color = dna.blood_color var/datum/species/S = H.species - S.produceCopy(dna.base_species,dna.species_traits,src) + S.produceCopy(dna.species_traits,src) // VOREStation Edit End H.force_update_organs() //VOREStation Add - Gotta do this too diff --git a/code/modules/client/preference_setup/vore/07_traits.dm b/code/modules/client/preference_setup/vore/07_traits.dm index 185b8047b4..72c3126c1b 100644 --- a/code/modules/client/preference_setup/vore/07_traits.dm +++ b/code/modules/client/preference_setup/vore/07_traits.dm @@ -114,12 +114,7 @@ pref.dirty_synth = 0 var/datum/species/S = character.species - var/SB - if(S.selects_bodytype) - SB = pref.custom_base ? pref.custom_base : "Human" - else - SB = S.name - var/datum/species/new_S = S.produceCopy(SB, pref.pos_traits + pref.neu_traits + pref.neg_traits, character) + var/datum/species/new_S = S.produceCopy(pref.pos_traits + pref.neu_traits + pref.neg_traits, character, pref.custom_base) //Any additional non-trait settings can be applied here new_S.blood_color = pref.blood_color diff --git a/code/modules/mob/living/carbon/human/species/species_vr.dm b/code/modules/mob/living/carbon/human/species/species_vr.dm index 9777f197b0..06c9d2bdf3 100644 --- a/code/modules/mob/living/carbon/human/species/species_vr.dm +++ b/code/modules/mob/living/carbon/human/species/species_vr.dm @@ -42,32 +42,49 @@ nif.nifsofts = nifsofts else ..() -/datum/species/proc/produceCopy(var/datum/species/to_copy,var/list/traits,var/mob/living/carbon/human/H) - ASSERT(to_copy) +/datum/species/proc/produceCopy(var/list/traits,var/mob/living/carbon/human/H, var/custom_base) + var/datum/species/S + //If species allows custom base, and custom base is set, apply it, otherwise use default. + if(selects_bodytype && custom_base) + S = GLOB.all_species[custom_base] + else + S = GLOB.all_species[src.name] + ASSERT(S) ASSERT(istype(H)) + var/datum/species/new_copy = new S.type() - if(ispath(to_copy)) - to_copy = "[initial(to_copy.name)]" - if(istext(to_copy)) - to_copy = GLOB.all_species[to_copy] + for(var/i in S.vars) //Thorough copy of species. + if(new_copy.vars[i] != S.vars[i]) + //Skipping lists because they may contain more lists, copy those manually. + //Also ignoring type var since it's read-only and will runtime. + if(islist(vars[i])) + continue + new_copy.vars[i] = S.vars[i] - var/datum/species/new_copy = new to_copy.type() - - for(var/organ in to_copy.has_limbs) - var/list/organ_data = to_copy.has_limbs[organ] + for(var/organ in S.has_limbs) //Copy important organ data generated by species. + var/list/organ_data = S.has_limbs[organ] new_copy.has_limbs[organ] = organ_data.Copy() + new_copy.traits = traits //If you had traits, apply them if(new_copy.traits) for(var/trait in new_copy.traits) var/datum/trait/T = all_traits[trait] - T.apply(new_copy,H) + T.apply(new_copy, H) //Set up a mob H.species = new_copy + H.icon_state = new_copy.get_bodytype() + + if(new_copy.holder_type) + H.holder_type = new_copy.holder_type if(H.dna) H.dna.ready_dna(H) - return new_copy \ No newline at end of file + return new_copy + + +/datum/species/get_bodytype() + return base_species \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/species/station/alraune.dm b/code/modules/mob/living/carbon/human/species/station/alraune.dm index 1b0ed79897..e9904dd5ca 100644 --- a/code/modules/mob/living/carbon/human/species/station/alraune.dm +++ b/code/modules/mob/living/carbon/human/species/station/alraune.dm @@ -445,55 +445,6 @@ //End of fruit gland code. -/datum/species/alraune/produceCopy(var/datum/species/to_copy,var/list/traits,var/mob/living/carbon/human/H) - ASSERT(to_copy) - ASSERT(istype(H)) - - if(ispath(to_copy)) - to_copy = "[initial(to_copy.name)]" - if(istext(to_copy)) - to_copy = GLOB.all_species[to_copy] - - var/datum/species/alraune/new_copy = new() - - //Initials so it works with a simple path passed, or an instance - new_copy.base_species = to_copy.name - new_copy.icobase = to_copy.icobase - new_copy.deform = to_copy.deform - new_copy.tail = to_copy.tail - new_copy.tail_animation = to_copy.tail_animation - new_copy.icobase_tail = to_copy.icobase_tail - new_copy.color_mult = to_copy.color_mult - new_copy.primitive_form = to_copy.primitive_form - new_copy.appearance_flags = to_copy.appearance_flags - new_copy.flesh_color = to_copy.flesh_color - new_copy.base_color = to_copy.base_color - new_copy.blood_mask = to_copy.blood_mask - new_copy.damage_mask = to_copy.damage_mask - new_copy.damage_overlays = to_copy.damage_overlays - new_copy.traits = traits - - //If you had traits, apply them - if(new_copy.traits) - for(var/trait in new_copy.traits) - var/datum/trait/T = all_traits[trait] - T.apply(new_copy,H) - - //Set up a mob - H.species = new_copy - H.icon_state = lowertext(new_copy.get_bodytype()) - - if(new_copy.holder_type) - H.holder_type = new_copy.holder_type - - if(H.dna) - H.dna.ready_dna(H) - - return new_copy - -/datum/species/alraune/get_bodytype() - return base_species - /datum/species/alraune/get_race_key() var/datum/species/real = GLOB.all_species[base_species] return real.race_key diff --git a/code/modules/mob/living/carbon/human/species/station/blank_vr.dm b/code/modules/mob/living/carbon/human/species/station/blank_vr.dm index daead88b84..c358fda022 100644 --- a/code/modules/mob/living/carbon/human/species/station/blank_vr.dm +++ b/code/modules/mob/living/carbon/human/species/station/blank_vr.dm @@ -42,61 +42,14 @@ BP_R_FOOT = list("path" = /obj/item/organ/external/foot/right, "descriptor" = "right foot") ) -/datum/species/custom/get_bodytype() - return base_species - /datum/species/custom/get_race_key() var/datum/species/real = GLOB.all_species[base_species] return real.race_key -/datum/species/custom/produceCopy(var/datum/species/to_copy,var/list/traits,var/mob/living/carbon/human/H) - ASSERT(to_copy) - ASSERT(istype(H)) - - if(ispath(to_copy)) - to_copy = "[initial(to_copy.name)]" - if(istext(to_copy)) - to_copy = GLOB.all_species[to_copy] - - var/datum/species/custom/new_copy = new() - - //Initials so it works with a simple path passed, or an instance - new_copy.base_species = to_copy.name - new_copy.icobase = to_copy.icobase - new_copy.deform = to_copy.deform - new_copy.tail = to_copy.tail - new_copy.tail_animation = to_copy.tail_animation - new_copy.icobase_tail = to_copy.icobase_tail - new_copy.color_mult = to_copy.color_mult - new_copy.primitive_form = to_copy.primitive_form - new_copy.appearance_flags = to_copy.appearance_flags - new_copy.flesh_color = to_copy.flesh_color - new_copy.base_color = to_copy.base_color - new_copy.blood_mask = to_copy.blood_mask - new_copy.damage_mask = to_copy.damage_mask - new_copy.damage_overlays = to_copy.damage_overlays - new_copy.traits = traits - new_copy.move_trail = move_trail - new_copy.has_floating_eyes = has_floating_eyes - - //If you had traits, apply them - if(new_copy.traits) - for(var/trait in new_copy.traits) - var/datum/trait/T = all_traits[trait] - T.apply(new_copy,H) - - //Set up a mob - H.species = new_copy - H.maxHealth = new_copy.total_health - H.hunger_rate = new_copy.hunger_factor - - if(new_copy.holder_type) - H.holder_type = new_copy.holder_type - - if(H.dna) - H.dna.ready_dna(H) - - return new_copy +/datum/species/custom/produceCopy(var/list/traits,var/mob/living/carbon/human/H) + . = ..() + H.maxHealth = H.species.total_health + H.hunger_rate = H.species.hunger_factor // Stub species overrides for shoving trait abilities into diff --git a/code/modules/mob/living/carbon/human/species/station/station_special_vr.dm b/code/modules/mob/living/carbon/human/species/station/station_special_vr.dm index 801fde1afa..a549049e2a 100644 --- a/code/modules/mob/living/carbon/human/species/station/station_special_vr.dm +++ b/code/modules/mob/living/carbon/human/species/station/station_special_vr.dm @@ -291,56 +291,6 @@ // HUD update time update_xenochimera_hud(H, danger, feral_state) - -/datum/species/xenochimera/produceCopy(var/datum/species/to_copy,var/list/traits,var/mob/living/carbon/human/H) - ASSERT(to_copy) - ASSERT(istype(H)) - - if(ispath(to_copy)) - to_copy = "[initial(to_copy.name)]" - if(istext(to_copy)) - to_copy = GLOB.all_species[to_copy] - - var/datum/species/xenochimera/new_copy = new() - - //Initials so it works with a simple path passed, or an instance - new_copy.base_species = to_copy.name - new_copy.icobase = to_copy.icobase - new_copy.deform = to_copy.deform - new_copy.tail = to_copy.tail - new_copy.tail_animation = to_copy.tail_animation - new_copy.icobase_tail = to_copy.icobase_tail - new_copy.color_mult = to_copy.color_mult - new_copy.primitive_form = to_copy.primitive_form - new_copy.appearance_flags = to_copy.appearance_flags - new_copy.flesh_color = to_copy.flesh_color - new_copy.base_color = to_copy.base_color - new_copy.blood_mask = to_copy.blood_mask - new_copy.damage_mask = to_copy.damage_mask - new_copy.damage_overlays = to_copy.damage_overlays - new_copy.traits = traits - - //If you had traits, apply them - if(new_copy.traits) - for(var/trait in new_copy.traits) - var/datum/trait/T = all_traits[trait] - T.apply(new_copy,H) - - //Set up a mob - H.species = new_copy - H.icon_state = lowertext(new_copy.get_bodytype()) - - if(new_copy.holder_type) - H.holder_type = new_copy.holder_type - - if(H.dna) - H.dna.ready_dna(H) - - return new_copy - -/datum/species/xenochimera/get_bodytype() - return base_species - /datum/species/xenochimera/get_race_key() var/datum/species/real = GLOB.all_species[base_species] return real.race_key