mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 21:48:39 +01:00
update_appearance (#55468)
Creates update_name and update_desc Creates the wrapper proc update_appearance to batch update_name, update_desc, and update_icon together Less non-icon handling code in update_icon and friends Signal hooks for things that want to change names and descriptions 99%+ of the changes in this are just from switching everything over to update_appearance from update_icon
This commit is contained in:
@@ -53,26 +53,25 @@
|
||||
return FALSE
|
||||
return (cpu.emag_act(user))
|
||||
|
||||
/obj/machinery/modular_computer/update_icon()
|
||||
cut_overlays()
|
||||
icon_state = icon_state_powered
|
||||
/obj/machinery/modular_computer/update_appearance(updates)
|
||||
. = ..()
|
||||
set_light(cpu?.enabled ? light_strength : 0)
|
||||
|
||||
if(!cpu || !cpu.enabled)
|
||||
/obj/machinery/modular_computer/update_icon_state()
|
||||
icon_state = (cpu?.enabled || (!(machine_stat & NOPOWER) && cpu?.use_power())) ? icon_state_powered : icon_state_unpowered
|
||||
return ..()
|
||||
|
||||
/obj/machinery/modular_computer/update_overlays()
|
||||
. = ..()
|
||||
if(!cpu?.enabled)
|
||||
if (!(machine_stat & NOPOWER) && (cpu?.use_power()))
|
||||
add_overlay(screen_icon_screensaver)
|
||||
else
|
||||
icon_state = icon_state_unpowered
|
||||
set_light(0)
|
||||
. += screen_icon_screensaver
|
||||
else
|
||||
set_light(light_strength)
|
||||
if(cpu.active_program)
|
||||
add_overlay(cpu.active_program.program_icon_state ? cpu.active_program.program_icon_state : screen_icon_state_menu)
|
||||
else
|
||||
add_overlay(screen_icon_state_menu)
|
||||
. += cpu.active_program?.program_icon_state || screen_icon_state_menu
|
||||
|
||||
if(cpu && cpu.obj_integrity <= cpu.integrity_failure * cpu.max_integrity)
|
||||
add_overlay("bsod")
|
||||
add_overlay("broken")
|
||||
. += "bsod"
|
||||
. += "broken"
|
||||
|
||||
/obj/machinery/modular_computer/AltClick(mob/user)
|
||||
if(cpu)
|
||||
@@ -101,13 +100,13 @@
|
||||
if(cpu)
|
||||
cpu.shutdown_computer(0)
|
||||
set_machine_stat(machine_stat | NOPOWER)
|
||||
update_icon()
|
||||
update_appearance()
|
||||
|
||||
// Modular computers can have battery in them, we handle power in previous proc, so prevent this from messing it up for us.
|
||||
/obj/machinery/modular_computer/power_change()
|
||||
if(cpu?.use_power()) // If MC_CPU still has a power source, PC wouldn't go offline.
|
||||
set_machine_stat(machine_stat & ~NOPOWER)
|
||||
update_icon()
|
||||
update_appearance()
|
||||
return
|
||||
. = ..()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user