Record computers to modular computers (#7797)

Things this does:

    Refactors _app_preset_name to use a type name instead. This makes it validate the presets at compile time, making it much more secure.
    Removes all records computers from the code, along with the CMC.
    Replaces all records computers with appropriate modular computers
    Each head of staff now has 1 departmental computer, 1 head-specific computer, 1 head laptop
    Removes the C&C program from the heads that had it, because you're supposed to use the bridge for it.
This commit is contained in:
Erki
2019-12-27 15:58:12 +02:00
committed by GitHub
parent 8fce204145
commit 8ce37c8b28
22 changed files with 202 additions and 757 deletions
@@ -38,9 +38,9 @@
playsound(loc, "computerbeep", 30, 1, 10, required_preferences = SOUND_AMBIENCE)
ambience_last_played = world.time
/obj/item/modular_computer/proc/get_preset_programs(var/app_preset_name)
/obj/item/modular_computer/proc/get_preset_programs(preset_type)
for (var/datum/modular_computer_app_presets/prs in ntnet_global.available_software_presets)
if(prs.name == app_preset_name)
if(prs.type == preset_type)
return prs.return_install_programs()
// Used to perform preset-specific hardware changes.
@@ -50,7 +50,7 @@
// Used to install preset-specific programs
/obj/item/modular_computer/proc/install_default_programs()
if(enrolled)
var/programs = get_preset_programs(_app_preset_name)
var/programs = get_preset_programs(_app_preset_type)
for (var/datum/computer_file/program/prog in programs)
hard_drive.store_file(prog)
@@ -18,7 +18,7 @@
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/enrolled = 0 // Weather the computer is enrolled in the company device management or not. 0 - unconfigured 1 - enrolled (work device) 2 - unenrolled (private device)
var/_app_preset_name = "" // Used for specifying the software preset of the console
var/_app_preset_type = null // Used for specifying the software preset of the console
var/ambience_last_played // Last time sound was played
// Modular computers can run on various devices. Each DEVICE (Laptop, Console, Tablet,..)
@@ -19,23 +19,32 @@
/obj/item/modular_computer/console/preset/install_default_programs()
..()
// Engineering
/obj/item/modular_computer/console/preset/engineering/
name = "engineering console"
_app_preset_name = "engineering"
_app_preset_type = /datum/modular_computer_app_presets/engineering
enrolled = 1
/obj/item/modular_computer/console/preset/engineering/ce
name = "engineering console"
_app_preset_type = /datum/modular_computer_app_presets/engineering/ce
enrolled = 1
// Medical
/obj/item/modular_computer/console/preset/medical/
name = "medical console"
_app_preset_name = "medical"
_app_preset_type = /datum/modular_computer_app_presets/medical
enrolled = 1
/obj/item/modular_computer/console/preset/medical/cmo
name = "medical console"
_app_preset_type = /datum/modular_computer_app_presets/medical/cmo
enrolled = 1
// Research
/obj/item/modular_computer/console/preset/research/
name = "research console"
_app_preset_name = "research"
_app_preset_type = /datum/modular_computer_app_presets/research
enrolled = 1
/obj/item/modular_computer/console/preset/research/install_default_hardware()
@@ -45,7 +54,7 @@
// Command
/obj/item/modular_computer/console/preset/command/
name = "command console"
_app_preset_name = "command"
_app_preset_type = /datum/modular_computer_app_presets/command
enrolled = 1
/obj/item/modular_computer/console/preset/command/install_default_hardware()
@@ -55,44 +64,42 @@
nano_printer.stored_paper = 20
card_slot = new/obj/item/computer_hardware/card_slot(src)
/obj/item/modular_computer/console/preset/captain/
/obj/item/modular_computer/console/preset/command/captain
name = "captain's console"
_app_preset_name = "captain"
_app_preset_type = /datum/modular_computer_app_presets/captain
enrolled = 1
/obj/item/modular_computer/console/preset/captain/install_default_hardware()
..()
nano_printer = new/obj/item/computer_hardware/nano_printer(src)
nano_printer.max_paper = 25
nano_printer.stored_paper = 20
card_slot = new/obj/item/computer_hardware/card_slot(src)
/obj/item/modular_computer/console/preset/command/hop
name = "command console"
_app_preset_type = /datum/modular_computer_app_presets/command/hop
enrolled = 1
// Security
/obj/item/modular_computer/console/preset/security/
name = "security console"
_app_preset_name = "security"
_app_preset_type = /datum/modular_computer_app_presets/security
enrolled = 1
/obj/item/modular_computer/console/preset/security/investigations
name = "investigations console"
_app_preset_name = "security_inv"
_app_preset_type = /datum/modular_computer_app_presets/security/investigations
enrolled = 1
/obj/item/modular_computer/console/preset/security/hos
name = "head of security's console"
_app_preset_name = "security_head"
_app_preset_type = /datum/modular_computer_app_presets/security/hos
enrolled = 1
// Civilian
/obj/item/modular_computer/console/preset/civilian/
name = "civilian console"
_app_preset_name = "civilian"
_app_preset_type = /datum/modular_computer_app_presets/civilian
enrolled = 1
// Supply
/obj/item/modular_computer/console/preset/supply/
name = "supply console"
_app_preset_name = "supply"
_app_preset_type = /datum/modular_computer_app_presets/supply
enrolled = 1
/obj/item/modular_computer/console/preset/supply/install_default_hardware()
@@ -112,13 +119,13 @@
card_slot = new/obj/item/computer_hardware/card_slot(src)
/obj/item/modular_computer/console/preset/ert/
_app_preset_name = "ert"
_app_preset_type = /datum/modular_computer_app_presets/ert
enrolled = 2
computer_emagged = TRUE
// Mercenary
/obj/item/modular_computer/console/preset/mercenary/
_app_preset_name = "merc"
_app_preset_type = /datum/modular_computer_app_presets/merc
computer_emagged = TRUE
enrolled = 2
@@ -131,7 +138,7 @@
// Merchant
/obj/item/modular_computer/console/preset/merchant
_app_preset_name = "merchant"
_app_preset_type = /datum/modular_computer_app_presets/merchant
enrolled = 2
/obj/item/modular_computer/console/preset/merchant/install_default_hardware()
@@ -143,5 +150,5 @@
// AI
/obj/item/modular_computer/console/preset/ai
_app_preset_name = "ai"
_app_preset_type = /datum/modular_computer_app_presets/ai
enrolled = 2
@@ -21,31 +21,31 @@
/obj/item/modular_computer/laptop/preset/engineering/
name = "engineering laptop"
desc = "A portable computer belonging to the engineering department. It appears to have been used as a door stop at one point or another."
_app_preset_name = "engineering"
_app_preset_type = /datum/modular_computer_app_presets/engineering
enrolled = 1
/obj/item/modular_computer/laptop/preset/engineering/ce/
name = "chief engineer's laptop"
desc = "A portable computer belonging to the chief engineer."
_app_preset_name = "engineering_head"
_app_preset_type = /datum/modular_computer_app_presets/engineering/ce
// Medical
/obj/item/modular_computer/laptop/preset/medical/
name = "medical laptop"
desc = "A portable computer belonging to the medical department."
_app_preset_name = "medical"
_app_preset_type = /datum/modular_computer_app_presets/medical
enrolled = 1
/obj/item/modular_computer/laptop/preset/medical/cmo/
name = "chief medical officer's laptop"
desc = "A portable computer belonging to the chief medical officer."
_app_preset_name = "medical_head"
_app_preset_type = /datum/modular_computer_app_presets/medical/cmo
// Research
/obj/item/modular_computer/laptop/preset/research/
name = "research laptop"
desc = "A portable computer belonging to the research department."
_app_preset_name = "research"
_app_preset_type = /datum/modular_computer_app_presets/research
enrolled = 1
/obj/item/modular_computer/laptop/preset/research/install_default_hardware()
@@ -55,53 +55,53 @@
/obj/item/modular_computer/laptop/preset/research/rd/
name = "research director's laptop"
desc = "A portable computer belonging to the research director. The edges are stained and partially melted."
_app_preset_name = "research_head"
_app_preset_type = /datum/modular_computer_app_presets/research/rd
// Command
/obj/item/modular_computer/laptop/preset/command/
name = "command laptop"
_app_preset_name = "command"
_app_preset_type = /datum/modular_computer_app_presets/command
enrolled = 1
/obj/item/modular_computer/laptop/preset/command/hop/
name = "head of personnel's laptop"
desc = "A portable computer beloning to the head of personnel. The fan is filled with dog hair."
_app_preset_name = "command_hop"
_app_preset_type = /datum/modular_computer_app_presets/command/hop
/obj/item/modular_computer/laptop/preset/command/captain/
name = "captain's laptop"
desc = "A portable computer belonging to the captain."
_app_preset_name = "captain"
_app_preset_type = /datum/modular_computer_app_presets/captain
// Security
/obj/item/modular_computer/laptop/preset/security/
name = "security laptop"
desc = "A portable computer belonging to the security department."
_app_preset_name = "security"
_app_preset_type = /datum/modular_computer_app_presets/security
enrolled = 1
/obj/item/modular_computer/laptop/preset/security/hos/
name = "head of security's laptop"
desc = "A portable computer belonging to the head of security. It smells faintly of gunpowder."
_app_preset_name = "security_head"
_app_preset_type = /datum/modular_computer_app_presets/security/hos
// Civilian
/obj/item/modular_computer/laptop/preset/civilian/
_app_preset_name = "civilian"
_app_preset_type = /datum/modular_computer_app_presets/civilian
enrolled = 1
// Supply
/obj/item/modular_computer/laptop/preset/supply/
name = "supply laptop"
desc = "A portable computer belonging to cargo."
_app_preset_name = "supply"
_app_preset_type = /datum/modular_computer_app_presets/supply
enrolled = 1
// Representative
/obj/item/modular_computer/laptop/preset/representative/
name = "representative's laptop"
desc = "A portable computer belonging to the representative's office."
_app_preset_name = "representative"
_app_preset_type = /datum/modular_computer_app_presets/representative
enrolled = 1
@@ -19,5 +19,5 @@
// Cargo Delivery
/obj/item/modular_computer/tablet/preset/custom_loadout/advanced/cargo_delivery/
_app_preset_name = "cargo_delivery"
enrolled = 1
_app_preset_type = /datum/modular_computer_app_presets/cargo_delivery
enrolled = 1
@@ -6,9 +6,9 @@
network_card = new/obj/item/computer_hardware/network_card(src)
/obj/item/modular_computer/telescreen/preset/generic/
_app_preset_name = "wallgeneric"
_app_preset_type = /datum/modular_computer_app_presets/wall_generic
enrolled = 1
/obj/item/modular_computer/telescreen/preset/trashcompactor/
_app_preset_name = "trashcompactor"
_app_preset_type = /datum/modular_computer_app_presets/trashcompactor
enrolled = 1