diff --git a/code/__DEFINES/dcs/signals/atom/signals_atom.dm b/code/__DEFINES/dcs/signals/atom/signals_atom.dm index d9bd1202c159..12cec9e8c1f9 100644 --- a/code/__DEFINES/dcs/signals/atom/signals_atom.dm +++ b/code/__DEFINES/dcs/signals/atom/signals_atom.dm @@ -54,3 +54,11 @@ /// Called when an atom has emp_act called on it, from /atom/emp_act: (severity) #define COMSIG_ATOM_EMP_ACT "atom_emp_act" + +//from base of atom/update_icon(): () +#define COMSIG_ATOM_UPDATE_ICON "atom_update_icon" + #define COMSIG_ATOM_NO_UPDATE_ICON_STATE (1<<0) + #define COMSIG_ATOM_NO_UPDATE_OVERLAYS (1<<1) + +//from base of atom/update_overlays(): (list/new_overlays) +#define COMSIG_ATOM_UPDATE_OVERLAYS "atom_update_overlays" diff --git a/code/_onclick/hud/map_popups.dm b/code/_onclick/hud/map_popups.dm index 26dc93bbff2b..4466f796c076 100644 --- a/code/_onclick/hud/map_popups.dm +++ b/code/_onclick/hud/map_popups.dm @@ -68,7 +68,7 @@ plane = GAME_PLANE ///le awesome parent type -/atom/movable/screen/proc/update_icon() +/atom/movable/screen/update_icon() return /** diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 5f36b3b8b390..0c862e959a28 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -95,6 +95,9 @@ ///The color this atom will be if we choose to draw it on the minimap var/minimap_color = MINIMAP_SOLID + ///overlays managed by update_overlays() to prevent removing overlays that weren't added by the same proc + var/list/managed_overlays + /atom/New(loc, ...) var/do_initialize = SSatoms.initialized if(do_initialize != INITIALIZATION_INSSATOMS) @@ -660,6 +663,29 @@ Parameters are passed from New. /atom/proc/reset_light() turn_light(null, TRUE, 1 SECONDS, FALSE, TRUE) +/atom/proc/update_icon() + var/signalOut = SEND_SIGNAL(src, COMSIG_ATOM_UPDATE_ICON) + + if(!(signalOut & COMSIG_ATOM_NO_UPDATE_ICON_STATE)) + update_icon_state() + + if(!(signalOut & COMSIG_ATOM_NO_UPDATE_OVERLAYS)) + var/list/new_overlays = update_overlays() + if(managed_overlays) + overlays -= managed_overlays + managed_overlays = null + if(length(new_overlays)) + managed_overlays = new_overlays + overlays += new_overlays + +/// Updates the icon state of the atom +/atom/proc/update_icon_state() + +/atom/proc/update_overlays() + SHOULD_CALL_PARENT(TRUE) + . = list() + SEND_SIGNAL(src, COMSIG_ATOM_UPDATE_OVERLAYS, .) + /** * Return the markup to for the dropdown list for the VV panel for this atom * diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 21f7b6b0a9be..2aae8fce8532 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -94,8 +94,6 @@ if(light_system == DIRECTIONAL_LIGHT) AddComponent(/datum/component/overlay_lighting, is_directional = TRUE) -/* - ///Updates this movables emissive overlay /atom/movable/proc/update_emissive_block() if(!blocks_emissive) @@ -114,8 +112,6 @@ . += update_emissive_block() -*/ - /atom/movable/vv_get_dropdown() . = ..() VV_DROPDOWN_OPTION(VV_HK_EDIT_PARTICLES, "Edit Particles") diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index 76a370061a2f..e04009068870 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -14,7 +14,7 @@ /obj/structure/machinery/door/window/Initialize() . = ..() - addtimer(CALLBACK(src, PROC_REF(update_icon)), 1) + addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, update_icon)), 1) if (src.req_access && src.req_access.len) src.icon_state = "[src.icon_state]" src.base_state = src.icon_state diff --git a/code/game/machinery/fire_alarm.dm b/code/game/machinery/fire_alarm.dm index 55aef1323c4d..a37776d29b3d 100644 --- a/code/game/machinery/fire_alarm.dm +++ b/code/game/machinery/fire_alarm.dm @@ -128,7 +128,7 @@ FIRE ALARM /obj/structure/machinery/firealarm/power_change() ..() - addtimer(CALLBACK(src, PROC_REF(update_icon)), rand(0,15)) + addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, update_icon)), rand(0,15)) /obj/structure/machinery/firealarm/attack_hand(mob/user as mob) if(user.stat || inoperable()) diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm index de61830c2501..8643d995ba28 100644 --- a/code/game/machinery/lightswitch.dm +++ b/code/game/machinery/lightswitch.dm @@ -22,11 +22,11 @@ name = "light switch ([area.name])" src.on = src.area.lightswitch - updateicon() + update_icon() -/obj/structure/machinery/light_switch/proc/updateicon() +/obj/structure/machinery/light_switch/update_icon_state() if(stat & NOPOWER) icon_state = "light-p" else @@ -35,6 +35,12 @@ else icon_state = "light0" +/obj/structure/machinery/light_switch/update_overlays() + . = ..() + if(stat & NOPOWER) + return + . += emissive_appearance(icon, "light[on]_emissive") + /obj/structure/machinery/light_switch/get_examine_text(mob/user) . = ..() . += "It is [on? "on" : "off"]." @@ -47,7 +53,7 @@ for(var/obj/structure/machinery/light_switch/L in area) L.on = on - L.updateicon() + L.update_icon() area.power_change() @@ -59,7 +65,7 @@ else stat |= NOPOWER - updateicon() + update_icon() /obj/structure/machinery/light_switch/emp_act(severity) . = ..() diff --git a/code/game/machinery/vending/vending.dm b/code/game/machinery/vending/vending.dm index 8629ce2bb2be..abb33ae35b79 100644 --- a/code/game/machinery/vending/vending.dm +++ b/code/game/machinery/vending/vending.dm @@ -922,7 +922,7 @@ GLOBAL_LIST_EMPTY_TYPED(total_vending_machines, /obj/structure/machinery/vending /obj/structure/machinery/vending/power_change() ..() if(stat & NOPOWER) - addtimer(CALLBACK(src, PROC_REF(update_icon)), rand(1, 15)) + addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, update_icon)), rand(1, 15)) return update_icon() diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 7cb2781b253b..649093656235 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -4,6 +4,7 @@ mouse_drag_pointer = MOUSE_ACTIVE_POINTER layer = ITEM_LAYER light_system = MOVABLE_LIGHT + blocks_emissive = EMISSIVE_BLOCK_GENERIC /// this saves our blood splatter overlay, which will be processed not to go over the edges of the sprite var/image/blood_overlay = null var/randpixel = 6 diff --git a/code/game/objects/items/devices/portable_vendor.dm b/code/game/objects/items/devices/portable_vendor.dm index 465ba0666828..a42c99a32c06 100644 --- a/code/game/objects/items/devices/portable_vendor.dm +++ b/code/game/objects/items/devices/portable_vendor.dm @@ -198,14 +198,15 @@ fabricating = FALSE update_overlays() -/obj/item/device/portable_vendor/proc/update_overlays() - if(overlays) overlays.Cut() +/obj/item/device/portable_vendor/update_overlays() + . = ..() + if (broken) - overlays += image(icon, "securespark") + . += image(icon, "securespark") else if (fabricating) - overlays += image(icon, "secureb") + . += image(icon, "secureb") else - overlays += image(icon, "secure0") + . += image(icon, "secure0") /obj/item/device/portable_vendor/process() diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index 512ca8baad9b..996d5ffdda4f 100644 --- a/code/game/objects/items/devices/scanners.dm +++ b/code/game/objects/items/devices/scanners.dm @@ -439,7 +439,7 @@ FORENSIC SCANNER overlays += image('icons/obj/items/devices.dmi', "+mendoza_scanner_value_cyan") else overlays += image('icons/obj/items/devices.dmi', "+mendoza_scanner_value_white") - addtimer(CALLBACK(src, PROC_REF(update_icon)), 1 SECONDS) + addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, update_icon)), 1 SECONDS) else overlays += image('icons/obj/items/devices.dmi', "+mendoza_scanner_clamp_off") diff --git a/code/game/objects/items/tools/experimental_tools.dm b/code/game/objects/items/tools/experimental_tools.dm index 221aa279a53b..ad31ce796906 100644 --- a/code/game/objects/items/tools/experimental_tools.dm +++ b/code/game/objects/items/tools/experimental_tools.dm @@ -219,7 +219,7 @@ if(detaching) overlays += "+draining" - addtimer(CALLBACK(src, PROC_REF(update_icon)), attach_time) + addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, update_icon)), attach_time) else if(attaching) overlays += "+filling" diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 7747a45ed9da..cf81592e26bc 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -174,13 +174,12 @@ /obj/proc/interact(mob/user) return -/obj/proc/update_icon() +/obj/update_overlays() + . = ..() + for(var/datum/effects/E in effects_list) if(E.icon_path && E.obj_icon_state_path) - overlays += image(E.icon_path, icon_state = E.obj_icon_state_path) - return - - + . += image(E.icon_path, icon_state = E.obj_icon_state_path) /obj/item/proc/updateSelfDialog() var/mob/M = loc diff --git a/code/game/objects/structures/barricade/barricade.dm b/code/game/objects/structures/barricade/barricade.dm index b23e07f707f2..954c59b9821c 100644 --- a/code/game/objects/structures/barricade/barricade.dm +++ b/code/game/objects/structures/barricade/barricade.dm @@ -42,7 +42,7 @@ update_health(0, TRUE) if(user) user.count_niche_stat(STATISTICS_NICHE_CADES) - addtimer(CALLBACK(src, PROC_REF(update_icon)), 0) + addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, update_icon)), 0) starting_maxhealth = maxhealth /obj/structure/barricade/initialize_pass_flags(datum/pass_flags_container/pass_flags) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index fa87cd6b2b71..0d6839a4a2ba 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -5,6 +5,7 @@ icon_state = "closed" density = TRUE layer = BELOW_OBJ_LAYER + blocks_emissive = EMISSIVE_BLOCK_GENERIC var/icon_closed = "closed" var/icon_opened = "open" var/opened = 0 diff --git a/code/game/objects/structures/noticeboard.dm b/code/game/objects/structures/noticeboard.dm index 0c763378ede1..9b050cde08c5 100644 --- a/code/game/objects/structures/noticeboard.dm +++ b/code/game/objects/structures/noticeboard.dm @@ -96,10 +96,11 @@ remove_item(item, user) return TRUE -/obj/structure/noticeboard/proc/update_overlays() - if(overlays) overlays.Cut() +/obj/structure/noticeboard/update_overlays() + . = ..() + if(notices) - overlays += image(icon, "notices_[notices]") + . += image(icon, "notices_[notices]") /obj/structure/noticeboard/proc/remove_item(obj/item/item, mob/user) item.forceMove(loc) diff --git a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm index e523906f4cfe..778b9cdb9190 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm @@ -162,8 +162,9 @@ I.throw_atom(starting_turf, rand(2, 5), SPEED_FAST, null, TRUE) qdel(src) -/obj/structure/bed/chair/proc/update_overlays() - overlays.Cut() +/obj/structure/bed/chair/update_overlays() + . = ..() + if(!stacked_size) name = initial(name) desc = initial(desc) @@ -201,7 +202,7 @@ I.pixel_y = previous_chair_overlay.pixel_y + 3 if(stacked_size > 8) I.pixel_x = I.pixel_x + pick(list(-1, 1)) - overlays += I + . += I /obj/structure/bed/chair/verb/rotate() set name = "Rotate Chair" diff --git a/code/game/turfs/open.dm b/code/game/turfs/open.dm index 7d9dd6303c64..d830b5e59ebc 100644 --- a/code/game/turfs/open.dm +++ b/code/game/turfs/open.dm @@ -19,7 +19,7 @@ update_icon() /turf/open/update_icon() - overlays.Cut() + . = ..() add_cleanable_overlays() @@ -473,16 +473,17 @@ ..() update_overlays() -/turf/open/gm/river/proc/update_overlays() - overlays.Cut() +/turf/open/gm/river/update_overlays() + . = ..() + if(no_overlay) return if(covered) name = covered_name - overlays += image("icon"=src.cover_icon,"icon_state"=cover_icon_state,"layer"=CATWALK_LAYER,"dir" = dir) + . += image("icon"=src.cover_icon,"icon_state"=cover_icon_state,"layer"=CATWALK_LAYER,"dir" = dir) else name = default_name - overlays += image("icon"=src.icon,"icon_state"=icon_overlay,"layer"=ABOVE_MOB_LAYER,"dir" = dir) + . += image("icon"=src.icon,"icon_state"=icon_overlay,"layer"=ABOVE_MOB_LAYER,"dir" = dir) /turf/open/gm/river/ex_act(severity) if(covered & severity >= EXPLOSION_THRESHOLD_LOW) diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 22fe85bdde65..5cd5834e2b07 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -145,9 +145,6 @@ /turf/ex_act(severity) return 0 -/turf/proc/update_icon() //Base parent. - Abby - return - /turf/proc/add_cleanable_overlays() for(var/cleanable_type in cleanables) var/obj/effect/decal/cleanable/C = cleanables[cleanable_type] diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index 9ec9d0b05ec5..a33b77c864e3 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -1,6 +1,7 @@ /mob/living/carbon/human light_system = MOVABLE_LIGHT rotate_on_lying = TRUE + blocks_emissive = EMISSIVE_BLOCK_UNIQUE //Hair color and style var/r_hair = 0 var/g_hair = 0 diff --git a/code/modules/mob/living/simple_animal/friendly/spiderbot.dm b/code/modules/mob/living/simple_animal/friendly/spiderbot.dm index 1e1c15d173b7..2214164c97ce 100644 --- a/code/modules/mob/living/simple_animal/friendly/spiderbot.dm +++ b/code/modules/mob/living/simple_animal/friendly/spiderbot.dm @@ -149,7 +149,7 @@ eject_brain() death(cause) -/mob/living/simple_animal/spiderbot/proc/update_icon() +/mob/living/simple_animal/spiderbot/update_icon_state() if(mmi) if(istype(mmi,/obj/item/device/mmi)) icon_state = "spiderbot-chassis-mmi" diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index f7f062295778..70e84e13de0f 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -3,6 +3,7 @@ layer = MOB_LAYER animate_movement = 2 rebounds = TRUE + blocks_emissive = EMISSIVE_BLOCK_GENERIC var/mob_flags = NO_FLAGS var/datum/mind/mind diff --git a/code/modules/projectiles/gun_helpers.dm b/code/modules/projectiles/gun_helpers.dm index 8e73124a8b92..3d1d49086216 100644 --- a/code/modules/projectiles/gun_helpers.dm +++ b/code/modules/projectiles/gun_helpers.dm @@ -410,7 +410,9 @@ DEFINES in setup.dm, referenced here. if(attachable_offset && attachments[attachable]) update_overlays(attachments[attachable], attachable) -/obj/item/weapon/gun/proc/update_overlays(obj/item/attachable/attachment, slot) +/obj/item/weapon/gun/update_overlays(obj/item/attachable/attachment, slot) + . = ..() + var/image/gun_image = attachable_overlays[slot] overlays -= gun_image attachable_overlays[slot] = null @@ -422,7 +424,7 @@ DEFINES in setup.dm, referenced here. gun_image.pixel_x = attachable_offset["[slot]_x"] - attachment.pixel_shift_x + x_offset_by_attachment_type(attachment.type) gun_image.pixel_y = attachable_offset["[slot]_y"] - attachment.pixel_shift_y + y_offset_by_attachment_type(attachment.type) attachable_overlays[slot] = gun_image - overlays += gun_image + . += gun_image else attachable_overlays[slot] = null /obj/item/weapon/gun/proc/x_offset_by_attachment_type(attachment_type) diff --git a/code/modules/vehicles/vehicle.dm b/code/modules/vehicles/vehicle.dm index 2239329d3e44..26c8fe0cf6b7 100644 --- a/code/modules/vehicles/vehicle.dm +++ b/code/modules/vehicles/vehicle.dm @@ -6,6 +6,7 @@ anchored = TRUE animate_movement = 1 can_buckle = TRUE + blocks_emissive = EMISSIVE_BLOCK_GENERIC // The mobs that are in each position/seat of the vehicle var/list/mob/seats = list( diff --git a/icons/obj/structures/machinery/power.dmi b/icons/obj/structures/machinery/power.dmi index 76ca47047b63..fd4dc579c52b 100644 Binary files a/icons/obj/structures/machinery/power.dmi and b/icons/obj/structures/machinery/power.dmi differ