Skip to content

Commit

Permalink
Fixes random species features not being applied when spawning randomi…
Browse files Browse the repository at this point in the history
…zed mobs (#1063)

* Fixes random species features not being applied when spawning randomized mobs

* Does this without creating duped list entries

* Update dna.dm

* Update dna.dm

* No more monkey abominations

* Update monkey.dm

* Update monkey.dm

* Update global_lists.dm

* Update dna.dm

Co-authored-by: Bloop <[email protected]>
  • Loading branch information
Steals-The-PRs and vinylspiders authored Dec 10, 2023
1 parent 3347b9c commit b4c7a90
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions code/__HELPERS/global_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
init_sprite_accessory_subtypes(/datum/sprite_accessory/bra, GLOB.bra_list, GLOB.bra_m, GLOB.bra_f) // SKYRAT EDIT ADDITION

init_sprite_accessory_subtypes(/datum/sprite_accessory/wings/moth, GLOB.moth_wings_list) // SKYRAT EDIT ADDITION - Customization
init_sprite_accessory_subtypes(/datum/sprite_accessory/tails/monkey, GLOB.tails_list_monkey, add_blank = TRUE) // SKYRAT EDIT ADDITION - We don't want monkeys getting randomized non-monkey tails
init_sprite_accessory_subtypes(/datum/sprite_accessory/pod_hair, GLOB.pod_hair_list, add_blank = TRUE) // SKYRAT EDIT - Customization - ORIGINAL: init_sprite_accessory_subtypes(/datum/sprite_accessory/pod_hair, GLOB.pod_hair_list)

//SKYRAT EDIT ADDITION BEGIN
Expand Down
1 change: 1 addition & 0 deletions code/_globalvars/lists/flavor_misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ GLOBAL_LIST_EMPTY(caps_list)
*/
//SKYRAT EDIT REMOVAL END
GLOBAL_LIST_EMPTY(moth_wings_list) // SKYRAT EDIT ADDITION - Customization
GLOBAL_LIST_EMPTY(tails_list_monkey) // SKYRAT EDIT ADDITION - Customization
GLOBAL_LIST_EMPTY(pod_hair_list)

GLOBAL_LIST_INIT(color_list_ethereal, list(
Expand Down
8 changes: 4 additions & 4 deletions code/datums/dna.dm
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,8 @@ GLOBAL_LIST_INIT(total_uf_len_by_block, populate_total_uf_len_by_block())
blood_type = newblood_type
if(create_mutation_blocks) //I hate this
generate_dna_blocks()
mutant_bodyparts = species.get_mutant_bodyparts(features, existing_mutant_bodyparts = randomize_features ? list() : mutant_bodyparts) // SKYRAT EDIT ADDITION
if(randomize_features)
/* SKYRAT EDIT REMOVAL - We don't really want this, do we? We get the same effect from get_mutant_bodyparts() on our end, but without mixing up weird species features.
/* SKYRAT EDIT REMOVAL - We don't really want this. We instead let get_mutant_bodyparts() handle the bodypart randomization on our end, to prevent getting any crazy cross-species features.
var/static/list/all_species_protoypes
if(isnull(all_species_protoypes))
all_species_protoypes = list()
Expand All @@ -507,10 +506,11 @@ GLOBAL_LIST_INIT(total_uf_len_by_block, populate_total_uf_len_by_block())
for(var/datum/species/random_species as anything in all_species_protoypes)
features |= random_species.randomize_features()
SKYRAT EDIT REMOVAL END */
body_markings = species.get_random_body_markings(features) // SKYRAT EDIT ADDITION

features["mcolor"] = "#[random_color()]"
features = species.randomize_features() | features // SKYRAT EDIT CHANGE - Where applicable, replace features with the features generated by species/randomize_features() - Original: features["mcolor"] = "#[random_color()]"
body_markings = species.get_random_body_markings(features) // SKYRAT EDIT ADDITION

mutant_bodyparts = species.get_mutant_bodyparts(features, existing_mutant_bodyparts = randomize_features ? list() : mutant_bodyparts) // SKYRAT EDIT ADDITION
update_dna_identity()

/datum/dna/stored //subtype used by brain mob's stored_dna
Expand Down
2 changes: 1 addition & 1 deletion code/modules/surgery/organs/external/tails.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
feature_key = "tail" // SKYRAT EDIT - Customization - ORIGINAL: feature_key = "tail_monkey"

/datum/bodypart_overlay/mutant/tail/monkey/get_global_feature_list()
return GLOB.sprite_accessories["tail"] // SKYRAT EDIT CHANGE - ORIGINAL: return GLOB.tails_list_monkey
return GLOB.tails_list_monkey

/obj/item/organ/external/tail/lizard
name = "lizard tail"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
"tail" = list("Monkey", FALSE),
)

/datum/species/monkey/randomize_features()
var/list/features = ..()
features["tail"] = pick(GLOB.tails_list_monkey - list("None")) // No tail-less monkeys.
return features

/datum/species/monkey/prepare_human_for_preview(mob/living/carbon/human/monke)
regenerate_organs(monke, src, visual_only = TRUE)
monke.update_body(is_creating = TRUE)
Expand Down

0 comments on commit b4c7a90

Please sign in to comment.