Modular computer fixes

- Tesla link is now correctly enabled when being installed into a console. Fixes #11974
- Tesla link now correctly stops using power when the computer shuts down.
- Configurator program now uses much better method to obtain list of components. This method takes into account possible hardware additions in the future.
This commit is contained in:
Atlantis
2016-01-12 23:57:36 +01:00
parent d04bef2991
commit 75e40d7748
2 changed files with 11 additions and 30 deletions

View File

@@ -80,6 +80,7 @@
return return
..() ..()
machinery_computer.update_icon() machinery_computer.update_icon()
machinery_computer.use_power = 0
return return
// Tesla links only work on machinery types, so we'll override the default try_install_component() proc // Tesla links only work on machinery types, so we'll override the default try_install_component() proc
@@ -94,6 +95,7 @@
// Consoles don't usually have internal power source, so we can't disable tesla link in them. // Consoles don't usually have internal power source, so we can't disable tesla link in them.
if(istype(machinery_computer, /obj/machinery/modular_computer/console)) if(istype(machinery_computer, /obj/machinery/modular_computer/console))
L.critical = 1 L.critical = 1
L.enabled = 1
found = 1 found = 1
..(user, H, found) ..(user, H, found)

View File

@@ -16,25 +16,16 @@
/datum/nano_module/computer_configurator /datum/nano_module/computer_configurator
name = "NTOS Computer Configuration Tool" name = "NTOS Computer Configuration Tool"
var/obj/machinery/modular_computer/stationary = null
var/obj/item/modular_computer/movable = null var/obj/item/modular_computer/movable = null
/datum/nano_module/computer_configurator/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = default_state) /datum/nano_module/computer_configurator/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = default_state)
if(program) if(program)
stationary = program.computer
movable = program.computer movable = program.computer
if(!istype(stationary))
stationary = null
if(!istype(movable)) if(!istype(movable))
movable = null movable = null
if(istype(movable, /obj/item/modular_computer/processor))
var/obj/item/modular_computer/processor/P = movable
stationary = P.machinery_computer
// No computer connection, we can't get data from that. // No computer connection, we can't get data from that.
if(!movable && !stationary) if(!movable)
return 0 return 0
var/list/data = list() var/list/data = list()
@@ -42,20 +33,8 @@
if(program) if(program)
data = program.get_header_data() data = program.get_header_data()
var/list/hardware = list() var/list/hardware = movable.get_all_components()
if(stationary)
if(stationary.cpu)
movable = stationary.cpu
hardware.Add(stationary.tesla_link)
else
return
if(movable)
hardware.Add(movable.network_card)
hardware.Add(movable.hard_drive)
hardware.Add(movable.card_slot)
hardware.Add(movable.nano_printer)
hardware.Add(movable.battery_module)
data["disk_size"] = movable.hard_drive.max_capacity data["disk_size"] = movable.hard_drive.max_capacity
data["disk_used"] = movable.hard_drive.used_capacity data["disk_used"] = movable.hard_drive.used_capacity
data["power_usage"] = movable.last_power_usage data["power_usage"] = movable.last_power_usage