Further update_icon splitup (#48784)

* Further update_icon splitup

After this there'll be just under 100 old update_icon() calls that need fixing.

* Thanks Travis
This commit is contained in:
MrPerson
2020-01-22 10:18:05 -05:00
committed by Emmett Gaines
parent bbf944d329
commit 26093e5ac2
155 changed files with 680 additions and 741 deletions
@@ -26,6 +26,7 @@
var/icon_state_unpowered = null // Icon state when the computer is turned off.
var/icon_state_powered = null // Icon state when the computer is turned on.
var/icon_state_menu = "menu" // Icon state overlay when the computer is turned on, but no program is loaded that would override the screen.
var/display_overlays = TRUE // If FALSE, don't draw overlays on this device at all
var/max_hardware_size = 0 // Maximal hardware w_class. Tablets/PDAs have 1, laptops 2, consoles 4.
var/steel_sheet_cost = 5 // Amount of steel sheets refunded when disassembling an empty frame of this computer.
@@ -210,20 +211,25 @@
. += get_modular_computer_parts_examine(user)
/obj/item/modular_computer/update_icon()
cut_overlays()
/obj/item/modular_computer/update_icon_state()
if(!enabled)
icon_state = icon_state_unpowered
else
icon_state = icon_state_powered
/obj/item/modular_computer/update_overlays()
. = ..()
if(!display_overlays)
return
if(enabled)
if(active_program)
add_overlay(active_program.program_icon_state ? active_program.program_icon_state : icon_state_menu)
. += active_program.program_icon_state ? active_program.program_icon_state : icon_state_menu
else
add_overlay(icon_state_menu)
. += icon_state_menu
if(obj_integrity <= integrity_failure * max_integrity)
add_overlay("bsod")
add_overlay("broken")
. += "bsod"
. += "broken"
// On-click handling. Turns on the computer if it's off and opens the GUI.
@@ -7,6 +7,7 @@
icon_state_powered = "laptop"
icon_state_unpowered = "laptop-off"
icon_state_menu = "menu"
display_overlays = FALSE
hardware_flag = PROGRAM_LAPTOP
max_hardware_size = 2
@@ -32,7 +33,14 @@
if(start_open && !screen_on)
toggle_open()
/obj/item/modular_computer/laptop/update_icon()
/obj/item/modular_computer/laptop/update_icon_state()
if(!screen_on)
icon_state = icon_state_closed
else
. = ..()
/obj/item/modular_computer/laptop/update_overlays()
. = ..()
if(screen_on)
..()
else
@@ -100,6 +108,7 @@
w_class = w_class_open
screen_on = !screen_on
display_overlays = screen_on
update_icon()
@@ -36,14 +36,11 @@
integrity_failure = machinery_computer.integrity_failure
base_active_power_usage = machinery_computer.base_active_power_usage
base_idle_power_usage = machinery_computer.base_idle_power_usage
machinery_computer.RegisterSignal(src, COMSIG_ATOM_UPDATED_ICON, /atom/proc/update_icon) //when we update_icon, also update the computer
/obj/item/modular_computer/processor/relay_qdel()
qdel(machinery_computer)
/obj/item/modular_computer/processor/update_icon()
if(machinery_computer)
return machinery_computer.update_icon()
// This thing is not meant to be used on it's own, get topic data from our machinery owner.
//obj/item/modular_computer/processor/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE)
// if(!machinery_computer)
@@ -15,14 +15,11 @@
var/has_variants = TRUE
var/finish_color = null
/obj/item/modular_computer/tablet/update_icon()
..()
if (has_variants)
/obj/item/modular_computer/tablet/update_icon_state()
if(has_variants)
if(!finish_color)
finish_color = pick("red","blue","brown","green","black")
icon_state = "tablet-[finish_color]"
icon_state_unpowered = "tablet-[finish_color]"
icon_state_powered = "tablet-[finish_color]"
icon_state = icon_state_powered = icon_state_unpowered = "tablet-[finish_color]"
/obj/item/modular_computer/tablet/syndicate_contract_uplink
name = "contractor tablet"