allow COMSIG_ATOM_UPDATE_OVERLAY responders to add managed overlays directly (#29091)

This commit is contained in:
warriorstar-orion
2025-04-26 18:12:14 +00:00
committed by GitHub
parent fc9958dac8
commit 9e0f79358a
5 changed files with 11 additions and 30 deletions
+3 -2
View File
@@ -24,11 +24,12 @@
/datum/component/proc/add_tape_text(datum/source, mob/user, list/examine_list)
examine_list += "<span class='notice'>There's some sticky tape attached to [source].</span>"
/datum/component/ducttape/proc/add_tape_overlay(obj/item/O)
/datum/component/ducttape/proc/add_tape_overlay(obj/item/O, list/overlays)
SIGNAL_HANDLER // COMSIG_ATOM_UPDATE_OVERLAYS
tape_overlay = new('icons/obj/bureaucracy.dmi', "tape")
tape_overlay.Shift(EAST, x_offset - 2)
tape_overlay.Shift(NORTH, y_offset - 2)
O.add_overlay(tape_overlay)
overlays += tape_overlay
/datum/component/ducttape/proc/remove_tape(obj/item/I, mob/user)
to_chat(user, "<span class='notice'>You tear the tape off [I]!</span>")
+3 -8
View File
@@ -33,8 +33,6 @@
COOLDOWN_DECLARE(charge_add_cd)
/// A callback for the sparks/message that play when a charge is used, see [/datum/component/shielded/proc/default_run_hit_callback]
var/datum/callback/on_hit_effects
///The visual effect
var/mutable_appearance/shield
/datum/component/shielded/Initialize(max_charges = 3, recharge_start_delay = 20 SECONDS, charge_increment_delay = 1 SECONDS, charge_recovery = 1, lose_multiple_charges = FALSE, show_charge_as_alpha = FALSE, recharge_path = null, starting_charges = null, shield_icon_file = 'icons/effects/effects.dmi', shield_icon = "shield-old", shield_inhand = FALSE, run_hit_callback)
if(!isitem(parent) || max_charges <= 0)
@@ -122,7 +120,6 @@
if(wearer)
UnregisterSignal(wearer, list(COMSIG_ATOM_UPDATE_OVERLAYS, COMSIG_PARENT_QDELETING))
wearer.cut_overlay(shield)
wearer.update_appearance(UPDATE_ICON)
wearer = null
@@ -134,14 +131,12 @@
wearer.update_appearance(UPDATE_ICON)
/// Used to draw the shield overlay on the wearer
/datum/component/shielded/proc/on_update_overlays(atom/parent_atom)
SIGNAL_HANDLER
wearer.cut_overlay(shield)
/datum/component/shielded/proc/on_update_overlays(atom/parent_atom, list/overlays)
SIGNAL_HANDLER // COMSIG_ATOM_UPDATE_OVERLAYS
var/mutable_appearance/shield_appearance = mutable_appearance(shield_icon_file, (current_charges > 0 ? shield_icon : "broken"), MOB_LAYER + 0.01)
if(show_charge_as_alpha)
shield_appearance.alpha = (current_charges/max_charges)*255
wearer.add_overlay(shield_appearance)
shield = shield_appearance
overlays += shield_appearance
/**
* This proc fires when we're hit, and is responsible for checking if we're charged, then deducting one + returning that we're blocking if so.