mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-21 07:32:02 +00:00
- Modular computers now support multitasking. - New hardware type added. Basic CPUs may be obtained when purchasing a laptop or tablet, Photonic CPUs can be printed at research at imprinter. This hardware piece determines how many programs can be on background. - Programs can now have an icon that is rendered in main UI's header (along with the power icons, etc.) when the program is on background. As an example, these icons have been added to NTNRC client (Dark icon when no messages have been received, blinking when new message is waiting), Alarm monitor (Blinking red when an alarm is active, green otherwise) and downloader program (Animated arrow when downloading, stationary when finished.) - Adds missing crew monitor icon to tablets. Fixes #11937
119 lines
4.5 KiB
Plaintext
119 lines
4.5 KiB
Plaintext
// Held by /obj/machinery/modular_computer to reduce amount of copy-pasted code.
|
|
/obj/item/modular_computer/processor
|
|
name = "processing unit"
|
|
desc = "You shouldn't see this. If you do, report it."
|
|
icon = null
|
|
icon_state = null
|
|
icon_state_unpowered = null
|
|
icon_state_menu = null
|
|
hardware_flag = 0
|
|
|
|
var/obj/machinery/modular_computer/machinery_computer = null
|
|
|
|
/obj/item/modular_computer/processor/Destroy()
|
|
if(machinery_computer && (machinery_computer.cpu == src))
|
|
machinery_computer.cpu = null
|
|
machinery_computer = null
|
|
return ..()
|
|
|
|
// Due to how processes work, we'd receive two process calls - one from machinery type and one from our own type.
|
|
// Since we want this to be in-sync with machinery (as it's hidden type for machinery-based computers) we'll ignore
|
|
// non-relayed process calls.
|
|
/obj/item/modular_computer/processor/process(var/relayed = 0)
|
|
if(relayed)
|
|
..()
|
|
else
|
|
return
|
|
|
|
// Power interaction is handled by our machinery part, due to machinery having APC connection.
|
|
/obj/item/modular_computer/processor/handle_power()
|
|
if(machinery_computer)
|
|
machinery_computer.handle_power()
|
|
|
|
/obj/item/modular_computer/processor/New(var/comp)
|
|
if(!comp || !istype(comp, /obj/machinery/modular_computer))
|
|
CRASH("Inapropriate type passed to obj/item/modular_computer/processor/New()! Aborting.")
|
|
return
|
|
// Obtain reference to machinery computer
|
|
machinery_computer = comp
|
|
machinery_computer.cpu = src
|
|
hardware_flag = machinery_computer.hardware_flag
|
|
max_hardware_size = machinery_computer.max_hardware_size
|
|
steel_sheet_cost = machinery_computer.steel_sheet_cost
|
|
|
|
/obj/item/modular_computer/processor/relay_qdel()
|
|
qdel(machinery_computer)
|
|
|
|
/obj/item/modular_computer/processor/find_hardware_by_name(var/N)
|
|
var/obj/item/weapon/computer_hardware/H = machinery_computer.find_hardware_by_name(N)
|
|
if(H)
|
|
return H
|
|
else
|
|
return ..()
|
|
|
|
/obj/item/modular_computer/processor/update_icon()
|
|
if(machinery_computer)
|
|
return machinery_computer.update_icon()
|
|
|
|
/obj/item/modular_computer/processor/get_header_data()
|
|
var/list/L = ..()
|
|
if(machinery_computer.tesla_link && machinery_computer.tesla_link.enabled && machinery_computer.powered())
|
|
L["PC_apclinkicon"] = "charging.gif"
|
|
return L
|
|
|
|
// Checks whether the machinery computer doesn't take power from APC network
|
|
/obj/item/modular_computer/processor/check_power_override()
|
|
if(!machinery_computer)
|
|
return 0
|
|
if(!machinery_computer.tesla_link || !machinery_computer.tesla_link.enabled)
|
|
return 0
|
|
return machinery_computer.powered()
|
|
|
|
// 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(user, state)
|
|
if(!machinery_computer)
|
|
return 0
|
|
return machinery_computer.CanUseTopic(user, state)
|
|
|
|
/obj/item/modular_computer/processor/shutdown_computer()
|
|
if(!machinery_computer)
|
|
return
|
|
..()
|
|
machinery_computer.update_icon()
|
|
return
|
|
|
|
// Tesla links only work on machinery types, so we'll override the default try_install_component() proc
|
|
/obj/item/modular_computer/processor/try_install_component(var/mob/living/user, var/obj/item/weapon/computer_hardware/H, var/found = 0)
|
|
if(istype(H, /obj/item/weapon/computer_hardware/tesla_link))
|
|
if(machinery_computer.tesla_link)
|
|
user << "This computer's tesla link slot is already occupied by \the [machinery_computer.tesla_link]."
|
|
return
|
|
var/obj/item/weapon/computer_hardware/tesla_link/L = H
|
|
L.holder = machinery_computer
|
|
machinery_computer.tesla_link = L
|
|
// 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))
|
|
L.critical = 1
|
|
found = 1
|
|
..(user, H, found)
|
|
|
|
/obj/item/modular_computer/processor/uninstall_component(var/mob/living/user, var/obj/item/weapon/computer_hardware/H, var/found = 0, var/critical = 0)
|
|
if(machinery_computer.tesla_link == H)
|
|
machinery_computer.tesla_link = null
|
|
var/obj/item/weapon/computer_hardware/tesla_link/L = H
|
|
L.critical = 0 // That way we can install tesla link from console to laptop and it will be possible to turn it off via config.
|
|
L.holder = null
|
|
found = 1
|
|
..(user, H, found, critical)
|
|
|
|
/obj/item/modular_computer/processor/get_all_components()
|
|
var/list/all_components = ..()
|
|
if(machinery_computer.tesla_link)
|
|
all_components.Add(machinery_computer.tesla_link)
|
|
return all_components
|
|
|
|
// Perform adjacency checks on our machinery counterpart, rather than on ourselves.
|
|
/obj/item/modular_computer/processor/Adjacent(var/atom/neighbor)
|
|
if(!machinery_computer)
|
|
return 0
|
|
return machinery_computer.Adjacent(neighbor) |