Computer tweaks (#1285)

Pulling in some computer changes from bay.
This commit is contained in:
Werner
2016-12-25 13:19:50 +01:00
committed by skull132
parent 93143a8e45
commit 5df9509435
94 changed files with 2682 additions and 989 deletions

View File

@@ -0,0 +1,43 @@
// A wrapper that allows the computer to contain an intellicard.
/obj/item/weapon/computer_hardware/ai_slot
name = "intellicard slot"
desc = "An IIS interlink with connection uplinks that allow the device to interface with most common intellicard models. Too large to fit into tablets. Uses a lot of power when active."
icon_state = "aislot"
hardware_size = 2
critical = 0
power_usage = 100
origin_tech = list(TECH_POWER = 2, TECH_DATA = 3)
var/obj/item/weapon/aicard/stored_card
var/power_usage_idle = 100
var/power_usage_occupied = 2 KILOWATTS
/obj/item/weapon/computer_hardware/ai_slot/proc/update_power_usage()
if(!stored_card || !stored_card.carded_ai)
power_usage = power_usage_idle
return
power_usage = power_usage_occupied
/obj/item/weapon/computer_hardware/ai_slot/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
if(..())
return 1
if(istype(W, /obj/item/weapon/aicard))
if(stored_card)
user << "\The [src] is already occupied."
return
user.drop_from_inventory(W)
stored_card = W
W.forceMove(src)
update_power_usage()
if(istype(W, /obj/item/weapon/screwdriver))
user << "You manually remove \the [stored_card] from \the [src]."
stored_card.forceMove(get_turf(src))
stored_card = null
update_power_usage()
/obj/item/weapon/computer_hardware/ai_slot/Destroy()
if(holder2 && (holder2.ai_slot == src))
holder2.ai_slot = null
if(stored_card)
stored_card.forceMove(get_turf(holder2))
holder2 = null
..()

View File

@@ -5,7 +5,8 @@
desc = "A standard power cell, commonly seen in high-end portable microcomputers or low-end laptops. It's rating is 750."
icon_state = "battery_normal"
critical = 1
malfunction_probability = 1
origin_tech = list(TECH_POWER = 1, TECH_ENGINEERING = 1)
var/battery_rating = 750
var/obj/item/weapon/cell/battery = null
@@ -13,6 +14,7 @@
name = "advanced battery"
desc = "An advanced power cell, often used in most laptops. It is too large to be fitted into smaller devices. It's rating is 1100."
icon_state = "battery_advanced"
origin_tech = list(TECH_POWER = 2, TECH_ENGINEERING = 2)
hardware_size = 2
battery_rating = 1100
@@ -20,6 +22,7 @@
name = "super battery"
desc = "A very advanced power cell, often used in high-end devices, or as uninterruptable power supply for important consoles or servers. It's rating is 1500."
icon_state = "battery_super"
origin_tech = list(TECH_POWER = 3, TECH_ENGINEERING = 3)
hardware_size = 2
battery_rating = 1500
@@ -27,6 +30,7 @@
name = "ultra battery"
desc = "A very advanced large power cell. It's often used as uninterruptable power supply for critical consoles or servers. It's rating is 2000."
icon_state = "battery_ultra"
origin_tech = list(TECH_POWER = 5, TECH_ENGINEERING = 4)
hardware_size = 3
battery_rating = 2000
@@ -34,12 +38,14 @@
name = "micro battery"
desc = "A small power cell, commonly seen in most portable microcomputers. It's rating is 500."
icon_state = "battery_micro"
origin_tech = list(TECH_POWER = 2, TECH_ENGINEERING = 2)
battery_rating = 500
/obj/item/weapon/computer_hardware/battery_module/nano
name = "nano battery"
desc = "A tiny power cell, commonly seen in low-end portable microcomputers. It's rating is 300."
icon_state = "battery_nano"
origin_tech = list(TECH_POWER = 1, TECH_ENGINEERING = 1)
battery_rating = 300
// This is not intended to be obtainable in-game. Intended for adminbus and debugging purposes.
@@ -49,11 +55,20 @@
icon_state = "battery_lambda"
hardware_size = 1
battery_rating = 1000000
/obj/item/weapon/computer_hardware/battery_module/lambda/New()
..()
battery = new/obj/item/weapon/cell/infinite(src)
/obj/item/weapon/computer_hardware/battery_module/diagnostics(var/mob/user)
..()
user << "Internal battery charge: [battery.charge]/[battery.maxcharge] CU"
/obj/item/weapon/computer_hardware/battery_module/New()
battery = new/obj/item/weapon/cell(src)
battery.maxcharge = battery_rating
battery.charge = battery_rating
..()
battery.charge = 0
..()
/obj/item/weapon/computer_hardware/battery_module/proc/charge_to_full()
if(battery)
battery.charge = battery.maxcharge

View File

@@ -5,6 +5,7 @@
critical = 0
icon_state = "cardreader"
hardware_size = 1
origin_tech = list(TECH_DATA = 2)
var/obj/item/weapon/card/id/stored_card = null

View File

@@ -4,6 +4,7 @@
power_usage = 25 // SSD or something with low power usage
icon_state = "hdd_normal"
hardware_size = 1
origin_tech = list(TECH_DATA = 1, TECH_ENGINEERING = 1)
var/max_capacity = 128
var/used_capacity = 0
var/list/stored_files = list() // List of stored files on this drive. DO NOT MODIFY DIRECTLY!
@@ -12,6 +13,7 @@
name = "advanced hard drive"
desc = "A small hybrid hard drive with 256GQ of storage capacity for use in higher grade computers where balance between power efficiency and capacity is desired."
max_capacity = 256
origin_tech = list(TECH_DATA = 2, TECH_ENGINEERING = 2)
power_usage = 50 // Hybrid, medium capacity and medium power storage
icon_state = "hdd_advanced"
hardware_size = 2
@@ -20,6 +22,7 @@
name = "super hard drive"
desc = "A small hard drive with 512GQ of storage capacity for use in cluster storage solutions where capacity is more important than power efficiency."
max_capacity = 512
origin_tech = list(TECH_DATA = 3, TECH_ENGINEERING = 3)
power_usage = 100 // High-capacity but uses lots of power, shortening battery life. Best used with APC link.
icon_state = "hdd_super"
hardware_size = 2
@@ -28,6 +31,7 @@
name = "cluster hard drive"
desc = "A large storage cluster consisting of multiple hard drives for usage in high capacity storage systems. Has capacity of 2048 GQ."
power_usage = 500
origin_tech = list(TECH_DATA = 4, TECH_ENGINEERING = 4)
max_capacity = 2048
icon_state = "hdd_cluster"
hardware_size = 3
@@ -37,6 +41,7 @@
name = "small hard drive"
desc = "A small highly efficient solid state drive for portable devices."
power_usage = 10
origin_tech = list(TECH_DATA = 2, TECH_ENGINEERING = 2)
max_capacity = 64
icon_state = "hdd_small"
hardware_size = 1
@@ -45,10 +50,17 @@
name = "micro hard drive"
desc = "A small micro hard drive for portable devices."
power_usage = 2
origin_tech = list(TECH_DATA = 1, TECH_ENGINEERING = 1)
max_capacity = 32
icon_state = "hdd_micro"
hardware_size = 1
/obj/item/weapon/computer_hardware/hard_drive/diagnostics(var/mob/user)
..()
// 999 is a byond limit that is in place. It's unlikely someone will reach that many files anyway, since you would sooner run out of space.
user << "NT-NFS File Table Status: [stored_files.len]/999"
user << "Storage capacity: [used_capacity]/[max_capacity]GQ"
// Use this proc to add file to the drive. Returns 1 on success and 0 on failure. Contains necessary sanity checks.
/obj/item/weapon/computer_hardware/hard_drive/proc/store_file(var/datum/computer_file/F)
if(!F || !istype(F))
@@ -57,6 +69,9 @@
if(!can_store_file(F.size))
return 0
if(!check_functionality())
return 0
if(!stored_files)
return 0
@@ -84,6 +99,9 @@
if(!stored_files)
return 0
if(!check_functionality())
return 0
if(F in stored_files)
stored_files -= F
recalculate_size()
@@ -124,6 +142,9 @@
// Tries to find the file by filename. Returns null on failure
/obj/item/weapon/computer_hardware/hard_drive/proc/find_file_by_name(var/filename)
if(!check_functionality())
return null
if(!filename)
return null

View File

@@ -1,14 +1,53 @@
/obj/item/weapon/computer_hardware/
name = "Hardware"
desc = "Unknown Hardware"
desc = "Unknown Hardware."
icon = 'icons/obj/modular_components.dmi'
var/obj/item/modular_computer/holder2 = 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.
var/hardware_size = 1 // Limits which devices can contain this component. 1: Tablets/Laptops/Consoles, 2: Laptops/Consoles, 3: Consoles only
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.
var/hardware_size = 1 // Limits which devices can contain this component. 1: Tablets/Laptops/Consoles, 2: Laptops/Consoles, 3: Consoles only
var/damage = 0 // Current damage level
var/max_damage = 100 // Maximal damage level.
var/damage_malfunction = 20 // "Malfunction" threshold. When damage exceeds this value the hardware piece will semi-randomly fail and do !!FUN!! things
var/damage_failure = 50 // "Failure" threshold. When damage exceeds this value the hardware piece will not work at all.
var/malfunction_probability = 10// Chance of malfunction when the component is damaged
/obj/item/weapon/computer_hardware/attackby(var/obj/item/W as obj, var/mob/living/user as mob)
// Multitool. Runs diagnostics
if(istype(W, /obj/item/device/multitool))
user << "***** DIAGNOSTICS REPORT *****"
diagnostics(user)
user << "******************************"
return 1
// Nanopaste. Repair all damage if present for a single unit.
var/obj/item/stack/S = W
if(istype(S, /obj/item/stack/nanopaste))
if(!damage)
user << "\The [src] doesn't seem to require repairs."
return 1
if(S.use(1))
user << "You apply a bit of \the [W] to \the [src]. It immediately repairs all damage."
damage = 0
return 1
// Cable coil. Works as repair method, but will probably require multiple applications and more cable.
if(istype(S, /obj/item/stack/cable_coil))
if(!damage)
user << "\The [src] doesn't seem to require repairs."
return 1
if(S.use(1))
user << "You patch up \the [src] with a bit of \the [W]."
take_damage(-10)
return 1
return ..()
// Called on multitool click, prints diagnostic information to the user.
/obj/item/weapon/computer_hardware/proc/diagnostics(var/mob/user)
user << "Hardware Integrity Test... (Corruption: [damage]/[max_damage]) [damage > damage_failure ? "FAIL" : damage > damage_malfunction ? "WARN" : "PASS"]"
/obj/item/weapon/computer_hardware/New(var/obj/L)
w_class = hardware_size
if(istype(L, /obj/machinery/modular_computer))
var/obj/machinery/modular_computer/C = L
if(C.cpu)
@@ -20,4 +59,31 @@
/obj/item/weapon/computer_hardware/Destroy()
holder2 = null
..()
return ..()
// Handles damage checks
/obj/item/weapon/computer_hardware/proc/check_functionality()
// Too damaged to work at all.
if(damage > damage_failure)
return 0
// Still working. Well, sometimes...
if(damage > damage_malfunction)
if(prob(malfunction_probability))
return 0
// Good to go.
return 1
/obj/item/weapon/computer_hardware/examine(var/mob/user)
. = ..()
if(damage > damage_failure)
user << "<span class='danger'>It seems to be severely damaged!</span>"
else if(damage > damage_malfunction)
user << "<span class='notice'>It seems to be damaged!</span>"
else if(damage)
user << "It seems to be slightly damaged."
// Damages the component. Contains necessary checks. Negative damage "heals" the component.
/obj/item/weapon/computer_hardware/proc/take_damage(var/amount)
damage += round(amount) // We want nice rounded numbers here.
damage = between(0, damage, max_damage) // Clamp the value.

View File

@@ -1,62 +1,46 @@
/obj/item/weapon/computer_hardware/nano_printer
name = "nano printer"
desc = "Small integrated printer with scanner and paper recycling module."
desc = "Small integrated printer with paper recycling module."
power_usage = 50
origin_tech = list(TECH_DATA = 2, TECH_ENGINEERING = 2)
critical = 0
icon_state = "printer"
hardware_size = 1
var/stored_paper = 5
var/max_paper = 10
var/obj/item/weapon/paper/P = null // Currently stored paper for scanning.
/obj/item/weapon/computer_hardware/nano_printer/diagnostics(var/mob/user)
..()
user << "Paper buffer level: [stored_paper]/[max_paper]"
/obj/item/weapon/computer_hardware/nano_printer/proc/print_text(var/text_to_print, var/paper_title = null)
if(!stored_paper)
return 0
if(!enabled)
return 0
if(!check_functionality())
return 0
// Recycle stored paper
if(P)
stored_paper++
qdel(P)
P = null
// Damaged printer causes the resulting paper to be somewhat harder to read.
if(damage > damage_malfunction)
text_to_print = stars(text_to_print, 100-malfunction_probability)
new/obj/item/weapon/paper(get_turf(holder2),text_to_print, paper_title)
P = new/obj/item/weapon/paper(get_turf(holder2))
P.info = text_to_print
if(paper_title)
P.name = paper_title
P.update_icon()
stored_paper--
P = null
return 1
/obj/item/weapon/computer_hardware/nano_printer/proc/load_paper(var/obj/item/weapon/paper/paper)
if(!paper || !istype(paper))
return 0
/obj/item/weapon/computer_hardware/nano_printer/attackby(obj/item/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/paper))
if(stored_paper >= max_paper)
user << "You try to add \the [W] into [src], but it's paper bin is full"
return
// We already have paper loaded, recycle it.
if(P && try_recycle_paper())
P = paper
P.forceMove(holder2)
/obj/item/weapon/computer_hardware/nano_printer/proc/try_recycle_paper()
if(!P)
return 0
if(stored_paper >= max_paper)
return 0
qdel(P)
P = null
return 1
user << "You insert \the [W] into [src]."
qdel(W)
stored_paper++
/obj/item/weapon/computer_hardware/nano_printer/Destroy()
if(holder2 && (holder2.nano_printer == src))
holder2.nano_printer = null
if(P)
if(holder2)
P.forceMove(get_turf(holder2))
else
qdel(P)
P = null
holder2 = null
..()

View File

@@ -4,6 +4,7 @@ var/global/ntnet_card_uid = 1
name = "basic NTNet network card"
desc = "A basic network card for usage with standard NTNet frequencies."
power_usage = 50
origin_tech = list(TECH_DATA = 2, TECH_ENGINEERING = 1)
critical = 0
icon_state = "netcard_basic"
hardware_size = 1
@@ -11,6 +12,18 @@ var/global/ntnet_card_uid = 1
var/identification_string = "" // Identification string, technically nickname seen in the network. Can be set by user.
var/long_range = 0
var/ethernet = 0 // Hard-wired, therefore always on, ignores NTNet wireless checks.
malfunction_probability = 1
/obj/item/weapon/computer_hardware/network_card/diagnostics(var/mob/user)
..()
user << "NIX Unique ID: [identification_id]"
user << "NIX User Tag: [identification_string]"
user << "Supported protocols:"
user << "511.m SFS (Subspace) - Standard Frequency Spread"
if(long_range)
user << "511.n WFS/HB (Subspace) - Wide Frequency Spread/High Bandiwdth"
if(ethernet)
user << "OpenEth (Physical Connection) - Physical network connection port"
/obj/item/weapon/computer_hardware/network_card/New(var/l)
..(l)
@@ -21,14 +34,16 @@ var/global/ntnet_card_uid = 1
name = "advanced NTNet network card"
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
origin_tech = list(TECH_DATA = 4, TECH_ENGINEERING = 2)
power_usage = 100 // Better range but higher power usage.
icon_state = "netcard_advanced"
hardware_size = 1
/obj/item/weapon/computer_hardware/network_card/wired
name = "wired NTNet network card"
desc = "An advanced network card for usage with NTNet. This one uses wired connection."
desc = "An advanced network card for usage with standard NTNet frequencies. This one also supports wired connection."
ethernet = 1
origin_tech = list(TECH_DATA = 5, TECH_ENGINEERING = 3)
power_usage = 100 // Better range but higher power usage.
icon_state = "netcard_ethernet"
hardware_size = 3
@@ -51,6 +66,9 @@ var/global/ntnet_card_uid = 1
if(!enabled)
return 0
if(!check_functionality())
return 0
if(ethernet) // Computer is connected via wired connection.
return 3
@@ -60,7 +78,11 @@ var/global/ntnet_card_uid = 1
if(holder2)
var/turf/T = get_turf(holder2)
if((T && istype(T)) && T.z in config.station_levels)
return 2
// Computer is on station. Low/High signal depending on what type of network card you have
if(long_range)
return 2
else
return 1
if(long_range) // Computer is not on station, but it has upgraded network card. Low signal.
return 1

View File

@@ -1,29 +1,30 @@
// These are basically USB data sticks and may be used to transfer files between devices
/obj/item/weapon/computer_hardware/hard_drive/portable/
name = "basic data crystal"
desc = "Small crystal with imprinted photonic circuits that can be used to store data. It's capacity is 16 GQ"
desc = "Small crystal with imprinted photonic circuits that can be used to store data. Its capacity is 16 GQ."
power_usage = 10
icon_state = "flashdrive_basic"
hardware_size = 1
max_capacity = 16
origin_tech = list(TECH_DATA = 1)
/obj/item/weapon/computer_hardware/hard_drive/portable/advanced
name = "advanced data crystal"
desc = "Small crystal with imprinted high-density photonic circuits that can be used to store data. It's capacity is 64 GQ"
desc = "Small crystal with imprinted high-density photonic circuits that can be used to store data. Its capacity is 64 GQ."
power_usage = 20
icon_state = "flashdrive_advanced"
hardware_size = 1
max_capacity = 64
origin_tech = list(TECH_DATA = 2)
/obj/item/weapon/computer_hardware/hard_drive/portable/super
name = "super data crystal"
desc = "Small crystal with imprinted ultra-density photonic circuits that can be used to store data. It's capacity is 256 GQ"
desc = "Small crystal with imprinted ultra-density photonic circuits that can be used to store data. Its capacity is 256 GQ."
power_usage = 40
icon_state = "flashdrive_super"
hardware_size = 1
max_capacity = 256
origin_tech = list(TECH_DATA = 4)
/obj/item/weapon/computer_hardware/hard_drive/portable/New()
..()

View File

@@ -8,6 +8,8 @@
hardware_size = 2
power_usage = 50
critical = 1
malfunction_probability = 1
origin_tech = list(TECH_DATA = 3, TECH_ENGINEERING = 2)
var/max_idle_programs = 2 // 2 idle, + 1 active = 3 as said in description.
@@ -18,6 +20,7 @@
hardware_size = 1
power_usage = 25
max_idle_programs = 1
origin_tech = list(TECH_DATA = 2, TECH_ENGINEERING = 2)
/obj/item/weapon/computer_hardware/processor_unit/photonic
name = "photonic processor"
@@ -26,6 +29,7 @@
hardware_size = 2
power_usage = 250
max_idle_programs = 4
origin_tech = list(TECH_DATA = 5, TECH_ENGINEERING = 4)
/obj/item/weapon/computer_hardware/processor_unit/photonic/small
name = "photonic microprocessor"
@@ -33,4 +37,5 @@
icon_state = "cpu_small_photonic"
hardware_size = 1
power_usage = 75
max_idle_programs = 2
max_idle_programs = 2
origin_tech = list(TECH_DATA = 4, TECH_ENGINEERING = 3)

View File

@@ -2,9 +2,10 @@
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
enabled = 1
icon_state = "teslalink"
hardware_size = 2 // Can't be installed into tablets
origin_tech = list(TECH_DATA = 2, TECH_POWER = 3, TECH_ENGINEERING = 2)
var/obj/machinery/modular_computer/holder
/obj/item/weapon/computer_hardware/tesla_link/New(var/obj/L)