Computer manager and more (#1406)

The downloader and the file manager no longer come default on any device.
A client enrollment app comes now with every console
The user has to select weather the device is a private or company device and select a software preset if its a work console
Work devices are locked down to a specific set of programs
Private devices get the downloader and the file manager to install programs as usual.
Threw out the backup of the old-old camera monitor.
Made software presets a generic thing that are not dependant on the form factor of a device.
Ported holowarrants from bay
Ported wall mounted consoles from bay
Ported various computer fixes from bay
Vending machines spawn now with the holowarrant "client"
Mapping changes:

CE and HoS dont get a modular computer with command preset (they did not have that before bay merge, so why should they now)
Added a modular computer with command preset to the head of staff briefing room
Replaced the camera monitoring console in the Engine Control room with a modular computer
Replaced the cam monitor in the CE´s office with a wall mounted console
Switched places of the bar sink and console
Replaced the consoles with obj/item consoles
Mapped in the ERT and Merc Console (Merc Shuttle, ERT Area)
Fixed the "border" at the heisters base
Also waiting for CCIA on a design for the warrants.
But that can be changed with a follow up pull
This commit is contained in:
Werner
2017-01-20 20:45:53 +01:00
committed by skull132
parent 58dc6dde9e
commit 9d134d8e15
56 changed files with 2095 additions and 1727 deletions
@@ -1,12 +1,6 @@
/obj/machinery/modular_computer/initial_data()
return cpu ? cpu.get_header_data() : ..()
/obj/item/modular_computer/initial_data()
return get_header_data()
/obj/machinery/modular_computer/update_layout()
return TRUE
/obj/item/modular_computer/update_layout()
return TRUE
@@ -31,7 +31,5 @@
// The hacked variant has access to all commonly used networks.
/datum/nano_module/camera_monitor/hacked/modify_networks_list(var/list/networks)
networks.Add(list(list("tag" = NETWORK_MERCENARY, "has_access" = 1)))
networks.Add(list(list("tag" = NETWORK_ERT, "has_access" = 1)))
networks.Add(list(list("tag" = NETWORK_CRESCENT, "has_access" = 1)))
return networks
@@ -16,25 +16,24 @@
activate()
/datum/computer_file/program/revelation/proc/activate()
if(computer)
computer.visible_message("<span class='notice'>\The [computer]'s screen brightly flashes and loud electrical buzzing is heard.</span>")
computer.enabled = 0
computer.update_icon()
if(!computer)
return
computer.visible_message("<span class='notice'>\The [computer]'s screen brightly flashes and loud electrical buzzing is heard.</span>")
computer.enabled = 0
computer.update_icon()
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(10, 1, computer.loc)
s.start()
if(computer.hard_drive)
qdel(computer.hard_drive)
if(computer.battery_module && prob(25))
qdel(computer.battery_module)
computer.visible_message("<span class='notice'>\The [computer]'s battery explodes in rain of sparks.</span>")
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(10, 1, computer.loc)
s.start()
if(istype(computer, /obj/item/modular_computer/processor))
var/obj/item/modular_computer/processor/P = computer
if(P.machinery_computer.tesla_link && prob(50))
qdel(P.machinery_computer.tesla_link)
computer.visible_message("<span class='notice'>\The [computer]'s tesla link explodes in rain of sparks.</span>")
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(10, 1, computer.loc)
s.start()
if(computer.battery_module && prob(25))
qdel(computer.battery_module)
if(computer.tesla_link && prob(50))
qdel(computer.tesla_link)
/datum/computer_file/program/revelation/Topic(href, href_list)
if(..())
@@ -0,0 +1,146 @@
/datum/modular_computer_app_presets
var/name = "default_preset"
var/display_name = "default preset"
var/description = "Description of the preset"
var/available = 0
/datum/modular_computer_app_presets/proc/return_install_programs()
return list()
/datum/modular_computer_app_presets/all
name = "all"
display_name = "All Programs"
description = "Contains all Progams"
available = 0
/datum/modular_computer_app_presets/all/return_install_programs()
var/list/_prg_list = list()
for(var/F in typesof(/datum/computer_file/program))
var/datum/computer_file/program/prog = new F
_prg_list += prog
return _prg_list
/datum/modular_computer_app_presets/engineering
name = "engineering"
display_name = "Engineering"
description = "Contains the most common engineering Programs"
available = 1
/datum/modular_computer_app_presets/engineering/return_install_programs()
var/list/_prg_list = list(
new/datum/computer_file/program/power_monitor(),
new/datum/computer_file/program/alarm_monitor(),
new/datum/computer_file/program/atmos_control(),
new/datum/computer_file/program/rcon_console(),
new/datum/computer_file/program/camera_monitor(),
new/datum/computer_file/program/lighting_control(),
new/datum/computer_file/program/chatclient()
)
return _prg_list
/datum/modular_computer_app_presets/medical
name = "medical"
display_name = "Medical"
description = "Contains the most common medical Programs"
available = 1
/datum/modular_computer_app_presets/medical/return_install_programs()
var/list/_prg_list = list(
new/datum/computer_file/program/chatclient(),
new/datum/computer_file/program/suit_sensors()
)
return _prg_list
/datum/modular_computer_app_presets/research
name = "research"
display_name = "Research"
description = "Contains the most common research Programs"
available = 1
/datum/modular_computer_app_presets/research/return_install_programs()
var/list/_prg_list = list(
new/datum/computer_file/program/chatclient(),
new/datum/computer_file/program/ntnetmonitor(),
new/datum/computer_file/program/aidiag(),
new/datum/computer_file/program/exosuit_monitor()
)
return _prg_list
/datum/modular_computer_app_presets/command
name = "command"
display_name = "Command"
description = "Contains the most common command Programs"
available = 1
/datum/modular_computer_app_presets/command/return_install_programs()
var/list/_prg_list = list(
new/datum/computer_file/program/chatclient(),
new/datum/computer_file/program/card_mod(),
new/datum/computer_file/program/comm()
)
return _prg_list
/datum/modular_computer_app_presets/security
name = "security"
display_name = "Security"
description = "Contains the most common security Programs"
available = 1
/datum/modular_computer_app_presets/security/return_install_programs()
var/list/_prg_list = list(
new/datum/computer_file/program/chatclient(),
new/datum/computer_file/program/camera_monitor(),
new/datum/computer_file/program/comm(),
new/datum/computer_file/program/digitalwarrant()
)
return _prg_list
/datum/modular_computer_app_presets/civilian
name = "civilian"
display_name = "Civilian"
description = "Contains the most common civilian Programs"
available = 1
/datum/modular_computer_app_presets/civilian/return_install_programs()
var/list/_prg_list = list(
new/datum/computer_file/program/chatclient(),
new/datum/computer_file/program/game/arcade(),
new/datum/computer_file/program/game/sudoku()
)
return _prg_list
/datum/modular_computer_app_presets/wall_generic
name = "wallgeneric"
display_name = "Wall - Generic"
description = "A generic preset for the wall console"
available = 0
/datum/modular_computer_app_presets/wall_generic/return_install_programs()
var/list/_prg_list = list(
new/datum/computer_file/program/chatclient(),
new/datum/computer_file/program/camera_monitor(),
new/datum/computer_file/program/alarm_monitor()
)
return _prg_list
/datum/modular_computer_app_presets/merc
name = "merc"
display_name = "Mercenary"
description = "Preset for the Merc Console"
available = 0
/datum/modular_computer_app_presets/merc/return_install_programs()
var/list/_prg_list = list(
new/datum/computer_file/program/filemanager(),
new/datum/computer_file/program/ntnetdownload(),
new/datum/computer_file/program/camera_monitor/hacked()
)
return _prg_list
/datum/modular_computer_app_presets/ert
name = "ert"
display_name = "EmergencyResposeTeam"
description = "Preset for the ERT Console"
available = 0
/datum/modular_computer_app_presets/ert/return_install_programs()
var/list/_prg_list = list(
new/datum/computer_file/program/filemanager(),
new/datum/computer_file/program/ntnetdownload(),
new/datum/computer_file/program/camera_monitor/hacked(),
new/datum/computer_file/program/comm(),
new/datum/computer_file/program/suit_sensors(),
new/datum/computer_file/program/alarm_monitor(),
new/datum/computer_file/program/lighting_control(),
new/datum/computer_file/program/aidiag()
)
return _prg_list
@@ -0,0 +1,140 @@
var/warrant_uid = 0
/datum/datacore/var/list/warrants[] = list()
/datum/data/record/warrant
var/warrant_id
/datum/data/record/warrant/New()
..()
warrant_id = warrant_uid++
/datum/computer_file/program/digitalwarrant
filename = "digitalwarrant"
filedesc = "Warrant Assistant"
extended_desc = "Official NTsec program for creation and handling of warrants."
size = 8
requires_ntnet = 1
available_on_ntnet = 1
required_access_download = access_hos
required_access_run = access_security
usage_flags = PROGRAM_ALL
nanomodule_path = /datum/nano_module/program/digitalwarrant/
/datum/nano_module/program/digitalwarrant/
name = "Warrant Assistant"
var/datum/data/record/warrant/activewarrant
/datum/nano_module/program/digitalwarrant/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = default_state)
var/list/data = host.initial_data()
if(activewarrant)
data["warrantname"] = activewarrant.fields["namewarrant"]
data["warrantcharges"] = activewarrant.fields["charges"]
data["warrantauth"] = activewarrant.fields["auth"]
data["type"] = activewarrant.fields["arrestsearch"]
else
var/list/allwarrants = list()
for(var/datum/data/record/warrant/W in data_core.warrants)
allwarrants.Add(list(list(
"warrantname" = W.fields["namewarrant"],
"charges" = "[copytext(W.fields["charges"],1,min(length(W.fields["charges"]) + 1, 50))]...",
"auth" = W.fields["auth"],
"id" = W.warrant_id,
"arrestsearch" = W.fields["arrestsearch"]
)))
data["allwarrants"] = allwarrants
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "digitalwarrant.tmpl", name, 500, 350, state = state)
ui.auto_update_layout = 1
ui.set_initial_data(data)
ui.open()
/datum/nano_module/program/digitalwarrant/Topic(href, href_list)
if(..())
return 1
if(href_list["sw_menu"])
activewarrant = null
if(href_list["editwarrant"])
. = 1
for(var/datum/data/record/warrant/W in data_core.warrants)
if(W.warrant_id == text2num(href_list["editwarrant"]))
activewarrant = W
break
// The following actions will only be possible if the user has an ID with security access equipped. This is in line with modular computer framework's authentication methods,
// which also use RFID scanning to allow or disallow access to some functions. Anyone can view warrants, editing requires ID.
var/mob/user = usr
if(!istype(user))
return
var/obj/item/weapon/card/id/I = user.GetIdCard()
if(!istype(I) || !I.registered_name || !(access_armory in I.access))
to_chat(user, "Authentication error: Unable to locate ID with apropriate access to allow this operation.")
return
if(href_list["addwarrant"])
. = 1
var/datum/data/record/warrant/W = new()
var/temp = sanitize(input(usr, "Do you want to create a search-, or an arrest warrant?") as null|anything in list("search","arrest"))
if(CanInteract(user, default_state))
if(temp == "arrest")
W.fields["namewarrant"] = "Unknown"
W.fields["charges"] = "No charges present"
W.fields["auth"] = "Unauthorized"
W.fields["arrestsearch"] = "arrest"
if(temp == "search")
W.fields["namewarrant"] = "No location given"
W.fields["charges"] = "No reason given"
W.fields["auth"] = "Unauthorized"
W.fields["arrestsearch"] = "search"
activewarrant = W
if(href_list["savewarrant"])
. = 1
data_core.warrants |= activewarrant
activewarrant = null
if(href_list["deletewarrant"])
. = 1
data_core.warrants -= activewarrant
activewarrant = null
if(href_list["editwarrantname"])
. = 1
var/namelist = list()
for(var/datum/data/record/t in data_core.general)
namelist += t.fields["name"]
var/new_name = sanitize(input(usr, "Please input name") as null|anything in namelist)
if(CanInteract(user, default_state))
if (!new_name)
return
activewarrant.fields["namewarrant"] = new_name
if(href_list["editwarrantnamecustom"])
. = 1
var/new_name = sanitize(input("Please input name") as null|text)
if(CanInteract(user, default_state))
if (!new_name)
return
activewarrant.fields["namewarrant"] = new_name
if(href_list["editwarrantcharges"])
. = 1
var/new_charges = sanitize(input("Please input charges", "Charges", activewarrant.fields["charges"]) as null|text)
if(CanInteract(user, default_state))
if (!new_charges)
return
activewarrant.fields["charges"] = new_charges
if(href_list["editwarrantauth"])
. = 1
activewarrant.fields["auth"] = "[I.registered_name] - [I.assignment ? I.assignment : "(Unknown)"]"
if(href_list["back"])
. = 1
activewarrant = null
@@ -0,0 +1,113 @@
// This is special hardware configuration program.
// It is to be used only with modular computers.
// It allows you to toggle components of your device.
/datum/computer_file/program/clientmanager
filename = "clientmanager"
filedesc = "NTOS Client Manager"
extended_desc = "This program allows configuration of computer's software"
program_icon_state = "generic"
unsendable = 1
undeletable = 1
size = 4
available_on_ntnet = 0
requires_ntnet = 0
nanomodule_path = /datum/nano_module/program/clientmanager/
var/_dev_type = 1 //1 - Company Device ,2 - Private device
var/_dev_preset = "civilian"
var/_error_message = null
/datum/nano_module/program/clientmanager
name = "NTOS Client Manager"
var/obj/item/modular_computer/movable = null
/datum/computer_file/program/clientmanager/Topic(href, href_list)
if(..())
return 1
if(href_list["PRG_dev_type"])
_dev_type = text2num(href_list["PRG_dev_type"])
return 1
if(href_list["PRG_dev_preset"])
_dev_preset = href_list["PRG_dev_preset"]
return 1
if(href_list["PRG_enroll"])
if(ntnet_global.check_function(NTNET_SOFTWAREDOWNLOAD))
_error_message = null
if(_dev_type == 1)
enroll_company_device()
return 1
if(_dev_type == 2)
enroll_private_device()
return 1
return 0
else
_error_message = "NTNET unavailable. Unable to enroll device"
return 0
//Set´s up the computer with the file manager and the downloader and removes the lock
/datum/computer_file/program/clientmanager/proc/enroll_private_device()
if(!computer)
return 0
computer.enrolled = 2 // private devices
computer.hard_drive.store_file(new/datum/computer_file/program/filemanager())
computer.hard_drive.store_file(new/datum/computer_file/program/ntnetdownload())
return 1
//Set´s up the programs from the preset
/datum/computer_file/program/clientmanager/proc/enroll_company_device()
if(!computer || !_dev_type || !_dev_preset)
return 0
for (var/datum/modular_computer_app_presets/prs in ntnet_global.available_software_presets)
if(prs.name == _dev_preset && prs.available == 1)
var/list/prs_programs = prs.return_install_programs()
for (var/datum/computer_file/program/prog in prs_programs)
computer.hard_drive.store_file(prog)
computer.enrolled = 1 // enroll as company device after finding matching preset and storing software
return 1
return 0
/datum/nano_module/program/clientmanager/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = default_state)
var/list/data = list()
if(program)
movable = program.computer
data = program.get_header_data()
if(!istype(movable))
movable = null
var/datum/computer_file/program/clientmanager/PRG = program
// For now limited to execution by the downloader program
// No computer connection, we can't get data from that.
if(!PRG || !istype(PRG) || !movable )
return 0
data["status_enrollment"] = movable.enrolled
data["status_compliance"] = 1 // 0 - Not Complaint 1 - Compliant //For now. TODO-IT: Run actual compliance checks
data["status_remote"] = 1 // 0 - Disabled 1 - Enabled //For now. TODO-IT: ability to enable and disable remote control
if(!movable.enrolled)
data["dev_type"] = PRG._dev_type
var/list/all_presets = list()
for (var/datum/modular_computer_app_presets/prs in ntnet_global.available_software_presets)
if(prs.available)
all_presets.Add(list(list(
"name" = prs.name,
"display_name" = prs.display_name,
"description" = prs.description
)))
data["dev_presets"] = all_presets
data["dev_preset"] = PRG._dev_preset
else if(movable.enrolled > 2)
PRG._error_message = "Unable to determine enrollment status. Contact IT department"
data["error_message"] = PRG._error_message
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "ntnet_clientmanager.tmpl", "NTOS Client Manager", 575, 700, state = state)
ui.auto_update_layout = 1
ui.set_initial_data(data)
ui.open()
@@ -125,7 +125,7 @@
. = 1
var/obj/item/weapon/computer_hardware/hard_drive/HDD = computer.hard_drive
var/obj/item/weapon/computer_hardware/hard_drive/portable/RHDD = computer.portable_drive
if(!HDD || !RHDD || computer.software_locked)
if(!HDD || !RHDD || computer.enrolled != 2)
return 1
var/datum/computer_file/F = HDD.find_file_by_name(href_list["PRG_copytousb"])
if(!F || !istype(F))
@@ -136,7 +136,7 @@
. = 1
var/obj/item/weapon/computer_hardware/hard_drive/HDD = computer.hard_drive
var/obj/item/weapon/computer_hardware/hard_drive/portable/RHDD = computer.portable_drive
if(!HDD || !RHDD || computer.software_locked)
if(!HDD || !RHDD || computer.enrolled != 2)
return 1
var/datum/computer_file/F = RHDD.find_file_by_name(href_list["PRG_copyfromusb"])
if(!F || !istype(F))
@@ -32,7 +32,10 @@
if(PRG.available_on_syndinet && !computer_emagged)
return 0
if(!computer || !computer.hard_drive || !computer.hard_drive.try_store_file(PRG) || computer.software_locked)
if(!computer || !computer.hard_drive || !computer.hard_drive.try_store_file(PRG))
return 0
if(computer.enrolled == 1 && !computer_emagged)
return 0
ui_header = "downloader_running.gif"
@@ -167,7 +170,7 @@
ui.set_auto_update(0)//No need for auto updating on the software menu
data["disk_size"] = my_computer.hard_drive.max_capacity
data["disk_used"] = my_computer.hard_drive.used_capacity
if(!my_computer.software_locked) //To lock installation of software on work computers until the IT Department is properly implemented
if(my_computer.enrolled == 2) //To lock installation of software on work computers until the IT Department is properly implemented - Then check for access on enrolled computers
data += get_programlist(user)
else
data["downloadable_programs"] = list()
@@ -227,4 +230,3 @@
data["downloadable_programs"] = all_entries
return data