Updates Part Sechs

This commit is contained in:
Unknown
2019-04-09 15:47:44 -04:00
parent 0d0d4e02db
commit 8a55090738
18 changed files with 116 additions and 52 deletions
@@ -148,6 +148,7 @@
STOP_PROCESSING(SSobj, src)
for(var/obj/item/weapon/computer_hardware/CH in src.get_all_components())
uninstall_component(null, CH)
qdel(CH)
return ..()
/obj/item/modular_computer/update_icon()
@@ -198,6 +199,8 @@
var/list/program = list()
program["name"] = P.filename
program["desc"] = P.filedesc
if(P in idle_threads)
program["running"] = 1
programs.Add(list(program))
data["programs"] = programs
@@ -395,10 +398,6 @@
if(!active_program || !processor_unit)
return
if(idle_threads.len >= processor_unit.max_idle_programs)
user << "<span class='notice'>\The [src] displays a \"Maximal CPU load reached. Unable to minimize another program.\" error</span>"
return
idle_threads.Add(active_program)
active_program.program_state = PROGRAM_STATE_BACKGROUND // Should close any existing UIs
SSnanoui.close_uis(active_program.NM ? active_program.NM : active_program)
@@ -407,6 +406,20 @@
if(user && istype(user))
ui_interact(user) // Re-open the UI on this computer. It should show the main screen now.
if( href_list["PC_killprogram"] )
var/prog = href_list["PC_killprogram"]
var/datum/computer_file/program/P = null
var/mob/user = usr
if(hard_drive)
P = hard_drive.find_file_by_name(prog)
if(!istype(P) || P.program_state == PROGRAM_STATE_KILLED)
return
P.kill_program(1)
update_uis()
user << "<span class='notice'>Program [P.filename].[P.filetype] with PID [rand(100,999)] has been killed.</span>"
if( href_list["PC_runprogram"] )
var/prog = href_list["PC_runprogram"]
var/datum/computer_file/program/P = null
@@ -431,9 +444,14 @@
update_icon()
return
if(idle_threads.len >= processor_unit.max_idle_programs+1)
user << "<span class='notice'>\The [src] displays a \"Maximal CPU load reached. Unable to run another program.\" error</span>"
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
if(P.run_program(user))
active_program = P
update_icon()
@@ -16,6 +16,9 @@
machinery_computer.cpu = null
machinery_computer = null
/obj/item/modular_computer/processor/nano_host()
return machinery_computer.nano_host()
// Due to how processes work, we'd receive two process calls - one from machinery type and one from our own type.
// Since we want this to be in-sync with machinery (as it's hidden type for machinery-based computers) we'll ignore
// non-relayed process calls.
@@ -100,10 +103,6 @@
var/obj/item/weapon/computer_hardware/tesla_link/L = H
L.holder = machinery_computer
machinery_computer.tesla_link = L
// Consoles don't usually have internal power source, so we can't disable tesla link in them.
if(istype(machinery_computer, /obj/machinery/modular_computer/console))
L.critical = 1
L.enabled = 1
found = 1
..(user, H, found)
@@ -111,7 +110,6 @@
if(machinery_computer.tesla_link == H)
machinery_computer.tesla_link = null
var/obj/item/weapon/computer_hardware/tesla_link/L = H
L.critical = 0 // That way we can install tesla link from console to laptop and it will be possible to turn it off via config.
L.holder = null
found = 1
..(user, H, found, critical)
@@ -126,4 +124,10 @@
/obj/item/modular_computer/processor/Adjacent(var/atom/neighbor)
if(!machinery_computer)
return 0
return machinery_computer.Adjacent(neighbor)
return machinery_computer.Adjacent(neighbor)
/obj/item/modular_computer/processor/turn_on(var/mob/user)
// If we have a tesla link on our machinery counterpart, enable it automatically. Lets computer without a battery work.
if(machinery_computer && machinery_computer.tesla_link)
machinery_computer.tesla_link.enabled = 1
..()
@@ -5,6 +5,7 @@
desc = "A low-end tablet often seen among low ranked station personnel"
processor_unit = new/obj/item/weapon/computer_hardware/processor_unit/small(src)
battery_module = new/obj/item/weapon/computer_hardware/battery_module/nano(src)
battery_module.charge_to_full()
hard_drive = new/obj/item/weapon/computer_hardware/hard_drive/micro(src)
network_card = new/obj/item/weapon/computer_hardware/network_card(src)
@@ -13,6 +14,7 @@
. = ..()
processor_unit = new/obj/item/weapon/computer_hardware/processor_unit/small(src)
battery_module = new/obj/item/weapon/computer_hardware/battery_module(src)
battery_module.charge_to_full()
hard_drive = new/obj/item/weapon/computer_hardware/hard_drive/small(src)
network_card = new/obj/item/weapon/computer_hardware/network_card(src)
nano_printer = new/obj/item/weapon/computer_hardware/nano_printer(src)
@@ -30,8 +30,6 @@
cpu.battery_module = null
cpu.network_card = new/obj/item/weapon/computer_hardware/network_card/wired(src)
tesla_link = new/obj/item/weapon/computer_hardware/tesla_link(src)
tesla_link.enabled = 1
tesla_link.critical = 1 // Consoles don't usually come with cells, and this prevents people from disabling their only power source, as they wouldn't be able to enable it again.
cpu.hard_drive = new/obj/item/weapon/computer_hardware/hard_drive/super(src) // Consoles generally have better HDDs due to lower space limitations
var/area/A = get_area(src)
// Attempts to set this console's tag according to our area. Since some areas have stuff like "XX - YY" in their names we try to remove that too.
@@ -25,6 +25,13 @@
if(comp && istype(comp))
computer = comp
/datum/computer_file/program/Destroy()
computer = null
. = ..()
/datum/computer_file/program/nano_host()
return computer.nano_host()
/datum/computer_file/program/clone()
var/datum/computer_file/program/temp = ..()
temp.required_access = required_access
@@ -96,7 +103,7 @@
/datum/computer_file/program/proc/run_program(var/mob/living/user)
if(can_run(user, 1))
if(nanomodule_path)
NM = new nanomodule_path(computer, src) // Computer is passed here as it's (probably!) physical object. Some UI's perform get_turf() and passing program datum wouldn't go well with this.
NM = new nanomodule_path(src, new /datum/topic_manager/program(src), src)
if(requires_ntnet && network_destination)
generate_network_log("Connection opened to [network_destination].")
program_state = PROGRAM_STATE_ACTIVE
@@ -4,8 +4,28 @@
/obj/machinery/modular_computer/update_layout()
return TRUE
/obj/item/modular_computer/initial_data()
return get_header_data()
/obj/item/modular_computer/update_layout()
return TRUE
///datum/nano_module/program
//adheres_to_NT_standard = FALSE
/datum/nano_module/program
//available_to_ai = FALSE
var/datum/computer_file/program/program = null // Program-Based computer program that runs this nano module. Defaults to null.
/datum/nano_module/program/New(var/host, var/topic_manager, var/program)
..()
src.program = program
/datum/topic_manager/program
var/datum/program
/datum/topic_manager/program/New(var/datum/program)
..()
src.program = program
// Calls forwarded to PROGRAM itself should begin with "PRG_"
// Calls forwarded to COMPUTER running the program should begin with "PC_"
/datum/topic_manager/program/Topic(href, href_list)
return program && program.Topic(href, href_list)
@@ -6,6 +6,7 @@
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.
@@ -57,5 +63,9 @@
/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
@@ -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
@@ -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,6 +50,7 @@
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
@@ -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
@@ -33,6 +34,7 @@ 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
@@ -41,6 +43,7 @@ var/global/ntnet_card_uid = 1
name = "wired NTNet network card"
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
@@ -6,7 +6,7 @@
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"
@@ -15,7 +15,7 @@
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"
@@ -24,6 +24,7 @@
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()
..()
@@ -9,6 +9,7 @@
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.
@@ -19,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"
@@ -27,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"
@@ -34,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)
@@ -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)
@@ -246,10 +246,12 @@ obj/machinery/lapvend/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(process_payment(I,W))
fabricate_and_recalc_price(1)
if((devtype == 1) && fabricated_laptop)
fabricated_laptop.cpu.battery_module.charge_to_full()
fabricated_laptop.forceMove(src.loc)
fabricated_laptop.close_laptop()
fabricated_laptop = null
else if((devtype == 2) && fabricated_tablet)
fabricated_tablet.battery_module.charge_to_full()
fabricated_tablet.forceMove(src.loc)
fabricated_tablet = null
ping("Enjoy your new product!")