From d9243d1016e3e370e4564495472a2f8d0ec59dc6 Mon Sep 17 00:00:00 2001 From: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Date: Fri, 9 Feb 2024 18:26:00 -0600 Subject: [PATCH] Refactors fire overlays once again to make it not get stuck so often (#81367) ## About The Pull Request Maybe finally fixes #77701 A big reason why this kept happening is because fire uses standing overlays. But fire isn't managed by mobs anymore. Meaning in some situations, fire can cease to exist but the overlay can still be on the mob. So it gets stuck. So like, why use standing overlays anymore? We can just hook `update_overlays` signal. Isn't that neat. ## Changelog :cl: Melbert refactor: Fire effects get added to mobs in a different way now. Maybe it will get stuck less. Report any oddities. /:cl: --- code/__DEFINES/mobs.dm | 9 ++--- code/__DEFINES/status_effects.dm | 5 +++ code/__DEFINES/traits/declarations.dm | 4 +- code/_globalvars/traits/_traits.dm | 2 +- code/_globalvars/traits/admin_tooling.dm | 2 +- .../datums/elements/permanent_fire_overlay.dm | 26 ++++++++++++ .../status_effects/debuffs/fire_stacks.dm | 40 +++++++++---------- code/game/turfs/open/lava.dm | 7 ++-- code/modules/mob/living/basic/basic.dm | 22 +++++----- .../mob/living/carbon/carbon_update_icons.dm | 29 +++++--------- .../carbon/human/species_types/plasmamen.dm | 2 +- .../modules/mob/living/carbon/init_signals.dm | 12 ------ code/modules/mob/living/living.dm | 24 +++++------ .../modules/mob/living/silicon/robot/robot.dm | 26 +++++------- tgstation.dme | 1 + 15 files changed, 102 insertions(+), 109 deletions(-) create mode 100644 code/datums/elements/permanent_fire_overlay.dm diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index d85e62615d4..2e1eac6672d 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -486,9 +486,6 @@ #define ROBOTIC_BRUTE_EXAMINE_TEXT "denting" #define ROBOTIC_BURN_EXAMINE_TEXT "charring" -// If a mob has a higher threshold than this, the icon shown will be increased to the big fire icon. -#define MOB_BIG_FIRE_STACK_THRESHOLD 3 - #define GRAB_PIXEL_SHIFT_PASSIVE 6 #define GRAB_PIXEL_SHIFT_AGGRESSIVE 12 #define GRAB_PIXEL_SHIFT_NECK 16 @@ -756,8 +753,8 @@ GLOBAL_LIST_INIT(human_heights_to_offsets, list( #define WOUND_LAYER 3 /// Blood cult ascended halo layer, because there's currently no better solution for adding/removing #define HALO_LAYER 2 -/// Fire layer when you're on fire -#define FIRE_LAYER 1 +/// The highest most layer for mob overlays. Unused +#define HIGHEST_LAYER 1 #define UPPER_BODY "upper body" #define LOWER_BODY "lower body" @@ -798,7 +795,7 @@ GLOBAL_LIST_INIT(layers_to_offset, list( // BODY_BEHIND_LAYER (external organs like wings) // BODY_FRONT_LAYER (external organs like wings) // DAMAGE_LAYER (full body) - // FIRE_LAYER (full body) + // HIGHEST_LAYER (full body) // UNIFORM_LAYER (full body) // WOUND_LAYER (full body) )) diff --git a/code/__DEFINES/status_effects.dm b/code/__DEFINES/status_effects.dm index 768f1faa514..4e901c4ba2c 100644 --- a/code/__DEFINES/status_effects.dm +++ b/code/__DEFINES/status_effects.dm @@ -31,6 +31,11 @@ /// If the incapacitated status effect will ignore a mob being agressively grabbed #define IGNORE_GRAB (1<<2) +/// Maxamounts of fire stacks a mob can get +#define MAX_FIRE_STACKS 20 +/// If a mob has a higher threshold than this, the icon shown will be increased to the big fire icon. +#define MOB_BIG_FIRE_STACK_THRESHOLD 3 + // Grouped effect sources, see also code/__DEFINES/traits.dm #define STASIS_MACHINE_EFFECT "stasis_machine" diff --git a/code/__DEFINES/traits/declarations.dm b/code/__DEFINES/traits/declarations.dm index 867f567be00..4e0a0f5b8f9 100644 --- a/code/__DEFINES/traits/declarations.dm +++ b/code/__DEFINES/traits/declarations.dm @@ -353,8 +353,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define TRAIT_TUMOR_SUPPRESSED "brain_tumor_suppressed" /// Prevents hallucinations from the hallucination brain trauma (RDS) #define TRAIT_RDS_SUPPRESSED "rds_suppressed" -/// mobs that have this trait cannot be extinguished -#define TRAIT_PERMANENTLY_ONFIRE "permanently_onfire" +/// Mobs that have this trait cannot be extinguished +#define TRAIT_NO_EXTINGUISH "no_extinguish" /// Indicates if the mob is currently speaking with sign language #define TRAIT_SIGN_LANG "sign_language" /// This mob is able to use sign language over the radio. diff --git a/code/_globalvars/traits/_traits.dm b/code/_globalvars/traits/_traits.dm index aba502d16ee..d58940485ac 100644 --- a/code/_globalvars/traits/_traits.dm +++ b/code/_globalvars/traits/_traits.dm @@ -318,6 +318,7 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_NO_DEBRAIN_OVERLAY" = TRAIT_NO_DEBRAIN_OVERLAY, "TRAIT_NO_DNA_COPY" = TRAIT_NO_DNA_COPY, "TRAIT_NO_DNA_SCRAMBLE" = TRAIT_NO_DNA_SCRAMBLE, + "TRAIT_NO_EXTINGUISH" = TRAIT_NO_EXTINGUISH, "TRAIT_NO_FLOATING_ANIM" = TRAIT_NO_FLOATING_ANIM, "TRAIT_NO_GLIDE" = TRAIT_NO_GLIDE, "TRAIT_NO_GUN_AKIMBO" = TRAIT_NO_GUN_AKIMBO, @@ -353,7 +354,6 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_PASSTABLE" = TRAIT_PASSTABLE, "TRAIT_PERFECT_ATTACKER" = TRAIT_PERFECT_ATTACKER, "TRAIT_PERMANENTLY_MORTAL" = TRAIT_PERMANENTLY_MORTAL, - "TRAIT_PERMANENTLY_ONFIRE" = TRAIT_PERMANENTLY_ONFIRE, "TRAIT_PHOTOGRAPHER" = TRAIT_PHOTOGRAPHER, "TRAIT_PIERCEIMMUNE" = TRAIT_PIERCEIMMUNE, "TRAIT_PLANT_SAFE" = TRAIT_PLANT_SAFE, diff --git a/code/_globalvars/traits/admin_tooling.dm b/code/_globalvars/traits/admin_tooling.dm index c2148f2b7b6..01269087d36 100644 --- a/code/_globalvars/traits/admin_tooling.dm +++ b/code/_globalvars/traits/admin_tooling.dm @@ -129,6 +129,7 @@ GLOBAL_LIST_INIT(admin_visible_traits, list( "TRAIT_NO_AUGMENTS" = TRAIT_NO_AUGMENTS, "TRAIT_NO_BLOOD_OVERLAY" = TRAIT_NO_BLOOD_OVERLAY, "TRAIT_NO_DNA_COPY" = TRAIT_NO_DNA_COPY, + "TRAIT_NO_EXTINGUISH" = TRAIT_NO_EXTINGUISH, "TRAIT_NO_GLIDE" = TRAIT_NO_GLIDE, "TRAIT_NO_PLASMA_TRANSFORM" = TRAIT_NO_PLASMA_TRANSFORM, "TRAIT_NO_SLIP_ALL" = TRAIT_NO_SLIP_ALL, @@ -162,7 +163,6 @@ GLOBAL_LIST_INIT(admin_visible_traits, list( "TRAIT_PARALYSIS_R_LEG" = TRAIT_PARALYSIS_R_LEG, "TRAIT_PASSTABLE" = TRAIT_PASSTABLE, "TRAIT_PERFECT_ATTACKER" = TRAIT_PERFECT_ATTACKER, - "TRAIT_PERMANENTLY_ONFIRE" = TRAIT_PERMANENTLY_ONFIRE, "TRAIT_PHOTOGRAPHER" = TRAIT_PHOTOGRAPHER, "TRAIT_PIERCEIMMUNE" = TRAIT_PIERCEIMMUNE, "TRAIT_PLANT_SAFE" = TRAIT_PLANT_SAFE, diff --git a/code/datums/elements/permanent_fire_overlay.dm b/code/datums/elements/permanent_fire_overlay.dm new file mode 100644 index 00000000000..e4a61852aed --- /dev/null +++ b/code/datums/elements/permanent_fire_overlay.dm @@ -0,0 +1,26 @@ +/// When applied to a mob, they will always have a fire overlay regardless of if they are *actually* on fire. +/datum/element/perma_fire_overlay + +/datum/element/perma_fire_overlay/Attach(atom/target) + . = ..() + if(!isliving(target)) + return ELEMENT_INCOMPATIBLE + + RegisterSignal(target, COMSIG_ATOM_UPDATE_OVERLAYS, PROC_REF(add_fire_overlay)) + target.update_appearance(UPDATE_OVERLAYS) + ADD_TRAIT(target, TRAIT_NO_EXTINGUISH, ELEMENT_TRAIT(type)) + +/datum/element/perma_fire_overlay/Detach(atom/target) + . = ..() + UnregisterSignal(target, COMSIG_ATOM_UPDATE_OVERLAYS) + REMOVE_TRAIT(target, TRAIT_NO_EXTINGUISH, ELEMENT_TRAIT(type)) + target.update_appearance(UPDATE_OVERLAYS) + +/datum/element/perma_fire_overlay/proc/add_fire_overlay(mob/living/source, list/overlays) + SIGNAL_HANDLER + + var/mutable_appearance/created_overlay = source.get_fire_overlay(stacks = MAX_FIRE_STACKS, on_fire = TRUE) + if(isnull(created_overlay)) + return + + overlays |= created_overlay diff --git a/code/datums/status_effects/debuffs/fire_stacks.dm b/code/datums/status_effects/debuffs/fire_stacks.dm index 4a6e7b6b730..2f32ff5b3be 100644 --- a/code/datums/status_effects/debuffs/fire_stacks.dm +++ b/code/datums/status_effects/debuffs/fire_stacks.dm @@ -7,7 +7,7 @@ /// Current amount of stacks we have var/stacks /// Maximum of stacks that we could possibly get - var/stack_limit = 20 + var/stack_limit = MAX_FIRE_STACKS /// What status effect types do we remove uppon being applied. These are just deleted without any deduction from our or their stacks when forced. var/list/enemy_types /// What status effect types do we merge into if they exist. Ignored when forced. @@ -116,12 +116,8 @@ owner.clear_alert(ALERT_FIRE) else if(!was_on_fire && owner.on_fire) owner.throw_alert(ALERT_FIRE, /atom/movable/screen/alert/fire) - -/** - * Used to update owner's effect overlay - */ - -/datum/status_effect/fire_handler/proc/update_overlay() + owner.update_appearance(UPDATE_OVERLAYS) + update_particles() /datum/status_effect/fire_handler/fire_stacks id = "fire_stacks" //fire_stacks and wet_stacks should have different IDs or else has_status_effect won't work @@ -132,8 +128,6 @@ /// If we're on fire var/on_fire = FALSE - /// Stores current fire overlay icon state, for optimisation purposes - var/last_icon_state /// Reference to the mob light emitter itself var/obj/effect/dummy/lighting_obj/moblight /// Type of mob light emitter we use when on fire @@ -160,8 +154,6 @@ return TRUE deal_damage(seconds_between_ticks) - update_overlay() - update_particles() /datum/status_effect/fire_handler/fire_stacks/update_particles() if(on_fire) @@ -239,8 +231,6 @@ moblight = new moblight_type(owner) cache_stacks() - update_overlay() - update_particles() SEND_SIGNAL(owner, COMSIG_LIVING_IGNITED, owner) return TRUE @@ -254,8 +244,6 @@ owner.clear_mood_event("on_fire") SEND_SIGNAL(owner, COMSIG_LIVING_EXTINGUISHED, owner) cache_stacks() - update_overlay() - update_particles() for(var/obj/item/equipped in owner.get_equipped_items()) equipped.extinguish() @@ -263,16 +251,26 @@ if(on_fire) extinguish() set_stacks(0) - update_overlay() - update_particles() + UnregisterSignal(owner, COMSIG_ATOM_UPDATE_OVERLAYS) + owner.update_appearance(UPDATE_OVERLAYS) return ..() -/datum/status_effect/fire_handler/fire_stacks/update_overlay() - last_icon_state = owner.update_fire_overlay(stacks, on_fire, last_icon_state) - /datum/status_effect/fire_handler/fire_stacks/on_apply() . = ..() - update_overlay() + RegisterSignal(owner, COMSIG_ATOM_UPDATE_OVERLAYS, PROC_REF(add_fire_overlay)) + owner.update_appearance(UPDATE_OVERLAYS) + +/datum/status_effect/fire_handler/fire_stacks/proc/add_fire_overlay(mob/living/source, list/overlays) + SIGNAL_HANDLER + + if(stacks <= 0 || !on_fire) + return + + var/mutable_appearance/created_overlay = owner.get_fire_overlay(stacks, on_fire) + if(isnull(created_overlay)) + return + + overlays |= created_overlay /obj/effect/dummy/lighting_obj/moblight/fire name = "fire" diff --git a/code/game/turfs/open/lava.dm b/code/game/turfs/open/lava.dm index 1a174723d85..30bed8fc87c 100644 --- a/code/game/turfs/open/lava.dm +++ b/code/game/turfs/open/lava.dm @@ -52,7 +52,7 @@ /turf/open/lava/Destroy() for(var/mob/living/leaving_mob in contents) - REMOVE_TRAIT(leaving_mob, TRAIT_PERMANENTLY_ONFIRE, TURF_TRAIT) + leaving_mob.RemoveElement(/datum/element/perma_fire_overlay) return ..() /turf/open/lava/update_overlays() @@ -144,7 +144,7 @@ /turf/open/lava/Exited(atom/movable/gone, direction) . = ..() if(isliving(gone) && !islava(gone.loc)) - REMOVE_TRAIT(gone, TRAIT_PERMANENTLY_ONFIRE, TURF_TRAIT) + gone.RemoveElement(/datum/element/perma_fire_overlay) /turf/open/lava/hitby(atom/movable/AM, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum) if(burn_stuff(AM)) @@ -311,10 +311,9 @@ return var/mob/living/burn_living = burn_target - ADD_TRAIT(burn_living, TRAIT_PERMANENTLY_ONFIRE, TURF_TRAIT) + burn_living.AddElement(/datum/element/perma_fire_overlay) burn_living.ignite_mob() burn_living.adjust_fire_stacks(lava_firestacks * seconds_per_tick) - burn_living.update_fire() burn_living.adjustFireLoss(lava_damage * seconds_per_tick) /turf/open/lava/can_cross_safely(atom/movable/crossing) diff --git a/code/modules/mob/living/basic/basic.dm b/code/modules/mob/living/basic/basic.dm index ba07c944652..d69665d6bcd 100644 --- a/code/modules/mob/living/basic/basic.dm +++ b/code/modules/mob/living/basic/basic.dm @@ -270,17 +270,17 @@ /mob/living/basic/on_fire_stack(seconds_per_tick, datum/status_effect/fire_handler/fire_stacks/fire_handler) adjust_bodytemperature((maximum_survivable_temperature + (fire_handler.stacks * 12)) * 0.5 * seconds_per_tick) -/mob/living/basic/update_fire_overlay(stacks, on_fire, last_icon_state, suffix = "") - var/mutable_appearance/fire_overlay = mutable_appearance('icons/mob/effects/onfire.dmi', "generic_fire") - if(on_fire && isnull(last_icon_state)) - add_overlay(fire_overlay) - return fire_overlay - else if(!on_fire && !isnull(last_icon_state)) - cut_overlay(fire_overlay) - return null - else if(on_fire && !isnull(last_icon_state)) - return last_icon_state - return null +/mob/living/basic/get_fire_overlay(stacks, on_fire) + var/fire_icon = "generic_fire" + if(!GLOB.fire_appearances[fire_icon]) + GLOB.fire_appearances[fire_icon] = mutable_appearance( + 'icons/mob/effects/onfire.dmi', + fire_icon, + -HIGHEST_LAYER, + appearance_flags = RESET_COLOR, + ) + + return GLOB.fire_appearances[fire_icon] /mob/living/basic/put_in_hands(obj/item/I, del_on_fail = FALSE, merge_stacks = TRUE, ignore_animation = TRUE) . = ..() diff --git a/code/modules/mob/living/carbon/carbon_update_icons.dm b/code/modules/mob/living/carbon/carbon_update_icons.dm index 7aa9afba95e..8dfa0be5e2b 100644 --- a/code/modules/mob/living/carbon/carbon_update_icons.dm +++ b/code/modules/mob/living/carbon/carbon_update_icons.dm @@ -278,8 +278,8 @@ update_held_items() update_worn_handcuffs() update_worn_legcuffs() - update_fire() update_body() + update_appearance(UPDATE_OVERLAYS) /mob/living/carbon/update_held_items() . = ..() @@ -315,27 +315,18 @@ hands += I.build_worn_icon(default_layer = HANDS_LAYER, default_icon_file = icon_file, isinhands = TRUE) return hands -/mob/living/carbon/update_fire_overlay(stacks, on_fire, last_icon_state, suffix = "") - var/fire_icon = "[dna?.species.fire_overlay || "human"]_[stacks > MOB_BIG_FIRE_STACK_THRESHOLD ? "big_fire" : "small_fire"][suffix]" +/mob/living/carbon/get_fire_overlay(stacks, on_fire) + var/fire_icon = "[dna?.species.fire_overlay || "human"]_[stacks > MOB_BIG_FIRE_STACK_THRESHOLD ? "big_fire" : "small_fire"]" if(!GLOB.fire_appearances[fire_icon]) - GLOB.fire_appearances[fire_icon] = mutable_appearance('icons/mob/effects/onfire.dmi', fire_icon, -FIRE_LAYER, appearance_flags = RESET_COLOR) + GLOB.fire_appearances[fire_icon] = mutable_appearance( + 'icons/mob/effects/onfire.dmi', + fire_icon, + -HIGHEST_LAYER, + appearance_flags = RESET_COLOR, + ) - if((stacks > 0 && on_fire) || HAS_TRAIT(src, TRAIT_PERMANENTLY_ONFIRE)) - if(fire_icon == last_icon_state) - return last_icon_state - - remove_overlay(FIRE_LAYER) - overlays_standing[FIRE_LAYER] = GLOB.fire_appearances[fire_icon] - apply_overlay(FIRE_LAYER) - return fire_icon - - if(!last_icon_state) - return last_icon_state - - remove_overlay(FIRE_LAYER) - apply_overlay(FIRE_LAYER) - return null + return GLOB.fire_appearances[fire_icon] /mob/living/carbon/update_damage_overlays() remove_overlay(DAMAGE_LAYER) diff --git a/code/modules/mob/living/carbon/human/species_types/plasmamen.dm b/code/modules/mob/living/carbon/human/species_types/plasmamen.dm index 8ce8be6f6d6..c9fa732b288 100644 --- a/code/modules/mob/living/carbon/human/species_types/plasmamen.dm +++ b/code/modules/mob/living/carbon/human/species_types/plasmamen.dm @@ -115,7 +115,7 @@ else internal_fire = FALSE - H.update_fire() + H.update_appearance(UPDATE_OVERLAYS) /datum/species/plasmaman/handle_fire(mob/living/carbon/human/H, seconds_per_tick, no_protection = FALSE) if(internal_fire) diff --git a/code/modules/mob/living/carbon/init_signals.dm b/code/modules/mob/living/carbon/init_signals.dm index 190fe9d8453..e64410ab635 100644 --- a/code/modules/mob/living/carbon/init_signals.dm +++ b/code/modules/mob/living/carbon/init_signals.dm @@ -13,12 +13,6 @@ RegisterSignal(src, SIGNAL_ADDTRAIT(TRAIT_TOXIMMUNE), PROC_REF(on_toximmune_trait_gain)) RegisterSignal(src, SIGNAL_ADDTRAIT(TRAIT_GENELESS), PROC_REF(on_geneless_trait_gain)) - - RegisterSignals(src, list( - SIGNAL_ADDTRAIT(TRAIT_PERMANENTLY_ONFIRE), - SIGNAL_REMOVETRAIT(TRAIT_PERMANENTLY_ONFIRE), - ), PROC_REF(update_permanently_on_fire)) - /** * On gain of TRAIT_AGENDER * @@ -90,12 +84,6 @@ reagents.end_metabolization(keep_liverless = TRUE) -///On gain of TRAIT_PERMANENTLY_ONFIRE, update the visuals if not on fire -/mob/living/carbon/proc/update_permanently_on_fire(datum/source) - SIGNAL_HANDLER - if(!on_fire) - update_fire() - /** * On gain of TRAIT_VIRUSIMMUNE * diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index f518e29a2b4..e096434cbb9 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -1580,11 +1580,6 @@ GLOBAL_LIST_EMPTY(fire_appearances) return fire_status.ignite(silent) -/mob/living/proc/update_fire() - var/datum/status_effect/fire_handler/fire_stacks/fire_stacks = has_status_effect(/datum/status_effect/fire_handler/fire_stacks) - if(fire_stacks) - fire_stacks.update_overlay() - /** * Extinguish all fire on the mob * @@ -1592,7 +1587,7 @@ GLOBAL_LIST_EMPTY(fire_appearances) * Signals the extinguishing. */ /mob/living/proc/extinguish_mob() - if(HAS_TRAIT(src, TRAIT_PERMANENTLY_ONFIRE)) //The everlasting flames will not be extinguished + if(HAS_TRAIT(src, TRAIT_NO_EXTINGUISH)) //The everlasting flames will not be extinguished return var/datum/status_effect/fire_handler/fire_stacks/fire_status = has_status_effect(/datum/status_effect/fire_handler/fire_stacks) if(!fire_status || !fire_status.on_fire) @@ -1611,13 +1606,13 @@ GLOBAL_LIST_EMPTY(fire_appearances) /mob/living/proc/adjust_fire_stacks(stacks, fire_type = /datum/status_effect/fire_handler/fire_stacks) if(stacks < 0) - if(HAS_TRAIT(src, TRAIT_PERMANENTLY_ONFIRE)) //You can't reduce fire stacks of the everlasting flames + if(HAS_TRAIT(src, TRAIT_NO_EXTINGUISH)) //You can't reduce fire stacks of the everlasting flames return stacks = max(-fire_stacks, stacks) apply_status_effect(fire_type, stacks) /mob/living/proc/adjust_wet_stacks(stacks, wet_type = /datum/status_effect/fire_handler/wet_stacks) - if(HAS_TRAIT(src, TRAIT_PERMANENTLY_ONFIRE)) //The everlasting flames will not be extinguished + if(HAS_TRAIT(src, TRAIT_NO_EXTINGUISH)) //The everlasting flames will not be extinguished return if(stacks < 0) stacks = max(fire_stacks, stacks) @@ -1695,19 +1690,18 @@ GLOBAL_LIST_EMPTY(fire_appearances) ignite_mob() /** - * Sets fire overlay of the mob. + * Gets the fire overlay to use for this mob * - * Vars: + * Args: * * stacks: Current amount of fire_stacks * * on_fire: If we're lit on fire - * * last_icon_state: Holds last fire overlay icon state, used for optimization - * * suffix: Suffix for the fire icon state for special fire types * - * This should return last_icon_state for the fire status efect + * Return a mutable appearance, the overlay that will be applied. */ -/mob/living/proc/update_fire_overlay(stacks, on_fire, last_icon_state, suffix = "") - return last_icon_state +/mob/living/proc/get_fire_overlay(stacks, on_fire) + RETURN_TYPE(/mutable_appearance) + return null /** * Handles effects happening when mob is on normal fire diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index ed9cbe09352..f73336fe963 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -352,7 +352,7 @@ var/mutable_appearance/head_overlay = hat.build_worn_icon(default_layer = 20, default_icon_file = 'icons/mob/clothing/head/default.dmi') head_overlay.pixel_z += hat_offset add_overlay(head_overlay) - update_fire() + update_appearance(UPDATE_OVERLAYS) /mob/living/silicon/robot/on_changed_z_level(turf/old_turf, turf/new_turf, same_z_layer, notify_contents) if(same_z_layer) @@ -1017,25 +1017,19 @@ /mob/living/silicon/robot/proc/untip_roleplay() to_chat(src, span_notice("Your frustration has empowered you! You can now right yourself faster!")) -/mob/living/silicon/robot/update_fire_overlay(stacks, on_fire, last_icon_state, suffix = "") - var/fire_icon = "generic_fire[suffix]" +/mob/living/silicon/robot/get_fire_overlay(stacks, on_fire) + var/fire_icon = "generic_fire" if(!GLOB.fire_appearances[fire_icon]) - var/mutable_appearance/new_fire_overlay = mutable_appearance('icons/mob/effects/onfire.dmi', fire_icon, -FIRE_LAYER) - new_fire_overlay.appearance_flags = RESET_COLOR + var/mutable_appearance/new_fire_overlay = mutable_appearance( + 'icons/mob/effects/onfire.dmi', + fire_icon, + -HIGHEST_LAYER, + appearance_flags = RESET_COLOR, + ) GLOB.fire_appearances[fire_icon] = new_fire_overlay - if(stacks && on_fire) - if(last_icon_state == fire_icon) - return last_icon_state - add_overlay(GLOB.fire_appearances[fire_icon]) - return fire_icon - - if(!last_icon_state) - return last_icon_state - - cut_overlay(GLOB.fire_appearances[fire_icon]) - return null + return GLOB.fire_appearances[fire_icon] /// Draw power from the robot /mob/living/silicon/robot/proc/draw_power(power_to_draw) diff --git a/tgstation.dme b/tgstation.dme index d14bab6c226..0c076bc191d 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -1444,6 +1444,7 @@ #include "code\datums\elements\openspace_item_click_handler.dm" #include "code\datums\elements\ore_collecting.dm" #include "code\datums\elements\organ_set_bonus.dm" +#include "code\datums\elements\permanent_fire_overlay.dm" #include "code\datums\elements\pet_bonus.dm" #include "code\datums\elements\plant_backfire.dm" #include "code\datums\elements\point_of_interest.dm"