Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(finishes) porting emissives from tgmc #5405

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions code/__DEFINES/dcs/signals/atom/signals_atom.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion code/_onclick/hud/map_popups.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
plane = GAME_PLANE

///le awesome parent type
/atom/movable/screen/proc/update_icon()
/atom/movable/screen/update_icon()
return

/**
Expand Down
26 changes: 26 additions & 0 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
*
Expand Down
4 changes: 0 additions & 4 deletions code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -114,8 +112,6 @@

. += update_emissive_block()

*/

/atom/movable/vv_get_dropdown()
. = ..()
VV_DROPDOWN_OPTION(VV_HK_EDIT_PARTICLES, "Edit Particles")
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/doors/windowdoor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/fire_alarm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
14 changes: 10 additions & 4 deletions code/game/machinery/lightswitch.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"]."
Expand All @@ -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()

Expand All @@ -59,7 +65,7 @@
else
stat |= NOPOWER

updateicon()
update_icon()

/obj/structure/machinery/light_switch/emp_act(severity)
. = ..()
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/vending/vending.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions code/game/objects/items/devices/portable_vendor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/scanners.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/tools/experimental_tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 4 additions & 5 deletions code/game/objects/objs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/barricade/barricade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/structures/crates_lockers/closets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 20 additions & 3 deletions code/game/objects/structures/morgue.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@

/obj/structure/morgue/Initialize()
. = ..()

connected = new tray_path(src)
update_icon()

/obj/structure/morgue/Destroy()
for(var/atom/movable/object in contents)
object.forceMove(loc)
. = ..()
QDEL_NULL(connected)

/obj/structure/morgue/update_icon()
/obj/structure/morgue/update_icon_state()
if(morgue_open)
icon_state = "[morgue_type]0"
else
Expand All @@ -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)
Expand Down Expand Up @@ -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()
. = ..()
Expand Down
7 changes: 4 additions & 3 deletions code/game/objects/structures/noticeboard.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions code/game/objects/structures/stool_bed_chair_nest/chairs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"
Expand Down
11 changes: 6 additions & 5 deletions code/game/turfs/open.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
update_icon()

/turf/open/update_icon()
overlays.Cut()
. = ..()

add_cleanable_overlays()

Expand Down Expand Up @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions code/game/turfs/turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/living/carbon/human/human_defines.dm
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/mob_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading
Loading