Skip to content

Commit

Permalink
Fix gooey catslime ears disappearing across Z-levels (#2449)
Browse files Browse the repository at this point in the history
  • Loading branch information
Absolucy authored Jun 29, 2024
1 parent d0bad66 commit ad69e1c
Showing 1 changed file with 33 additions and 12 deletions.
45 changes: 33 additions & 12 deletions monkestation/code/modules/slimecore/slime_traits/_base_trait.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,34 +25,55 @@
host.update_overlays()
host.update_appearance()

/datum/slime_trait/proc/apply_overlays(obj/item/source, list/overlays)
SIGNAL_HANDLER
return NONE

/datum/slime_trait/proc/on_remove(mob/living/basic/slime/parent)
return
if(trait_flags & TRAIT_ON_DEATH)
UnregisterSignal(host, COMSIG_LIVING_DEATH)
if(trait_flags & TRAIT_VISUAL)
UnregisterSignal(host, COMSIG_ATOM_UPDATE_OVERLAYS)
host.update_overlays()
host.update_appearance()

/datum/slime_trait/proc/on_death()
return

/datum/slime_trait/proc/apply_overlays(obj/item/source, list/overlays)
return


/datum/slime_trait/visual

trait_flags = (TRAIT_VISUAL)
//the visual icon_state of the trait
// The visual icon_state of the trait.
var/trait_icon_state
///the icon path of the trait
/// The icon path of the trait.
var/trait_icon
/// The mutable_appearance object that will be created.
var/mutable_appearance/slime_visual

/datum/slime_trait/visual/Destroy()
if(slime_visual)
QDEL_NULL(slime_visual)
return ..()

/datum/slime_trait/visual/apply_overlays(obj/item/source, list/overlays)
if(!trait_icon || !trait_icon_state)
/datum/slime_trait/visual/on_add(mob/living/basic/slime/parent)
. = ..()
if(!host)
return
if(trait_icon && trait_icon_state)
slime_visual = mutable_appearance(trait_icon, trait_icon_state, host.layer)
LAZYADD(host.update_overlays_on_z, slime_visual)

var/mutable_appearance/slime_visual = mutable_appearance(trait_icon, trait_icon_state, host.layer, host, host.plane)
/datum/slime_trait/visual/on_remove(mob/living/basic/slime/parent)
. = ..()
if(slime_visual)
LAZYREMOVE(host.update_overlays_on_z, slime_visual)
QDEL_NULL(slime_visual)

/datum/slime_trait/visual/apply_overlays(obj/item/source, list/overlays)
if(!slime_visual)
return
SET_PLANE_EXPLICIT(slime_visual, PLANE_TO_TRUE(host.plane), host)
if(!host.overwrite_color)
slime_visual.color = host.current_color.slime_color
else
slime_visual.color = host.overwrite_color

overlays += slime_visual

0 comments on commit ad69e1c

Please sign in to comment.