diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 6e7563429be..9609f19ceb4 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -51,6 +51,8 @@ // /atom signals ///from base of atom/proc/Initialize(): sent any time a new atom is created #define COMSIG_ATOM_CREATED "atom_created" +//from SSatoms InitAtom - Only if the atom was not deleted or failed initialization +#define COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZE "atom_init_success" ///from base of atom/attackby(): (/obj/item, /mob/living, params) #define COMSIG_PARENT_ATTACKBY "atom_attackby" ///Return this in response if you don't want afterattack to be called diff --git a/code/controllers/subsystem/atoms.dm b/code/controllers/subsystem/atoms.dm index 15f2f59cad0..8ae7ba290e6 100644 --- a/code/controllers/subsystem/atoms.dm +++ b/code/controllers/subsystem/atoms.dm @@ -89,6 +89,8 @@ SUBSYSTEM_DEF(atoms) qdeleted = TRUE else if(!(A.flags_1 & INITIALIZED_1)) BadInitializeCalls[the_type] |= BAD_INIT_DIDNT_INIT + else + SEND_SIGNAL(A,COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZE) return qdeleted || QDELING(A) diff --git a/code/datums/components/decal.dm b/code/datums/components/decal.dm index babb9573613..f474e35cc8d 100644 --- a/code/datums/components/decal.dm +++ b/code/datums/components/decal.dm @@ -51,10 +51,18 @@ /datum/component/decal/proc/apply(atom/thing) var/atom/master = thing || parent RegisterSignal(master,COMSIG_ATOM_UPDATE_OVERLAYS,.proc/apply_overlay) - master.update_icon() //could use some queuing here now maybe. + if(master.flags_1 & INITIALIZED_1) + master.update_icon() //could use some queuing here now maybe. + else + RegisterSignal(master,COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZE,.proc/late_update_icon) if(isitem(master)) addtimer(CALLBACK(master, /obj/item/.proc/update_slot_icon), 0, TIMER_UNIQUE) +/datum/component/decal/proc/late_update_icon(atom/source) + if(source && istype(source)) + source.update_icon() + UnregisterSignal(source,COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZE) + /datum/component/decal/proc/apply_overlay(atom/source, list/overlay_list) overlay_list += pic