mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-01-01 04:52:16 +00:00
Major update
- Renames some files, tidies up some of the code - Adds forceMove() and Topic() sanity checks from github suggestions - Properly implements tablets, usage flags and portable devices in general. For now, adds codersprites (final release will have actual sprites) - Fixes some bugs - Assigns file sizes to programs
This commit is contained in:
@@ -1,29 +1,41 @@
|
||||
/*
|
||||
Program-based computers (similar to computer3 project, which this system replaces. It may, in future, be extended to other devices)
|
||||
Program-based computers, designed to replace computer3 project and eventually most consoles on station
|
||||
|
||||
|
||||
1. Basic information
|
||||
Program based computers will allow you to do multiple things from single computer. Each computer will have programs, with more being downloadable from NTNet (stationwide wireless network)
|
||||
Program based computers will allow you to do multiple things from single computer. Each computer will have programs, with more being downloadable from NTNet (stationwide network with wireless coverage)
|
||||
if user has apropriate ID card access. It will be possible to hack the computer by using an emag on it - the emag will have to be completely new and will be consumed on use, but it will
|
||||
lift ALL locks on ALL installed programs, and allow download of programs even if your ID doesn't have access to them. Computers will have hard drives that can store files.
|
||||
Files can be programs (datum/computer_file/program/ subtype) or data files (datum/computer_file/data/ subtypes). Program for sending files will be available that will allow transfer via NTNet.
|
||||
NTNet coverage will be limited to station's Z level, but better network card (=more expensive and higher power use) will allow usage everywhere. Hard drives will have limited capacity for files
|
||||
which will be related to how good hard drive you buy when purchasing the laptop. For storing more files USB-style drives will be buildable with Protolathe in research.
|
||||
|
||||
2. Laptops
|
||||
Laptops are vendable via vending machine similar to how original laptops worked. This vending machine will allow hardware selection (hardware will be described below). Laptops will be
|
||||
quite expensive, basic cost being 1499$ + cost of any extra hardware. When purchased they will contain only basic software (text editor, game, etc.) but more will be downloadable via NTNet.
|
||||
2. Available devices
|
||||
CONSOLES
|
||||
Consoles will come in various pre-fabricated loadouts, each loadout starting with certain set of programs (aka Engineering console, Medical console, etc.), of course, more software may be downloaded.
|
||||
Consoles won't usually have integrated battery, but the possibility to install one will exist for critical applications. Consoles are considered hardwired into NTNet network which means they
|
||||
will have working coverage on higher speed (Ethernet is faster than Wi-Fi) and won't require wireless coverage to exist.
|
||||
LAPTOPS
|
||||
Laptops are middle ground between actual portable devices and full consoles. They offer certain level of mobility, as they can be closed, moved somewhere else and then opened again.
|
||||
Laptops will by default have internal battery to power them, and may be recharged with rechargers. However, laptops rely on wireless NTNet coverage. Laptop HDDs are also designed with power efficiency
|
||||
in mind, which means they sacrifice some storage space for higher battery life. Laptops may be dispensed from computer vendor machine, and may be customised before vending. For people which don't
|
||||
want to rely on internal battery, tesla link exists that connects to APC, if one exists.
|
||||
TABLETS
|
||||
Tablets are smallest available devices, designed with full mobility in mind. Tablets have only weak CPU which means the software they can run is somewhat limited. They are also designed with high
|
||||
battery life in mind, which means the hardware focuses on power efficiency rather than high performance. This is most visible with hard drives which have quite small storage capacity.
|
||||
Tablets can't be equipped with tesla link, which means they have to be recharged manually.
|
||||
|
||||
3. Laptop Hardware
|
||||
Laptops will come with basic hardware installed, with upgrades being selectable when purchasing the laptop.
|
||||
Hard Drive: Basic (20 GQ, free), Advanced (35 GQ, +199$), Super (60 GQ, +499$) One file (program or data file) equals 1GQ of capacity, regardless of file contents.
|
||||
Network Card: Basic (NTNet on station Z levels, free), Advanced (NTNet on all Z levels, +399$)
|
||||
Battery: Basic (about 10 minutes of charge, free), Advanced (about 20 minutes of charge, +199$), Super (about 30 minutes of charge, +399$)
|
||||
Extras (those won't be installed by default)
|
||||
ID Card Slot (required for HoP-style programs to work. Access for security record-style programs is read from ID of user [RFID?] without requiring this) - 99$
|
||||
APC Wireless Relay (allows the computer to run from APC, including slow recharge) - 499$
|
||||
Disk Drive (allows usage of data disks that store 10GQ of data, comes with FREE disk already inside!) - 199$
|
||||
Nano Printer (allows the computer to store few pieces of paper and print text files on them [NOTE: Paper not included!]) - 199$ // HoP's best friend!
|
||||
|
||||
3. Computer Hardware
|
||||
Computers will come with basic hardware installed, with upgrades being selectable when purchasing the device.
|
||||
Hard Drive: Stores data, mandatory for the computer to work
|
||||
Network Card: Connects to NTNet
|
||||
Battery: Internal power source that ensures the computer operates when not connected to APC.
|
||||
Extras (those won't be installed by default, but can be bought)
|
||||
ID Card Slot: Required for HoP-style programs to work. Access for security record-style programs is read from ID of user [RFID?] without requiring this
|
||||
APC Tesla Relay: Wirelessly powers the device from APC. Consoles have it by default. Laptops can buy it.
|
||||
Disk Drive: Allows usage of portable data disks.
|
||||
Nano Printer: Allows the computer to scan paper contents and save them to file, as well as recycle papers and print stuff on it.
|
||||
|
||||
4. NTNet
|
||||
NTNet is stationwide network that allows users to download programs needed for their work. It will be possible to send any files to other active computers using relevant program (NTN Transfer).
|
||||
@@ -65,6 +77,7 @@ Research - Requires "Research and Development" access on ID card (ie. RD, Roboti
|
||||
Robotics Monitor Console - Allows monitoring of robots and exosuits. Lockdown/Self-Destruct options are unavailable [balance reasons for malf/traitor AIs]. Requires extra access: "Robotics"
|
||||
NTNRC Administration Console - Allows administrative access to NTNRC. This includes bypassing any channel passwords and enabling "invisible" mode for spying on conversations. Requires extra access: "Research Director"
|
||||
NTNet Administration Console - Allows remote configuration of NTNet Relay - CAUTION: If NTNet is turned off it won't be possible to turn it on again from the computer, as operation requires NTNet to work! Requires extra access: "Research Director"
|
||||
NTNet Monitor - Allows monitoring of NTNet and it's various components, including simplified network logs and system status.
|
||||
|
||||
Security - Requires "Security" access on ID card (ie. HOS, Security officer, Detective)
|
||||
Security Records Uplink - Allows editing/reading of security records. Printing requires Nanoprinter hardware.
|
||||
@@ -78,10 +91,31 @@ Command - Requires "Bridge" access on ID card (all heads)
|
||||
Emergency Shuttle Control Console - Allows calling/recalling the emergency shuttle.
|
||||
Shuttle Control Console - Allows control of various shuttles around the station (mining, research, engineering)
|
||||
|
||||
*REDACTED* - Can be downloaded from SyndiCorp servers, only via emagged devices. These files are very large and limited to laptops/consoles only.
|
||||
SYSCRACK - Allows cracking of secure network terminals, such as, NTNet administration. The sysadmin will probably notice this.
|
||||
SYSOVERRIDE - Allows hacking into any device connected to NTNet. User will notice this and may stop the hack by disconnecting from NTNet first. After hacking various options exist, such as stealing/deleting files.
|
||||
SYSKILL - Tricks NTNet to force-disconnect a device. The sysadmin will probably notice this.
|
||||
SYSDOS - Launches a Denial of Service attack on NTNet relay. Can DoS only one relay at once. Requires NTNet connection. After some time the relay crashes until attack stops. The sysadmin will probably notice this.
|
||||
AIHACK - Hacks an AI, allowing you to upload/remove/modify a law even without relevant circuit board. The AI is alerted once the hack starts, and it takes a while for it to complete. Does not work on AIs with zeroth law.
|
||||
COREPURGE - Deletes all files on the hard drive, including the undeletable ones. Something like software self-destruct for computer.
|
||||
|
||||
6. Security
|
||||
Laptops will be password-lockable. If password is set a MD5 hash of it is stored and password is required every time you turn on the laptop.
|
||||
Passwords may be decrypted by using special Decrypter (protolathable, RDs office starts with one) device that will slowly decrypt the password.
|
||||
Decryption time would be length_of_password * 30 seconds, with maximum being 9 minutes (due to battery life limitations, which is 10+ min).
|
||||
If decrypted the password is cleared, so you can keep using your favorite password without people ever actually revealing it (for meta prevention reasons mostly).
|
||||
Emagged laptops will have option to enable "Safe Encryption". If safely encrypted laptop is decrypted it loses it's emag status and 50% of files is deleted (randomly selected).
|
||||
|
||||
7. System Administrator
|
||||
System Administrator will be new job under Research. It's main specifics will be maintaining of computer systems on station, espicially from software side.
|
||||
From IC perspective they'd probably know how to build a console or something given they work with computers, but they are mostly programmers/network experts.
|
||||
They will have office in research, which will probably replace (and contain) the server room and part of the toxins storage which is currently oversized.
|
||||
They will have access to DOWNLOAD (not run) all programs that exist on NTNet. They'll have fairly good amount of available programs, most of them being
|
||||
administrative consoles and other very useful things. They'll also be able to monitor NTNet. There will probably be one or two job slots.
|
||||
|
||||
8. IDS
|
||||
With addition of various antag programs, IDS(Intrusion Detection System) will be added to NTNet. This system can be turned on/off via administration console.
|
||||
If enabled, this system automatically detects any abnormality and triggers a warning that's visible on the NTNet status screen, as well as generating a security log.
|
||||
IDS can be disabled by simple on/off switch in the configuration.
|
||||
|
||||
*/
|
||||
@@ -2,7 +2,6 @@
|
||||
// This is mostly modified copypaste of modular_computer.dm. It is necessary as
|
||||
// modular_computer MUST stay as machinery subtype, while this must be an item subtype
|
||||
// as it's portable.
|
||||
|
||||
/obj/item/modular_computer
|
||||
name = "Modular Microcomputer"
|
||||
desc = "A small portable microcomputer"
|
||||
@@ -10,6 +9,7 @@
|
||||
var/enabled = 1 // Whether the computer is turned on.
|
||||
var/open = 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
|
||||
|
||||
// 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
|
||||
@@ -56,26 +56,41 @@
|
||||
user << "There is no card in \the [src]"
|
||||
return
|
||||
|
||||
card_slot.stored_card.loc = src.loc
|
||||
card_slot.stored_card.forceMove(get_turf(src))
|
||||
card_slot.stored_card = null
|
||||
user << "You remove the card from \the [src]"
|
||||
|
||||
// TODO: Convert hardware creation specific stuff to vending machine that handles laptops.
|
||||
/obj/item/modular_computer/New()
|
||||
network_card = new(src)
|
||||
hard_drive = new(src)
|
||||
battery = new(src)
|
||||
battery.maxcharge = 1000
|
||||
battery.charge = 1000
|
||||
|
||||
hard_drive.stored_files.Add(new/datum/computer_file/program/alarm_monitor(src))
|
||||
hard_drive.stored_files.Add(new/datum/computer_file/program/power_monitor(src))
|
||||
hard_drive.stored_files.Add(new/datum/computer_file/program/atmos_control(src))
|
||||
hard_drive.stored_files.Add(new/datum/computer_file/program/rcon_console(src))
|
||||
hard_drive.stored_files.Add(new/datum/computer_file/program/suit_sensors(src))
|
||||
processing_objects.Add(src)
|
||||
update_icon()
|
||||
..()
|
||||
|
||||
/obj/item/modular_computer/Destroy()
|
||||
processing_objects.Remove(src)
|
||||
if(network_card)
|
||||
qdel(network_card)
|
||||
if(hard_drive)
|
||||
qdel(hard_drive)
|
||||
if(battery)
|
||||
qdel(battery)
|
||||
if(nano_printer)
|
||||
qdel(nano_printer)
|
||||
if(card_slot)
|
||||
qdel(card_slot)
|
||||
..()
|
||||
|
||||
/obj/item/modular_computer/update_icon()
|
||||
icon_state = icon_state_unpowered
|
||||
|
||||
overlays.Cut()
|
||||
if(!enabled)
|
||||
return
|
||||
if(active_program)
|
||||
overlays.Add(active_program.program_icon_state ? active_program.program_icon_state : icon_state_menu)
|
||||
else
|
||||
overlays.Add(icon_state_menu)
|
||||
|
||||
// Operates NanoUI
|
||||
/obj/item/modular_computer/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
if(!open || !enabled)
|
||||
@@ -119,7 +134,7 @@
|
||||
ui.set_auto_update(1)
|
||||
|
||||
// On-click handling. Turns on the computer if it's off and opens the GUI.
|
||||
/obj/item/modular_computer/attack_hand(mob/user)
|
||||
/obj/item/modular_computer/attack_self(mob/user)
|
||||
if(enabled)
|
||||
ui_interact(user)
|
||||
else if(battery && battery.charge) // Battery-run and charged or non-battery but powered by APC.
|
||||
@@ -179,6 +194,14 @@
|
||||
data["PC_showexitprogram"] = active_program ? 1 : 0 // Hides "Exit Program" button on mainscreen
|
||||
return data
|
||||
|
||||
// Installs programs necessary for computer function.
|
||||
// TODO: Implement program for downloading of other programs, and replace hardcoded program addition here
|
||||
/obj/item/modular_computer/proc/install_default_programs()
|
||||
hard_drive.store_file(new/datum/computer_file/program/alarm_monitor(src))
|
||||
hard_drive.store_file(new/datum/computer_file/program/power_monitor(src))
|
||||
hard_drive.store_file(new/datum/computer_file/program/atmos_control(src))
|
||||
hard_drive.store_file(new/datum/computer_file/program/rcon_console(src))
|
||||
hard_drive.store_file(new/datum/computer_file/program/suit_sensors(src))
|
||||
|
||||
// Relays kill program request to currently active program. Use this to quit current program.
|
||||
/obj/item/modular_computer/proc/kill_program(var/forced = 0)
|
||||
@@ -199,6 +222,8 @@
|
||||
|
||||
// Handles user's GUI input
|
||||
/obj/item/modular_computer/Topic(href, href_list)
|
||||
if(..())
|
||||
return 1
|
||||
if( href_list["PC_exit"] )
|
||||
kill_program()
|
||||
return
|
||||
@@ -219,6 +244,9 @@
|
||||
user << "<span class='danger'>\The [src]'s screen shows \"I/O ERROR - Unable to run program\" warning.</span>"
|
||||
return
|
||||
|
||||
if(!P.is_supported_by_hardware(hardware_flag, 1, user))
|
||||
return
|
||||
|
||||
if(P.requires_ntnet && !get_ntnet_status(P.requires_ntnet_feature)) // The program requires NTNet connection, but we are not connected to NTNet.
|
||||
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>"
|
||||
return
|
||||
@@ -249,7 +277,7 @@
|
||||
power_usage += hard_drive.power_usage
|
||||
|
||||
if(battery)
|
||||
battery.use(power_usage)
|
||||
battery.use(power_usage * CELLRATE)
|
||||
|
||||
/obj/item/modular_computer/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if(istype(W, /obj/item/weapon/card/id)) // ID Card, try to insert it.
|
||||
@@ -263,7 +291,7 @@
|
||||
return
|
||||
|
||||
card_slot.stored_card = I
|
||||
I.loc = src
|
||||
I.forceMove(src)
|
||||
user << "You insert \the [I] into \the [src]."
|
||||
return
|
||||
|
||||
7
code/modules/modular_computers/computers/item/tablet.dm
Normal file
7
code/modules/modular_computers/computers/item/tablet.dm
Normal file
@@ -0,0 +1,7 @@
|
||||
/obj/item/modular_computer/tablet
|
||||
name = "tablet computer"
|
||||
icon = 'icons/obj/modular_tablet.dmi'
|
||||
icon_state = "tablet"
|
||||
icon_state_unpowered = "tablet"
|
||||
icon_state_menu = "menu"
|
||||
hardware_flag = PROGRAM_TABLET
|
||||
@@ -9,15 +9,17 @@
|
||||
var/datum/computer_file/program/active_program = null // A currently active program running on the computer.
|
||||
var/battery_powered = 0 // Whether computer should be battery powered. It is set automatically
|
||||
use_power = 0
|
||||
var/hardware_flag = 0 // A flag that describes this device type
|
||||
|
||||
// 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 = 'icons/obj/computer.dmi'
|
||||
icon_state = "laptop-open"
|
||||
icon = null
|
||||
icon_state = null
|
||||
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.
|
||||
var/screen_icon_state_menu = "menu" // Icon state overlay when the computer is turned on, but no program is loaded that would override the screen.
|
||||
var/keyboard_icon_state_menu = "keyboard1" // Keyboard's icon state overlay when the computer is turned on and no program is loaded
|
||||
|
||||
// Important hardware (must be installed for computer to work)
|
||||
var/datum/computer_hardware/network_card/network_card // Network Card component of this computer. Allows connection to NTNet
|
||||
@@ -29,6 +31,18 @@
|
||||
var/datum/computer_hardware/nano_printer/nano_printer // Nano Printer component of this computer, for your everyday paperwork needs.
|
||||
|
||||
|
||||
/obj/machinery/modular_computer/update_icon()
|
||||
icon_state = icon_state_unpowered
|
||||
|
||||
overlays.Cut()
|
||||
if(!enabled)
|
||||
return
|
||||
if(active_program)
|
||||
overlays.Add(active_program.program_icon_state ? active_program.program_icon_state : screen_icon_state_menu)
|
||||
overlays.Add(active_program.keyboard_icon_state ? active_program.keyboard_icon_state : keyboard_icon_state_menu)
|
||||
else
|
||||
overlays.Add(screen_icon_state_menu)
|
||||
overlays.Add(keyboard_icon_state_menu)
|
||||
|
||||
// Eject ID card from computer, if it has ID slot with card inside.
|
||||
/obj/machinery/modular_computer/verb/eject_id()
|
||||
@@ -58,27 +72,18 @@
|
||||
user << "There is no card in \the [src]"
|
||||
return
|
||||
|
||||
card_slot.stored_card.loc = src.loc
|
||||
card_slot.stored_card.forceMove(src.loc)
|
||||
card_slot.stored_card = null
|
||||
user << "You remove the card from \the [src]"
|
||||
|
||||
|
||||
// TODO: Convert hardware creation specific stuff to vending machine that handles laptops.
|
||||
/obj/machinery/modular_computer/New()
|
||||
network_card = new(src)
|
||||
hard_drive = new(src)
|
||||
tesla_link = new(src)
|
||||
battery = new(src)
|
||||
battery.maxcharge = 500
|
||||
battery.charge = 500
|
||||
|
||||
hard_drive.stored_files.Add(new/datum/computer_file/program/alarm_monitor(src))
|
||||
hard_drive.stored_files.Add(new/datum/computer_file/program/power_monitor(src))
|
||||
hard_drive.stored_files.Add(new/datum/computer_file/program/atmos_control(src))
|
||||
hard_drive.stored_files.Add(new/datum/computer_file/program/rcon_console(src))
|
||||
hard_drive.stored_files.Add(new/datum/computer_file/program/suit_sensors(src))
|
||||
update_icon()
|
||||
..()
|
||||
// Installs programs necessary for computer function.
|
||||
// TODO: Implement program for downloading of other programs, and replace hardcoded program addition here
|
||||
/obj/machinery/modular_computer/proc/install_default_programs()
|
||||
hard_drive.store_file(new/datum/computer_file/program/alarm_monitor(src))
|
||||
hard_drive.store_file(new/datum/computer_file/program/power_monitor(src))
|
||||
hard_drive.store_file(new/datum/computer_file/program/atmos_control(src))
|
||||
hard_drive.store_file(new/datum/computer_file/program/rcon_console(src))
|
||||
hard_drive.store_file(new/datum/computer_file/program/suit_sensors(src))
|
||||
|
||||
// Operates NanoUI
|
||||
/obj/machinery/modular_computer/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
@@ -209,6 +214,8 @@
|
||||
|
||||
// Handles user's GUI input
|
||||
/obj/machinery/modular_computer/Topic(href, href_list)
|
||||
if(..())
|
||||
return 1
|
||||
if( href_list["PC_exit"] )
|
||||
kill_program()
|
||||
return
|
||||
@@ -229,6 +236,9 @@
|
||||
user << "<span class='danger'>\The [src]'s screen shows \"I/O ERROR - Unable to run program\" warning.</span>"
|
||||
return
|
||||
|
||||
if(!P.is_supported_by_hardware(hardware_flag, 1, user))
|
||||
return
|
||||
|
||||
if(P.requires_ntnet && !get_ntnet_status(P.requires_ntnet_feature)) // The program requires NTNet connection, but we are not connected to NTNet.
|
||||
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>"
|
||||
return
|
||||
@@ -301,7 +311,7 @@
|
||||
return
|
||||
|
||||
card_slot.stored_card = I
|
||||
I.loc = src
|
||||
I.forceMove(src)
|
||||
user << "You insert \the [I] into \the [src]."
|
||||
return
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/obj/machinery/modular_computer/console/
|
||||
name = "console"
|
||||
desc = "A stationary computer."
|
||||
enabled = 1
|
||||
|
||||
icon = 'icons/obj/modular_console.dmi'
|
||||
icon_state = "console"
|
||||
icon_state_unpowered = "console"
|
||||
screen_icon_state_menu = "menu"
|
||||
keyboard_icon_state_menu = "kb_menu"
|
||||
anchored = 1
|
||||
density = 1
|
||||
|
||||
/obj/machinery/modular_computer/console/New()
|
||||
..()
|
||||
battery = null
|
||||
network_card = new/datum/computer_hardware/network_card/wired(src)
|
||||
tesla_link = new/datum/computer_hardware/tesla_link(src)
|
||||
tesla_link.enabled = 1
|
||||
hard_drive = new/datum/computer_hardware/hard_drive/super(src) // Consoles generally have better HDDs due to lower space limitations
|
||||
install_default_programs() // Consoles come with set of department-specific programs when constructed.
|
||||
@@ -29,13 +29,13 @@
|
||||
if(!stored_computer)
|
||||
if(contents.len)
|
||||
for(var/obj/O in contents)
|
||||
O.loc = loc
|
||||
O.forceMove(src.loc)
|
||||
usr << "\The [src] crumbles to pieces."
|
||||
spawn(5)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
stored_computer.loc = loc
|
||||
stored_computer.forceMove(src.loc)
|
||||
stored_computer.stat &= ~MAINT
|
||||
stored_computer.update_icon()
|
||||
stored_computer.open = 1
|
||||
@@ -57,17 +57,6 @@
|
||||
icon = 'icons/obj/modular_laptop.dmi'
|
||||
icon_state = "laptop-open"
|
||||
|
||||
/obj/machinery/modular_computer/laptop/update_icon()
|
||||
icon_state = icon_state_unpowered
|
||||
|
||||
overlays.Cut()
|
||||
if(!enabled)
|
||||
return
|
||||
if(active_program)
|
||||
overlays.Add(active_program.program_icon_state ? active_program.program_icon_state : icon_state_menu)
|
||||
else
|
||||
overlays.Add(icon_state_menu)
|
||||
|
||||
// Close the computer. collapsing it into movable item that can't be used.
|
||||
/obj/machinery/modular_computer/laptop/verb/close_computer()
|
||||
set name = "Close Laptop"
|
||||
@@ -94,8 +83,8 @@
|
||||
portable=new
|
||||
portable.stored_computer = src
|
||||
|
||||
portable.loc = loc
|
||||
loc = portable
|
||||
portable.forceMove(src.loc)
|
||||
src.forceMove(portable)
|
||||
stat |= MAINT
|
||||
if(user)
|
||||
user << "You close \the [src]."
|
||||
@@ -1,33 +0,0 @@
|
||||
/obj/machinery/modular_computer/console/
|
||||
name = "console"
|
||||
desc = "A stationary computer."
|
||||
enabled = 1
|
||||
icon = 'icons/obj/modular_console.dmi'
|
||||
icon_state = "console"
|
||||
icon_state_unpowered = "console"
|
||||
icon_state_menu = "menu"
|
||||
var/keyboard_icon_state_menu = "keyboard13"
|
||||
battery_powered = 0
|
||||
anchored = 1
|
||||
density = 1
|
||||
|
||||
/obj/machinery/modular_computer/console/New()
|
||||
..()
|
||||
battery = null
|
||||
tesla_link = new/datum/computer_hardware/tesla_link(src)
|
||||
tesla_link.enabled = 1
|
||||
hard_drive = new/datum/computer_hardware/hard_drive/super(src) // Consoles generally have better HDDs due to lower space limitations
|
||||
|
||||
|
||||
/obj/machinery/modular_computer/console/update_icon()
|
||||
icon_state = icon_state_unpowered
|
||||
|
||||
overlays.Cut()
|
||||
if(!enabled)
|
||||
return
|
||||
if(active_program)
|
||||
overlays.Add(active_program.program_icon_state ? active_program.program_icon_state : icon_state_menu)
|
||||
overlays.Add(active_program.keyboard_icon_state ? active_program.keyboard_icon_state : keyboard_icon_state_menu)
|
||||
else
|
||||
overlays.Add(icon_state_menu)
|
||||
overlays.Add(keyboard_icon_state_menu)
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 682 B After Width: | Height: | Size: 818 B |
@@ -9,7 +9,7 @@
|
||||
var/atom/movable/computer = null // Device that runs this program.
|
||||
var/filedesc = "Unknown Program" // User-friendly name of this program.
|
||||
var/program_icon_state = null // Overlay for this program, selected by computer
|
||||
var/keyboard_icon_state = null // Program-specific keboard icon state
|
||||
var/keyboard_icon_state = null // Program-specific keboard icon state
|
||||
var/requires_ntnet = 0 // Set to 1 for program to require nonstop NTNet connection to run. If NTNet connection is lost program crashes.
|
||||
var/requires_ntnet_feature = 0 // Optional, if above is set to 1 checks for specific function of NTNet (currently NTNET_SOFTWAREDOWNLOAD, NTNET_PEERTOPEER, NTNET_SYSTEMCONTROL and NTNET_COMMUNICATION)
|
||||
var/ntnet_status = 1 // NTNet status, updated every tick by computer running this program. Don't use this for checks if NTNet works, computers do that. Use this for calculations, etc.
|
||||
@@ -31,6 +31,13 @@
|
||||
temp.usage_flags = usage_flags
|
||||
return temp
|
||||
|
||||
/datum/computer_file/program/proc/is_supported_by_hardware(var/hardware_flag = 0, var/loud = 0, var/mob/user = null)
|
||||
if(!(hardware_flag & usage_flags))
|
||||
if(loud && computer && user)
|
||||
user << "<span class='danger'>\The [computer] flashes an \"Hardware Error - Incompatible software\" warning.</span>"
|
||||
return 0
|
||||
return 1
|
||||
|
||||
// Check if the user can run program. Only humans can operate computer. Automatically called in run_program()
|
||||
// User has to wear their ID or have it inhand for ID Scan to work.
|
||||
/datum/computer_file/program/proc/can_run(var/mob/living/user, var/loud = 0)
|
||||
@@ -64,6 +71,10 @@
|
||||
if(istype(computer, /obj/machinery/modular_computer))
|
||||
var/obj/machinery/modular_computer/L = computer
|
||||
return L.get_header_data()
|
||||
if(istype(computer, /obj/item/modular_computer))
|
||||
var/obj/item/modular_computer/L = computer
|
||||
return L.get_header_data()
|
||||
return list()
|
||||
|
||||
// This is performed on program startup. May be overriden to add extra logic. Remember to include ..() call. Return 1 on success, 0 on failure.
|
||||
// When implementing new program based device, use this to run the program.
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
program_icon_state = "power_monitor"
|
||||
keyboard_icon_state = "keyboard9"
|
||||
requires_ntnet = 1
|
||||
size = 8
|
||||
|
||||
/datum/computer_file/program/alarm_monitor
|
||||
filename = "alarmmonitor"
|
||||
@@ -15,6 +16,7 @@
|
||||
program_icon_state = "alarm_monitor"
|
||||
keyboard_icon_state = "keyboard4"
|
||||
requires_ntnet = 1
|
||||
size = 5
|
||||
|
||||
/datum/computer_file/program/atmos_control
|
||||
filename = "atmoscontrol"
|
||||
@@ -26,6 +28,7 @@
|
||||
requires_ntnet = 1
|
||||
requires_ntnet_feature = NTNET_SYSTEMCONTROL
|
||||
usage_flags = PROGRAM_LAPTOP & PROGRAM_CONSOLE
|
||||
size = 17
|
||||
|
||||
/datum/computer_file/program/rcon_console
|
||||
filename = "rconconsole"
|
||||
@@ -37,6 +40,7 @@
|
||||
requires_ntnet = 1
|
||||
requires_ntnet_feature = NTNET_SYSTEMCONTROL
|
||||
usage_flags = PROGRAM_LAPTOP & PROGRAM_CONSOLE
|
||||
size = 25
|
||||
|
||||
/datum/computer_file/program/suit_sensors
|
||||
filename = "sensormonitor"
|
||||
@@ -44,4 +48,5 @@
|
||||
nanomodule_path = /datum/nano_module/crew_monitor
|
||||
program_icon_state = "crew"
|
||||
keyboard_icon_state = "keyboard7"
|
||||
requires_ntnet = 1
|
||||
requires_ntnet = 1
|
||||
size = 20
|
||||
@@ -70,7 +70,7 @@
|
||||
/datum/computer_hardware/hard_drive/proc/recalculate_size()
|
||||
var/total_size = 0
|
||||
for(var/datum/computer_file/F in stored_files)
|
||||
total_size = F.size
|
||||
total_size += F.size
|
||||
|
||||
used_capacity = total_size
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
// 0 - No signal, 1 - Low signal, 2 - High signal. 3 - Wired Connection
|
||||
/datum/computer_hardware/network_card/proc/get_signal(var/specific_action = 0)
|
||||
if(!holder) // Hardware is not installed in anything. No signal. How did this even get called?
|
||||
if(!holder && !holder2) // Hardware is not installed in anything. No signal. How did this even get called?
|
||||
return 0
|
||||
|
||||
if(!enabled)
|
||||
@@ -39,9 +39,14 @@
|
||||
if(!ntnet_global || !ntnet_global.check_function(specific_action)) // NTNet is down and we are not connected via wired connection. No signal.
|
||||
return 0
|
||||
|
||||
if(holder.z in config.station_levels) // Computer is on station, High signal
|
||||
if(holder && holder.z in config.station_levels) // Computer is on station, High signal
|
||||
return 2
|
||||
|
||||
if(holder2)
|
||||
var/turf/T = get_turf(holder2)
|
||||
if((T && istype(T)) && T.z in config.station_levels)
|
||||
return 2
|
||||
|
||||
if(long_range) // Computer is not on station, but it has upgraded network card. Low signal.
|
||||
return 1
|
||||
|
||||
|
||||
@@ -1,2 +1,288 @@
|
||||
// A vendor machine for modular computer portable devices - Laptops and Tablets
|
||||
|
||||
/obj/machinery/lapvend // This is now in place to correct compile errors.
|
||||
name = "Laptop Vendor Placeholder"
|
||||
name = "computer vendor"
|
||||
desc = "A vending machine with microfabricator capable of dispensing various NT-branded computers"
|
||||
icon = 'icons/obj/vending.dmi'
|
||||
icon_state = "robotics"
|
||||
layer = 2.9
|
||||
anchored = 1
|
||||
density = 1
|
||||
|
||||
// The actual laptop/tablet
|
||||
var/obj/machinery/modular_computer/laptop/fabricated_laptop = null
|
||||
var/obj/item/modular_computer/tablet/fabricated_tablet = null
|
||||
|
||||
// Utility vars
|
||||
var/state = 0 // 0: Select device type, 1: Select loadout, 2: Payment, 3: Thankyou screen
|
||||
var/devtype = 0 // 0: None(unselected), 1: Laptop, 2: Tablet
|
||||
var/total_price = 0 // Price of currently vended device.
|
||||
|
||||
// Device loadout
|
||||
var/dev_battery = 1 // 1: Default, 2: Upgraded, 3: Advanced
|
||||
var/dev_disk = 1 // 1: Default, 2: Upgraded, 3: Advanced
|
||||
var/dev_netcard = 0 // 0: None, 1: Basic, 2: Long-Range
|
||||
var/dev_tesla = 0 // 0: None, 1: Standard (LAPTOP ONLY)
|
||||
var/dev_nanoprint = 0 // 0: None, 1: Standard
|
||||
var/dev_card = 0 // 0: None, 1: Standard
|
||||
|
||||
// Removes all traces of old order and allows you to begin configuration from scratch.
|
||||
/obj/machinery/lapvend/proc/reset_order()
|
||||
state = 0
|
||||
devtype = 0
|
||||
if(fabricated_laptop)
|
||||
qdel(fabricated_laptop)
|
||||
fabricated_laptop = null
|
||||
if(fabricated_tablet)
|
||||
qdel(fabricated_tablet)
|
||||
fabricated_tablet = null
|
||||
dev_battery = 1
|
||||
dev_disk = 1
|
||||
dev_netcard = 0
|
||||
dev_tesla = 0
|
||||
dev_nanoprint = 0
|
||||
dev_card = 0
|
||||
|
||||
// Recalculates the price and optionally even fabricates the device.
|
||||
/obj/machinery/lapvend/proc/fabricate_and_recalc_price(var/fabricate = 0)
|
||||
total_price = 0
|
||||
if(devtype == 1) // Laptop, generally cheaper to make it accessible for most station roles
|
||||
if(fabricate)
|
||||
fabricated_laptop = new(src)
|
||||
fabricated_laptop.battery = new(fabricated_laptop)
|
||||
total_price = 99
|
||||
switch(dev_battery)
|
||||
if(1) // Basic(500C)
|
||||
if(fabricate)
|
||||
fabricated_laptop.battery.maxcharge = 500
|
||||
fabricated_laptop.battery.charge = 500
|
||||
if(2) // Upgraded(1000C)
|
||||
if(fabricate)
|
||||
fabricated_laptop.battery.maxcharge = 1000
|
||||
fabricated_laptop.battery.charge = 1000
|
||||
total_price += 199
|
||||
if(3) // Advanced(1500C)
|
||||
if(fabricate)
|
||||
fabricated_laptop.battery.maxcharge = 1500
|
||||
fabricated_laptop.battery.charge = 1500
|
||||
total_price += 499
|
||||
switch(dev_disk)
|
||||
if(1) // Basic(128GQ)
|
||||
if(fabricate)
|
||||
fabricated_laptop.hard_drive = new/datum/computer_hardware/hard_drive(fabricated_laptop)
|
||||
if(2) // Upgraded(256GQ)
|
||||
if(fabricate)
|
||||
fabricated_laptop.hard_drive = new/datum/computer_hardware/hard_drive/advanced(fabricated_laptop)
|
||||
total_price += 99
|
||||
if(3) // Advanced(512GQ)
|
||||
if(fabricate)
|
||||
fabricated_laptop.hard_drive = new/datum/computer_hardware/hard_drive/super(fabricated_laptop)
|
||||
total_price += 299
|
||||
switch(dev_netcard)
|
||||
if(1) // Basic(Short-Range)
|
||||
if(fabricate)
|
||||
fabricated_laptop.network_card = new/datum/computer_hardware/network_card(fabricated_laptop)
|
||||
total_price += 99
|
||||
if(2) // Advanced (Long Range)
|
||||
if(fabricate)
|
||||
fabricated_laptop.network_card = new/datum/computer_hardware/network_card/advanced(fabricated_laptop)
|
||||
total_price += 299
|
||||
if(dev_tesla)
|
||||
total_price += 399
|
||||
if(fabricate)
|
||||
fabricated_laptop.tesla_link = new/datum/computer_hardware/tesla_link(fabricated_laptop)
|
||||
if(dev_nanoprint)
|
||||
total_price += 99
|
||||
if(fabricate)
|
||||
fabricated_laptop.nano_printer = new/datum/computer_hardware/nano_printer(fabricated_laptop)
|
||||
if(dev_card)
|
||||
total_price += 199
|
||||
if(fabricate)
|
||||
fabricated_laptop.card_slot = new/datum/computer_hardware/card_slot(fabricated_laptop)
|
||||
|
||||
return total_price
|
||||
else if(devtype == 2) // Tablet, more expensive, not everyone could probably afford this.
|
||||
if(fabricate)
|
||||
fabricated_tablet = new(src)
|
||||
fabricated_tablet.battery = new(fabricated_tablet)
|
||||
total_price = 199
|
||||
switch(dev_battery)
|
||||
if(1) // Basic(300C)
|
||||
if(fabricate)
|
||||
fabricated_tablet.battery.maxcharge = 300
|
||||
fabricated_tablet.battery.charge = 300
|
||||
if(2) // Upgraded(500C)
|
||||
if(fabricate)
|
||||
fabricated_tablet.battery.maxcharge = 500
|
||||
fabricated_tablet.battery.charge = 500
|
||||
total_price += 199
|
||||
if(3) // Advanced(750C)
|
||||
if(fabricate)
|
||||
fabricated_tablet.battery.maxcharge = 750
|
||||
fabricated_tablet.battery.charge = 750
|
||||
total_price += 499
|
||||
switch(dev_disk)
|
||||
if(1) // Basic(32GQ)
|
||||
if(fabricate)
|
||||
fabricated_tablet.hard_drive = new/datum/computer_hardware/hard_drive/micro(fabricated_tablet)
|
||||
if(2) // Upgraded(64GQ)
|
||||
if(fabricate)
|
||||
fabricated_tablet.hard_drive = new/datum/computer_hardware/hard_drive/small(fabricated_tablet)
|
||||
total_price += 99
|
||||
if(3) // Advanced(128GQ)
|
||||
if(fabricate)
|
||||
fabricated_tablet.hard_drive = new/datum/computer_hardware/hard_drive(fabricated_tablet)
|
||||
total_price += 299
|
||||
switch(dev_netcard)
|
||||
if(1) // Basic(Short-Range)
|
||||
if(fabricate)
|
||||
fabricated_tablet.network_card = new/datum/computer_hardware/network_card(fabricated_tablet)
|
||||
total_price += 99
|
||||
if(2) // Advanced (Long Range)
|
||||
if(fabricate)
|
||||
fabricated_tablet.network_card = new/datum/computer_hardware/network_card/advanced(fabricated_tablet)
|
||||
total_price += 299
|
||||
if(dev_nanoprint)
|
||||
total_price += 99
|
||||
if(fabricate)
|
||||
fabricated_tablet.nano_printer = new/datum/computer_hardware/nano_printer(fabricated_tablet)
|
||||
if(dev_card)
|
||||
total_price += 199
|
||||
if(fabricate)
|
||||
fabricated_tablet.card_slot = new/datum/computer_hardware/card_slot(fabricated_tablet)
|
||||
return total_price
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/obj/machinery/lapvend/Topic(href, href_list)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
if(href_list["pick_device"])
|
||||
if(state) // We've already picked a device type
|
||||
return 0
|
||||
devtype = text2num(href_list["pick_device"])
|
||||
state = 1
|
||||
fabricate_and_recalc_price(0)
|
||||
return 1
|
||||
if(href_list["clean_order"])
|
||||
reset_order()
|
||||
return 1
|
||||
if((state != 1) && devtype) // Following IFs should only be usable when in the Select Loadout mode
|
||||
return 0
|
||||
if(href_list["confirm_order"])
|
||||
state = 2 // Wait for ID swipe for payment processing
|
||||
fabricate_and_recalc_price(0)
|
||||
return 1
|
||||
if(href_list["hw_battery"])
|
||||
dev_battery = text2num(href_list["hw_battery"])
|
||||
fabricate_and_recalc_price(0)
|
||||
return 1
|
||||
if(href_list["hw_disk"])
|
||||
dev_disk = text2num(href_list["hw_disk"])
|
||||
fabricate_and_recalc_price(0)
|
||||
return 1
|
||||
if(href_list["hw_netcard"])
|
||||
dev_netcard = text2num(href_list["hw_netcard"])
|
||||
fabricate_and_recalc_price(0)
|
||||
return 1
|
||||
if(href_list["hw_tesla"])
|
||||
dev_tesla = text2num(href_list["hw_tesla"])
|
||||
fabricate_and_recalc_price(0)
|
||||
return 1
|
||||
if(href_list["hw_nanoprint"])
|
||||
dev_nanoprint = text2num(href_list["hw_nanoprint"])
|
||||
fabricate_and_recalc_price(0)
|
||||
return 1
|
||||
if(href_list["hw_card"])
|
||||
dev_card = text2num(href_list["hw_card"])
|
||||
fabricate_and_recalc_price(0)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/machinery/lapvend/attack_hand(var/mob/user)
|
||||
ui_interact(user)
|
||||
|
||||
/obj/machinery/lapvend/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
if(stat & (BROKEN | NOPOWER | MAINT))
|
||||
if(ui)
|
||||
ui.close()
|
||||
return 0
|
||||
|
||||
var/list/data[0]
|
||||
data["state"] = state
|
||||
data["devtype"] = devtype
|
||||
data["hw_battery"] = dev_battery
|
||||
data["hw_disk"] = dev_disk
|
||||
data["hw_netcard"] = dev_netcard
|
||||
data["hw_tesla"] = dev_tesla
|
||||
data["hw_nanoprint"] = dev_nanoprint
|
||||
data["hw_card"] = dev_card
|
||||
data["totalprice"] = "[total_price]$"
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "computer_fabricator.tmpl", "Personal Computer Vendor", 500, 400)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
|
||||
|
||||
obj/machinery/lapvend/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
var/obj/item/weapon/card/id/I = W.GetID()
|
||||
// Awaiting payment state
|
||||
if(state == 2)
|
||||
if(process_payment(I,W))
|
||||
fabricate_and_recalc_price(1)
|
||||
if((devtype == 1) && fabricated_laptop)
|
||||
fabricated_laptop.forceMove(src.loc)
|
||||
fabricated_laptop.install_default_programs()
|
||||
fabricated_laptop.close_laptop()
|
||||
fabricated_laptop = null
|
||||
else if((devtype == 2) && fabricated_tablet)
|
||||
fabricated_tablet.forceMove(src.loc)
|
||||
fabricated_tablet.install_default_programs()
|
||||
fabricated_tablet = null
|
||||
ping("Enjoy your new product!")
|
||||
state = 3
|
||||
return 1
|
||||
return 0
|
||||
return ..()
|
||||
|
||||
|
||||
// Simplified payment processing, returns 1 on success.
|
||||
/obj/machinery/lapvend/proc/process_payment(var/obj/item/weapon/card/id/I, var/obj/item/ID_container)
|
||||
if(I==ID_container || ID_container == null)
|
||||
visible_message("<span class='info'>\The [usr] swipes \the [I] through \the [src].</span>")
|
||||
else
|
||||
visible_message("<span class='info'>\The [usr] swipes \the [ID_container] through \the [src].</span>")
|
||||
var/datum/money_account/customer_account = get_account(I.associated_account_number)
|
||||
if (!customer_account || customer_account.suspended)
|
||||
ping("Connection error. Unable to connect to account.")
|
||||
return 0
|
||||
|
||||
if(customer_account.security_level != 0) //If card requires pin authentication (ie seclevel 1 or 2)
|
||||
var/attempt_pin = input("Enter pin code", "Vendor transaction") as num
|
||||
customer_account = attempt_account_access(I.associated_account_number, attempt_pin, 2)
|
||||
|
||||
if(!customer_account)
|
||||
ping("Unable to access account: incorrect credentials.")
|
||||
return 0
|
||||
|
||||
if(total_price > customer_account.money)
|
||||
ping("Insufficient funds in account.")
|
||||
return 0
|
||||
else
|
||||
customer_account.money -= total_price
|
||||
var/datum/transaction/T = new()
|
||||
T.target_name = "Computer Manufacturer (via [src.name])"
|
||||
T.purpose = "Purchase of [(devtype == 1) ? "laptop computer" : "tablet microcomputer"]."
|
||||
T.amount = total_price
|
||||
T.source_terminal = src.name
|
||||
T.date = current_date_string
|
||||
T.time = worldtime2text()
|
||||
customer_account.transaction_log.Add(T)
|
||||
return 1
|
||||
Reference in New Issue
Block a user