Skip to content

Commit

Permalink
[MISSED MIRROR] Lizard spines no longer "float" on characters without…
Browse files Browse the repository at this point in the history
… lizard tails.(#1668)

* Lizard spines no longer "float" on characters without lizard tails. (#80456)

---------

Co-authored-by: Bloop <[email protected]>
Co-authored-by: lizardqueenlexi <[email protected]>
  • Loading branch information
3 people authored Jan 24, 2024
1 parent ffb6795 commit 24fa218
Show file tree
Hide file tree
Showing 17 changed files with 181 additions and 108 deletions.
4 changes: 4 additions & 0 deletions code/__DEFINES/external_organs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@
///Tail wagging
#define WAG_ABLE (1<<0)
#define WAG_WAGGING (1<<1)

/// Tail spine defines
#define SPINE_KEY_LIZARD "lizard"
#define SPINE_KEY_VOX "vox" // NOVA EDIT ADDITION
1 change: 1 addition & 0 deletions code/__HELPERS/global_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
init_sprite_accessory_subtypes(/datum/sprite_accessory/frills, GLOB.frills_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/spines, GLOB.spines_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/spines_animated, GLOB.animated_spines_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/tail_spines, GLOB.tail_spines_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/legs, GLOB.legs_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/caps, GLOB.caps_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/moth_wings, GLOB.moth_wings_list)
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 @@ -26,6 +26,7 @@ GLOBAL_LIST_EMPTY(snouts_list)
GLOBAL_LIST_EMPTY(horns_list)
GLOBAL_LIST_EMPTY(frills_list)
GLOBAL_LIST_EMPTY(spines_list)
GLOBAL_LIST_EMPTY(tail_spines_list)
GLOBAL_LIST_EMPTY(legs_list)
GLOBAL_LIST_EMPTY(animated_spines_list)
Expand Down
32 changes: 32 additions & 0 deletions code/datums/sprite_accessories.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1756,9 +1756,12 @@

/datum/sprite_accessory/tails
em_block = TRUE
/// Describes which tail spine sprites to use, if any.
var/spine_key = NONE

/datum/sprite_accessory/tails/lizard
icon = 'icons/mob/human/species/lizard/lizard_tails.dmi'
spine_key = SPINE_KEY_LIZARD

/datum/sprite_accessory/tails/lizard/smooth
name = "Smooth"
Expand All @@ -1779,6 +1782,7 @@
/datum/sprite_accessory/tails/lizard/short
name = "Short"
icon_state = "short"
spine_key = NONE

/datum/sprite_accessory/tails/human/cat
name = "Cat"
Expand Down Expand Up @@ -2091,6 +2095,10 @@
icon = 'icons/mob/human/species/lizard/lizard_spines.dmi'
em_block = TRUE

/datum/sprite_accessory/tail_spines
icon = 'icons/mob/human/species/lizard/lizard_spines.dmi'
em_block = TRUE

/datum/sprite_accessory/spines/none
name = "None"
icon_state = "none"
Expand All @@ -2099,6 +2107,10 @@
name = "None"
icon_state = "none"

/datum/sprite_accessory/tail_spines/none
name = "None"
icon_state = "none"

/datum/sprite_accessory/spines/short
name = "Short"
icon_state = "short"
Expand All @@ -2107,6 +2119,10 @@
name = "Short"
icon_state = "short"

/datum/sprite_accessory/tail_spines/short
name = "Short"
icon_state = "short"

/datum/sprite_accessory/spines/shortmeme
name = "Short + Membrane"
icon_state = "shortmeme"
Expand All @@ -2115,6 +2131,10 @@
name = "Short + Membrane"
icon_state = "shortmeme"

/datum/sprite_accessory/tail_spines/shortmeme
name = "Short + Membrane"
icon_state = "shortmeme"

/datum/sprite_accessory/spines/long
name = "Long"
icon_state = "long"
Expand All @@ -2123,6 +2143,10 @@
name = "Long"
icon_state = "long"

/datum/sprite_accessory/tail_spines/long
name = "Long"
icon_state = "long"

/datum/sprite_accessory/spines/longmeme
name = "Long + Membrane"
icon_state = "longmeme"
Expand All @@ -2131,6 +2155,10 @@
name = "Long + Membrane"
icon_state = "longmeme"

/datum/sprite_accessory/tail_spines/longmeme
name = "Long + Membrane"
icon_state = "longmeme"

/datum/sprite_accessory/spines/aquatic
name = "Aquatic"
icon_state = "aqua"
Expand All @@ -2139,6 +2167,10 @@
name = "Aquatic"
icon_state = "aqua"

/datum/sprite_accessory/tail_spines/aquatic
name = "Aquatic"
icon_state = "aqua"

/datum/sprite_accessory/legs //legs are a special case, they aren't actually sprite_accessories but are updated with them.
icon = null //These datums exist for selecting legs on preference, and little else
em_block = TRUE
Expand Down
9 changes: 9 additions & 0 deletions code/modules/surgery/organs/external/_external_organ.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@
if(restyle_flags)
RegisterSignal(src, COMSIG_ATOM_RESTYLE, PROC_REF(on_attempt_feature_restyle))

/obj/item/organ/external/Insert(mob/living/carbon/receiver, special, movement_flags)
. = ..()
receiver.update_body_parts()

/obj/item/organ/external/Remove(mob/living/carbon/organ_owner, special, movement_flags)
. = ..()
if(!special)
organ_owner.update_body_parts()

/obj/item/organ/external/mob_insert(mob/living/carbon/receiver, special, movement_flags)
if(!should_external_organ_apply_to(type, receiver))
stack_trace("adding a [type] to a [receiver.type] when it shouldn't be!")
Expand Down
28 changes: 9 additions & 19 deletions code/modules/surgery/organs/external/spines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,27 @@

bodypart_overlay = /datum/bodypart_overlay/mutant/spines

///A two-way reference between the tail and the spines because of wagging sprites. Bruh.
var/obj/item/organ/external/tail/lizard/paired_tail

/obj/item/organ/external/spines/Insert(mob/living/carbon/receiver, special, movement_flags)
. = ..()
if(.)
paired_tail = locate(/obj/item/organ/external/tail/lizard) in receiver.organs //We want specifically a lizard tail, so we don't use the slot.
paired_tail?.paired_spines = src
// If we have a tail, attempt to add a tail spines overlay
var/obj/item/organ/external/tail/our_tail = receiver.get_organ_slot(ORGAN_SLOT_EXTERNAL_TAIL)
our_tail?.try_insert_tail_spines(our_tail.bodypart_owner)
return ..()

/obj/item/organ/external/spines/Remove(mob/living/carbon/organ_owner, special, movement_flags)
. = ..()
if(paired_tail)
paired_tail.paired_spines = null
paired_tail = null
// If we have a tail, remove any tail spines overlay
var/obj/item/organ/external/tail/our_tail = organ_owner.get_organ_slot(ORGAN_SLOT_EXTERNAL_TAIL)
our_tail?.remove_tail_spines(our_tail.bodypart_owner)
return ..()

///Bodypart overlay for spines (wagging gets updated by tail)
///Bodypart overlay for spines
/datum/bodypart_overlay/mutant/spines
layers = EXTERNAL_ADJACENT|EXTERNAL_BEHIND
feature_key = "spines"
///Spines moth with the tail, so track it
var/wagging = FALSE

/datum/bodypart_overlay/mutant/spines/get_global_feature_list()
return GLOB.sprite_accessories["spines"] // NOVA EDIT - Customization - ORIGINAL: return GLOB.spines_list

/datum/bodypart_overlay/mutant/spines/get_base_icon_state()
return (wagging ? "wagging_" : "") + sprite_datum.icon_state //add the wagging tag if we be wagging


/datum/bodypart_overlay/mutant/spines/can_draw_on_bodypart(mob/living/carbon/human/human)
. = ..()
if(human.wear_suit && (human.wear_suit.flags_inv & HIDEJUMPSUIT))
return FALSE

89 changes: 63 additions & 26 deletions code/modules/surgery/organs/external/tails.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
var/wag_flags = NONE
///The original owner of this tail
var/original_owner //Yay, snowflake code!
///The overlay for tail spines, if any
var/datum/bodypart_overlay/mutant/tail_spines/tail_spines_overlay

/obj/item/organ/external/tail/Insert(mob/living/carbon/receiver, special, movement_flags)
. = ..()
Expand All @@ -32,6 +34,42 @@
else if(type in receiver.dna.species.external_organs)
receiver.add_mood_event("wrong_tail_regained", /datum/mood_event/tail_regained_wrong)

/obj/item/organ/external/tail/on_bodypart_insert(obj/item/bodypart/bodypart)
var/obj/item/organ/external/spines/our_spines = bodypart.owner.get_organ_slot(ORGAN_SLOT_EXTERNAL_SPINES)
if(our_spines)
try_insert_tail_spines(bodypart)
return ..()

/obj/item/organ/external/tail/on_bodypart_remove(obj/item/bodypart/bodypart)
remove_tail_spines(bodypart)
return ..()

/// If the owner has spines and an appropriate overlay exists, add a tail spines overlay.
/obj/item/organ/external/tail/proc/try_insert_tail_spines(obj/item/bodypart/bodypart)
// Don't insert another overlay if there already is one.
if(tail_spines_overlay)
return
// If this tail doesn't have a valid set of tail spines, don't insert them
var/datum/sprite_accessory/tails/tail_sprite_datum = bodypart_overlay.sprite_datum
if(!istype(tail_sprite_datum))
return
var/tail_spine_key = tail_sprite_datum.spine_key
if(!tail_spine_key)
return

tail_spines_overlay = new
tail_spines_overlay.tail_spine_key = tail_spine_key
var/feature_name = bodypart.owner.dna.mutant_bodyparts["spines"][MUTANT_INDEX_NAME] // NOVA 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") // NOVA 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
/obj/item/organ/external/tail/proc/remove_tail_spines(obj/item/bodypart/bodypart)
if(!tail_spines_overlay)
return
bodypart.remove_bodypart_overlay(tail_spines_overlay)
QDEL_NULL(tail_spines_overlay)

/obj/item/organ/external/tail/on_mob_remove(mob/living/carbon/organ_owner, special)
. = ..()

Expand Down Expand Up @@ -64,6 +102,8 @@
var/datum/bodypart_overlay/mutant/tail/accessory = bodypart_overlay
wag_flags |= WAG_WAGGING
accessory.wagging = TRUE
if(tail_spines_overlay) //if there are spines, they should wag with the tail
tail_spines_overlay.wagging = TRUE
organ_owner.update_body_parts()
RegisterSignal(organ_owner, COMSIG_LIVING_DEATH, PROC_REF(stop_wag))
return TRUE
Expand All @@ -75,6 +115,8 @@
var/datum/bodypart_overlay/mutant/tail/accessory = bodypart_overlay
wag_flags &= ~WAG_WAGGING
accessory.wagging = FALSE
if(tail_spines_overlay) //if there are spines, they should stop wagging with the tail
tail_spines_overlay.wagging = FALSE
if(isnull(organ_owner))
return

Expand Down Expand Up @@ -135,32 +177,7 @@
bodypart_overlay = /datum/bodypart_overlay/mutant/tail/lizard

wag_flags = WAG_ABLE
///A reference to the paired_spines, since for some fucking reason tail spines are tied to the spines themselves.
var/obj/item/organ/external/spines/paired_spines

/obj/item/organ/external/tail/lizard/Insert(mob/living/carbon/receiver, special, movement_flags)
. = ..()
if(.)
paired_spines = bodypart_owner.owner.get_organ_slot(ORGAN_SLOT_EXTERNAL_SPINES)
paired_spines?.paired_tail = src

/obj/item/organ/external/tail/lizard/Remove(mob/living/carbon/organ_owner, special, movement_flags)
. = ..()
if(paired_spines)
paired_spines.paired_tail = null
paired_spines = null

/obj/item/organ/external/tail/lizard/start_wag()
if(paired_spines)
var/datum/bodypart_overlay/mutant/spines/accessory = paired_spines.bodypart_overlay
accessory.wagging = TRUE
return ..()

/obj/item/organ/external/tail/lizard/stop_wag()
if(paired_spines)
var/datum/bodypart_overlay/mutant/spines/accessory = paired_spines.bodypart_overlay
accessory.wagging = FALSE
return ..()
//dna_block = DNA_LIZARD_TAIL_BLOCK // NOVA EDIT REMOVAL - Customization - We have our own system to handle DNA.

///Lizard tail bodypart overlay datum
/datum/bodypart_overlay/mutant/tail/lizard
Expand All @@ -172,3 +189,23 @@
/obj/item/organ/external/tail/lizard/fake
name = "fabricated lizard tail"
desc = "A fabricated severed lizard tail. This one's made of synthflesh. Probably not usable for lizard wine."

///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"
///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.
var/tail_spine_key = NONE

/datum/bodypart_overlay/mutant/tail_spines/get_global_feature_list()
return GLOB.sprite_accessories["tailspines"] // NOVA EDIT CHANGE - ORIGINAL: return GLOB.tail_spines_list

/datum/bodypart_overlay/mutant/tail_spines/get_base_icon_state()
return (!isnull(tail_spine_key) ? "[tail_spine_key]_" : "") + (wagging ? "wagging_" : "") + sprite_datum.icon_state // Select the wagging state if appropriate

/datum/bodypart_overlay/mutant/tail_spines/can_draw_on_bodypart(mob/living/carbon/human/human)
. = ..()
if(human.wear_suit && (human.wear_suit.flags_inv & HIDEJUMPSUIT))
return FALSE
Binary file modified icons/mob/human/species/lizard/lizard_spines.dmi
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@
*
* Arguments:
* * dna - The `/datum/dna` datum from which we're going to be extracting the data to set the
* * accessory_name - instead of using the name from mutant_bodyparts[feature_key][MUTANT_INDEX_NAME] you can optionally pass one explicitly
* * feature_key - same as with accessory_key, you can optionally pass a feature_key explicitly
* appearance.
*/
/datum/bodypart_overlay/mutant/proc/set_appearance_from_dna(datum/dna/dna)
sprite_datum = fetch_sprite_datum_from_name(dna.mutant_bodyparts[feature_key][MUTANT_INDEX_NAME])
/datum/bodypart_overlay/mutant/proc/set_appearance_from_dna(datum/dna/dna, accessory_name, feature_key)
if(isnull(feature_key)) // if not explicitly set, just use the feature_key of the bodypart_overlay
feature_key = src.feature_key
sprite_datum = fetch_sprite_datum_from_name(accessory_name ? accessory_name : dna.mutant_bodyparts[feature_key][MUTANT_INDEX_NAME])
modsuit_affected = sprite_datum.use_custom_mod_icon
draw_color = dna.mutant_bodyparts[feature_key][MUTANT_INDEX_COLOR_LIST]
build_emissive_eligibility(dna.mutant_bodyparts[feature_key][MUTANT_INDEX_EMISSIVE_LIST])
Expand Down
Binary file not shown.
Binary file modified modular_nova/master_files/icons/mob/sprite_accessory/vox_spines.dmi
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,12 @@ GLOBAL_LIST_EMPTY(cached_mutant_icon_files)

///Set this to true to make an accessory appear as color customizable in preferences despite advanced color settings being off, will also prevent the accessory from being reset
var/always_color_customizable
///Whether the accessory can have a special icon_state to render, i.e. wagging tails
var/special_render_case
///Special case of whether the accessory should be shifted in the X dimension, check taur genitals for example
var/special_x_dimension
///Special case of whether the accessory should have a different icon, check taur genitals for example
var/special_icon_case
///Special case for MODsuit overlays
var/use_custom_mod_icon
///Special case of applying a different color
var/special_colorize
///If defined, the accessory will be only available to ckeys inside the list. ITS ASSOCIATIVE, ie. ("ckey" = TRUE). For speed
var/list/ckey_whitelist
///Whether this feature is genetic, and thus modifiable by DNA consoles
Expand Down Expand Up @@ -87,15 +83,6 @@ GLOBAL_LIST_EMPTY(cached_mutant_icon_files)
/datum/sprite_accessory/proc/is_hidden(mob/living/carbon/human/owner)
return FALSE

/datum/sprite_accessory/proc/get_special_render_state(mob/living/carbon/human/H)
return null

/datum/sprite_accessory/proc/get_special_render_key(mob/living/carbon/human/owner)
return key

/datum/sprite_accessory/proc/get_special_render_colour(mob/living/carbon/human/H, passed_state)
return null

/datum/sprite_accessory/proc/get_special_icon(mob/living/carbon/human/H, passed_state)
return icon

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
#define TAUR_DIMENSION_X 64

/datum/sprite_accessory/genital
special_render_case = TRUE
special_colorize = TRUE
var/associated_organ_slot
/// If true, then there should be a variant in the icon file that's slightly pinkier to match human base colors.
var/has_skintone_shading = FALSE
Expand Down Expand Up @@ -57,15 +55,6 @@
else
return TRUE

/datum/sprite_accessory/genital/get_special_render_state(mob/living/carbon/human/human)
var/obj/item/organ/external/genital/genital = human.get_organ_slot(associated_organ_slot)
return "[genital?.sprite_suffix]"

/datum/sprite_accessory/genital/get_special_render_colour(mob/living/carbon/human/human, render_state)
var/obj/item/organ/external/genital/genital = human.get_organ_slot(associated_organ_slot)
if(genital?.uses_skin_color && HAS_TRAIT(human, TRAIT_USES_SKINTONES))
return skintone2hex(human.skin_tone)

/datum/sprite_accessory/genital/penis
icon = 'modular_nova/master_files/icons/mob/sprite_accessory/genitals/penis_onmob.dmi'
organ_type = /obj/item/organ/external/genital/penis
Expand Down
Loading

0 comments on commit 24fa218

Please sign in to comment.