mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-21 03:51:49 +01:00
Destroys a ton of sources of lag: - /obj/machinery/biogenerator/interact and /obj/machinery/computer/rdconsole/attack_hand Both of these call REF(src) constantly on their UI update, which also happens constantly. Death by a thousand cuts - /obj/machinery/button/ignition/attack_hand and /obj/machinery/button/switch/holosign/attack_hand Sleeps rather than timers, iterating the entire machinery list rather than just storing the IDs we need at roundstart - /obj/machinery/telecomms/update_icon and /obj/machinery/meter/process Calling overlay updates WAY TOO MUCH. UpdateOverlays is a significant overhead for the server at this point and the two of these combined are responsible for a little over 20% of updates. They now should only update overlays when necessary rather than every tick. - NEW! /obj/machinery/disposal/proc/update and /obj/machinery/portable_atmospherics/hydroponics/update_icon These two were also offenders, worse than telecomms but better than meters. They have also been brought into line. - /mob/living/carbon/slime Hard-del'd if grinded into slime extract less than two minutes after being "born". Fixed by adding TIMER_DELETE_ME flag. --------- Co-authored-by: Matt Atlas <liermattia@gmail.com>
94 lines
2.2 KiB
Plaintext
94 lines
2.2 KiB
Plaintext
////////////////////HOLOSIGN///////////////////////////////////////
|
|
/obj/machinery/holosign
|
|
name = "holosign"
|
|
desc = "Small wall-mounted holographic projector"
|
|
icon = 'icons/obj/holosign.dmi'
|
|
icon_state = "sign_off"
|
|
layer = ABOVE_DOOR_LAYER
|
|
idle_power_usage = 2
|
|
active_power_usage = 4
|
|
anchored = 1
|
|
var/lit = 0
|
|
var/id = null
|
|
var/on_icon = "sign_on"
|
|
var/_wifi_id
|
|
var/datum/wifi/receiver/button/holosign/wifi_receiver
|
|
|
|
/obj/machinery/holosign/Initialize()
|
|
. = ..()
|
|
if(_wifi_id)
|
|
wifi_receiver = new(_wifi_id, src)
|
|
|
|
/obj/machinery/holosign/Destroy()
|
|
qdel(wifi_receiver)
|
|
wifi_receiver = null
|
|
return ..()
|
|
|
|
/obj/machinery/holosign/proc/toggle()
|
|
if (stat & (BROKEN|NOPOWER))
|
|
return
|
|
lit = !lit
|
|
update_use_power(lit ? POWER_USE_ACTIVE : POWER_USE_IDLE)
|
|
update_icon()
|
|
|
|
/obj/machinery/holosign/update_icon()
|
|
if (!lit)
|
|
icon_state = "sign_off"
|
|
else
|
|
icon_state = on_icon
|
|
|
|
/obj/machinery/holosign/power_change()
|
|
..()
|
|
if (stat & NOPOWER)
|
|
lit = 0
|
|
update_use_power(POWER_USE_OFF)
|
|
update_icon()
|
|
|
|
/obj/machinery/holosign/surgery
|
|
name = "surgery holosign"
|
|
desc = "Small wall-mounted holographic projector. This one reads SURGERY."
|
|
on_icon = "surgery"
|
|
|
|
/obj/machinery/holosign/service
|
|
name = "service holosign"
|
|
on_icon = "serviceopen"
|
|
desc = "A small wall-mounted holographic projector. This one reads OPEN."
|
|
|
|
/obj/machinery/holosign/service/update_icon()
|
|
if(!lit)
|
|
icon_state = "serviceclosed"
|
|
else
|
|
icon_state = on_icon
|
|
|
|
////////////////////SWITCH///////////////////////////////////////
|
|
|
|
/obj/machinery/button/switch/holosign
|
|
name = "holosign switch"
|
|
desc = "A remote control switch for a holosign."
|
|
icon_state = "light0"
|
|
var/list/datum/weakref/linked_signs
|
|
|
|
/obj/machinery/button/switch/holosign/Initialize()
|
|
..()
|
|
return INITIALIZE_HINT_LATELOAD
|
|
|
|
/obj/machinery/button/switch/holosign/LateInitialize()
|
|
. = ..()
|
|
for(var/obj/machinery/holosign/H in SSmachinery.machinery)
|
|
if(H.id == id)
|
|
LAZYADD(linked_signs, WEAKREF(H))
|
|
|
|
/obj/machinery/button/switch/holosign/attack_hand(mob/user as mob)
|
|
if(..())
|
|
return
|
|
add_fingerprint(user)
|
|
|
|
active = !active
|
|
update_icon()
|
|
for(var/datum/weakref/W in linked_signs)
|
|
var/obj/machinery/holosign/H = W.resolve()
|
|
if(!isnull(H))
|
|
INVOKE_ASYNC(H, TYPE_PROC_REF(/obj/machinery/holosign, toggle))
|
|
|
|
return
|