Adds Syndicate tablets, replaces the pinpointer used by Nuke Ops (#51386)

* Synux

* cleanup

* I bet this merge conflicts

we hate tgui.bundle

* extra bits

* Syndix

* small fixes

* Summary (required)

* this linter drives me up the wall

* final touchups

* Forgot this thing
This commit is contained in:
zxaber
2020-06-22 16:24:43 -03:00
committed by GitHub
parent f7ce2b7270
commit 4156b79b94
20 changed files with 250 additions and 98 deletions
@@ -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
@@ -194,13 +195,22 @@
turn_on(user)
/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 0
else
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 1
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)
. = ..()
@@ -307,6 +317,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]
@@ -39,13 +39,20 @@
assets.send(user)
assets = get_asset_datum(/datum/asset/simple/arcade)
assets.send(user)
ui = new(user, src, ui_key, "NtosMain", "NtOS Main menu", 400, 500, master_ui, state)
var/headername
switch(device_theme)
if("ntos")
headername = "NtOS Main Menu"
if("syndicate")
headername = "Syndix Main Menu"
ui = new(user, src, ui_key, "NtosMain", headername, 400, 500, master_ui, state)
ui.open()
ui.set_autoupdate(state = 1)
/obj/item/modular_computer/ui_data(mob/user)
var/list/data = get_header_data()
data["device_theme"] = device_theme
data["programs"] = list()
var/obj/item/computer_hardware/hard_drive/hard_drive = all_components[MC_HDD]
for(var/datum/computer_file/program/P in hard_drive.stored_files)
@@ -33,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
@@ -46,3 +46,11 @@
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)
/// 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)
@@ -48,7 +48,10 @@
cpu.attack_ghost(user)
/obj/machinery/modular_computer/emag_act(mob/user)
return cpu ? cpu.emag_act(user) : 1
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()
cut_overlays()
@@ -150,6 +150,20 @@
return 1
return 0
/**
*
*Called by the device when it is emagged.
*
*Emagging the device allows certain programs to unlock new functions. However, the program will
*need to be downloaded first, and then handle the unlock on their own in their run_emag() proc.
*The device will allow an emag to be run multiple times, so the user can re-emag to run the
*override again, should they download something new. The run_emag() proc should return TRUE if
*the emagging affected anything, and FALSE if no change was made (already emagged, or has no
*emag functions).
**/
/datum/computer_file/program/proc/run_emag()
return FALSE
// Use this proc to kill the program. Designed to be implemented by each program if it requires on-quit logic, such as the NTNRC client.
/datum/computer_file/program/proc/kill_program(forced = FALSE)
program_state = PROGRAM_STATE_KILLED
@@ -20,6 +20,21 @@
var/download_netspeed = 0
var/downloaderror = ""
var/obj/item/modular_computer/my_computer = null
var/emagged = FALSE
var/list/main_repo
var/list/antag_repo
/datum/computer_file/program/ntnetdownload/run_program()
. = ..()
main_repo = SSnetworks.station_network.available_station_software
antag_repo = SSnetworks.station_network.available_antag_software
/datum/computer_file/program/ntnetdownload/run_emag()
if(emagged)
return FALSE
emagged = TRUE
return TRUE
/datum/computer_file/program/ntnetdownload/proc/begin_file_download(filename)
if(downloaded_file)
@@ -30,8 +45,8 @@
if(!PRG || !istype(PRG))
return 0
// Attempting to download antag only program, but without having emagged computer. No.
if(PRG.available_on_syndinet && !(computer.obj_flags & EMAGGED))
// Attempting to download antag only program, but without having emagged/syndicate computer. No.
if(PRG.available_on_syndinet && !emagged)
return 0
var/obj/item/computer_hardware/hard_drive/hard_drive = computer.all_components[MC_HDD]
@@ -41,10 +56,10 @@
ui_header = "downloader_running.gif"
if(PRG in SSnetworks.station_network.available_station_software)
if(PRG in main_repo)
generate_network_log("Began downloading file [PRG.filename].[PRG.filetype] from NTNet Software Repository.")
hacked_download = 0
else if(PRG in SSnetworks.station_network.available_antag_software)
else if(PRG in antag_repo)
generate_network_log("Began downloading file **ENCRYPTED**.[PRG.filetype] from unspecified server.")
hacked_download = 1
else
@@ -130,7 +145,7 @@
data["disk_size"] = hard_drive.max_capacity
data["disk_used"] = hard_drive.used_capacity
var/list/all_entries[0]
for(var/A in SSnetworks.station_network.available_station_software)
for(var/A in main_repo)
var/datum/computer_file/program/P = A
// Only those programs our user can run will show in the list
if(!P.can_run(user,transfer = 1) || hard_drive.find_file_by_name(P.filename))
@@ -143,9 +158,9 @@
"size" = P.size,
)))
data["hackedavailable"] = FALSE
if(computer.obj_flags & EMAGGED) // If we are running on emagged computer we have access to some "bonus" software
if(emagged) // If we are running on emagged computer we have access to some "bonus" software
var/list/hacked_programs[0]
for(var/S in SSnetworks.station_network.available_antag_software)
for(var/S in antag_repo)
var/datum/computer_file/program/P = S
if(hard_drive.find_file_by_name(P.filename))
continue
@@ -172,3 +187,24 @@
/datum/computer_file/program/ntnetdownload/kill_program(forced)
abort_file_download()
return ..(forced)
////////////////////////
//Syndicate Downloader//
////////////////////////
/// This app only lists programs normally found in the emagged section of the normal downloader app
/datum/computer_file/program/ntnetdownload/syndicate
filename = "syndownloader"
filedesc = "Software Download Tool"
program_icon_state = "generic"
extended_desc = "This program allows downloads of software from shared Syndicate repositories"
requires_ntnet = 0
ui_header = "downloader_finished.gif"
tgui_id = "NtosNetDownloader"
emagged = TRUE
/datum/computer_file/program/ntnetdownload/syndicate/run_program()
. = ..()
main_repo = SSnetworks.station_network.available_antag_software
antag_repo = null
@@ -2,11 +2,11 @@
filename = "genericfinder"
filedesc = "debug_finder"
ui_header = "borg_mon.gif" //DEBUG -- new icon before PR
program_icon_state = "generic"
extended_desc = "generic"
program_icon_state = "radarntos"
requires_ntnet = TRUE
transfer_access = null
available_on_ntnet = FALSE
usage_flags = PROGRAM_LAPTOP | PROGRAM_TABLET
network_destination = "tracking program"
size = 5
tgui_id = "NtosRadar"
@@ -21,10 +21,28 @@
var/atom/selected
///Used to store when the next scan is available. Updated by the scan() proc.
var/next_scan = 0
///Used to keep track of the last value program_icon_state was set to, to prevent constant unnecessary update_icon() calls
var/last_icon_state = ""
///Used by the tgui interface, themed NT or Syndicate.
var/arrowstyle = "ntosradarpointer.png"
///Used by the tgui interface, themed for NT or Syndicate colors.
var/pointercolor = "green"
/datum/computer_file/program/radar/run_program(mob/living/user)
. = ..()
if(.)
START_PROCESSING(SSfastprocess, src)
return
return FALSE
/datum/computer_file/program/radar/kill_program(forced = FALSE)
objects = list()
selected = null
STOP_PROCESSING(SSfastprocess, src)
return ..()
/datum/computer_file/program/radar/Destroy()
STOP_PROCESSING(SSfastprocess, src)
return ..()
/datum/computer_file/program/radar/ui_data(mob/user)
@@ -65,7 +83,37 @@
*
*/
/datum/computer_file/program/radar/proc/track()
return
var/atom/movable/signal = find_atom()
if(!trackable(signal))
return
var/turf/here_turf = (get_turf(computer))
var/turf/target_turf = (get_turf(signal))
var/userot = FALSE
var/rot = 0
var/pointer="crosshairs"
var/locx = (target_turf.x - here_turf.x) + 24
var/locy = (here_turf.y - target_turf.y) + 24
if(get_dist_euclidian(here_turf, target_turf) > 24)
userot = TRUE
rot = round(Get_Angle(here_turf, target_turf))
else
if(target_turf.z > here_turf.z)
pointer="caret-up"
else if(target_turf.z < here_turf.z)
pointer="caret-down"
var/list/trackinfo = list(
"locx" = locx,
"locy" = locy,
"userot" = userot,
"rot" = rot,
"arrowstyle" = arrowstyle,
"color" = pointercolor,
"pointer" = pointer,
)
return trackinfo
/**
*
@@ -77,10 +125,12 @@
**arg1 is the atom being evaluated.
*/
/datum/computer_file/program/radar/proc/trackable(atom/movable/signal)
if(!signal)
if(!signal || !computer)
return FALSE
var/turf/here = get_turf(computer)
var/turf/there = get_turf(signal)
if(!here || !there)
return FALSE //I was still getting a runtime even after the above check while scanning, so fuck it
return (there.z == here.z) || (is_station_level(here.z) && is_station_level(there.z))
/**
@@ -98,6 +148,59 @@
/datum/computer_file/program/radar/proc/scan()
return
/**
*
*Finds the atom in the appropriate list that the `selected` var indicates
*
*The `selected` var holds a REF, which is a string. A mob REF may be
*something like "mob_209". In order to find the actual atom, we need
*to search the appropriate list for the REF string. This is dependant
*on the program (Lifeline uses GLOB.human_list, while Fission360 uses
*GLOB.poi_list), but the result will be the same; evaluate the string and
*return an atom reference.
*/
/datum/computer_file/program/radar/proc/find_atom()
return
//We use SSfastprocess for the program icon state because it runs faster than process_tick() does.
/datum/computer_file/program/radar/process()
if(computer.active_program != src)
STOP_PROCESSING(SSfastprocess, src) //We're not the active program, it's time to stop.
return
if(!selected)
return
var/atom/movable/signal = find_atom()
if(!trackable(signal))
program_icon_state = "[initial(program_icon_state)]lost"
if(last_icon_state != program_icon_state)
computer.update_icon()
last_icon_state = program_icon_state
return
var/here_turf = get_turf(computer)
var/target_turf = get_turf(signal)
var/trackdistance = get_dist_euclidian(here_turf, target_turf)
switch(trackdistance)
if(0)
program_icon_state = "[initial(program_icon_state)]direct"
if(1 to 12)
program_icon_state = "[initial(program_icon_state)]close"
if(13 to 24)
program_icon_state = "[initial(program_icon_state)]medium"
if(25 to INFINITY)
program_icon_state = "[initial(program_icon_state)]far"
if(last_icon_state != program_icon_state)
computer.update_icon()
last_icon_state = program_icon_state
computer.setDir(get_dir(here_turf, target_turf))
//We can use process_tick to restart fast processing, since the computer will be running this constantly either way.
/datum/computer_file/program/radar/process_tick()
if(computer.active_program == src)
START_PROCESSING(SSfastprocess, src)
///////////////////
//Suit Sensor App//
///////////////////
@@ -106,44 +209,13 @@
/datum/computer_file/program/radar/lifeline
filename = "Lifeline"
filedesc = "Lifeline"
program_icon_state = "generic"
extended_desc = "This program allows for tracking of crew members via their suit sensors."
requires_ntnet = TRUE
transfer_access = ACCESS_MEDICAL
available_on_ntnet = TRUE
/datum/computer_file/program/radar/lifeline/track()
var/mob/living/carbon/human/humanoid = locate(selected) in GLOB.human_list
if(!istype(humanoid) || !trackable(humanoid))
return
var/turf/here_turf = (get_turf(computer))
var/turf/target_turf = (get_turf(humanoid))
var/userot = FALSE
var/rot = 0
var/pointer="crosshairs"
var/locx = (target_turf.x - here_turf.x)
var/locy = (here_turf.y - target_turf.y)
if(get_dist_euclidian(here_turf, target_turf) > 24) //If they're too far away, we need the angle for the arrow along the edge of the radar display
userot = TRUE
rot = round(Get_Angle(here_turf, target_turf))
else
locx = locx + 24
locy = locy + 24
if(target_turf.z > here_turf.z)
pointer="caret-up"
else if(target_turf.z < here_turf.z)
pointer="caret-down"
var/list/trackinfo = list(
locx = locx,
locy = locy,
userot = userot,
rot = rot,
arrowstyle = "ntosradarpointer.png", //For the rotation arrow, it's stupid I know
color = "green",
pointer = pointer,
)
return trackinfo
/datum/computer_file/program/radar/lifeline/find_atom()
return locate(selected) in GLOB.human_list
/datum/computer_file/program/radar/lifeline/scan()
if(world.time < next_scan)
@@ -184,46 +256,18 @@
/datum/computer_file/program/radar/fission360
filename = "Fission360"
filedesc = "Fission360"
program_icon_state = "generic"
program_icon_state = "radarsyndicate"
extended_desc = "This program allows for tracking of nuclear authorization disks and warheads."
requires_ntnet = FALSE
transfer_access = null
available_on_ntnet = FALSE
available_on_syndinet = TRUE
tgui_id = "NtosRadarSyndicate"
arrowstyle = "ntosradarpointerS.png"
pointercolor = "red"
/datum/computer_file/program/radar/fission360/track()
var/obj/nuke = locate(selected) in GLOB.poi_list
if(!trackable(nuke))
return
var/turf/here_turf = (get_turf(computer))
var/turf/target_turf = (get_turf(nuke))
var/userot = FALSE
var/rot = 0
var/pointer="crosshairs"
var/locx = (target_turf.x - here_turf.x)
var/locy = (here_turf.y - target_turf.y)
if(get_dist_euclidian(here_turf, target_turf) > 24) //If they're too far away, we need the angle for the arrow along the edge of the radar display
userot = TRUE
rot = round(Get_Angle(here_turf, target_turf))
else
locx = locx + 24
locy = locy + 24
if(target_turf.z > here_turf.z)
pointer="caret-up"
else if(target_turf.z < here_turf.z)
pointer="caret-down"
var/list/trackinfo = list(
locx = locx,
locy = locy,
userot = userot,
rot = rot,
arrowstyle = "ntosradarpointerS.png",
color = "red",
pointer = pointer,
)
return trackinfo
/datum/computer_file/program/radar/fission360/find_atom()
return locate(selected) in GLOB.poi_list
/datum/computer_file/program/radar/fission360/scan()
if(world.time < next_scan)
@@ -166,6 +166,17 @@
max_capacity = 70
var/datum/antagonist/traitor/traitor_data // Syndicate hard drive has the user's data baked directly into it on creation
/// For tablets given to nuke ops
/obj/item/computer_hardware/hard_drive/small/nukeops
power_usage = 8
max_capacity = 70
/obj/item/computer_hardware/hard_drive/small/nukeops/install_default_programs()
store_file(new/datum/computer_file/program/computerconfig(src))
store_file(new/datum/computer_file/program/ntnetdownload/syndicate(src)) // Syndicate version; automatic access to syndicate apps and no NT apps
store_file(new/datum/computer_file/program/filemanager(src))
store_file(new/datum/computer_file/program/radar/fission360(src)) //I am legitimately afraid if I don't do this, Ops players will think they just don't get a pinpointer anymore.
/obj/item/computer_hardware/hard_drive/micro
name = "micro solid state drive"
desc = "A highly efficient SSD chip for portable devices."