PCUs and SR Connected Computers (#4040)

* PCU and Connected Consoles

* Clean this up
This commit is contained in:
Zandario
2022-05-14 06:45:56 -07:00
committed by GitHub
parent 843e7e15fe
commit 03aacd017e
39 changed files with 617 additions and 462 deletions
@@ -1,53 +1,53 @@
// Attempts to install the hardware into apropriate slot.
/obj/item/modular_computer/proc/try_install_component(var/mob/living/user, var/obj/item/computer_hardware/H, var/found = 0)
/// Attempts to install the hardware into apropriate slot.
/obj/item/modular_computer/proc/try_install_component(mob/living/user, obj/item/computer_hardware/H, found = FALSE)
// "USB" flash drive.
if(istype(H, /obj/item/computer_hardware/hard_drive/portable))
if(portable_drive)
to_chat(user, "This computer's portable drive slot is already occupied by \the [portable_drive].")
return
found = 1
found = TRUE
portable_drive = H
else if(istype(H, /obj/item/computer_hardware/hard_drive))
if(hard_drive)
to_chat(user, "This computer's hard drive slot is already occupied by \the [hard_drive].")
return
found = 1
found = TRUE
hard_drive = H
else if(istype(H, /obj/item/computer_hardware/network_card))
if(network_card)
to_chat(user, "This computer's network card slot is already occupied by \the [network_card].")
return
found = 1
found = TRUE
network_card = H
else if(istype(H, /obj/item/computer_hardware/nano_printer))
if(nano_printer)
to_chat(user, "This computer's nano printer slot is already occupied by \the [nano_printer].")
return
found = 1
found = TRUE
nano_printer = H
else if(istype(H, /obj/item/computer_hardware/card_slot))
if(card_slot)
to_chat(user, "This computer's card slot is already occupied by \the [card_slot].")
return
found = 1
found = TRUE
card_slot = H
else if(istype(H, /obj/item/computer_hardware/battery_module))
if(battery_module)
to_chat(user, "This computer's battery slot is already occupied by \the [battery_module].")
return
found = 1
found = TRUE
battery_module = H
else if(istype(H, /obj/item/computer_hardware/processor_unit))
if(processor_unit)
to_chat(user, "This computer's processor slot is already occupied by \the [processor_unit].")
return
found = 1
found = TRUE
processor_unit = H
else if(istype(H, /obj/item/computer_hardware/tesla_link))
if(tesla_link)
to_chat(user, "This computer's tesla link slot is already occupied by \the [tesla_link].")
return
found = 1
found = TRUE
tesla_link = H
if(found)
to_chat(user, "You install \the [H] into \the [src]")
@@ -56,34 +56,34 @@
H.forceMove(src)
update_verbs()
// Uninstalls component. Found and Critical vars may be passed by parent types, if they have additional hardware.
/obj/item/modular_computer/proc/uninstall_component(var/mob/living/user, var/obj/item/computer_hardware/H, var/found = 0, var/critical = 0)
/// Uninstalls component. Found and Critical vars may be passed by parent types, if they have additional hardware.
/obj/item/modular_computer/proc/uninstall_component(mob/living/user, obj/item/computer_hardware/H, found = FALSE, critical = FALSE)
if(portable_drive == H)
portable_drive = null
found = 1
found = TRUE
if(hard_drive == H)
hard_drive = null
found = 1
critical = 1
found = TRUE
critical = TRUE
if(network_card == H)
network_card = null
found = 1
found = TRUE
if(nano_printer == H)
nano_printer = null
found = 1
found = TRUE
if(card_slot == H)
card_slot = null
found = 1
found = TRUE
if(battery_module == H)
battery_module = null
found = 1
found = TRUE
if(processor_unit == H)
processor_unit = null
found = 1
critical = 1
found = TRUE
critical = TRUE
if(tesla_link == H)
tesla_link = null
found = 1
found = TRUE
if(found)
if(user)
to_chat(user, "You remove \the [H] from \the [src].")
@@ -92,13 +92,13 @@
update_verbs()
if(critical && enabled)
if(user)
to_chat(user, "<span class='danger'>\The [src]'s screen freezes for few seconds and then displays an \"HARDWARE ERROR: Critical component disconnected. Please verify component connection and reboot the device. If the problem persists contact technical support for assistance.\" warning.</span>")
to_chat(user, SPAN_DANGER("\The [src]'s screen freezes for few seconds and then displays an \"HARDWARE ERROR: Critical component disconnected. Please verify component connection and reboot the device. If the problem persists contact technical support for assistance.\" warning."))
shutdown_computer()
update_icon()
// Checks all hardware pieces to determine if name matches, if yes, returns the hardware piece, otherwise returns null
/obj/item/modular_computer/proc/find_hardware_by_name(var/name)
/// Checks all hardware pieces to determine if name matches, if yes, returns the hardware piece, otherwise returns null.
/obj/item/modular_computer/proc/find_hardware_by_name(name)
if(portable_drive && (portable_drive.name == name))
return portable_drive
if(hard_drive && (hard_drive.name == name))
@@ -117,7 +117,7 @@
return tesla_link
return null
// Returns list of all components
/// Returns list of all components.
/obj/item/modular_computer/proc/get_all_components()
var/list/all_components = list()
if(hard_drive)