Initial (buggy) implementation

- Implements modular computers, starting with single program (power monitoring console)
- Implements most hardware. Some is still TBD, but the important stuff is in place
- Implements file-based system. Currently two file types exist, programs, which have NanoUI/Topic() interaction with user and data files, which may be used to store string of data.
This commit is contained in:
Atlantis
2015-06-28 08:19:43 +02:00
parent eedbcee063
commit ef64187fc2
46 changed files with 970 additions and 49 deletions
@@ -0,0 +1,7 @@
/datum/computer_hardware/card_slot
name = "RFID Card Slot"
desc = "Slot that allows this computer to write data on RFID cards. Necessary for some programs to run properly."
power_usage = 10 //W
critical = 0
var/obj/item/weapon/card/id/stored_card = null
@@ -0,0 +1,36 @@
/datum/computer_hardware/hard_drive/
name = "Hard Drive"
desc = "A small power efficient solid state drive, with 25GQ of storage capacity for use in basic computers where power efficiency is desired."
power_usage = 25 // SSD or something with low power usage
var/max_capacity = 25
var/list/stored_files = list() // List of stored files on this drive.
/datum/computer_hardware/hard_drive/advanced
desc = "A small hybrid hard drive with 35GQ of storage capacity for use in higher grade computers where balance between power efficiency and capacity is desired."
max_capacity = 35
power_usage = 50 // Hybrid, medium capacity and medium power storage
/datum/computer_hardware/hard_drive/super
desc = "A small hard drive with 60GQ of storage capacity for use in cluster storage solutions where capacity is more important than power efficiency."
max_capacity = 60
power_usage = 100 // High-capacity but uses lots of power, shortening battery life. Best used with APC link.
// Checks whether file can be stored on the hard drive.
/datum/computer_hardware/hard_drive/proc/can_store_file(var/size = 1)
if(stored_files.len + size > max_capacity)
return 0
else
return 1
// Tries to find the file by filename. Returns null on failure
/datum/computer_hardware/hard_drive/proc/find_file_by_name(var/filename)
if(!filename)
return null
if(!stored_files)
return null
for(var/datum/computer_file/F in stored_files)
if(F.filename == filename)
return F
return null
@@ -0,0 +1,11 @@
/datum/computer_hardware/
var/name = "Hardware"
var/desc = "Unknown Hardware"
var/obj/machinery/modular_computer/holder = null
var/power_usage = 0 // If the hardware uses extra power, change this.
var/enabled = 1 // If the hardware is turned off set this to 0.
var/critical = 1 // Prevent disabling for important component, like the HDD.
/datum/computer_hardware/New(var/obj/machinery/modular_computer/L)
holder = L
..()
@@ -0,0 +1,44 @@
/datum/computer_hardware/network_card/
name = "NTNet Network Card"
desc = "A basic network card for usage with standard NTNet frequencies."
power_usage = 50
critical = 0
var/long_range = 0
var/ethernet = 0 // Hard-wired, therefore always on, ignores NTNet wireless checks.
/datum/computer_hardware/network_card/advanced
desc = "An advanced network card for usage with standard NTNet frequencies. It's transmitter is strong enough to connect even off-station."
long_range = 1
power_usage = 100 // Better range but higher power usage.
/datum/computer_hardware/network_card/wired
desc = "An advanced network card for usage with NTNet. This one uses wired connection."
ethernet = 1
power_usage = 100 // Better range but higher power usage.
/datum/computer_hardware/network_card/Destroy()
if(holder && (holder.network_card == src))
holder.network_card = null
holder = null
..()
// 0 - No signal, 1 - Low signal, 2 - High signal. 3 - Wired Connection
/datum/computer_hardware/network_card/proc/get_signal()
if(!holder) // Hardware is not installed in anything. No signal. How did this even get called?
return 0
if(!enabled)
return 0
if(ethernet) // Computer is connected via wired connection.
return 3
// TODO: Add checks for NTNet Relays here!
if(holder.z in config.station_levels) // Computer is on station, High signal
return 2
if(long_range) // Computer is not on station, but it has upgraded network card. Low signal.
return 1
return 0 // Computer is not on station and does not have upgraded network card. No signal.
@@ -0,0 +1,5 @@
/datum/computer_hardware/tesla_link
name = "Tesla Link"
desc = "An advanced tesla link that wirelessly recharges connected device from nearby area power controller."
critical = 0
enabled = 0 // Starts turned off