mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-20 20:06:42 +01:00
PCUs and SR Connected Computers (#4040)
* PCU and Connected Consoles * Clean this up
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
/obj/item/modular_computer/process(delta_time)
|
||||
if(!enabled) // The computer is turned off
|
||||
last_power_usage = 0
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
if(damage > broken_damage)
|
||||
shutdown_computer()
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
if(active_program && active_program.requires_ntnet && !get_ntnet_status(active_program.requires_ntnet_feature)) // Active program requires NTNet to run but we've just lost connection. Crash.
|
||||
// Active program requires NTNet to run but we've just lost connection. Crash.
|
||||
if(active_program && active_program.requires_ntnet && !get_ntnet_status(active_program.requires_ntnet_feature))
|
||||
active_program.event_networkfailure(0)
|
||||
|
||||
for(var/datum/computer_file/program/P in idle_threads)
|
||||
@@ -33,13 +34,13 @@
|
||||
handle_power() // Handles all computer power interaction
|
||||
check_update_ui_need()
|
||||
|
||||
// Used to perform preset-specific hardware changes.
|
||||
/// Used to perform preset-specific hardware changes.
|
||||
/obj/item/modular_computer/proc/install_default_hardware()
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
// Used to install preset-specific programs
|
||||
/// Used to install preset-specific programs
|
||||
/obj/item/modular_computer/proc/install_default_programs()
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/obj/item/modular_computer/Initialize(mapload)
|
||||
. = ..()
|
||||
@@ -63,9 +64,9 @@
|
||||
to_chat(user, "\The [src] was already emagged.")
|
||||
return //NO_EMAG_ACT
|
||||
else
|
||||
computer_emagged = 1
|
||||
computer_emagged = TRUE
|
||||
to_chat(user, "You emag \the [src]. It's screen briefly shows a \"OVERRIDE ACCEPTED: New software downloads available.\" message.")
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/obj/item/modular_computer/update_icon()
|
||||
icon_state = icon_state_unpowered
|
||||
@@ -87,11 +88,11 @@
|
||||
else
|
||||
overlays.Add(icon_state_menu)
|
||||
|
||||
/obj/item/modular_computer/proc/turn_on(var/mob/user)
|
||||
/obj/item/modular_computer/proc/turn_on(mob/user)
|
||||
if(bsod)
|
||||
return
|
||||
if(tesla_link)
|
||||
tesla_link.enabled = 1
|
||||
tesla_link.enabled = TRUE
|
||||
var/issynth = issilicon(user) // Robots and AIs get different activation messages.
|
||||
if(damage > broken_damage)
|
||||
if(issynth)
|
||||
@@ -112,8 +113,8 @@
|
||||
else
|
||||
to_chat(user, "You press the power button but \the [src] does not respond")
|
||||
|
||||
// Relays kill program request to currently active program. Use this to quit current program.
|
||||
/obj/item/modular_computer/proc/kill_program(var/forced = 0)
|
||||
/// Relays kill program request to currently active program. Use this to quit current program.
|
||||
/obj/item/modular_computer/proc/kill_program(forced = FALSE)
|
||||
if(active_program)
|
||||
active_program.kill_program(forced)
|
||||
active_program = null
|
||||
@@ -123,28 +124,28 @@
|
||||
update_icon()
|
||||
|
||||
// Returns 0 for No Signal, 1 for Low Signal and 2 for Good Signal. 3 is for wired connection (always-on)
|
||||
/obj/item/modular_computer/proc/get_ntnet_status(var/specific_action = 0)
|
||||
/obj/item/modular_computer/proc/get_ntnet_status(specific_action = 0)
|
||||
if(network_card)
|
||||
return network_card.get_signal(specific_action)
|
||||
else
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
/obj/item/modular_computer/proc/add_log(var/text)
|
||||
/obj/item/modular_computer/proc/add_log(text)
|
||||
if(!get_ntnet_status())
|
||||
return 0
|
||||
return FALSE
|
||||
return ntnet_global.add_log(text, network_card)
|
||||
|
||||
/obj/item/modular_computer/proc/shutdown_computer(var/loud = 1)
|
||||
/obj/item/modular_computer/proc/shutdown_computer(loud = TRUE)
|
||||
kill_program(1)
|
||||
for(var/datum/computer_file/program/P in idle_threads)
|
||||
P.kill_program(1)
|
||||
idle_threads.Remove(P)
|
||||
if(loud)
|
||||
visible_message("\The [src] shuts down.")
|
||||
enabled = 0
|
||||
enabled = FALSE
|
||||
update_icon()
|
||||
|
||||
/obj/item/modular_computer/proc/enable_computer(var/mob/user = null)
|
||||
/obj/item/modular_computer/proc/enable_computer(mob/user = null)
|
||||
enabled = 1
|
||||
update_icon()
|
||||
|
||||
@@ -169,7 +170,6 @@
|
||||
if(istype(user))
|
||||
nano_ui_interact(user) // Re-open the UI on this computer. It should show the main screen now.
|
||||
|
||||
|
||||
/obj/item/modular_computer/proc/run_program(prog)
|
||||
var/datum/computer_file/program/P = null
|
||||
var/mob/user = usr
|
||||
@@ -177,7 +177,7 @@
|
||||
P = hard_drive.find_file_by_name(prog)
|
||||
|
||||
if(!P || !istype(P)) // Program not found or it's not executable program.
|
||||
to_chat(user, "<span class='danger'>\The [src]'s screen shows \"I/O ERROR - Unable to run [prog]\" warning.</span>")
|
||||
to_chat(user, SPAN_DANGER("\The [src]'s screen shows \"I/O ERROR - Unable to run [prog]\" warning."))
|
||||
return
|
||||
|
||||
P.computer = src
|
||||
@@ -192,11 +192,11 @@
|
||||
return
|
||||
|
||||
if(idle_threads.len >= processor_unit.max_idle_programs+1)
|
||||
to_chat(user, "<span class='notice'>\The [src] displays a \"Maximal CPU load reached. Unable to run another program.\" error</span>")
|
||||
to_chat(user, SPAN_NOTICE("\The [src] displays a \"Maximal CPU load reached. Unable to run another program.\" error"))
|
||||
return
|
||||
|
||||
if(P.requires_ntnet && !get_ntnet_status(P.requires_ntnet_feature)) // The program requires NTNet connection, but we are not connected to NTNet.
|
||||
to_chat(user, "<span class='danger'>\The [src]'s screen shows \"NETWORK ERROR - Unable to connect to NTNet. Please retry. If problem persists contact your system administrator.\" warning.</span>")
|
||||
to_chat(user, SPAN_DANGER("\The [src]'s screen shows \"NETWORK ERROR - Unable to connect to NTNet. Please retry. If problem persists contact your system administrator.\" warning."))
|
||||
return
|
||||
|
||||
if(active_program)
|
||||
@@ -204,7 +204,7 @@
|
||||
|
||||
if(P.run_program(user))
|
||||
update_icon()
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/obj/item/modular_computer/proc/update_uis()
|
||||
if(active_program) //Should we update program ui or computer ui?
|
||||
@@ -215,16 +215,16 @@
|
||||
SSnanoui.update_uis(src)
|
||||
|
||||
/obj/item/modular_computer/proc/check_update_ui_need()
|
||||
var/ui_update_needed = 0
|
||||
var/ui_update_needed = FALSE
|
||||
if(battery_module)
|
||||
var/batery_percent = battery_module.battery.percent()
|
||||
if(last_battery_percent != batery_percent) //Let's update UI on percent change
|
||||
ui_update_needed = 1
|
||||
ui_update_needed = TRUE
|
||||
last_battery_percent = batery_percent
|
||||
|
||||
if(stationtime2text() != last_world_time)
|
||||
last_world_time = stationtime2text()
|
||||
ui_update_needed = 1
|
||||
ui_update_needed = TRUE
|
||||
|
||||
if(idle_threads.len)
|
||||
var/list/current_header_icons = list()
|
||||
@@ -237,25 +237,25 @@
|
||||
|
||||
else if(!(last_header_icons ~= current_header_icons))
|
||||
last_header_icons = current_header_icons
|
||||
ui_update_needed = 1
|
||||
ui_update_needed = TRUE
|
||||
else
|
||||
for(var/x in last_header_icons|current_header_icons)
|
||||
if(last_header_icons[x]!=current_header_icons[x])
|
||||
last_header_icons = current_header_icons
|
||||
ui_update_needed = 1
|
||||
ui_update_needed = TRUE
|
||||
break
|
||||
|
||||
if(ui_update_needed)
|
||||
update_uis()
|
||||
|
||||
// Used by camera monitor program
|
||||
/obj/item/modular_computer/check_eye(var/mob/user)
|
||||
/obj/item/modular_computer/check_eye(mob/user)
|
||||
if(active_program)
|
||||
return active_program.check_eye(user)
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/modular_computer/relaymove(var/mob/user, direction)
|
||||
/obj/item/modular_computer/relaymove(mob/user, direction)
|
||||
if(active_program)
|
||||
return active_program.relaymove(user, direction)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/obj/item/modular_computer/examine(mob/user)
|
||||
. = ..()
|
||||
if(damage > broken_damage)
|
||||
. += "<span class='danger'>It is heavily damaged!</span>"
|
||||
. += SPAN_DANGER("It is heavily damaged!")
|
||||
else if(damage)
|
||||
. += "It is damaged."
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
H.take_damage(rand(10,30))
|
||||
qdel()
|
||||
|
||||
/obj/item/modular_computer/take_damage(var/amount, var/component_probability, var/damage_casing = 1, var/randomize = 1)
|
||||
/obj/item/modular_computer/take_damage(amount, component_probability, damage_casing = TRUE, randomize = TRUE)
|
||||
if(randomize)
|
||||
// 75%-125%, rand() works with integers, apparently.
|
||||
amount *= (rand(75, 125) / 100.0)
|
||||
@@ -33,19 +33,23 @@
|
||||
if(damage >= max_damage)
|
||||
break_apart()
|
||||
|
||||
// Stronger explosions cause serious damage to internal components
|
||||
// Minor explosions are mostly mitigitated by casing.
|
||||
/obj/item/modular_computer/ex_act(var/severity)
|
||||
/**
|
||||
* Stronger explosions cause serious damage to internal components
|
||||
* Minor explosions are mostly mitigitated by casing.
|
||||
*/
|
||||
/obj/item/modular_computer/ex_act(severity)
|
||||
take_damage(rand(100,200) / severity, 30 / severity)
|
||||
|
||||
// EMPs are similar to explosions, but don't cause physical damage to the casing. Instead they screw up the components
|
||||
/obj/item/modular_computer/emp_act(var/severity)
|
||||
/// EMPs are similar to explosions, but don't cause physical damage to the casing. Instead they screw up the components
|
||||
/obj/item/modular_computer/emp_act(severity)
|
||||
take_damage(rand(100,200) / severity, 50 / severity, 0)
|
||||
|
||||
// "Stun" weapons can cause minor damage to components (short-circuits?)
|
||||
// "Burn" damage is equally strong against internal components and exterior casing
|
||||
// "Brute" damage mostly damages the casing.
|
||||
/obj/item/modular_computer/bullet_act(var/obj/item/projectile/Proj)
|
||||
/**
|
||||
* "Stun" weapons can cause minor damage to components (short-circuits?)
|
||||
* "Burn" damage is equally strong against internal components and exterior casing
|
||||
* "Brute" damage mostly damages the casing.
|
||||
*/
|
||||
/obj/item/modular_computer/bullet_act(obj/item/projectile/Proj)
|
||||
switch(Proj.damage_type)
|
||||
if(BRUTE)
|
||||
take_damage(Proj.damage, Proj.damage / 2)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -13,20 +13,20 @@
|
||||
set src in view(1)
|
||||
|
||||
if(usr.incapacitated() || !istype(usr, /mob/living))
|
||||
to_chat(usr, "<span class='warning'>You can't do that.</span>")
|
||||
to_chat(usr, SPAN_WARNING("You can't do that."))
|
||||
return
|
||||
|
||||
if(!Adjacent(usr))
|
||||
to_chat(usr, "<span class='warning'>You can't reach it.</span>")
|
||||
to_chat(usr, SPAN_WARNING("You can't reach it."))
|
||||
return
|
||||
|
||||
if(enabled)
|
||||
bsod = 1
|
||||
bsod = TRUE
|
||||
update_icon()
|
||||
shutdown_computer()
|
||||
to_chat(usr, "You press a hard-reset button on \the [src]. It displays a brief debug screen before shutting down.")
|
||||
spawn(2 SECONDS)
|
||||
bsod = 0
|
||||
bsod = FALSE
|
||||
update_icon()
|
||||
|
||||
|
||||
@@ -37,11 +37,11 @@
|
||||
set src in view(1)
|
||||
|
||||
if(usr.incapacitated() || !istype(usr, /mob/living))
|
||||
to_chat(usr, "<span class='warning'>You can't do that.</span>")
|
||||
to_chat(usr, SPAN_WARNING("You can't do that."))
|
||||
return
|
||||
|
||||
if(!Adjacent(usr))
|
||||
to_chat(usr, "<span class='warning'>You can't reach it.</span>")
|
||||
to_chat(usr, SPAN_WARNING("You can't reach it."))
|
||||
return
|
||||
|
||||
proc_eject_id(usr)
|
||||
@@ -53,11 +53,11 @@
|
||||
set src in view(1)
|
||||
|
||||
if(usr.incapacitated() || !istype(usr, /mob/living))
|
||||
to_chat(usr, "<span class='warning'>You can't do that.</span>")
|
||||
to_chat(usr, SPAN_WARNING("You can't do that."))
|
||||
return
|
||||
|
||||
if(!Adjacent(usr))
|
||||
to_chat(usr, "<span class='warning'>You can't reach it.</span>")
|
||||
to_chat(usr, SPAN_WARNING("You can't reach it."))
|
||||
return
|
||||
|
||||
proc_eject_usb(usr)
|
||||
@@ -97,31 +97,31 @@
|
||||
uninstall_component(user, portable_drive)
|
||||
update_uis()
|
||||
|
||||
/obj/item/modular_computer/attack_ghost(var/mob/observer/ghost/user)
|
||||
/obj/item/modular_computer/attack_ghost(mob/observer/ghost/user)
|
||||
. = ..()
|
||||
if(enabled)
|
||||
nano_ui_interact(user)
|
||||
else if(check_rights(R_ADMIN, 0, user))
|
||||
var/response = alert(user, "This computer is turned off. Would you like to turn it on?", "Admin Override", "Yes", "No")
|
||||
var/response = tgui_alert(user, "This computer is turned off. Would you like to turn it on?", "Admin Override", list("Yes", "No"))
|
||||
if(response == "Yes")
|
||||
turn_on(user)
|
||||
|
||||
/obj/item/modular_computer/attack_ai(var/mob/user)
|
||||
/obj/item/modular_computer/attack_ai(mob/user)
|
||||
return attack_self(user)
|
||||
|
||||
/obj/item/modular_computer/attack_hand(var/mob/user)
|
||||
/obj/item/modular_computer/attack_hand(mob/user)
|
||||
if(anchored)
|
||||
return attack_self(user)
|
||||
return ..()
|
||||
|
||||
// On-click handling. Turns on the computer if it's off and opens the GUI.
|
||||
/obj/item/modular_computer/attack_self(var/mob/user)
|
||||
/// On-click handling. Turns on the computer if it's off and opens the GUI.
|
||||
/obj/item/modular_computer/attack_self(mob/user)
|
||||
if(enabled && screen_on)
|
||||
nano_ui_interact(user)
|
||||
else if(!enabled && screen_on)
|
||||
turn_on(user)
|
||||
|
||||
/obj/item/modular_computer/attackby(var/obj/item/W as obj, var/mob/user as mob)
|
||||
/obj/item/modular_computer/attackby(obj/item/W, mob/user)
|
||||
if(istype(W, /obj/item/card/id)) // ID Card, try to insert it.
|
||||
var/obj/item/card/id/I = W
|
||||
if(!card_slot)
|
||||
@@ -181,7 +181,7 @@
|
||||
for(var/obj/item/computer_hardware/H in all_components)
|
||||
component_names.Add(H.name)
|
||||
|
||||
var/choice = input(usr, "Which component do you want to uninstall?", "Computer maintenance", null) as null|anything in component_names
|
||||
var/choice = tgui_input_list(user, "Which component do you want to uninstall?", "Computer maintenance", component_names)
|
||||
|
||||
if(!choice)
|
||||
return
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
/obj/item/modular_computer/proc/power_failure(var/malfunction = 0)
|
||||
/obj/item/modular_computer/proc/power_failure(malfunction = FALSE)
|
||||
if(enabled) // Shut down the computer
|
||||
visible_message("<span class='danger'>\The [src]'s screen flickers briefly and then goes dark.</span>")
|
||||
visible_message(SPAN_DANGER("\The [src]'s screen flickers briefly and then goes dark."))
|
||||
if(active_program)
|
||||
active_program.event_powerfailure(0)
|
||||
for(var/datum/computer_file/program/PRG in idle_threads)
|
||||
PRG.event_powerfailure(1)
|
||||
shutdown_computer(0)
|
||||
|
||||
// Tries to use power from battery. Passing 0 as parameter results in this proc returning whether battery is functional or not.
|
||||
/obj/item/modular_computer/proc/battery_power(var/power_usage = 0)
|
||||
/// Tries to use power from battery. Passing 0 as parameter results in this proc returning whether battery is functional or not.
|
||||
/obj/item/modular_computer/proc/battery_power(power_usage = 0)
|
||||
apc_powered = FALSE
|
||||
if(!battery_module || !battery_module.check_functionality() || battery_module.battery.charge <= 0)
|
||||
return FALSE
|
||||
@@ -16,8 +16,8 @@
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
// Tries to use power from APC, if present.
|
||||
/obj/item/modular_computer/proc/apc_power(var/power_usage = 0)
|
||||
/// Tries to use power from APC, if present.
|
||||
/obj/item/modular_computer/proc/apc_power(power_usage = 0)
|
||||
apc_powered = TRUE
|
||||
// Tesla link was originally limited to machinery only, but this probably works too, and the benefit of being able to power all devices from an APC outweights
|
||||
// the possible minor performance loss.
|
||||
@@ -35,7 +35,7 @@
|
||||
A.use_power_oneoff(power_usage, EQUIP)
|
||||
return TRUE
|
||||
|
||||
// Handles power-related things, such as battery interaction, recharging, shutdown when it's discharged
|
||||
/// Handles power-related things, such as battery interaction, recharging, shutdown when it's discharged
|
||||
/obj/item/modular_computer/proc/handle_power()
|
||||
var/power_usage = screen_on ? base_active_power_usage : base_idle_power_usage
|
||||
for(var/obj/item/computer_hardware/H in get_all_components())
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Operates NanoUI
|
||||
/obj/item/modular_computer/nano_ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
/obj/item/modular_computer/nano_ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1)
|
||||
if(!screen_on || !enabled)
|
||||
if(ui)
|
||||
ui.close()
|
||||
|
||||
@@ -4,50 +4,83 @@
|
||||
name = "Modular Computer"
|
||||
desc = "A modular computer. You shouldn't see this."
|
||||
|
||||
var/enabled = 0 // Whether the computer is turned on.
|
||||
var/screen_on = 1 // Whether the computer is active/opened/it's screen is on.
|
||||
var/datum/computer_file/program/active_program = null // A currently active program running on the computer.
|
||||
var/hardware_flag = 0 // A flag that describes this device type
|
||||
var/last_power_usage = 0 // Last tick power usage of this computer
|
||||
var/last_battery_percent = 0 // Used for deciding if battery percentage has chandged
|
||||
/// Whether the computer is turned on.
|
||||
var/enabled = FALSE
|
||||
/// Whether the computer is active/opened/it's screen is on.
|
||||
var/screen_on = TRUE
|
||||
/// A currently active program running on the computer.
|
||||
var/datum/computer_file/program/active_program = null
|
||||
/// A flag that describes this device type.
|
||||
var/hardware_flag = 0
|
||||
/// Last tick power usage of this computer.
|
||||
var/last_power_usage = 0
|
||||
/// Used for deciding if battery percentage has chandged.
|
||||
var/last_battery_percent = 0
|
||||
var/last_world_time = "00:00"
|
||||
var/list/last_header_icons
|
||||
var/computer_emagged = FALSE // Whether the computer is emagged.
|
||||
var/apc_powered = FALSE // Set automatically. Whether the computer used APC power last tick.
|
||||
var/base_active_power_usage = 50 // Power usage when the computer is open (screen is active) and can be interacted with. Remember hardware can use power too.
|
||||
var/base_idle_power_usage = 5 // Power usage when the computer is idle and screen is off (currently only applies to laptops)
|
||||
var/bsod = FALSE // Error screen displayed
|
||||
/// Whether the computer is emagged.
|
||||
var/computer_emagged = FALSE
|
||||
/// Set automatically. Whether the computer used APC power last tick.
|
||||
var/apc_powered = FALSE
|
||||
/// Power usage when the computer is open (screen is active) and can be interacted with. Remember hardware can use power too.
|
||||
var/base_active_power_usage = 50
|
||||
/// Power usage when the computer is idle and screen is off. (currently only applies to laptops)
|
||||
var/base_idle_power_usage = 5
|
||||
/// Error screen displayed.
|
||||
var/bsod = FALSE
|
||||
|
||||
// Modular computers can run on various devices. Each DEVICE (Laptop, Console, Tablet,..)
|
||||
// must have it's own DMI file. Icon states must be called exactly the same in all files, but may look differently
|
||||
// If you create a program which is limited to Laptops and Consoles you don't have to add it's icon_state overlay for Tablets too, for example.
|
||||
|
||||
icon = null // This thing isn't meant to be used on it's own. Subtypes should supply their own icon.
|
||||
/// This thing isn't meant to be used on it's own. Subtypes should supply their own icon.
|
||||
icon = null
|
||||
icon_state = null
|
||||
//center_of_mass = null // No pixelshifting by placing on tables, etc.
|
||||
//randpixel = 0 // And no random pixelshifting on-creation either.
|
||||
var/icon_state_unpowered = null // Icon state when the computer is turned off
|
||||
var/icon_state_menu = "menu" // Icon state overlay when the computer is turned on, but no program is loaded that would override the screen.
|
||||
/// No pixelshifting by placing on tables, etc.
|
||||
//center_of_mass = null
|
||||
/// And no random pixelshifting on-creation either.
|
||||
//randpixel = 0
|
||||
|
||||
/// Icon state when the computer is turned off.
|
||||
var/icon_state_unpowered = null
|
||||
/// Icon state overlay when the computer is turned on, but no program is loaded that would override the screen.
|
||||
var/icon_state_menu = "menu"
|
||||
var/icon_state_screensaver = null
|
||||
var/max_hardware_size = 0 // Maximal hardware size. Currently, tablets have 1, laptops 2 and consoles 3. Limits what hardware types can be installed.
|
||||
var/steel_sheet_cost = 5 // Amount of steel sheets refunded when disassembling an empty frame of this computer.
|
||||
var/light_strength = 0 // Intensity of light this computer emits. Comparable to numbers light fixtures use.
|
||||
var/list/idle_threads = list() // Idle programs on background. They still receive process calls but can't be interacted with.
|
||||
/// Maximal hardware size. Currently, tablets have 1, laptops 2 and consoles 3. Limits what hardware types can be installed.
|
||||
var/max_hardware_size = 0
|
||||
/// Amount of steel sheets refunded when disassembling an empty frame of this computer.
|
||||
var/steel_sheet_cost = 5
|
||||
/// Intensity of light this computer emits. Comparable to numbers light fixtures use.
|
||||
var/light_strength = 0
|
||||
/// Idle programs on background. They still receive process calls but can't be interacted with.
|
||||
var/list/idle_threads = list()
|
||||
|
||||
// Damage of the chassis. If the chassis takes too much damage it will break apart.
|
||||
var/damage = 0 // Current damage level
|
||||
var/broken_damage = 50 // Damage level at which the computer ceases to operate
|
||||
var/max_damage = 100 // Damage level at which the computer breaks apart.
|
||||
//! Damage of the chassis. If the chassis takes too much damage it will break apart.
|
||||
/// Current damage level.
|
||||
var/damage = 0
|
||||
/// Damage level at which the computer ceases to operate.
|
||||
var/broken_damage = 50
|
||||
/// Damage level at which the computer breaks apart.
|
||||
var/max_damage = 100
|
||||
|
||||
// Important hardware (must be installed for computer to work)
|
||||
var/obj/item/computer_hardware/processor_unit/processor_unit // CPU. Without it the computer won't run. Better CPUs can run more programs at once.
|
||||
var/obj/item/computer_hardware/network_card/network_card // Network Card component of this computer. Allows connection to NTNet
|
||||
var/obj/item/computer_hardware/hard_drive/hard_drive // Hard Drive component of this computer. Stores programs and files.
|
||||
//! Important hardware (must be installed for computer to work)
|
||||
/// CPU. Without it the computer won't run. Better CPUs can run more programs at once.
|
||||
var/obj/item/computer_hardware/processor_unit/processor_unit
|
||||
/// Network Card component of this computer. Allows connection to NTNet.
|
||||
var/obj/item/computer_hardware/network_card/network_card
|
||||
/// Hard Drive component of this computer. Stores programs and files.
|
||||
var/obj/item/computer_hardware/hard_drive/hard_drive
|
||||
|
||||
// Optional hardware (improves functionality, but is not critical for computer to work in most cases)
|
||||
var/obj/item/computer_hardware/battery_module/battery_module // An internal power source for this computer. Can be recharged.
|
||||
var/obj/item/computer_hardware/card_slot/card_slot // ID Card slot component of this computer. Mostly for HoP modification console that needs ID slot for modification.
|
||||
var/obj/item/computer_hardware/nano_printer/nano_printer // Nano Printer component of this computer, for your everyday paperwork needs.
|
||||
var/obj/item/computer_hardware/hard_drive/portable/portable_drive // Portable data storage
|
||||
var/obj/item/computer_hardware/ai_slot/ai_slot // AI slot, an intellicard housing that allows modifications of AIs.
|
||||
var/obj/item/computer_hardware/tesla_link/tesla_link // Tesla Link, Allows remote charging from nearest APC.
|
||||
//! Optional hardware (improves functionality, but is not critical for computer to work in most cases)
|
||||
/// An internal power source for this computer. Can be recharged.
|
||||
var/obj/item/computer_hardware/battery_module/battery_module
|
||||
/// ID Card slot component of this computer. Mostly for HoP modification console that needs ID slot for modification.
|
||||
var/obj/item/computer_hardware/card_slot/card_slot
|
||||
/// Nano Printer component of this computer, for your everyday paperwork needs.
|
||||
var/obj/item/computer_hardware/nano_printer/nano_printer
|
||||
/// Portable data storage.
|
||||
var/obj/item/computer_hardware/hard_drive/portable/portable_drive
|
||||
/// AI slot, an intellicard housing that allows modifications of AIs.
|
||||
var/obj/item/computer_hardware/ai_slot/ai_slot
|
||||
/// Tesla Link, Allows remote charging from nearest APC.
|
||||
var/obj/item/computer_hardware/tesla_link/tesla_link
|
||||
|
||||
Reference in New Issue
Block a user