mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 20:48:56 +01:00
Datumizes DNA blocks, makes DNA cleaner in general (#92061)
Moves all the dna block handling onto singleton datums initialized inside global lists, to make the handling dna less of a copy-paste mess and make adding new blocks significantly easier. There is still some work to be done in the copypaste department but ultimately that falls under its own PR scope after the core refactor goes through. (Ill probably do those but it will also be easier for everyone else as the code is now significantly less of an eyesore) Both features and identities have been tested through and through, and seem to be working fine. Also removed the reliance on weird hardcoded lookup tables for length, and other similar things that just didn't make sense when I was passing through DNA code. There's a lot more that fall out of scope for this exact PR's goal however I've been told the maintainers will love me for doing this 🆑 code: feature keys are no longer magical strings floating around the codebase and use proper defines refactor: DNA blocks are now handled with singleton datums. /🆑
This commit is contained in:
+13
-12
@@ -10,7 +10,7 @@ Unlike normal organs, we're actually inside a persons limbs at all times
|
||||
/// The savefile_key of the preference this relates to. Used for the preferences UI.
|
||||
var/preference
|
||||
///With what DNA block do we mutate in mutate_feature() ? For genetics
|
||||
var/dna_block
|
||||
var/datum/dna_block/dna_block
|
||||
|
||||
///Set to EXTERNAL_BEHIND, EXTERNAL_FRONT or EXTERNAL_ADJACENT if you want to draw one of those layers as the object sprite. FALSE to use your own
|
||||
///This will not work if it doesn't have a limb to generate its icon with
|
||||
@@ -79,7 +79,8 @@ Unlike normal organs, we're actually inside a persons limbs at all times
|
||||
|
||||
var/list/feature_list = bodypart_overlay.get_global_feature_list()
|
||||
|
||||
bodypart_overlay.set_appearance_from_name(feature_list[deconstruct_block(get_uni_feature_block(features, dna_block), feature_list.len)])
|
||||
var/datum/dna_block/feature/feature_block = GLOB.dna_feature_blocks[dna_block]
|
||||
bodypart_overlay.set_appearance_from_name(feature_list[deconstruct_block(feature_block.get_block(features), feature_list.len)])
|
||||
|
||||
///If you need to change an external_organ for simple one-offs, use this. Pass the accessory type : /datum/accessory/something
|
||||
/obj/item/organ/proc/simple_change_sprite(accessory_type)
|
||||
@@ -113,7 +114,7 @@ Unlike normal organs, we're actually inside a persons limbs at all times
|
||||
slot = ORGAN_SLOT_EXTERNAL_HORNS
|
||||
|
||||
preference = "feature_lizard_horns"
|
||||
//dna_block = DNA_HORNS_BLOCK // SKYRAT EDIT REMOVAL - Customization - We have our own system to handle DNA.
|
||||
//dna_block = /datum/dna_block/feature/horn // SKYRAT EDIT REMOVAL - Customization - We have our own system to handle DNA.
|
||||
restyle_flags = EXTERNAL_RESTYLE_ENAMEL
|
||||
|
||||
bodypart_overlay = /datum/bodypart_overlay/mutant/horns
|
||||
@@ -122,7 +123,7 @@ Unlike normal organs, we're actually inside a persons limbs at all times
|
||||
|
||||
/datum/bodypart_overlay/mutant/horns
|
||||
layers = EXTERNAL_ADJACENT
|
||||
feature_key = "horns"
|
||||
feature_key = FEATURE_HORNS
|
||||
dyable = TRUE
|
||||
|
||||
/datum/bodypart_overlay/mutant/horns/can_draw_on_bodypart(obj/item/bodypart/bodypart_owner)
|
||||
@@ -146,7 +147,7 @@ Unlike normal organs, we're actually inside a persons limbs at all times
|
||||
slot = ORGAN_SLOT_EXTERNAL_FRILLS
|
||||
|
||||
preference = "feature_lizard_frills"
|
||||
//dna_block = DNA_FRILLS_BLOCK // SKYRAT EDIT REMOVAL - Customization - We have our own system to handle DNA.
|
||||
//dna_block = /datum/dna_block/feature/frill // SKYRAT EDIT REMOVAL - Customization - We have our own system to handle DNA.
|
||||
restyle_flags = EXTERNAL_RESTYLE_FLESH
|
||||
|
||||
bodypart_overlay = /datum/bodypart_overlay/mutant/frills
|
||||
@@ -155,7 +156,7 @@ Unlike normal organs, we're actually inside a persons limbs at all times
|
||||
|
||||
/datum/bodypart_overlay/mutant/frills
|
||||
layers = EXTERNAL_ADJACENT
|
||||
feature_key = "frills"
|
||||
feature_key = FEATURE_FRILLS
|
||||
|
||||
/datum/bodypart_overlay/mutant/frills/can_draw_on_bodypart(obj/item/bodypart/bodypart_owner)
|
||||
var/mob/living/carbon/human/human = bodypart_owner.owner
|
||||
@@ -180,7 +181,7 @@ Unlike normal organs, we're actually inside a persons limbs at all times
|
||||
preference = "feature_lizard_snout"
|
||||
external_bodyshapes = BODYSHAPE_SNOUTED
|
||||
|
||||
//dna_block = DNA_SNOUT_BLOCK // SKYRAT EDIT REMOVAL - Customization - We have our own system to handle DNA.
|
||||
//dna_block = /datum/dna_block/feature/snout // SKYRAT EDIT REMOVAL - Customization - We have our own system to handle DNA.
|
||||
restyle_flags = EXTERNAL_RESTYLE_FLESH
|
||||
|
||||
bodypart_overlay = /datum/bodypart_overlay/mutant/snout
|
||||
@@ -189,7 +190,7 @@ Unlike normal organs, we're actually inside a persons limbs at all times
|
||||
|
||||
/datum/bodypart_overlay/mutant/snout
|
||||
layers = EXTERNAL_ADJACENT
|
||||
feature_key = "snout"
|
||||
feature_key = FEATURE_SNOUT
|
||||
|
||||
/datum/bodypart_overlay/mutant/snout/can_draw_on_bodypart(obj/item/bodypart/bodypart_owner)
|
||||
var/mob/living/carbon/human/human = bodypart_owner.owner
|
||||
@@ -212,7 +213,7 @@ Unlike normal organs, we're actually inside a persons limbs at all times
|
||||
slot = ORGAN_SLOT_EXTERNAL_ANTENNAE
|
||||
|
||||
preference = "feature_moth_antennae"
|
||||
//dna_block = DNA_MOTH_ANTENNAE_BLOCK // SKYRAT EDIT REMOVAL - Customization - We have our own system to handle DNA.
|
||||
//dna_block = /datum/dna_block/feature/moth_antenna // SKYRAT EDIT REMOVAL - Customization - We have our own system to handle DNA.
|
||||
restyle_flags = EXTERNAL_RESTYLE_FLESH
|
||||
|
||||
bodypart_overlay = /datum/bodypart_overlay/mutant/antennae
|
||||
@@ -266,7 +267,7 @@ Unlike normal organs, we're actually inside a persons limbs at all times
|
||||
///Moth antennae datum, with full burning functionality
|
||||
/datum/bodypart_overlay/mutant/antennae
|
||||
layers = EXTERNAL_FRONT | EXTERNAL_BEHIND
|
||||
feature_key = "moth_antennae"
|
||||
feature_key = FEATURE_MOTH_ANTENNAE
|
||||
dyable = TRUE
|
||||
///Accessory datum of the burn sprite
|
||||
var/datum/sprite_accessory/burn_datum = /datum/sprite_accessory/moth_antennae/burnt_off
|
||||
@@ -308,7 +309,7 @@ Unlike normal organs, we're actually inside a persons limbs at all times
|
||||
preference = "feature_pod_hair"
|
||||
use_mob_sprite_as_obj_sprite = TRUE
|
||||
|
||||
dna_block = DNA_POD_HAIR_BLOCK
|
||||
dna_block = /datum/dna_block/feature/pod_hair
|
||||
restyle_flags = EXTERNAL_RESTYLE_PLANT
|
||||
|
||||
bodypart_overlay = /datum/bodypart_overlay/mutant/pod_hair
|
||||
@@ -318,7 +319,7 @@ Unlike normal organs, we're actually inside a persons limbs at all times
|
||||
///Podperson bodypart overlay, with special coloring functionality to render the flowers in the inverse color
|
||||
/datum/bodypart_overlay/mutant/pod_hair
|
||||
layers = EXTERNAL_FRONT|EXTERNAL_ADJACENT
|
||||
feature_key = "pod_hair"
|
||||
feature_key = FEATURE_POD_HAIR
|
||||
dyable = TRUE
|
||||
|
||||
///This layer will be colored differently than the rest of the organ. So we can get differently colored flowers or something
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@
|
||||
|
||||
preference = "feature_lizard_spines"
|
||||
|
||||
//dna_block = DNA_SPINES_BLOCK // SKYRAT EDIT REMOVAL - Customization - We have our own system to handle DNA.
|
||||
//dna_block = /datum/dna_block/feature/spine // SKYRAT EDIT REMOVAL - Customization - We have our own system to handle DNA.
|
||||
restyle_flags = EXTERNAL_RESTYLE_FLESH
|
||||
|
||||
bodypart_overlay = /datum/bodypart_overlay/mutant/spines
|
||||
@@ -31,7 +31,7 @@
|
||||
///Bodypart overlay for spines
|
||||
/datum/bodypart_overlay/mutant/spines
|
||||
layers = EXTERNAL_ADJACENT|EXTERNAL_BEHIND
|
||||
feature_key = "spines"
|
||||
feature_key = FEATURE_SPINES
|
||||
dyable = TRUE
|
||||
|
||||
/datum/bodypart_overlay/mutant/spines/get_global_feature_list()
|
||||
|
||||
+11
-11
@@ -7,7 +7,7 @@
|
||||
zone = BODY_ZONE_PRECISE_GROIN
|
||||
slot = ORGAN_SLOT_EXTERNAL_TAIL
|
||||
|
||||
//dna_block = DNA_TAIL_BLOCK // SKYRAT EDIT REMOVAL - Customization - We have our own system to handle DNA.
|
||||
//dna_block = /datum/dna_block/feature/tail // SKYRAT EDIT REMOVAL - Customization - We have our own system to handle DNA.
|
||||
restyle_flags = EXTERNAL_RESTYLE_FLESH
|
||||
|
||||
// defaults to cat, but the parent type shouldn't be created regardless
|
||||
@@ -66,11 +66,11 @@
|
||||
tail_spines_overlay = new
|
||||
tail_spines_overlay.tail_spine_key = tail_spine_key
|
||||
// SKYRAT EDIT ADDITION START
|
||||
if(!bodypart.owner.dna.mutant_bodyparts["spines"])
|
||||
bodypart.owner.dna.mutant_bodyparts["spines"] = list(MUTANT_INDEX_NAME = "None", MUTANT_INDEX_COLOR_LIST = list("#886600", "#886600", "#886600"))
|
||||
if(!bodypart.owner.dna.mutant_bodyparts[FEATURE_SPINES])
|
||||
bodypart.owner.dna.mutant_bodyparts[FEATURE_SPINES] = list(MUTANT_INDEX_NAME = "None", MUTANT_INDEX_COLOR_LIST = list("#886600", "#886600", "#886600"))
|
||||
// SKYRAT EDIT ADDITION END
|
||||
var/feature_name = bodypart.owner.dna.mutant_bodyparts["spines"][MUTANT_INDEX_NAME] // SKYRAT EDIT CHANGE - ORIGINAL: var/feature_name = bodypart.owner.dna.features["spines"] //tail spines don't live in DNA, but share feature names with regular spines
|
||||
tail_spines_overlay.set_appearance_from_dna(bodypart.owner.dna, feature_name, feature_key = "spines") // SKYRAT EDIT CHANGE - ORIGINAL: tail_spines_overlay.set_appearance_from_name(feature_name)
|
||||
var/feature_name = bodypart.owner.dna.mutant_bodyparts[FEATURE_SPINES][MUTANT_INDEX_NAME] // SKYRAT EDIT CHANGE - ORIGINAL: var/feature_name = bodypart.owner.dna.features[FEATURE_SPINES] //tail spines don't live in DNA, but share feature names with regular spines
|
||||
tail_spines_overlay.set_appearance_from_dna(bodypart.owner.dna, feature_name, feature_key = FEATURE_SPINES) // SKYRAT EDIT CHANGE - ORIGINAL: tail_spines_overlay.set_appearance_from_name(feature_name)
|
||||
bodypart.add_bodypart_overlay(tail_spines_overlay)
|
||||
|
||||
/// If we have a tail spines overlay, delete it
|
||||
@@ -181,7 +181,7 @@
|
||||
|
||||
///Cat tail bodypart overlay
|
||||
/datum/bodypart_overlay/mutant/tail/cat
|
||||
feature_key = "tail" // SKYRAT EDIT - Customization - ORIGINAL: feature_key = "tail_cat"
|
||||
feature_key = "tail" // SKYRAT EDIT - Customization - ORIGINAL: feature_key = FEATURE_TAIL
|
||||
// color_source = ORGAN_COLOR_HAIR // SKYRAT EDIT REMOVAL
|
||||
|
||||
/datum/bodypart_overlay/mutant/tail/cat/get_global_feature_list()
|
||||
@@ -197,7 +197,7 @@
|
||||
///Monkey tail bodypart overlay
|
||||
/datum/bodypart_overlay/mutant/tail/monkey
|
||||
color_source = NONE
|
||||
feature_key = "tail" // SKYRAT EDIT - Customization - ORIGINAL: feature_key = "tail_monkey"
|
||||
feature_key = "tail" // SKYRAT EDIT - Customization - ORIGINAL: feature_key = FEATURE_TAIL_MONKEY
|
||||
|
||||
/datum/bodypart_overlay/mutant/tail/monkey/get_global_feature_list()
|
||||
return SSaccessories.tails_list_monkey
|
||||
@@ -240,7 +240,7 @@
|
||||
///Alien tail bodypart overlay
|
||||
/datum/bodypart_overlay/mutant/tail/xeno
|
||||
color_source = NONE
|
||||
feature_key = "tail_xeno"
|
||||
feature_key = FEATURE_TAIL_XENO
|
||||
imprint_on_next_insertion = FALSE
|
||||
/// We don't want to bother writing this in DNA, just use this appearance
|
||||
var/default_appearance = "Xeno"
|
||||
@@ -266,11 +266,11 @@
|
||||
bodypart_overlay = /datum/bodypart_overlay/mutant/tail/lizard
|
||||
|
||||
wag_flags = WAG_ABLE
|
||||
//dna_block = DNA_LIZARD_TAIL_BLOCK // SKYRAT EDIT REMOVAL - Customization - We have our own system to handle DNA.
|
||||
//dna_block = /datum/dna_block/feature/tail_lizard // SKYRAT EDIT REMOVAL - Customization - We have our own system to handle DNA.
|
||||
|
||||
///Lizard tail bodypart overlay datum
|
||||
/datum/bodypart_overlay/mutant/tail/lizard
|
||||
feature_key = "tail" // SKYRAT EDIT - Customization - ORIGINAL: feature_key = "tail_lizard"
|
||||
feature_key = "tail" // SKYRAT EDIT - Customization - ORIGINAL: feature_key = FEATURE_TAIL_LIZARD
|
||||
|
||||
/datum/bodypart_overlay/mutant/tail/lizard/get_global_feature_list()
|
||||
return SSaccessories.sprite_accessories["tail"] // SKYRAT EDIT - Customization - ORIGINAL: return SSaccessories.tails_list_lizard
|
||||
@@ -282,7 +282,7 @@
|
||||
///Bodypart overlay for tail spines. Handled by the tail - has no actual organ associated.
|
||||
/datum/bodypart_overlay/mutant/tail_spines
|
||||
layers = EXTERNAL_ADJACENT|EXTERNAL_BEHIND
|
||||
feature_key = "tailspines"
|
||||
feature_key = FEATURE_TAILSPINES
|
||||
///Spines wag when the tail does
|
||||
var/wagging = FALSE
|
||||
/// Key for tail spine states, depends on the shape of the tail. Defined in the tail sprite datum.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
preference = "feature_moth_wings"
|
||||
|
||||
//dna_block = DNA_MOTH_WINGS_BLOCK // SKYRAT EDIT REMOVAL
|
||||
//dna_block = /datum/dna_block/feature/moth_wing // SKYRAT EDIT REMOVAL
|
||||
|
||||
bodypart_overlay = /datum/bodypart_overlay/mutant/wings/moth
|
||||
restyle_flags = EXTERNAL_RESTYLE_FLESH
|
||||
@@ -101,7 +101,7 @@
|
||||
|
||||
///Moth wing bodypart overlay, including burn functionality!
|
||||
/datum/bodypart_overlay/mutant/wings/moth
|
||||
feature_key = "wings" // SKYRAT EDIT - Customization - ORIGINAL: feature_key = "moth_wings"
|
||||
feature_key = FEATURE_WINGS // SKYRAT EDIT - Customization - ORIGINAL: feature_key = FEATURE_MOTH_WINGS
|
||||
layers = EXTERNAL_BEHIND | EXTERNAL_FRONT
|
||||
///Accessory datum of the burn sprite
|
||||
var/datum/sprite_accessory/burn_datum = /datum/sprite_accessory/moth_wings/burnt_off
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
///Bodypart overlay of default wings. Does not have any wing functionality
|
||||
/datum/bodypart_overlay/mutant/wings
|
||||
layers = ALL_EXTERNAL_OVERLAYS
|
||||
feature_key = "wings"
|
||||
feature_key = FEATURE_WINGS
|
||||
|
||||
/datum/bodypart_overlay/mutant/wings/can_draw_on_bodypart(obj/item/bodypart/bodypart_owner)
|
||||
var/mob/living/carbon/human/human = bodypart_owner.owner
|
||||
|
||||
Reference in New Issue
Block a user