Ports some hud and update_icon code updates.

This commit is contained in:
Ghommie
2019-12-16 23:29:20 +01:00
parent 447f416ca6
commit 80402a0d88
56 changed files with 424 additions and 265 deletions
+11 -3
View File
@@ -326,8 +326,13 @@ GLOBAL_LIST_EMPTY(teleportlocs)
F.update_fire_light(fire)
for(var/obj/machinery/light/L in src)
L.update()
/area/proc/update_icon()
/**
* Update the icon state of the area
*
* Im not sure what the heck this does, somethign to do with weather being able to set icon
* states on areas?? where the heck would that even display?
*/
/area/update_icon_state()
var/weather_icon
for(var/V in SSweather.processing)
var/datum/weather/W = V
@@ -337,7 +342,10 @@ GLOBAL_LIST_EMPTY(teleportlocs)
if(!weather_icon)
icon_state = null
/area/space/update_icon()
/**
* Update the icon of the area (overridden to always be null for space
*/
/area/space/update_icon_state()
icon_state = null
/*
+28
View File
@@ -24,6 +24,8 @@
var/list/add_overlays // a very temporary list of overlays to add
var/list/managed_vis_overlays //vis overlays managed by SSvis_overlays to automaticaly turn them like other overlays
///overlays managed by update_overlays() to prevent removing overlays that weren't added by the same proc
var/list/managed_overlays
var/datum/proximity_monitor/proximity_monitor
var/buckle_message_cooldown = 0
@@ -310,6 +312,32 @@
SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE, user, .)
/// Updates the icon of the atom
/atom/proc/update_icon()
// I expect we're going to need more return flags and options in this proc
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)
cut_overlay(managed_overlays)
managed_overlays = null
if(length(new_overlays))
managed_overlays = new_overlays
add_overlay(new_overlays)
/// Updates the icon state of the atom
/atom/proc/update_icon_state()
/// Updates the overlays of the atom
/atom/proc/update_overlays()
SHOULD_CALL_PARENT(1)
. = list()
SEND_SIGNAL(src, COMSIG_ATOM_UPDATE_OVERLAYS, .)
/atom/proc/relaymove(mob/user)
if(buckle_message_cooldown <= world.time)
buckle_message_cooldown = world.time + 50
+14 -13
View File
@@ -38,21 +38,22 @@
board.one_access = 1
board.accesses = req_one_access
/obj/machinery/button/update_icon()
cut_overlays()
/obj/machinery/button/update_icon_state()
if(panel_open)
icon_state = "button-open"
if(device)
add_overlay("button-device")
if(board)
add_overlay("button-board")
else if(stat & (NOPOWER|BROKEN))
icon_state = "[skin]-p"
else
if(stat & (NOPOWER|BROKEN))
icon_state = "[skin]-p"
else
icon_state = skin
icon_state = skin
/obj/machinery/button/update_overlays()
. = ..()
if(!panel_open)
return
if(device)
. += "button-device"
if(board)
. += "button-board"
/obj/machinery/button/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/screwdriver))
@@ -168,7 +169,7 @@
if(device)
device.pulsed()
addtimer(CALLBACK(src, .proc/update_icon), 15)
addtimer(CALLBACK(src, /atom/.proc/update_icon), 15)
/obj/machinery/button/power_change()
..()
+1 -1
View File
@@ -292,7 +292,7 @@
new /obj/item/stack/cable_coil(loc, 2)
qdel(src)
/obj/machinery/camera/update_icon()
/obj/machinery/camera/update_icon_state()
if(!status)
icon_state = "[initial(icon_state)]1"
else if (stat & EMPED)
+15 -11
View File
@@ -38,17 +38,21 @@
defib.cell.give(180) //90% efficiency, slightly better than the cell charger's 87.5%
update_icon()
/obj/machinery/defibrillator_mount/update_icon()
cut_overlays()
if(defib)
add_overlay("defib")
if(defib.powered)
add_overlay(defib.safety ? "online" : "emagged")
var/ratio = defib.cell.charge / defib.cell.maxcharge
ratio = CEILING(ratio * 4, 1) * 25
add_overlay("charge[ratio]")
if(clamps_locked)
add_overlay("clamps")
/obj/machinery/defibrillator_mount/update_overlays()
. = ..()
if(!defib)
return
. += "defib"
if(defib.powered)
. += (defib.safety ? "online" : "emagged")
var/ratio = defib.cell.charge / defib.cell.maxcharge
ratio = CEILING(ratio * 4, 1) * 25
. += "charge[ratio]"
if(clamps_locked)
. += "clamps"
/obj/machinery/defibrillator_mount/get_cell()
if(defib)
+9 -13
View File
@@ -47,8 +47,7 @@
/obj/item/defibrillator/update_icon()
update_power()
update_overlays()
update_charge()
return ..()
/obj/item/defibrillator/proc/update_power()
if(!QDELETED(cell))
@@ -59,23 +58,20 @@
else
powered = FALSE
/obj/item/defibrillator/proc/update_overlays()
cut_overlays()
/obj/item/defibrillator/update_overlays()
. = ..()
if(!on)
add_overlay("[initial(icon_state)]-paddles")
. += "[initial(icon_state)]-paddles"
if(powered)
add_overlay("[initial(icon_state)]-powered")
if(!cell)
add_overlay("[initial(icon_state)]-nocell")
if(!safety)
add_overlay("[initial(icon_state)]-emagged")
/obj/item/defibrillator/proc/update_charge()
if(powered) //so it doesn't show charge if it's unpowered
. += "[initial(icon_state)]-powered"
if(!QDELETED(cell))
var/ratio = cell.charge / cell.maxcharge
ratio = CEILING(ratio*4, 1) * 25
add_overlay("[initial(icon_state)]-charge[ratio]")
if(!cell)
. += "[initial(icon_state)]-nocell"
if(!safety)
. += "[initial(icon_state)]-emagged"
/obj/item/defibrillator/CheckParts(list/parts_list)
..()
@@ -224,7 +224,7 @@
merge_gases()
for(var/i in 1 to 6)
addtimer(CALLBACK(src, .proc/update_icon), 20 + (i - 1) * 10)
addtimer(CALLBACK(src, /atom/.proc/update_icon), 20 + (i - 1) * 10)
else if(valve_open && tank_one && tank_two)
split_gases()
-3
View File
@@ -173,9 +173,6 @@
/obj/proc/container_resist(mob/living/user)
return
/obj/proc/update_icon()
return
/mob/proc/unset_machine()
if(machine)
machine.on_unset_machine(src)
+1 -1
View File
@@ -41,7 +41,7 @@
to_chat(user, "<span class='notice'>The water feels warm and soothing as you touch it. The fountain immediately dries up shortly afterwards.</span>")
user.reagents.add_reagent("godblood",20)
update_icon()
addtimer(CALLBACK(src, .proc/update_icon), time_between_uses)
addtimer(CALLBACK(src, /atom/.proc/update_icon), time_between_uses)
/obj/structure/healingfountain/update_icon()
+2 -2
View File
@@ -103,9 +103,9 @@
/turf/open/floor/blob_act(obj/structure/blob/B)
return
/turf/open/floor/proc/update_icon()
/turf/open/floor/update_icon()
. = ..()
update_visuals()
return 1
/turf/open/floor/attack_paw(mob/user)
return attack_hand(user)
@@ -202,15 +202,20 @@
return 1
return 0
/turf/closed/wall/r_wall/proc/update_icon()
/turf/closed/wall/r_wall/update_icon()
. = ..()
if(d_state != INTACT)
smooth = SMOOTH_FALSE
clear_smooth_overlays()
icon_state = "r_wall-[d_state]"
else
smooth = SMOOTH_TRUE
queue_smooth_neighbors(src)
queue_smooth(src)
/turf/closed/wall/r_wall/update_icon_state()
if(d_state != INTACT)
icon_state = "r_wall-[d_state]"
else
icon_state = "r_wall"
/turf/closed/wall/r_wall/singularity_pull(S, current_size)
+5 -2
View File
@@ -103,10 +103,13 @@
for(var/atom/movable/AM in src)
throw_atom(AM)
/turf/open/space/transit/proc/update_icon()
icon_state = "speedspace_ns_[get_transit_state(src)]"
/turf/open/space/transit/update_icon()
. = ..()
transform = turn(matrix(), get_transit_angle(src))
/turf/open/space/transit/update_icon_state()
icon_state = "speedspace_ns_[get_transit_state(src)]"
/proc/get_transit_state(turf/T)
var/p = 9
. = 1