Base systems pretty much done.

Still need to convert the id computer program.
This commit is contained in:
Shadowlight213
2016-08-05 22:51:53 -07:00
parent 5d9bc548a2
commit 0c9554cd35
45 changed files with 1431 additions and 1786 deletions
@@ -28,7 +28,6 @@
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/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
// Damage of the chassis. If the chassis takes too much damage it will break apart.
var/damage = 0 // Current damage level
@@ -47,6 +46,8 @@
var/list/idle_threads = list() // Idle programs on background. They still receive process calls but can't be interacted with.
var/activetemplate = "computer_main"
var/obj/physical = null
// Eject ID card from computer, if it has ID slot with card inside.
@@ -123,7 +124,7 @@
if(response == "Yes")
turn_on(user)
/obj/item/modular_computer/emag_act(remaining_charges, mob/user)
/obj/item/modular_computer/emag_act(mob/user)
if(computer_emagged)
user << "\The [src] was already emagged."
return 0
@@ -143,6 +144,8 @@
machines += src
START_PROCESSING(SSmachine, src)
update_icon()
if(!physical)
physical = src
..()
/obj/item/modular_computer/Destroy()
@@ -172,11 +175,13 @@
return 0
// Operates NanoUI
/obj/item/modular_computer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = always_state)
// if(!screen_on || !enabled)
// if(ui)
// ui.close()
// return 0
/obj/item/modular_computer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = default_state)
if(!screen_on || !enabled)
if(ui)
ui.close()
return 0
// if((!battery_module || !battery_module.battery.charge) && !check_power_override())
// if(ui)
// ui.close()
@@ -192,7 +197,7 @@
// We are still here, that means there is no program loaded. Load the BIOS/ROM/OS/whatever you want to call it.
// This screen simply lists available programs and user may select them.
if(!hard_drive || !hard_drive.stored_files || !hard_drive.stored_files.len)
visible_message("\The [src] beeps three times, it's screen displaying \"DISK ERROR\" warning.")
physical.visible_message("\The [src] beeps three times, it's screen displaying \"DISK ERROR\" warning.")
return // No HDD, No HDD files list or no stored files. Something is very broken.
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
@@ -214,8 +219,11 @@
data["programs"] = list()
// var/list/programs = list()
for(var/datum/computer_file/program/P in hard_drive.stored_files)
var/running = 0
if(P in idle_threads)
running = 1
data["programs"] += list(list("name" = P.filename, "desc" = P.filedesc))
data["programs"] += list(list("name" = P.filename, "desc" = P.filedesc, "running" = running))
// var/list/program = list()
@@ -235,7 +243,7 @@
turn_on(user)
/obj/item/modular_computer/proc/break_apart()
visible_message("\The [src] breaks apart!")
physical.visible_message("\The [src] breaks apart!")
var/turf/newloc = get_turf(src)
new /obj/item/stack/sheet/metal(newloc, round(steel_sheet_cost/2))
for(var/obj/item/weapon/computer_hardware/H in get_all_components())
@@ -383,7 +391,7 @@
P.kill_program(1)
idle_threads.Remove(P)
if(loud)
visible_message("\The [src] shuts down.")
physical.visible_message("\The [src] shuts down.")
enabled = 0
update_icon()
return
@@ -467,7 +475,7 @@
// Used in following function to reduce copypaste
/obj/item/modular_computer/proc/power_failure(var/malfunction = 0)
if(enabled) // Shut down the computer
visible_message("<span class='danger'>\The [src]'s screen flickers \"BATTERY [malfunction ? "MALFUNCTION" : "CRITICAL"]\" warning as it shuts down unexpectedly.</span>")
physical.visible_message("<span class='danger'>\The [src]'s screen flickers \"BATTERY [malfunction ? "MALFUNCTION" : "CRITICAL"]\" warning as it shuts down unexpectedly.</span>")
if(active_program)
active_program.event_powerfailure(0)
for(var/datum/computer_file/program/PRG in idle_threads)
@@ -527,7 +535,7 @@
user << "Remove all components from \the [src] before disassembling it."
return
new /obj/item/stack/sheet/metal( get_turf(src.loc), steel_sheet_cost )
src.visible_message("\The [src] has been disassembled by [user].")
physical.visible_message("\The [src] has been disassembled by [user].")
relay_qdel()
qdel(src)
return
@@ -670,8 +678,6 @@
// 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)
world <<"ran"
world << name
if(portable_drive && (portable_drive.name == name))
return portable_drive
if(hard_drive && (hard_drive.name == name))
@@ -790,4 +796,10 @@
//if(HALLOSS)
// take_damage(Proj.damage, Proj.damage / 3, 0)
if(BURN)
take_damage(Proj.damage, Proj.damage / 1.5)
take_damage(Proj.damage, Proj.damage / 1.5)
/obj/item/modular_computer/ui_host()
if(physical)
return physical
else
return src
@@ -7,5 +7,4 @@
hardware_flag = PROGRAM_TABLET
max_hardware_size = 1
w_class = 2
light_strength = 2 // Same as PDAs
var/use_power = 1
var/use_power = 0
@@ -21,7 +21,6 @@
/obj/machinery/modular_computer/console/preset/proc/install_programs()
return
/*
// ===== ENGINEERING CONSOLE =====
/obj/machinery/modular_computer/console/preset/engineering
@@ -31,18 +30,6 @@
/obj/machinery/modular_computer/console/preset/engineering/install_programs()
cpu.hard_drive.store_file(new/datum/computer_file/program/power_monitor())
cpu.hard_drive.store_file(new/datum/computer_file/program/alarm_monitor())
cpu.hard_drive.store_file(new/datum/computer_file/program/atmos_control())
cpu.hard_drive.store_file(new/datum/computer_file/program/rcon_console())
// ===== MEDICAL CONSOLE =====
/obj/machinery/modular_computer/console/preset/medical
console_department = "Medical"
desc = "A stationary computer. This one comes preloaded with medical programs."
/obj/machinery/modular_computer/console/preset/medical/install_programs()
cpu.hard_drive.store_file(new/datum/computer_file/program/suit_sensors())
// ===== RESEARCH CONSOLE =====
/obj/machinery/modular_computer/console/preset/research
@@ -54,34 +41,6 @@
cpu.hard_drive.store_file(new/datum/computer_file/program/nttransfer())
cpu.hard_drive.store_file(new/datum/computer_file/program/chatclient())
// ===== COMMAND CONSOLE =====
/obj/machinery/modular_computer/console/preset/command
console_department = "Command"
desc = "A stationary computer. This one comes preloaded with command programs."
_has_id_slot = 1
_has_printer = 1
/obj/machinery/modular_computer/console/preset/command/install_programs()
cpu.hard_drive.store_file(new/datum/computer_file/program/chatclient())
cpu.hard_drive.store_file(new/datum/computer_file/program/card_mod())
cpu.hard_drive.store_file(new/datum/computer_file/program/comm())
/obj/machinery/modular_computer/console/preset/command/main
console_department = "Command"
desc = "A stationary computer. This one comes preloaded with essential command programs."
_has_id_slot = 1
_has_printer = 1
// ===== SECURITY CONSOLE =====
/obj/machinery/modular_computer/console/preset/security
console_department = "Security"
desc = "A stationary computer. This one comes preloaded with security programs."
/obj/machinery/modular_computer/console/preset/security/install_programs()
return // No security programs exist, yet, but the preset is ready so it may be mapped in.
// ===== CIVILIAN CONSOLE =====
/obj/machinery/modular_computer/console/preset/civilian
console_department = "Civilian"
@@ -90,5 +49,4 @@
/obj/machinery/modular_computer/console/preset/civilian/install_programs()
cpu.hard_drive.store_file(new/datum/computer_file/program/chatclient())
cpu.hard_drive.store_file(new/datum/computer_file/program/nttransfer())
cpu.hard_drive.store_file(new/datum/computer_file/program/newsbrowser())
*/
@@ -38,9 +38,8 @@ var/list/global_modular_computers = list()
if(cpu)
cpu.attack_ghost(user)
/obj/machinery/modular_computer/emag_act(remaining_charges, mob/user)
// return cpu ? cpu.emag_act(remaining_charges, user) : NO_EMAG_ACT
return 1
/obj/machinery/modular_computer/emag_act(mob/user)
return cpu ? cpu.emag_act(user) : 1
/obj/machinery/modular_computer/update_icon()
icon_state = icon_state_unpowered
@@ -78,6 +77,7 @@ var/list/global_modular_computers = list()
/obj/machinery/modular_computer/New()
..()
cpu = new(src)
cpu.physical = src
global_modular_computers.Add(src)
/obj/machinery/modular_computer/Destroy()