h. Updates NTOS, and axes p2p filetransfer!

This commit is contained in:
Letter N
2020-07-30 20:54:13 +08:00
parent b376a6b6c4
commit e40470f553
54 changed files with 797 additions and 516 deletions

View File

@@ -0,0 +1,64 @@
/obj/proc/is_modular_computer()
return
/obj/proc/get_modular_computer_part(part_type)
return null
/obj/item/modular_computer/is_modular_computer()
return TRUE
/obj/item/modular_computer/get_modular_computer_part(part_type)
if(!part_type)
stack_trace("get_modular_computer_part() called without a valid part_type")
return null
return all_components[part_type]
/obj/machinery/modular_computer/is_modular_computer()
return TRUE
/obj/machinery/modular_computer/get_modular_computer_part(part_type)
if(!part_type)
stack_trace("get_modular_computer_part() called without a valid part_type")
return null
return cpu?.all_components[part_type]
/obj/proc/get_modular_computer_parts_examine(mob/user)
. = list()
if(!is_modular_computer())
return
var/user_is_adjacent = Adjacent(user) //don't reveal full details unless they're close enough to see it on the screen anyway.
var/obj/item/computer_hardware/ai_slot/ai_slot = get_modular_computer_part(MC_AI)
if(ai_slot)
if(ai_slot.stored_card)
if(user_is_adjacent)
. += "It has a slot installed for an intelliCard which contains: [ai_slot.stored_card.name]"
else
. += "It has a slot installed for an intelliCard, which appears to be occupied."
. += "<span class='info'>Alt-click to eject the intelliCard.</span>"
else
. += "It has a slot installed for an intelliCard."
var/obj/item/computer_hardware/card_slot/card_slot = get_modular_computer_part(MC_CARD)
if(card_slot)
if(card_slot.stored_card || card_slot.stored_card2)
var/obj/item/card/id/first_ID = card_slot.stored_card
var/obj/item/card/id/second_ID = card_slot.stored_card2
var/multiple_cards = istype(first_ID) && istype(second_ID)
if(user_is_adjacent)
. += "It has two slots for identification cards installed[multiple_cards ? " which contain [first_ID] and [second_ID]" : ", one of which contains [first_ID ? first_ID : second_ID]"]."
else
. += "It has two slots for identification cards installed, [multiple_cards ? "both of which appear" : "and one of them appears"] to be occupied."
. += "<span class='info'>Alt-click [src] to eject the identification card[multiple_cards ? "s":""].</span>"
else
. += "It has two slots installed for identification cards."
var/obj/item/computer_hardware/printer/printer_slot = get_modular_computer_part(MC_PRINT)
if(printer_slot)
. += "It has a printer installed."
if(user_is_adjacent)
. += "The printer's paper levels are at: [printer_slot.stored_paper]/[printer_slot.max_paper].</span>]"

View File

@@ -7,6 +7,7 @@
var/enabled = 0 // Whether the computer is turned on.
var/screen_on = 1 // Whether the computer is active/opened/it's screen is on.
var/device_theme = "ntos" // Sets the theme for the main menu, hardware config, and file browser apps. Overridden by certain non-NT devices.
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
var/last_power_usage = 0
@@ -98,7 +99,7 @@
if(issilicon(usr))
return
var/obj/item/computer_hardware/card_slot/card_slot = all_components[MC_CARD]
if(usr.canUseTopic(src))
if(usr.canUseTopic(src, BE_CLOSE))
card_slot.try_eject(null, usr)
// Eject ID card from computer, if it has ID slot with card inside.
@@ -109,7 +110,7 @@
if(issilicon(usr))
return
var/obj/item/computer_hardware/ai_slot/ai_slot = all_components[MC_AI]
if(usr.canUseTopic(src))
if(usr.canUseTopic(src, BE_CLOSE))
ai_slot.try_eject(null, usr,1)
@@ -121,17 +122,17 @@
if(issilicon(usr))
return
if(usr.canUseTopic(src))
if(usr.canUseTopic(src, BE_CLOSE))
var/obj/item/computer_hardware/hard_drive/portable/portable_drive = all_components[MC_SDD]
if(uninstall_component(portable_drive, usr))
portable_drive.verb_pickup()
/obj/item/modular_computer/AltClick(mob/user)
. = ..()
..()
if(issilicon(user))
return
if(user.canUseTopic(src))
if(user.canUseTopic(src, BE_CLOSE))
var/obj/item/computer_hardware/card_slot/card_slot = all_components[MC_CARD]
var/obj/item/computer_hardware/ai_slot/ai_slot = all_components[MC_AI]
var/obj/item/computer_hardware/hard_drive/portable/portable_drive = all_components[MC_SDD]
@@ -143,7 +144,7 @@
return
if(ai_slot)
ai_slot.try_eject(null, user)
return TRUE
// Gets IDs/access levels from card slot. Would be useful when/if PDAs would become modular PCs.
/obj/item/modular_computer/GetAccess()
@@ -175,7 +176,7 @@
/obj/item/modular_computer/MouseDrop(obj/over_object, src_location, over_location)
var/mob/M = usr
if((!istype(over_object, /obj/screen)) && usr.canUseTopic(src))
if((!istype(over_object, /obj/screen)) && usr.canUseTopic(src, BE_CLOSE))
return attack_self(M)
return ..()
@@ -195,12 +196,22 @@
/obj/item/modular_computer/emag_act(mob/user)
. = ..()
if(obj_flags & EMAGGED)
to_chat(user, "<span class='warning'>\The [src] was already emagged.</span>")
return
obj_flags |= EMAGGED
to_chat(user, "<span class='notice'>You emag \the [src]. It's screen briefly shows a \"OVERRIDE ACCEPTED: New software downloads available.\" message.</span>")
return TRUE
if(!enabled)
to_chat(user, "<span class='warning'>You'd need to turn the [src] on first.</span>")
return FALSE
obj_flags |= EMAGGED //Mostly for consistancy purposes; the programs will do their own emag handling
var/newemag = FALSE
var/obj/item/computer_hardware/hard_drive/drive = all_components[MC_HDD]
for(var/datum/computer_file/program/app in drive.stored_files)
if(!istype(app))
continue
if(app.run_emag())
newemag = TRUE
if(newemag)
to_chat(user, "<span class='notice'>You swipe \the [src]. A console window momentarily fills the screen, with white text rapidly scrolling past.</span>")
return TRUE
to_chat(user, "<span class='notice'>You swipe \the [src]. A console window fills the screen, but it quickly closes itself after only a few lines are written to it.</span>")
return FALSE
/obj/item/modular_computer/examine(mob/user)
. = ..()
@@ -209,13 +220,14 @@
else if(obj_integrity < max_integrity)
. += "<span class='warning'>It is damaged.</span>"
. += get_modular_computer_parts_examine(user)
/obj/item/modular_computer/update_icon_state()
if(!enabled)
icon_state = icon_state_unpowered
else
icon_state = icon_state_powered
/obj/item/modular_computer/update_overlays()
. = ..()
if(!display_overlays)
@@ -306,6 +318,8 @@
/obj/item/modular_computer/proc/get_header_data()
var/list/data = list()
data["PC_device_theme"] = device_theme
var/obj/item/computer_hardware/battery/battery_module = all_components[MC_CELL]
var/obj/item/computer_hardware/recharger/recharger = all_components[MC_CHARGE]
@@ -407,17 +421,17 @@
if(install_component(W, user))
return
if(istype(W, /obj/item/wrench))
if(W.tool_behaviour == TOOL_WRENCH)
if(all_components.len)
to_chat(user, "<span class='warning'>Remove all components from \the [src] before disassembling it.</span>")
return
new /obj/item/stack/sheet/metal( get_turf(src.loc), steel_sheet_cost )
physical.visible_message("\The [src] has been disassembled by [user].")
physical.visible_message("<span class='notice'>\The [src] is disassembled by [user].</span>")
relay_qdel()
qdel(src)
return
if(istype(W, /obj/item/weldingtool))
if(W.tool_behaviour == TOOL_WELDER)
if(obj_integrity == max_integrity)
to_chat(user, "<span class='warning'>\The [src] does not require repairs.</span>")
return
@@ -431,7 +445,7 @@
to_chat(user, "<span class='notice'>You repair \the [src].</span>")
return
if(istype(W, /obj/item/screwdriver))
if(W.tool_behaviour == TOOL_SCREWDRIVER)
if(!all_components.len)
to_chat(user, "<span class='warning'>This device doesn't have any components installed.</span>")
return
@@ -440,7 +454,7 @@
var/obj/item/computer_hardware/H = all_components[h]
component_names.Add(H.name)
var/choice = input(user, "Which component do you want to uninstall?", "Computer maintenance", null) as null|anything in component_names
var/choice = input(user, "Which component do you want to uninstall?", "Computer maintenance", null) as null|anything in sortList(component_names)
if(!choice)
return

View File

@@ -18,13 +18,13 @@
/obj/item/modular_computer/proc/break_apart()
if(!(flags_1 & NODECONSTRUCT_1))
physical.visible_message("\The [src] breaks apart!")
physical.visible_message("<span class='notice'>\The [src] breaks apart!</span>")
var/turf/newloc = get_turf(src)
new /obj/item/stack/sheet/metal(newloc, round(steel_sheet_cost/2))
for(var/C in all_components)
var/obj/item/computer_hardware/H = all_components[C]
if(QDELETED(H))
return
continue
uninstall_component(H)
H.forceMove(newloc)
if(prob(25))

View File

@@ -28,8 +28,7 @@
/obj/item/modular_computer/get_cell()
var/obj/item/computer_hardware/battery/battery_module = all_components[MC_CELL]
if(battery_module && battery_module.battery)
return battery_module.battery
return battery_module?.get_cell()
// Used in following function to reduce copypaste
/obj/item/modular_computer/proc/power_failure()

View File

@@ -7,6 +7,7 @@
icon_state_powered = "laptop"
icon_state_unpowered = "laptop-off"
icon_state_menu = "menu"
display_overlays = FALSE
hardware_flag = PROGRAM_LAPTOP
max_hardware_size = 2
@@ -18,8 +19,8 @@
screen_on = 0 // Starts closed
var/start_open = TRUE // unless this var is set to 1
var/icon_state_closed = "laptop-closed"
display_overlays = FALSE
var/w_class_open = WEIGHT_CLASS_BULKY
var/slowdown_open = TRUE
/obj/item/modular_computer/laptop/examine(mob/user)
. = ..()
@@ -38,6 +39,13 @@
else
. = ..()
/obj/item/modular_computer/laptop/update_overlays()
if(screen_on)
return ..()
else
cut_overlays()
icon_state = icon_state_closed
/obj/item/modular_computer/laptop/attack_self(mob/user)
if(!screen_on)
try_toggle_open(user)
@@ -64,7 +72,7 @@
return
M.put_in_hand(src, H.held_index)
/obj/item/modular_computer/laptop/on_attack_hand(mob/user, act_intent = user.a_intent, unarmed_attack_flags)
/obj/item/modular_computer/laptop/on_attack_hand(mob/user)
if(screen_on && isturf(loc))
return attack_self(user)
@@ -73,7 +81,7 @@
return
if(!isturf(loc) && !ismob(loc)) // No opening it in backpack.
return
if(!user.canUseTopic(src))
if(!user.canUseTopic(src, BE_CLOSE))
return
toggle_open(user)
@@ -82,15 +90,17 @@
/obj/item/modular_computer/laptop/AltClick(mob/user)
if(screen_on) // Close it.
try_toggle_open(user)
return TRUE
return ..()
else
return ..()
/obj/item/modular_computer/laptop/proc/toggle_open(mob/living/user=null)
if(screen_on)
to_chat(user, "<span class='notice'>You close \the [src].</span>")
slowdown = initial(slowdown)
w_class = initial(w_class)
else
to_chat(user, "<span class='notice'>You open \the [src].</span>")
slowdown = slowdown_open
w_class = w_class_open
screen_on = !screen_on

View File

@@ -20,4 +20,3 @@
/obj/item/modular_computer/laptop/preset/civilian/install_programs()
var/obj/item/computer_hardware/hard_drive/hard_drive = all_components[MC_HDD]
hard_drive.store_file(new/datum/computer_file/program/chatclient())
hard_drive.store_file(new/datum/computer_file/program/nttransfer())

View File

@@ -1,4 +1,5 @@
// Held by /obj/machinery/modular_computer to reduce amount of copy-pasted code.
//TODO: REFACTOR THIS SPAGHETTI CODE, MAKE IT A COMPUTER_HARDWARE COMPONENT OR REMOVE IT
/obj/item/modular_computer/processor
name = "processing unit"
desc = "You shouldn't see this. If you do, report it."
@@ -11,19 +12,22 @@
var/obj/machinery/modular_computer/machinery_computer = null
/obj/item/modular_computer/processor/Destroy()
. = ..()
if(machinery_computer && (machinery_computer.cpu == src))
machinery_computer.cpu = null
machinery_computer.UnregisterSignal(src, COMSIG_ATOM_UPDATED_ICON)
machinery_computer = null
/obj/item/modular_computer/processor/Initialize(mapload)
. = ..()
if(!loc || !istype(loc, /obj/machinery/modular_computer))
/obj/item/modular_computer/processor/New(comp) //intentional new probably
..()
STOP_PROCESSING(SSobj, src) // Processed by its machine
if(!comp || !istype(comp, /obj/machinery/modular_computer))
CRASH("Inapropriate type passed to obj/item/modular_computer/processor/New()! Aborting.")
// Obtain reference to machinery computer
all_components = list()
idle_threads = list()
machinery_computer = loc
machinery_computer = comp
machinery_computer.cpu = src
hardware_flag = machinery_computer.hardware_flag
max_hardware_size = machinery_computer.max_hardware_size
@@ -39,7 +43,7 @@
qdel(machinery_computer)
// This thing is not meant to be used on it's own, get topic data from our machinery owner.
//obj/item/modular_computer/processor/canUseTopic(atom/movable/M, be_close=FALSE, no_dextery=FALSE, no_tk=FALSE)
//obj/item/modular_computer/processor/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE)
// if(!machinery_computer)
// return 0
@@ -69,3 +73,6 @@
machinery_computer.verbs -= /obj/machinery/modular_computer/proc/eject_disk
if(MC_AI)
machinery_computer.verbs -= /obj/machinery/modular_computer/proc/eject_card
/obj/item/modular_computer/processor/attack_ghost(mob/user)
ui_interact(user)

View File

@@ -5,6 +5,7 @@
icon_state_unpowered = "tablet"
icon_state_powered = "tablet"
icon_state_menu = "menu"
//worn_icon_state = "tablet"
hardware_flag = PROGRAM_TABLET
max_hardware_size = 1
w_class = WEIGHT_CLASS_SMALL
@@ -32,3 +33,17 @@
slot_flags = ITEM_SLOT_ID | ITEM_SLOT_BELT
comp_light_luminosity = 6.3
has_variants = FALSE
/// Given to Nuke Ops members.
/obj/item/modular_computer/tablet/nukeops
icon_state = "tablet-syndicate"
comp_light_luminosity = 6.3
has_variants = FALSE
device_theme = "syndicate"
/obj/item/modular_computer/tablet/nukeops/emag_act(mob/user)
if(!enabled)
to_chat(user, "<span class='warning'>You'd need to turn the [src] on first.</span>")
return FALSE
to_chat(user, "<span class='notice'>You swipe \the [src]. It's screen briefly shows a message reading \"MEMORY CODE INJECTION DETECTED AND SUCCESSFULLY QUARANTINED\".</span>")
return FALSE

View File

@@ -22,23 +22,38 @@
/obj/item/modular_computer/tablet/preset/cargo/Initialize()
. = ..()
var/obj/item/computer_hardware/hard_drive/small/hard_drive = new
install_component(new /obj/item/computer_hardware/processor_unit/small)
install_component(new /obj/item/computer_hardware/battery(src, /obj/item/stock_parts/cell/computer))
install_component(new /obj/item/computer_hardware/hard_drive/small)
install_component(hard_drive)
install_component(new /obj/item/computer_hardware/network_card)
install_component(new /obj/item/computer_hardware/printer/mini)
hard_drive.store_file(new /datum/computer_file/program/bounty)
//hard_drive.store_file(new /datum/computer_file/program/shipping)
/obj/item/modular_computer/tablet/syndicate_contract_uplink/preset/uplink/Initialize() // Given by the syndicate as part of the contract uplink bundle - loads in the Contractor Uplink.
/// Given by the syndicate as part of the contract uplink bundle - loads in the Contractor Uplink.
/obj/item/modular_computer/tablet/syndicate_contract_uplink/preset/uplink/Initialize()
. = ..()
var/obj/item/computer_hardware/hard_drive/small/syndicate/hard_drive = new
var/datum/computer_file/program/contract_uplink/uplink = new
active_program = uplink
uplink.program_state = PROGRAM_STATE_ACTIVE
uplink.computer = src
hard_drive.store_file(uplink)
install_component(new /obj/item/computer_hardware/processor_unit/small)
install_component(new /obj/item/computer_hardware/battery(src, /obj/item/stock_parts/cell/computer))
install_component(hard_drive)
install_component(new /obj/item/computer_hardware/network_card)
install_component(new /obj/item/computer_hardware/card_slot)
install_component(new /obj/item/computer_hardware/printer/mini)
install_component(new /obj/item/computer_hardware/printer/mini)
/// Given to Nuke Ops members.
/obj/item/modular_computer/tablet/nukeops/Initialize()
. = ..()
install_component(new /obj/item/computer_hardware/processor_unit/small)
install_component(new /obj/item/computer_hardware/battery(src, /obj/item/stock_parts/cell/computer))
install_component(new /obj/item/computer_hardware/hard_drive/small/nukeops)
install_component(new /obj/item/computer_hardware/network_card)

View File

@@ -46,16 +46,12 @@
desc = "A stationary computer. This one comes preloaded with research programs."
_has_ai = TRUE
/obj/machinery/modular_computer/console/preset/research/examine(mob/user)
. = ..()
. += "<span class='notice'>Alt-click to eject the intelliCard.</span>"
/obj/machinery/modular_computer/console/preset/research/install_programs()
var/obj/item/computer_hardware/hard_drive/hard_drive = cpu.all_components[MC_HDD]
hard_drive.store_file(new/datum/computer_file/program/ntnetmonitor())
hard_drive.store_file(new/datum/computer_file/program/nttransfer())
hard_drive.store_file(new/datum/computer_file/program/chatclient())
hard_drive.store_file(new/datum/computer_file/program/aidiag())
hard_drive.store_file(new/datum/computer_file/program/robocontrol())
// ===== COMMAND CONSOLE =====
@@ -66,15 +62,27 @@
_has_id_slot = TRUE
_has_printer = TRUE
/obj/machinery/modular_computer/console/preset/command/examine(mob/user)
. = ..()
. += "<span class='notice'>Alt-click [src] to eject the identification card.</span>"
/obj/machinery/modular_computer/console/preset/command/install_programs()
var/obj/item/computer_hardware/hard_drive/hard_drive = cpu.all_components[MC_HDD]
hard_drive.store_file(new/datum/computer_file/program/chatclient())
hard_drive.store_file(new/datum/computer_file/program/card_mod())
// ===== IDENTIFICATION CONSOLE =====
/obj/machinery/modular_computer/console/preset/id
console_department = "Identification"
name = "identification console"
desc = "A stationary computer. This one comes preloaded with identification modification programs."
_has_id_slot = TRUE
_has_printer = TRUE
/obj/machinery/modular_computer/console/preset/id/install_programs()
var/obj/item/computer_hardware/hard_drive/hard_drive = cpu.all_components[MC_HDD]
hard_drive.store_file(new/datum/computer_file/program/chatclient())
hard_drive.store_file(new/datum/computer_file/program/card_mod())
hard_drive.store_file(new/datum/computer_file/program/job_management())
hard_drive.store_file(new/datum/computer_file/program/crew_manifest())
// ===== CIVILIAN CONSOLE =====
/obj/machinery/modular_computer/console/preset/civilian
console_department = "Civilian"
@@ -84,5 +92,4 @@
/obj/machinery/modular_computer/console/preset/civilian/install_programs()
var/obj/item/computer_hardware/hard_drive/hard_drive = cpu.all_components[MC_HDD]
hard_drive.store_file(new/datum/computer_file/program/chatclient())
hard_drive.store_file(new/datum/computer_file/program/nttransfer())
hard_drive.store_file(new/datum/computer_file/program/arcade())

View File

@@ -36,6 +36,10 @@
QDEL_NULL(cpu)
return ..()
/obj/machinery/modular_computer/examine(mob/user)
. = ..()
. += get_modular_computer_parts_examine(user)
/obj/machinery/modular_computer/attack_ghost(mob/dead/observer/user)
. = ..()
if(.)
@@ -45,31 +49,31 @@
/obj/machinery/modular_computer/emag_act(mob/user)
. = ..()
if(cpu)
. |= cpu.emag_act(user)
if(!cpu)
to_chat(user, "<span class='warning'>You'd need to turn the [src] on first.</span>")
return FALSE
return (cpu.emag_act(user))
/obj/machinery/modular_computer/update_icon_state()
if(cpu?.enabled)
icon_state = icon_state_powered
else if(stat & NOPOWER || !(cpu?.use_power()))
icon_state = icon_state_unpowered
/obj/machinery/modular_computer/update_icon()
cut_overlays()
icon_state = icon_state_powered
/obj/machinery/modular_computer/update_overlays()
. = ..()
if(!cpu || !cpu.enabled)
if (!(stat & NOPOWER) && (cpu && cpu.use_power()))
. += screen_icon_screensaver
add_overlay(screen_icon_screensaver)
else
icon_state = icon_state_unpowered
set_light(0)
else
set_light(light_strength)
if(cpu.active_program)
. += cpu.active_program.program_icon_state ? cpu.active_program.program_icon_state : screen_icon_state_menu
add_overlay(cpu.active_program.program_icon_state ? cpu.active_program.program_icon_state : screen_icon_state_menu)
else
. += screen_icon_state_menu
add_overlay(screen_icon_state_menu)
if(cpu && cpu.obj_integrity <= cpu.integrity_failure * cpu.max_integrity)
. += "bsod"
. += "broken"
add_overlay("bsod")
add_overlay("broken")
// Eject ID card from computer, if it has ID slot with card inside.
/obj/machinery/modular_computer/proc/eject_id()
@@ -96,10 +100,10 @@
cpu.eject_card()
/obj/machinery/modular_computer/AltClick(mob/user)
. = ..()
if(cpu)
return cpu.AltClick(user)
cpu.AltClick(user)
//ATTACK HAND IGNORING PARENT RETURN VALUE
// On-click handling. Turns on the computer if it's off and opens the GUI.
/obj/machinery/modular_computer/interact(mob/user)
if(cpu)
@@ -130,8 +134,7 @@
stat &= ~NOPOWER
update_icon()
return
..()
update_icon()
. = ..()
/obj/machinery/modular_computer/attackby(var/obj/item/W as obj, mob/user)
if(cpu && !(flags_1 & NODECONSTRUCT_1))
@@ -144,6 +147,13 @@
/obj/machinery/modular_computer/ex_act(severity)
if(cpu)
cpu.ex_act(severity)
// switch(severity)
// if(EXPLODE_DEVASTATE)
// SSexplosions.highobj += cpu
// if(EXPLODE_HEAVY)
// SSexplosions.medobj += cpu
// if(EXPLODE_LIGHT)
// SSexplosions.lowobj += cpu
..()
// EMPs are similar to explosions, but don't cause physical damage to the casing. Instead they screw up the components

View File

@@ -52,4 +52,4 @@
network_card.identification_string = "Unknown Console"
if(cpu)
cpu.screen_on = 1
update_icon()
update_icon()