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 fcd431c33d26..d56ae7f6915b 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 da399192b713..27da578f5c00 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 8a37eef3ee73..6a8b6639d524 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -171,13 +171,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 0a37e4bcec59..f696ae481152 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 6742e8b31700..0e754a6296ef 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/morgue.dm b/code/game/objects/structures/morgue.dm index f1717f5bf0f5..247ab5388839 100644 --- a/code/game/objects/structures/morgue.dm +++ b/code/game/objects/structures/morgue.dm @@ -19,7 +19,9 @@ /obj/structure/morgue/Initialize() . = ..() + connected = new tray_path(src) + update_icon() /obj/structure/morgue/Destroy() for(var/atom/movable/object in contents) @@ -27,7 +29,7 @@ . = ..() QDEL_NULL(connected) -/obj/structure/morgue/update_icon() +/obj/structure/morgue/update_icon_state() if(morgue_open) icon_state = "[morgue_type]0" else @@ -36,6 +38,20 @@ else icon_state = "[morgue_type]1" +/obj/structure/morgue/update_overlays() + . = ..() + + if(morgue_open) + . += emissive_appearance(icon, "[morgue_type]0_emissive") + return + + if(length(contents) > 1) + . += emissive_appearance(icon, "[morgue_type]2_emissive") + return + + . += emissive_appearance(icon, "[morgue_type]1_emissive") + + /obj/structure/morgue/ex_act(severity) switch(severity) if(EXPLOSION_THRESHOLD_LOW to EXPLOSION_THRESHOLD_MEDIUM) @@ -141,11 +157,12 @@ throwpass = 1 var/bloody = FALSE -/obj/structure/morgue_tray/New(loc, obj/structure/morgue/morgue_source) +/obj/structure/morgue_tray/Initialize(mapload, obj/structure/morgue/morgue_source) + . = ..() + icon_tray = initial(icon_state) if(morgue_source) linked_morgue = morgue_source - ..() /obj/structure/morgue_tray/Destroy() . = ..() 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 ac1635f151dd..f2032a7ce25e 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 be58259e17ba..06ad706c8b2b 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -142,9 +142,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 cb4d02cd28ec..1a7a9c4564a6 100644 --- a/code/modules/mob/living/simple_animal/friendly/spiderbot.dm +++ b/code/modules/mob/living/simple_animal/friendly/spiderbot.dm @@ -148,7 +148,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 41ef2bf3fe4e..208908ab61f0 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 66e3a65f2f77..95c433e2e049 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 diff --git a/icons/obj/structures/props/stationobjs.dmi b/icons/obj/structures/props/stationobjs.dmi index 09868e92fd88..f1b980307ff9 100644 Binary files a/icons/obj/structures/props/stationobjs.dmi and b/icons/obj/structures/props/stationobjs.dmi differ