Merge remote-tracking branch 'citadel/master' into unarmed_parry
This commit is contained in:
@@ -37,9 +37,9 @@
|
||||
if (!ui)
|
||||
var/datum/asset/assets = get_asset_datum(/datum/asset/simple/headers)
|
||||
assets.send(user)
|
||||
|
||||
ui = new(user, src, ui_key, "ntos_main", "NtOS Main menu", 400, 500, master_ui, state)
|
||||
ui.set_style("ntos")
|
||||
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)
|
||||
ui.open()
|
||||
ui.set_autoupdate(state = 1)
|
||||
|
||||
|
||||
@@ -85,3 +85,4 @@
|
||||
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())
|
||||
|
||||
@@ -1,26 +1,45 @@
|
||||
// /program/ files are executable programs that do things.
|
||||
/datum/computer_file/program
|
||||
filetype = "PRG"
|
||||
filename = "UnknownProgram" // File name. FILE NAME MUST BE UNIQUE IF YOU WANT THE PROGRAM TO BE DOWNLOADABLE FROM NTNET!
|
||||
var/required_access = null // List of required accesses to *run* the program.
|
||||
var/transfer_access = null // List of required access to download or file host the program
|
||||
var/program_state = PROGRAM_STATE_KILLED// PROGRAM_STATE_KILLED or PROGRAM_STATE_BACKGROUND or PROGRAM_STATE_ACTIVE - specifies whether this program is running.
|
||||
var/obj/item/modular_computer/computer // Device that runs this program.
|
||||
var/filedesc = "Unknown Program" // User-friendly name of this program.
|
||||
var/extended_desc = "N/A" // Short description of this program's function.
|
||||
var/program_icon_state = null // Program-specific screen icon state
|
||||
var/requires_ntnet = 0 // Set to 1 for program to require nonstop NTNet connection to run. If NTNet connection is lost program crashes.
|
||||
var/requires_ntnet_feature = 0 // Optional, if above is set to 1 checks for specific function of NTNet (currently NTNET_SOFTWAREDOWNLOAD, NTNET_PEERTOPEER, NTNET_SYSTEMCONTROL and NTNET_COMMUNICATION)
|
||||
var/ntnet_status = 1 // NTNet status, updated every tick by computer running this program. Don't use this for checks if NTNet works, computers do that. Use this for calculations, etc.
|
||||
var/usage_flags = PROGRAM_ALL // Bitflags (PROGRAM_CONSOLE, PROGRAM_LAPTOP, PROGRAM_TABLET combination) or PROGRAM_ALL
|
||||
var/network_destination = null // Optional string that describes what NTNet server/system this program connects to. Used in default logging.
|
||||
var/available_on_ntnet = 1 // Whether the program can be downloaded from NTNet. Set to 0 to disable.
|
||||
var/available_on_syndinet = 0 // Whether the program can be downloaded from SyndiNet (accessible via emagging the computer). Set to 1 to enable.
|
||||
var/tgui_id // ID of TGUI interface
|
||||
var/ui_style // ID of custom TGUI style (optional)
|
||||
var/ui_x = 575 // Default size of TGUI window, in pixels
|
||||
/// File name. FILE NAME MUST BE UNIQUE IF YOU WANT THE PROGRAM TO BE DOWNLOADABLE FROM NTNET!
|
||||
filename = "UnknownProgram"
|
||||
/// List of required accesses to *run* the program.
|
||||
var/required_access = null
|
||||
/// List of required access to download or file host the program
|
||||
var/transfer_access = null
|
||||
/// PROGRAM_STATE_KILLED or PROGRAM_STATE_BACKGROUND or PROGRAM_STATE_ACTIVE - specifies whether this program is running.
|
||||
var/program_state = PROGRAM_STATE_KILLED
|
||||
/// Device that runs this program.
|
||||
var/obj/item/modular_computer/computer
|
||||
/// User-friendly name of this program.
|
||||
var/filedesc = "Unknown Program"
|
||||
/// Short description of this program's function.
|
||||
var/extended_desc = "N/A"
|
||||
/// Program-specific screen icon state
|
||||
var/program_icon_state = null
|
||||
/// Set to 1 for program to require nonstop NTNet connection to run. If NTNet connection is lost program crashes.
|
||||
var/requires_ntnet = FALSE
|
||||
/// Optional, if above is set to 1 checks for specific function of NTNet (currently NTNET_SOFTWAREDOWNLOAD, NTNET_PEERTOPEER, NTNET_SYSTEMCONTROL and NTNET_COMMUNICATION)
|
||||
var/requires_ntnet_feature = 0
|
||||
/// NTNet status, updated every tick by computer running this program. Don't use this for checks if NTNet works, computers do that. Use this for calculations, etc.
|
||||
var/ntnet_status = 1
|
||||
/// Bitflags (PROGRAM_CONSOLE, PROGRAM_LAPTOP, PROGRAM_TABLET combination) or PROGRAM_ALL
|
||||
var/usage_flags = PROGRAM_ALL
|
||||
/// Optional string that describes what NTNet server/system this program connects to. Used in default logging.
|
||||
var/network_destination = null
|
||||
/// Whether the program can be downloaded from NTNet. Set to 0 to disable.
|
||||
var/available_on_ntnet = 1
|
||||
/// Whether the program can be downloaded from SyndiNet (accessible via emagging the computer). Set to 1 to enable.
|
||||
var/available_on_syndinet = 0
|
||||
/// ID of TGUI interface
|
||||
var/tgui_id
|
||||
/// Default size of TGUI window, in pixels
|
||||
var/ui_x = 575
|
||||
var/ui_y = 700
|
||||
var/ui_header = null // Example: "something.gif" - a header image that will be rendered in computer's UI when this program is running at background. Images are taken from /icons/program_icons. Be careful not to use too large images!
|
||||
/// Example: "something.gif" - a header image that will be rendered in computer's UI when this program is running at background. Images are taken from /icons/program_icons. Be careful not to use too large images!
|
||||
var/ui_header = null
|
||||
///Assets specific to programs
|
||||
var/list/special_assets = list()
|
||||
|
||||
/datum/computer_file/program/New(obj/item/modular_computer/comp = null)
|
||||
..()
|
||||
@@ -50,23 +69,23 @@
|
||||
/datum/computer_file/program/proc/generate_network_log(text)
|
||||
if(computer)
|
||||
return computer.add_log(text)
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
/datum/computer_file/program/proc/is_supported_by_hardware(hardware_flag = 0, loud = 0, mob/user = null)
|
||||
if(!(hardware_flag & usage_flags))
|
||||
if(loud && computer && user)
|
||||
to_chat(user, "<span class='danger'>\The [computer] flashes an \"Hardware Error - Incompatible software\" warning.</span>")
|
||||
return 0
|
||||
return 1
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/datum/computer_file/program/proc/get_signal(specific_action = 0)
|
||||
if(computer)
|
||||
return computer.get_ntnet_status(specific_action)
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
// Called by Process() on device that runs us, once every tick.
|
||||
/datum/computer_file/program/proc/process_tick()
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
// Check if the user can run program. Only humans can operate computer. Automatically called in run_program()
|
||||
// User has to wear their ID for ID Scan to work.
|
||||
@@ -87,7 +106,7 @@
|
||||
if(IsAdminGhost(user))
|
||||
return TRUE
|
||||
|
||||
if(computer && computer.hasSiliconAccessInArea(user))
|
||||
if(issilicon(user))
|
||||
return TRUE
|
||||
|
||||
if(ishuman(user))
|
||||
@@ -98,6 +117,7 @@
|
||||
D = card_slot.GetID()
|
||||
var/mob/living/carbon/human/h = user
|
||||
var/obj/item/card/id/I = h.get_idcard(TRUE)
|
||||
|
||||
if(!I && !D)
|
||||
if(loud)
|
||||
to_chat(user, "<span class='danger'>\The [computer] flashes an \"RFID Error - Unable to scan ID\" warning.</span>")
|
||||
@@ -123,7 +143,7 @@
|
||||
// This is performed on program startup. May be overridden to add extra logic. Remember to include ..() call. Return 1 on success, 0 on failure.
|
||||
// When implementing new program based device, use this to run the program.
|
||||
/datum/computer_file/program/proc/run_program(mob/living/user)
|
||||
if(can_run(user, 1))
|
||||
if(can_run(user, TRUE))
|
||||
if(requires_ntnet && network_destination)
|
||||
generate_network_log("Connection opened to [network_destination].")
|
||||
program_state = PROGRAM_STATE_ACTIVE
|
||||
@@ -143,12 +163,11 @@
|
||||
if(!ui && tgui_id)
|
||||
var/datum/asset/assets = get_asset_datum(/datum/asset/simple/headers)
|
||||
assets.send(user)
|
||||
for(var/i in special_assets)
|
||||
assets = get_asset_datum(i)
|
||||
assets.send(user)
|
||||
|
||||
ui = new(user, src, ui_key, tgui_id, filedesc, ui_x, ui_y, state = state)
|
||||
|
||||
if(ui_style)
|
||||
ui.set_style(ui_style)
|
||||
ui.set_autoupdate(state = 1)
|
||||
ui.open()
|
||||
|
||||
// CONVENTIONS, READ THIS WHEN CREATING NEW PROGRAM AND OVERRIDING THIS PROC:
|
||||
@@ -156,7 +175,7 @@
|
||||
// Calls beginning with "PRG_" are reserved for programs handling.
|
||||
// Calls beginning with "PC_" are reserved for computer handling (by whatever runs the program)
|
||||
// ALWAYS INCLUDE PARENT CALL ..() OR DIE IN FIRE.
|
||||
/datum/computer_file/program/ui_act(action,params,datum/tgui/ui)
|
||||
/datum/computer_file/program/ui_act(action,list/params,datum/tgui/ui)
|
||||
if(..())
|
||||
return TRUE
|
||||
if(computer)
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
program_icon_state = "generic"
|
||||
extended_desc = "This program is capable of reconstructing damaged AI systems. Requires direct AI connection via intellicard slot."
|
||||
size = 12
|
||||
requires_ntnet = 0
|
||||
usage_flags = PROGRAM_CONSOLE
|
||||
requires_ntnet = FALSE
|
||||
usage_flags = PROGRAM_CONSOLE | PROGRAM_LAPTOP
|
||||
transfer_access = ACCESS_HEADS
|
||||
available_on_ntnet = 1
|
||||
tgui_id = "ntos_ai_restorer"
|
||||
ui_x = 600
|
||||
available_on_ntnet = TRUE
|
||||
tgui_id = "NtosAiRestorer"
|
||||
ui_x = 370
|
||||
ui_y = 400
|
||||
|
||||
/// Variable dictating if we are in the process of restoring the AI in the inserted intellicard
|
||||
var/restoring = FALSE
|
||||
|
||||
/datum/computer_file/program/aidiag/proc/get_ai(cardcheck)
|
||||
@@ -30,11 +30,11 @@
|
||||
if(ai_slot.stored_card.AI)
|
||||
return ai_slot.stored_card.AI
|
||||
|
||||
return null
|
||||
return
|
||||
|
||||
/datum/computer_file/program/aidiag/ui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
return
|
||||
|
||||
var/mob/living/silicon/ai/A = get_ai()
|
||||
if(!A)
|
||||
@@ -44,6 +44,7 @@
|
||||
if("PRG_beginReconstruction")
|
||||
if(A && A.health < 100)
|
||||
restoring = TRUE
|
||||
A.notify_ghost_cloning("Your core files are being restored!", source = computer)
|
||||
return TRUE
|
||||
if("PRG_eject")
|
||||
if(computer.all_components[MC_AI])
|
||||
@@ -53,7 +54,7 @@
|
||||
return TRUE
|
||||
|
||||
/datum/computer_file/program/aidiag/process_tick()
|
||||
..()
|
||||
. = ..()
|
||||
if(!restoring) //Put the check here so we don't check for an ai all the time
|
||||
return
|
||||
var/obj/item/aicard/cardhold = get_ai(2)
|
||||
@@ -73,13 +74,13 @@
|
||||
restoring = FALSE
|
||||
return
|
||||
ai_slot.locked =TRUE
|
||||
A.adjustOxyLoss(-1, 0)
|
||||
A.adjustFireLoss(-1, 0)
|
||||
A.adjustToxLoss(-1, 0)
|
||||
A.adjustBruteLoss(-1, 0)
|
||||
A.adjustOxyLoss(-5, 0)
|
||||
A.adjustFireLoss(-5, 0)
|
||||
A.adjustToxLoss(-5, 0)
|
||||
A.adjustBruteLoss(-5, 0)
|
||||
A.updatehealth()
|
||||
if(A.health >= 0 && A.stat == DEAD)
|
||||
A.revive()
|
||||
A.revive(full_heal = FALSE, admin_revive = FALSE)
|
||||
// Finished restoring
|
||||
if(A.health >= 100)
|
||||
ai_slot.locked = FALSE
|
||||
@@ -90,14 +91,14 @@
|
||||
|
||||
/datum/computer_file/program/aidiag/ui_data(mob/user)
|
||||
var/list/data = get_header_data()
|
||||
var/mob/living/silicon/ai/AI
|
||||
// A shortcut for getting the AI stored inside the computer. The program already does necessary checks.
|
||||
AI = get_ai()
|
||||
var/mob/living/silicon/ai/AI = get_ai()
|
||||
|
||||
var/obj/item/aicard/aicard = get_ai(2)
|
||||
|
||||
data["ejectable"] = TRUE
|
||||
data["AI_present"] = FALSE
|
||||
data["error"] = null
|
||||
if(!aicard)
|
||||
data["nocard"] = TRUE
|
||||
data["error"] = "Please insert an intelliCard."
|
||||
else
|
||||
if(!AI)
|
||||
@@ -107,15 +108,15 @@
|
||||
if(cardhold.flush)
|
||||
data["error"] = "Flush in progress"
|
||||
else
|
||||
data["AI_present"] = TRUE
|
||||
data["name"] = AI.name
|
||||
data["restoring"] = restoring
|
||||
data["laws"] = AI.laws.get_law_list(include_zeroth = 1)
|
||||
data["health"] = (AI.health + 100) / 2
|
||||
data["isDead"] = AI.stat == DEAD
|
||||
data["ai_laws"] = AI.laws.get_law_list(include_zeroth = 1)
|
||||
data["laws"] = AI.laws.get_law_list(include_zeroth = 1)
|
||||
|
||||
return data
|
||||
|
||||
/datum/computer_file/program/aidiag/kill_program(forced)
|
||||
restoring = FALSE
|
||||
return ..(forced)
|
||||
return ..()
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
requires_ntnet = 1
|
||||
network_destination = "alarm monitoring network"
|
||||
size = 5
|
||||
tgui_id = "ntos_station_alert"
|
||||
tgui_id = "NtosStationAlertConsole"
|
||||
ui_x = 315
|
||||
ui_y = 500
|
||||
|
||||
@@ -72,15 +72,23 @@
|
||||
/datum/computer_file/program/alarm_monitor/proc/cancelAlarm(class, area/A, obj/origin)
|
||||
var/list/L = alarms[class]
|
||||
var/cleared = 0
|
||||
var/arealevelalarm = FALSE // set to TRUE for alarms that set/clear whole areas
|
||||
if (class=="Fire")
|
||||
arealevelalarm = TRUE
|
||||
for (var/I in L)
|
||||
if (I == A.name)
|
||||
var/list/alarm = L[I]
|
||||
var/list/srcs = alarm[3]
|
||||
if (origin in srcs)
|
||||
srcs -= origin
|
||||
if (srcs.len == 0)
|
||||
if (!arealevelalarm) // the traditional behaviour
|
||||
var/list/alarm = L[I]
|
||||
var/list/srcs = alarm[3]
|
||||
if (origin in srcs)
|
||||
srcs -= origin
|
||||
if (srcs.len == 0)
|
||||
cleared = 1
|
||||
L -= I
|
||||
else
|
||||
L -= I // wipe the instances entirely
|
||||
cleared = 1
|
||||
L -= I
|
||||
|
||||
|
||||
update_alarm_display()
|
||||
return !cleared
|
||||
|
||||
@@ -8,20 +8,20 @@
|
||||
available_on_ntnet = 0
|
||||
unsendable = 1
|
||||
undeletable = 1
|
||||
tgui_id = "synd_contract"
|
||||
ui_style = "syndicate"
|
||||
ui_x = 600
|
||||
tgui_id = "SyndContractor"
|
||||
ui_x = 500
|
||||
ui_y = 600
|
||||
var/error = ""
|
||||
var/page = CONTRACT_UPLINK_PAGE_CONTRACTS
|
||||
var/info_screen = TRUE
|
||||
var/assigned = FALSE
|
||||
var/first_load = TRUE
|
||||
|
||||
/datum/computer_file/program/contract_uplink/run_program(var/mob/living/user)
|
||||
. = ..(user)
|
||||
|
||||
/datum/computer_file/program/contract_uplink/ui_act(action, params)
|
||||
if(..())
|
||||
return 1
|
||||
return TRUE
|
||||
var/mob/living/user = usr
|
||||
var/obj/item/computer_hardware/hard_drive/small/syndicate/hard_drive = computer.all_components[MC_HDD]
|
||||
switch(action)
|
||||
@@ -31,27 +31,32 @@
|
||||
hard_drive.traitor_data.contractor_hub.assigned_contracts[contract_id].status = CONTRACT_STATUS_ACTIVE
|
||||
hard_drive.traitor_data.contractor_hub.current_contract = hard_drive.traitor_data.contractor_hub.assigned_contracts[contract_id]
|
||||
program_icon_state = "single_contract"
|
||||
return 1
|
||||
return TRUE
|
||||
if("PRG_login")
|
||||
var/datum/antagonist/traitor/traitor_data = user.mind.has_antag_datum(/datum/antagonist/traitor)
|
||||
if(traitor_data) // Bake their data right into the hard drive, or we don't allow non-antags gaining access to unused contract system. We also create their contracts at this point.
|
||||
if(!traitor_data.contractor_hub) // Only play greet sound, and handle contractor hub when assigning for the first time.
|
||||
|
||||
// Bake their data right into the hard drive, or we don't allow non-antags gaining access to an unused
|
||||
// contract system.
|
||||
// We also create their contracts at this point.
|
||||
if(traitor_data)
|
||||
// Only play greet sound, and handle contractor hub when assigning for the first time.
|
||||
if(!traitor_data.contractor_hub)
|
||||
user.playsound_local(user, 'sound/effects/contractstartup.ogg', 100, FALSE)
|
||||
traitor_data.contractor_hub = new
|
||||
traitor_data.contractor_hub.create_hub_items()
|
||||
user.playsound_local(user, 'sound/effects/contractstartup.ogg', 100, 0)
|
||||
// Stops any topic exploits such as logging in multiple times on a single system.
|
||||
// Stops any topic exploits such as logging in multiple times on a single system.
|
||||
if(!assigned)
|
||||
traitor_data.contractor_hub.create_contracts(traitor_data.owner)
|
||||
hard_drive.traitor_data = traitor_data
|
||||
program_icon_state = "contracts"
|
||||
assigned = TRUE
|
||||
else
|
||||
error = "Incorrect login details."
|
||||
return 1
|
||||
error = "UNAUTHORIZED USER"
|
||||
return TRUE
|
||||
if("PRG_call_extraction")
|
||||
if(hard_drive.traitor_data.contractor_hub.current_contract.status != CONTRACT_STATUS_EXTRACTING)
|
||||
if(hard_drive.traitor_data.contractor_hub.current_contract.handle_extraction(user))
|
||||
user.playsound_local(user, 'sound/effects/confirmdropoff.ogg', 100, 1)
|
||||
user.playsound_local(user, 'sound/effects/confirmdropoff.ogg', 100, TRUE)
|
||||
hard_drive.traitor_data.contractor_hub.current_contract.status = CONTRACT_STATUS_EXTRACTING
|
||||
program_icon_state = "extracted"
|
||||
else
|
||||
@@ -59,17 +64,18 @@
|
||||
error = "Either both you or your target aren't at the dropoff location, or the pod hasn't got a valid place to land. Clear space, or make sure you're both inside."
|
||||
else
|
||||
user.playsound_local(user, 'sound/machines/uplinkerror.ogg', 50)
|
||||
error = "Already extracting... Place the target into the pod. If the pod was destroyed, you will need to cancel this contract."
|
||||
return 1
|
||||
error = "Already extracting... Place the target into the pod. If the pod was destroyed, this contract is no longer possible."
|
||||
return TRUE
|
||||
if("PRG_contract_abort")
|
||||
var/contract_id = hard_drive.traitor_data.contractor_hub.current_contract.id
|
||||
hard_drive.traitor_data.contractor_hub.current_contract = null
|
||||
hard_drive.traitor_data.contractor_hub.assigned_contracts[contract_id].status = CONTRACT_STATUS_ABORTED
|
||||
program_icon_state = "contracts"
|
||||
return 1
|
||||
return TRUE
|
||||
if("PRG_redeem_TC")
|
||||
if(hard_drive.traitor_data.contractor_hub.contract_TC_to_redeem)
|
||||
var/obj/item/stack/telecrystal/crystals = new /obj/item/stack/telecrystal(get_turf(user), hard_drive.traitor_data.contractor_hub.contract_TC_to_redeem)
|
||||
var/obj/item/stack/telecrystal/crystals = new /obj/item/stack/telecrystal(get_turf(user),
|
||||
hard_drive.traitor_data.contractor_hub.contract_TC_to_redeem)
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(H.put_in_hands(crystals))
|
||||
@@ -78,22 +84,23 @@
|
||||
to_chat(user, "<span class='notice'>Your payment materializes onto the floor.</span>")
|
||||
hard_drive.traitor_data.contractor_hub.contract_TC_payed_out += hard_drive.traitor_data.contractor_hub.contract_TC_to_redeem
|
||||
hard_drive.traitor_data.contractor_hub.contract_TC_to_redeem = 0
|
||||
return 1
|
||||
return TRUE
|
||||
else
|
||||
user.playsound_local(user, 'sound/machines/uplinkerror.ogg', 50)
|
||||
return 1
|
||||
return TRUE
|
||||
if("PRG_clear_error")
|
||||
error = ""
|
||||
if("PRG_contractor_hub")
|
||||
page = CONTRACT_UPLINK_PAGE_HUB
|
||||
program_icon_state = "store"
|
||||
if("PRG_hub_back")
|
||||
page = CONTRACT_UPLINK_PAGE_CONTRACTS
|
||||
program_icon_state = "contracts"
|
||||
return TRUE
|
||||
if("PRG_set_first_load_finished")
|
||||
first_load = FALSE
|
||||
return TRUE
|
||||
if("PRG_toggle_info")
|
||||
info_screen = !info_screen
|
||||
return TRUE
|
||||
if("buy_hub")
|
||||
if(hard_drive.traitor_data.owner.current == user)
|
||||
var/item = params["item"]
|
||||
for (var/datum/contractor_item/hub_item in hard_drive.traitor_data.contractor_hub.hub_items)
|
||||
for(var/datum/contractor_item/hub_item in hard_drive.traitor_data.contractor_hub.hub_items)
|
||||
if (hub_item.name == item)
|
||||
hub_item.handle_purchase(hard_drive.traitor_data.contractor_hub, user)
|
||||
else
|
||||
@@ -104,21 +111,28 @@
|
||||
var/obj/item/computer_hardware/hard_drive/small/syndicate/hard_drive = computer.all_components[MC_HDD]
|
||||
var/screen_to_be = null
|
||||
|
||||
data["first_load"] = first_load
|
||||
if(hard_drive && hard_drive.traitor_data != null)
|
||||
var/datum/antagonist/traitor/traitor_data = hard_drive.traitor_data
|
||||
error = ""
|
||||
data = get_header_data()
|
||||
data += get_header_data()
|
||||
if(traitor_data.contractor_hub.current_contract)
|
||||
data["ongoing_contract"] = TRUE
|
||||
screen_to_be = "single_contract"
|
||||
if(traitor_data.contractor_hub.current_contract.status == CONTRACT_STATUS_EXTRACTING)
|
||||
data["extraction_enroute"] = TRUE
|
||||
screen_to_be = "extracted"
|
||||
else
|
||||
data["extraction_enroute"] = FALSE
|
||||
else
|
||||
data["ongoing_contract"] = FALSE
|
||||
data["extraction_enroute"] = FALSE
|
||||
data["logged_in"] = TRUE
|
||||
data["station_name"] = GLOB.station_name
|
||||
data["redeemable_tc"] = traitor_data.contractor_hub.contract_TC_to_redeem
|
||||
data["earned_tc"] = traitor_data.contractor_hub.contract_TC_payed_out
|
||||
data["contracts_completed"] = traitor_data.contractor_hub.contracts_completed
|
||||
data["contract_rep"] = traitor_data.contractor_hub.contract_rep
|
||||
data["page"] = page
|
||||
data["info_screen"] = info_screen
|
||||
data["error"] = error
|
||||
for(var/datum/contractor_item/hub_item in traitor_data.contractor_hub.hub_items)
|
||||
data["contractor_hub_items"] += list(list(
|
||||
@@ -136,7 +150,8 @@
|
||||
"payout_bonus" = contract.contract.payout_bonus,
|
||||
"dropoff" = contract.contract.dropoff,
|
||||
"id" = contract.id,
|
||||
"status" = contract.status
|
||||
"status" = contract.status,
|
||||
"message" = contract.wanted_message
|
||||
))
|
||||
|
||||
var/direction
|
||||
@@ -155,14 +170,8 @@
|
||||
else
|
||||
direction = "???"
|
||||
data["dropoff_direction"] = direction
|
||||
if (page == CONTRACT_UPLINK_PAGE_HUB)
|
||||
screen_to_be = "store"
|
||||
if (!screen_to_be)
|
||||
screen_to_be = "contracts"
|
||||
else
|
||||
data["logged_in"] = FALSE
|
||||
if (!screen_to_be)
|
||||
screen_to_be = "assign"
|
||||
program_icon_state = screen_to_be
|
||||
update_computer_icon()
|
||||
return data
|
||||
return data
|
||||
|
||||
@@ -4,11 +4,10 @@
|
||||
program_icon_state = "hostile"
|
||||
extended_desc = "This advanced script can perform denial of service attacks against NTNet quantum relays. The system administrator will probably notice this. Multiple devices can run this program together against same relay for increased effect"
|
||||
size = 20
|
||||
requires_ntnet = 1
|
||||
available_on_ntnet = 0
|
||||
available_on_syndinet = 1
|
||||
tgui_id = "ntos_net_dos"
|
||||
ui_style = "syndicate"
|
||||
requires_ntnet = TRUE
|
||||
available_on_ntnet = FALSE
|
||||
available_on_syndinet = TRUE
|
||||
tgui_id = "NtosNetDos"
|
||||
ui_x = 400
|
||||
ui_y = 250
|
||||
|
||||
@@ -37,64 +36,55 @@
|
||||
if(target)
|
||||
target.dos_sources.Remove(src)
|
||||
target = null
|
||||
executed = 0
|
||||
executed = FALSE
|
||||
|
||||
..()
|
||||
|
||||
/datum/computer_file/program/ntnet_dos/ui_act(action, params)
|
||||
if(..())
|
||||
return 1
|
||||
return
|
||||
switch(action)
|
||||
if("PRG_target_relay")
|
||||
for(var/obj/machinery/ntnet_relay/R in SSnetworks.station_network.relays)
|
||||
if("[R.uid]" == params["targid"])
|
||||
target = R
|
||||
return 1
|
||||
break
|
||||
return TRUE
|
||||
if("PRG_reset")
|
||||
if(target)
|
||||
target.dos_sources.Remove(src)
|
||||
target = null
|
||||
executed = 0
|
||||
executed = FALSE
|
||||
error = ""
|
||||
return 1
|
||||
return TRUE
|
||||
if("PRG_execute")
|
||||
if(target)
|
||||
executed = 1
|
||||
executed = TRUE
|
||||
target.dos_sources.Add(src)
|
||||
if(SSnetworks.station_network.intrusion_detection_enabled)
|
||||
var/obj/item/computer_hardware/network_card/network_card = computer.all_components[MC_NET]
|
||||
SSnetworks.station_network.add_log("IDS WARNING - Excess traffic flood targeting relay [target.uid] detected from device: [network_card.get_network_tag()]")
|
||||
SSnetworks.station_network.intrusion_detection_alarm = 1
|
||||
return 1
|
||||
SSnetworks.station_network.intrusion_detection_alarm = TRUE
|
||||
return TRUE
|
||||
|
||||
/datum/computer_file/program/ntnet_dos/ui_data(mob/user)
|
||||
if(!SSnetworks.station_network)
|
||||
return
|
||||
|
||||
var/list/data = list()
|
||||
var/list/data = get_header_data()
|
||||
|
||||
data = get_header_data()
|
||||
|
||||
if(error)
|
||||
data["error"] = error
|
||||
else if(target && executed)
|
||||
data["target"] = 1
|
||||
data["error"] = error
|
||||
if(target && executed)
|
||||
data["target"] = TRUE
|
||||
data["speed"] = dos_speed
|
||||
|
||||
// This is mostly visual, generate some strings of 1s and 0s
|
||||
// Probability of 1 is equal of completion percentage of DoS attack on this relay.
|
||||
// Combined with UI updates this adds quite nice effect to the UI
|
||||
var/percentage = target.dos_overload * 100 / target.dos_capacity
|
||||
data["dos_strings"] = list()
|
||||
for(var/j, j<10, j++)
|
||||
var/string = ""
|
||||
for(var/i, i<20, i++)
|
||||
string = "[string][prob(percentage)]"
|
||||
data["dos_strings"] += list(list("nums" = string))
|
||||
data["overload"] = target.dos_overload
|
||||
data["capacity"] = target.dos_capacity
|
||||
else
|
||||
data["target"] = FALSE
|
||||
data["relays"] = list()
|
||||
for(var/obj/machinery/ntnet_relay/R in SSnetworks.station_network.relays)
|
||||
data["relays"] += list(list("id" = R.uid))
|
||||
data["focus"] = target ? target.uid : null
|
||||
|
||||
return data
|
||||
return data
|
||||
|
||||
@@ -4,11 +4,10 @@
|
||||
program_icon_state = "hostile"
|
||||
extended_desc = "This virus can destroy hard drive of system it is executed on. It may be obfuscated to look like another non-malicious program. Once armed, it will destroy the system upon next execution."
|
||||
size = 13
|
||||
requires_ntnet = 0
|
||||
available_on_ntnet = 0
|
||||
available_on_syndinet = 1
|
||||
tgui_id = "ntos_revelation"
|
||||
ui_style = "syndicate"
|
||||
requires_ntnet = FALSE
|
||||
available_on_ntnet = FALSE
|
||||
available_on_syndinet = TRUE
|
||||
tgui_id = "NtosRevelation"
|
||||
ui_x = 400
|
||||
ui_y = 250
|
||||
|
||||
@@ -22,7 +21,7 @@
|
||||
/datum/computer_file/program/revelation/proc/activate()
|
||||
if(computer)
|
||||
computer.visible_message("<span class='notice'>\The [computer]'s screen brightly flashes and loud electrical buzzing is heard.</span>")
|
||||
computer.enabled = 0
|
||||
computer.enabled = FALSE
|
||||
computer.update_icon()
|
||||
var/obj/item/computer_hardware/hard_drive/hard_drive = computer.all_components[MC_HDD]
|
||||
var/obj/item/computer_hardware/battery/battery_module = computer.all_components[MC_CELL]
|
||||
@@ -44,18 +43,20 @@
|
||||
|
||||
/datum/computer_file/program/revelation/ui_act(action, params)
|
||||
if(..())
|
||||
return 1
|
||||
return
|
||||
switch(action)
|
||||
if("PRG_arm")
|
||||
armed = !armed
|
||||
return TRUE
|
||||
if("PRG_activate")
|
||||
activate()
|
||||
return TRUE
|
||||
if("PRG_obfuscate")
|
||||
var/mob/living/user = usr
|
||||
var/newname = sanitize(input(user, "Enter new program name: "))
|
||||
var/newname = params["new_name"]
|
||||
if(!newname)
|
||||
return
|
||||
filedesc = newname
|
||||
return TRUE
|
||||
|
||||
|
||||
/datum/computer_file/program/revelation/clone()
|
||||
@@ -68,4 +69,4 @@
|
||||
|
||||
data["armed"] = armed
|
||||
|
||||
return data
|
||||
return data
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
/datum/computer_file/program/arcade
|
||||
filename = "arcade"
|
||||
filedesc = "Nanotrasen Micro Arcade"
|
||||
program_icon_state = "arcade"
|
||||
extended_desc = "This port of the classic game 'Outbomb Cuban Pete', redesigned to run on tablets, with thrilling graphics and chilling storytelling."
|
||||
requires_ntnet = FALSE
|
||||
network_destination = "arcade network"
|
||||
size = 6
|
||||
tgui_id = "NtosArcade"
|
||||
ui_x = 450
|
||||
ui_y = 350
|
||||
|
||||
///Returns TRUE if the game is being played.
|
||||
var/game_active = TRUE
|
||||
///This disables buttom actions from having any impact if TRUE. Resets to FALSE when the player is allowed to make an action again.
|
||||
var/pause_state = FALSE
|
||||
var/boss_hp = 45
|
||||
var/boss_mp = 15
|
||||
var/player_hp = 30
|
||||
var/player_mp = 10
|
||||
var/ticket_count = 0
|
||||
///Shows what text is shown on the app, usually showing the log of combat actions taken by the player.
|
||||
var/heads_up = "Nanotrasen says, winners make us money."
|
||||
var/boss_name = "Cuban Pete's Minion"
|
||||
///Determines which boss image to use on the UI.
|
||||
var/boss_id = 1
|
||||
|
||||
/datum/computer_file/program/arcade/proc/game_check(mob/user)
|
||||
sleep(5)
|
||||
if(boss_hp <= 0)
|
||||
heads_up = "You have crushed [boss_name]! Rejoice!"
|
||||
playsound(computer.loc, 'sound/arcade/win.ogg', 50, TRUE, extrarange = -3, falloff = 10)
|
||||
game_active = FALSE
|
||||
program_icon_state = "arcade_off"
|
||||
if(istype(computer))
|
||||
computer.update_icon()
|
||||
ticket_count += 1
|
||||
sleep(10)
|
||||
else if(player_hp <= 0 || player_mp <= 0)
|
||||
heads_up = "You have been defeated... how will the station survive?"
|
||||
playsound(computer.loc, 'sound/arcade/lose.ogg', 50, TRUE, extrarange = -3, falloff = 10)
|
||||
game_active = FALSE
|
||||
program_icon_state = "arcade_off"
|
||||
if(istype(computer))
|
||||
computer.update_icon()
|
||||
sleep(10)
|
||||
|
||||
/datum/computer_file/program/arcade/proc/enemy_check(mob/user)
|
||||
var/boss_attackamt = 0 //Spam protection from boss attacks as well.
|
||||
var/boss_mpamt = 0
|
||||
var/bossheal = 0
|
||||
if(pause_state == TRUE)
|
||||
boss_attackamt = rand(3,6)
|
||||
boss_mpamt = rand (2,4)
|
||||
bossheal = rand (4,6)
|
||||
if(game_active == FALSE)
|
||||
return
|
||||
if (boss_mp <= 5)
|
||||
heads_up = "[boss_mpamt] magic power has been stolen from you!"
|
||||
playsound(computer.loc, 'sound/arcade/steal.ogg', 50, TRUE, extrarange = -3, falloff = 10)
|
||||
player_mp -= boss_mpamt
|
||||
boss_mp += boss_mpamt
|
||||
else if(boss_mp > 5 && boss_hp <12)
|
||||
heads_up = "[boss_name] heals for [bossheal] health!"
|
||||
playsound(computer.loc, 'sound/arcade/heal.ogg', 50, TRUE, extrarange = -3, falloff = 10)
|
||||
boss_hp += bossheal
|
||||
boss_mp -= boss_mpamt
|
||||
else
|
||||
heads_up = "[boss_name] attacks you for [boss_attackamt] damage!"
|
||||
playsound(computer.loc, 'sound/arcade/hit.ogg', 50, TRUE, extrarange = -3, falloff = 10)
|
||||
player_hp -= boss_attackamt
|
||||
|
||||
pause_state = FALSE
|
||||
game_check()
|
||||
|
||||
/datum/computer_file/program/arcade/ui_interact(mob/user, ui_key, datum/tgui/ui, force_open, datum/tgui/master_ui, datum/ui_state/state)
|
||||
. = ..()
|
||||
var/datum/asset/assets = get_asset_datum(/datum/asset/simple/arcade)
|
||||
assets.send(user)
|
||||
|
||||
/datum/computer_file/program/arcade/ui_data(mob/user)
|
||||
var/list/data = get_header_data()
|
||||
|
||||
data["Hitpoints"] = boss_hp
|
||||
data["PlayerHitpoints"] = player_hp
|
||||
data["PlayerMP"] = player_mp
|
||||
data["TicketCount"] = ticket_count
|
||||
data["GameActive"] = game_active
|
||||
data["PauseState"] = pause_state
|
||||
data["Status"] = heads_up
|
||||
data["BossID"] = "boss[boss_id].gif"
|
||||
return data
|
||||
|
||||
/datum/computer_file/program/arcade/ui_act(action, list/params)
|
||||
if(..())
|
||||
return TRUE
|
||||
var/obj/item/computer_hardware/printer/printer
|
||||
if(computer)
|
||||
printer = computer.all_components[MC_PRINT]
|
||||
|
||||
switch(action)
|
||||
if("Attack")
|
||||
var/attackamt = 0 //Spam prevention.
|
||||
if(pause_state == FALSE)
|
||||
attackamt = rand(2,6)
|
||||
pause_state = TRUE
|
||||
heads_up = "You attack for [attackamt] damage."
|
||||
playsound(computer.loc, 'sound/arcade/hit.ogg', 50, TRUE, extrarange = -3, falloff = 10)
|
||||
boss_hp -= attackamt
|
||||
sleep(10)
|
||||
game_check()
|
||||
enemy_check()
|
||||
return TRUE
|
||||
if("Heal")
|
||||
var/healamt = 0 //More Spam Prevention.
|
||||
var/healcost = 0
|
||||
if(pause_state == FALSE)
|
||||
healamt = rand(6,8)
|
||||
var/maxPointCost = 3
|
||||
healcost = rand(1, maxPointCost)
|
||||
pause_state = TRUE
|
||||
heads_up = "You heal for [healamt] damage."
|
||||
playsound(computer.loc, 'sound/arcade/heal.ogg', 50, TRUE, extrarange = -3, falloff = 10)
|
||||
player_hp += healamt
|
||||
player_mp -= healcost
|
||||
sleep(10)
|
||||
game_check()
|
||||
enemy_check()
|
||||
return TRUE
|
||||
if("Recharge_Power")
|
||||
var/rechargeamt = 0 //As above.
|
||||
if(pause_state == FALSE)
|
||||
rechargeamt = rand(4, 7)
|
||||
pause_state = TRUE
|
||||
heads_up = "You regain [rechargeamt] magic power."
|
||||
playsound(computer.loc, 'sound/arcade/mana.ogg', 50, TRUE, extrarange = -3, falloff = 10)
|
||||
player_mp += rechargeamt
|
||||
sleep(10)
|
||||
game_check()
|
||||
enemy_check()
|
||||
return TRUE
|
||||
if("Dispense_Tickets")
|
||||
if(!printer)
|
||||
to_chat(usr, "<span class='notice'>Hardware error: A printer is required to redeem tickets.</span>")
|
||||
return
|
||||
if(printer.stored_paper <= 0)
|
||||
to_chat(usr, "<span class='notice'>Hardware error: Printer is out of paper.</span>")
|
||||
return
|
||||
else
|
||||
computer.visible_message("<span class='notice'>\The [computer] prints out paper.</span>")
|
||||
if(ticket_count >= 1)
|
||||
new /obj/item/stack/arcadeticket((get_turf(computer)), 1)
|
||||
to_chat(usr, "<span class='notice'>[src] dispenses a ticket!</span>")
|
||||
ticket_count -= 1
|
||||
printer.stored_paper -= 1
|
||||
else
|
||||
to_chat(usr, "<span class='notice'>You don't have any stored tickets!</span>")
|
||||
return TRUE
|
||||
if("Start_Game")
|
||||
game_active = TRUE
|
||||
boss_hp = 45
|
||||
player_hp = 30
|
||||
player_mp = 10
|
||||
heads_up = "You stand before [boss_name]! Prepare for battle!"
|
||||
program_icon_state = "arcade"
|
||||
boss_id = rand(1,6)
|
||||
pause_state = FALSE
|
||||
if(istype(computer))
|
||||
computer.update_icon()
|
||||
@@ -0,0 +1,33 @@
|
||||
/datum/computer_file/program/atmosscan
|
||||
filename = "atmosscan"
|
||||
filedesc = "Atmospheric Scanner"
|
||||
program_icon_state = "air"
|
||||
extended_desc = "A small built-in sensor reads out the atmospheric conditions around the device."
|
||||
network_destination = "atmos scan"
|
||||
size = 4
|
||||
tgui_id = "NtosAtmos"
|
||||
ui_x = 300
|
||||
ui_y = 350
|
||||
|
||||
/datum/computer_file/program/atmosscan/ui_data(mob/user)
|
||||
var/list/data = get_header_data()
|
||||
var/list/airlist = list()
|
||||
var/turf/T = get_turf(ui_host())
|
||||
if(T)
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
var/list/env_gases = environment.gases
|
||||
var/pressure = environment.return_pressure()
|
||||
var/total_moles = environment.total_moles()
|
||||
data["AirPressure"] = round(pressure,0.1)
|
||||
data["AirTemp"] = round(environment.temperature-T0C)
|
||||
if (total_moles)
|
||||
for(var/id in env_gases)
|
||||
var/gas_level = env_gases[id][MOLES]/total_moles
|
||||
if(gas_level > 0)
|
||||
airlist += list(list("name" = "[env_gases[id][GAS_META][META_GAS_NAME]]", "percentage" = round(gas_level*100, 0.01)))
|
||||
data["AirData"] = airlist
|
||||
return data
|
||||
|
||||
/datum/computer_file/program/atmosscan/ui_act(action, list/params)
|
||||
if(..())
|
||||
return TRUE
|
||||
@@ -0,0 +1,69 @@
|
||||
/datum/computer_file/program/borg_monitor
|
||||
filename = "cyborgmonitor"
|
||||
filedesc = "Cyborg Remote Monitoring"
|
||||
ui_header = "borg_mon.gif"
|
||||
program_icon_state = "generic"
|
||||
extended_desc = "This program allows for remote monitoring of station cyborgs."
|
||||
requires_ntnet = TRUE
|
||||
transfer_access = ACCESS_ROBOTICS
|
||||
network_destination = "cyborg remote monitoring"
|
||||
size = 5
|
||||
tgui_id = "NtosCyborgRemoteMonitor"
|
||||
ui_x = 600
|
||||
ui_y = 800
|
||||
|
||||
/datum/computer_file/program/borg_monitor/ui_data(mob/user)
|
||||
var/list/data = get_header_data()
|
||||
|
||||
data["card"] = FALSE
|
||||
if(computer.GetID())
|
||||
data["card"] = TRUE
|
||||
|
||||
data["cyborgs"] = list()
|
||||
for(var/mob/living/silicon/robot/R in GLOB.silicon_mobs)
|
||||
if((get_turf(computer)).z != (get_turf(R)).z)
|
||||
continue
|
||||
if(R.scrambledcodes)
|
||||
continue
|
||||
|
||||
var/list/upgrade
|
||||
for(var/obj/item/borg/upgrade/I in R.upgrades)
|
||||
upgrade += "\[[I.name]\] "
|
||||
|
||||
var/shell = FALSE
|
||||
if(R.shell && !R.ckey)
|
||||
shell = TRUE
|
||||
|
||||
var/list/cyborg_data = list(
|
||||
name = R.name,
|
||||
locked_down = R.locked_down,
|
||||
status = R.stat,
|
||||
shell_discon = shell,
|
||||
charge = R.cell ? round(R.cell.percent()) : null,
|
||||
module = R.module ? "[R.module.name] Module" : "No Module Detected",
|
||||
upgrades = upgrade,
|
||||
ref = REF(R)
|
||||
)
|
||||
data["cyborgs"] += list(cyborg_data)
|
||||
return data
|
||||
|
||||
/datum/computer_file/program/borg_monitor/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("messagebot")
|
||||
var/mob/living/silicon/robot/R = locate(params["ref"]) in GLOB.silicon_mobs
|
||||
if(!istype(R))
|
||||
return
|
||||
var/obj/item/card/id/ID = computer.GetID()
|
||||
if(!ID)
|
||||
return
|
||||
var/message = stripped_input(usr, message = "Enter message to be sent to remote cyborg.", title = "Send Message")
|
||||
if(!message)
|
||||
return
|
||||
to_chat(R, "<br><br><span class='notice'>Message from [ID.registered_name] -- \"[message]\"</span><br>")
|
||||
SEND_SOUND(R, 'sound/machines/twobeep_high.ogg')
|
||||
if(R.connected_ai)
|
||||
to_chat(R.connected_ai, "<br><br><span class='notice'>Message from [ID.registered_name] to [R] -- \"[message]\"</span><br>")
|
||||
SEND_SOUND(R.connected_ai, 'sound/machines/twobeep_high.ogg')
|
||||
@@ -1,3 +1,11 @@
|
||||
#define CARDCON_DEPARTMENT_SERVICE "Service"
|
||||
#define CARDCON_DEPARTMENT_SECURITY "Security"
|
||||
#define CARDCON_DEPARTMENT_MEDICAL "Medical"
|
||||
#define CARDCON_DEPARTMENT_SUPPLY "Supply"
|
||||
#define CARDCON_DEPARTMENT_SCIENCE "Science"
|
||||
#define CARDCON_DEPARTMENT_ENGINEERING "Engineering"
|
||||
#define CARDCON_DEPARTMENT_COMMAND "Command"
|
||||
|
||||
/datum/computer_file/program/card_mod
|
||||
filename = "cardmod"
|
||||
filedesc = "ID Card Modification"
|
||||
@@ -6,97 +14,90 @@
|
||||
transfer_access = ACCESS_HEADS
|
||||
requires_ntnet = 0
|
||||
size = 8
|
||||
tgui_id = "ntos_card"
|
||||
ui_x = 600
|
||||
ui_y = 700
|
||||
tgui_id = "NtosCard"
|
||||
ui_x = 450
|
||||
ui_y = 520
|
||||
|
||||
var/mod_mode = 1
|
||||
var/is_centcom = 0
|
||||
var/show_assignments = 0
|
||||
var/minor = 0
|
||||
var/authenticated = 0
|
||||
var/list/reg_ids = list()
|
||||
var/list/region_access = null
|
||||
var/list/head_subordinates = null
|
||||
var/target_dept = 0 //Which department this computer has access to. 0=all departments
|
||||
var/change_position_cooldown = 30
|
||||
//Jobs you cannot open new positions for
|
||||
var/list/blacklisted = list(
|
||||
"AI",
|
||||
"Assistant",
|
||||
"Cyborg",
|
||||
"Captain",
|
||||
"Head of Personnel",
|
||||
"Head of Security",
|
||||
"Chief Engineer",
|
||||
"Research Director",
|
||||
"Chief Medical Officer")
|
||||
var/is_centcom = FALSE
|
||||
var/minor = FALSE
|
||||
var/authenticated = FALSE
|
||||
var/list/region_access
|
||||
var/list/head_subordinates
|
||||
///Which departments this computer has access to. Defined as access regions. null = all departments
|
||||
var/target_dept
|
||||
|
||||
//The scaling factor of max total positions in relation to the total amount of people on board the station in %
|
||||
var/max_relative_positions = 30 //30%: Seems reasonable, limit of 6 @ 20 players
|
||||
//For some reason everything was exploding if this was static.
|
||||
var/list/sub_managers
|
||||
|
||||
//This is used to keep track of opened positions for jobs to allow instant closing
|
||||
//Assoc array: "JobName" = (int)<Opened Positions>
|
||||
var/list/opened_positions = list();
|
||||
/datum/computer_file/program/card_mod/New(obj/item/modular_computer/comp)
|
||||
. = ..()
|
||||
sub_managers = list(
|
||||
"[ACCESS_HOP]" = list(
|
||||
"department" = list(CARDCON_DEPARTMENT_SERVICE, CARDCON_DEPARTMENT_COMMAND),
|
||||
"region" = 1,
|
||||
"head" = "Head of Personnel"
|
||||
),
|
||||
"[ACCESS_HOS]" = list(
|
||||
"department" = CARDCON_DEPARTMENT_SECURITY,
|
||||
"region" = 2,
|
||||
"head" = "Head of Security"
|
||||
),
|
||||
"[ACCESS_CMO]" = list(
|
||||
"department" = CARDCON_DEPARTMENT_MEDICAL,
|
||||
"region" = 3,
|
||||
"head" = "Chief Medical Officer"
|
||||
),
|
||||
"[ACCESS_RD]" = list(
|
||||
"department" = CARDCON_DEPARTMENT_SCIENCE,
|
||||
"region" = 4,
|
||||
"head" = "Research Director"
|
||||
),
|
||||
"[ACCESS_CE]" = list(
|
||||
"department" = CARDCON_DEPARTMENT_ENGINEERING,
|
||||
"region" = 5,
|
||||
"head" = "Chief Engineer"
|
||||
)
|
||||
)
|
||||
|
||||
/datum/computer_file/program/card_mod/New()
|
||||
..()
|
||||
addtimer(CALLBACK(src, .proc/SetConfigCooldown), 0)
|
||||
/datum/computer_file/program/card_mod/proc/authenticate(mob/user, obj/item/card/id/id_card)
|
||||
if(!id_card)
|
||||
return
|
||||
|
||||
/datum/computer_file/program/card_mod/proc/SetConfigCooldown()
|
||||
change_position_cooldown = CONFIG_GET(number/id_console_jobslot_delay)
|
||||
region_access = list()
|
||||
if(!target_dept && (ACCESS_CHANGE_IDS in id_card.access))
|
||||
minor = FALSE
|
||||
authenticated = TRUE
|
||||
update_static_data(user)
|
||||
return TRUE
|
||||
|
||||
/datum/computer_file/program/card_mod/event_idremoved(background, slot)
|
||||
if(!slot || slot == 2)// slot being false means both are removed
|
||||
minor = 0
|
||||
authenticated = 0
|
||||
head_subordinates = null
|
||||
region_access = null
|
||||
var/list/head_types = list()
|
||||
for(var/access_text in sub_managers)
|
||||
var/list/info = sub_managers[access_text]
|
||||
var/access = text2num(access_text)
|
||||
if((access in id_card.access) && ((info["region"] in target_dept) || !length(target_dept)))
|
||||
region_access += info["region"]
|
||||
//I don't even know what I'm doing anymore
|
||||
head_types += info["head"]
|
||||
|
||||
head_subordinates = list()
|
||||
if(length(head_types))
|
||||
for(var/j in SSjob.occupations)
|
||||
var/datum/job/job = j
|
||||
for(var/head in head_types)//god why
|
||||
if(head in job.department_head)
|
||||
head_subordinates += job.title
|
||||
|
||||
/datum/computer_file/program/card_mod/proc/job_blacklisted(jobtitle)
|
||||
return (jobtitle in blacklisted)
|
||||
if(length(region_access))
|
||||
minor = TRUE
|
||||
authenticated = TRUE
|
||||
update_static_data(user)
|
||||
return TRUE
|
||||
|
||||
|
||||
//Logic check for if you can open the job
|
||||
/datum/computer_file/program/card_mod/proc/can_open_job(datum/job/job)
|
||||
if(job)
|
||||
if(!job_blacklisted(job.title))
|
||||
if((job.total_positions <= GLOB.player_list.len * (max_relative_positions / 100)))
|
||||
var/delta = (world.time / 10) - GLOB.time_last_changed_position
|
||||
if((change_position_cooldown < delta) || (opened_positions[job.title] < 0))
|
||||
return 1
|
||||
return -2
|
||||
return 0
|
||||
return 0
|
||||
|
||||
//Logic check for if you can close the job
|
||||
/datum/computer_file/program/card_mod/proc/can_close_job(datum/job/job)
|
||||
if(job)
|
||||
if(!job_blacklisted(job.title))
|
||||
if(job.total_positions > job.current_positions)
|
||||
var/delta = (world.time / 10) - GLOB.time_last_changed_position
|
||||
if((change_position_cooldown < delta) || (opened_positions[job.title] > 0))
|
||||
return 1
|
||||
return -2
|
||||
return 0
|
||||
return 0
|
||||
|
||||
/datum/computer_file/program/card_mod/proc/format_jobs(list/jobs)
|
||||
var/obj/item/computer_hardware/card_slot/card_slot = computer.all_components[MC_CARD]
|
||||
var/obj/item/card/id/id_card = card_slot.stored_card
|
||||
var/list/formatted = list()
|
||||
for(var/job in jobs)
|
||||
formatted.Add(list(list(
|
||||
"display_name" = replacetext(job, " ", " "),
|
||||
"target_rank" = id_card && id_card.assignment ? id_card.assignment : "Unassigned",
|
||||
"job" = job)))
|
||||
|
||||
return formatted
|
||||
return FALSE
|
||||
|
||||
/datum/computer_file/program/card_mod/ui_act(action, params)
|
||||
if(..())
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
var/obj/item/computer_hardware/card_slot/card_slot
|
||||
var/obj/item/computer_hardware/printer/printer
|
||||
@@ -106,192 +107,220 @@
|
||||
if(!card_slot)
|
||||
return
|
||||
|
||||
var/obj/item/card/id/user_id_card = null
|
||||
var/mob/user = usr
|
||||
var/obj/item/card/id/user_id_card = user.get_idcard(FALSE)
|
||||
|
||||
var/obj/item/card/id/id_card = card_slot.stored_card
|
||||
var/obj/item/card/id/auth_card = card_slot.stored_card2
|
||||
|
||||
if(auth_card)
|
||||
user_id_card = auth_card
|
||||
else
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/h = user
|
||||
user_id_card = h.get_idcard(TRUE)
|
||||
|
||||
switch(action)
|
||||
if("PRG_switchm")
|
||||
if(params["target"] == "mod")
|
||||
mod_mode = 1
|
||||
else if (params["target"] == "manifest")
|
||||
mod_mode = 0
|
||||
else if (params["target"] == "manage")
|
||||
mod_mode = 2
|
||||
if("PRG_togglea")
|
||||
if(show_assignments)
|
||||
show_assignments = 0
|
||||
else
|
||||
show_assignments = 1
|
||||
if("PRG_authenticate")
|
||||
if(!computer || !user_id_card)
|
||||
playsound(computer, 'sound/machines/terminal_prompt_deny.ogg', 50, FALSE)
|
||||
return
|
||||
if(authenticate(user, user_id_card))
|
||||
playsound(computer, 'sound/machines/terminal_on.ogg', 50, FALSE)
|
||||
return TRUE
|
||||
if("PRG_logout")
|
||||
authenticated = FALSE
|
||||
playsound(computer, 'sound/machines/terminal_off.ogg', 50, FALSE)
|
||||
return TRUE
|
||||
if("PRG_print")
|
||||
if(computer && printer) //This option should never be called if there is no printer
|
||||
if(mod_mode)
|
||||
if(authorized())
|
||||
var/contents = {"<h4>Access Report</h4>
|
||||
<u>Prepared By:</u> [user_id_card && user_id_card.registered_name ? user_id_card.registered_name : "Unknown"]<br>
|
||||
<u>For:</u> [id_card.registered_name ? id_card.registered_name : "Unregistered"]<br>
|
||||
<hr>
|
||||
<u>Assignment:</u> [id_card.assignment]<br>
|
||||
<u>Access:</u><br>
|
||||
"}
|
||||
if(!computer || !printer)
|
||||
return
|
||||
if(!authenticated)
|
||||
return
|
||||
var/contents = {"<h4>Access Report</h4>
|
||||
<u>Prepared By:</u> [user_id_card && user_id_card.registered_name ? user_id_card.registered_name : "Unknown"]<br>
|
||||
<u>For:</u> [id_card.registered_name ? id_card.registered_name : "Unregistered"]<br>
|
||||
<hr>
|
||||
<u>Assignment:</u> [id_card.assignment]<br>
|
||||
<u>Access:</u><br>
|
||||
"}
|
||||
|
||||
var/known_access_rights = get_all_accesses()
|
||||
for(var/A in id_card.access)
|
||||
if(A in known_access_rights)
|
||||
contents += " [get_access_desc(A)]"
|
||||
var/known_access_rights = get_all_accesses()
|
||||
for(var/A in id_card.access)
|
||||
if(A in known_access_rights)
|
||||
contents += " [get_access_desc(A)]"
|
||||
|
||||
if(!printer.print_text(contents,"access report"))
|
||||
to_chat(usr, "<span class='notice'>Hardware error: Printer was unable to print the file. It may be out of paper.</span>")
|
||||
return
|
||||
else
|
||||
computer.visible_message("<span class='notice'>\The [computer] prints out paper.</span>")
|
||||
else
|
||||
var/contents = {"<h4>Crew Manifest</h4>
|
||||
<br>
|
||||
[GLOB.data_core ? GLOB.data_core.get_manifest(0) : ""]
|
||||
"}
|
||||
if(!printer.print_text(contents,text("crew manifest ([])", STATION_TIME_TIMESTAMP("hh:mm:ss", world.time))))
|
||||
to_chat(usr, "<span class='notice'>Hardware error: Printer was unable to print the file. It may be out of paper.</span>")
|
||||
return
|
||||
else
|
||||
computer.visible_message("<span class='notice'>\The [computer] prints out paper.</span>")
|
||||
if("PRG_eject")
|
||||
if(computer && card_slot)
|
||||
var/select = params["target"]
|
||||
switch(select)
|
||||
if("id")
|
||||
if(id_card)
|
||||
GLOB.data_core.manifest_modify(id_card.registered_name, id_card.assignment)
|
||||
card_slot.try_eject(1, user)
|
||||
else
|
||||
var/obj/item/I = usr.get_active_held_item()
|
||||
if (istype(I, /obj/item/card/id))
|
||||
if(!usr.transferItemToLoc(I, computer))
|
||||
return
|
||||
card_slot.stored_card = I
|
||||
if("auth")
|
||||
if(auth_card)
|
||||
if(id_card)
|
||||
GLOB.data_core.manifest_modify(id_card.registered_name, id_card.assignment)
|
||||
head_subordinates = null
|
||||
region_access = null
|
||||
authenticated = 0
|
||||
minor = 0
|
||||
card_slot.try_eject(2, user)
|
||||
else
|
||||
var/obj/item/I = usr.get_active_held_item()
|
||||
if (istype(I, /obj/item/card/id))
|
||||
if(!usr.transferItemToLoc(I, computer))
|
||||
return
|
||||
card_slot.stored_card2 = I
|
||||
if("PRG_terminate")
|
||||
if(computer && ((id_card.assignment in head_subordinates) || id_card.assignment == "Assistant"))
|
||||
id_card.assignment = "Unassigned"
|
||||
remove_nt_access(id_card)
|
||||
|
||||
if("PRG_edit")
|
||||
if(computer && authorized())
|
||||
if(params["name"])
|
||||
var/temp_name = reject_bad_name(input("Enter name.", "Name", id_card.registered_name))
|
||||
if(temp_name)
|
||||
id_card.registered_name = temp_name
|
||||
else
|
||||
computer.visible_message("<span class='notice'>[computer] buzzes rudely.</span>")
|
||||
//else if(params["account"])
|
||||
// var/account_num = text2num(input("Enter account number.", "Account", id_card.associated_account_number))
|
||||
// id_card.associated_account_number = account_num
|
||||
if("PRG_assign")
|
||||
if(computer && authorized() && id_card)
|
||||
var/t1 = params["assign_target"]
|
||||
if(t1 == "Custom")
|
||||
var/temp_t = reject_bad_text(input("Enter a custom job assignment.","Assignment", id_card.assignment), 45)
|
||||
//let custom jobs function as an impromptu alt title, mainly for sechuds
|
||||
if(temp_t)
|
||||
id_card.assignment = temp_t
|
||||
else
|
||||
var/list/access = list()
|
||||
if(is_centcom)
|
||||
access = get_centcom_access(t1)
|
||||
else
|
||||
var/datum/job/jobdatum
|
||||
for(var/jobtype in typesof(/datum/job))
|
||||
var/datum/job/J = new jobtype
|
||||
if(ckey(J.title) == ckey(t1))
|
||||
jobdatum = J
|
||||
break
|
||||
if(!jobdatum)
|
||||
to_chat(usr, "<span class='warning'>No log exists for this job: [t1]</span>")
|
||||
return
|
||||
|
||||
access = jobdatum.get_access()
|
||||
|
||||
remove_nt_access(id_card)
|
||||
apply_access(id_card, access)
|
||||
id_card.assignment = t1
|
||||
|
||||
if("PRG_access")
|
||||
if(params["allowed"] && computer && authorized())
|
||||
var/access_type = text2num(params["access_target"])
|
||||
var/access_allowed = text2num(params["allowed"])
|
||||
if(access_type in (is_centcom ? get_all_centcom_access() : get_all_accesses()))
|
||||
id_card.access -= access_type
|
||||
if(!access_allowed)
|
||||
id_card.access += access_type
|
||||
if("PRG_open_job")
|
||||
var/edit_job_target = params["target"]
|
||||
var/datum/job/j = SSjob.GetJob(edit_job_target)
|
||||
if(!j)
|
||||
return 0
|
||||
if(can_open_job(j) != 1)
|
||||
return 0
|
||||
if(opened_positions[edit_job_target] >= 0)
|
||||
GLOB.time_last_changed_position = world.time / 10
|
||||
j.total_positions++
|
||||
opened_positions[edit_job_target]++
|
||||
if("PRG_close_job")
|
||||
var/edit_job_target = params["target"]
|
||||
var/datum/job/j = SSjob.GetJob(edit_job_target)
|
||||
if(!j)
|
||||
return 0
|
||||
if(can_close_job(j) != 1)
|
||||
return 0
|
||||
//Allow instant closing without cooldown if a position has been opened before
|
||||
if(opened_positions[edit_job_target] <= 0)
|
||||
GLOB.time_last_changed_position = world.time / 10
|
||||
j.total_positions--
|
||||
opened_positions[edit_job_target]--
|
||||
if("PRG_regsel")
|
||||
if(!reg_ids)
|
||||
reg_ids = list()
|
||||
var/regsel = text2num(params["region"])
|
||||
if(regsel in reg_ids)
|
||||
reg_ids -= regsel
|
||||
if(!printer.print_text(contents,"access report"))
|
||||
to_chat(usr, "<span class='notice'>Hardware error: Printer was unable to print the file. It may be out of paper.</span>")
|
||||
return
|
||||
else
|
||||
reg_ids += regsel
|
||||
playsound(computer, 'sound/machines/terminal_on.ogg', 50, FALSE)
|
||||
computer.visible_message("<span class='notice'>\The [computer] prints out a paper.</span>")
|
||||
return TRUE
|
||||
if("PRG_eject")
|
||||
if(!computer || !card_slot)
|
||||
return
|
||||
if(id_card)
|
||||
GLOB.data_core.manifest_modify(id_card.registered_name, id_card.assignment)
|
||||
card_slot.try_eject(TRUE, user)
|
||||
else
|
||||
var/obj/item/I = user.get_active_held_item()
|
||||
if(istype(I, /obj/item/card/id))
|
||||
if(!user.transferItemToLoc(I, computer))
|
||||
return
|
||||
card_slot.stored_card = I
|
||||
playsound(computer, 'sound/machines/terminal_insert_disc.ogg', 50, FALSE)
|
||||
return TRUE
|
||||
if("PRG_terminate")
|
||||
if(!computer || !authenticated)
|
||||
return
|
||||
if(minor)
|
||||
if(!(id_card.assignment in head_subordinates) && id_card.assignment != "Assistant")
|
||||
return
|
||||
|
||||
if(id_card)
|
||||
id_card.name = text("[id_card.registered_name]'s ID Card ([id_card.assignment])")
|
||||
id_card.access -= get_all_centcom_access() + get_all_accesses()
|
||||
id_card.assignment = "Unassigned"
|
||||
id_card.update_label()
|
||||
playsound(computer, 'sound/machines/terminal_prompt_deny.ogg', 50, FALSE)
|
||||
return TRUE
|
||||
if("PRG_edit")
|
||||
if(!computer || !authenticated || !id_card)
|
||||
return
|
||||
var/new_name = params["name"]
|
||||
if(!new_name)
|
||||
return
|
||||
id_card.registered_name = new_name
|
||||
id_card.update_label()
|
||||
playsound(computer, "terminal_type", 50, FALSE)
|
||||
return TRUE
|
||||
if("PRG_assign")
|
||||
if(!computer || !authenticated || !id_card)
|
||||
return
|
||||
var/target = params["assign_target"]
|
||||
if(!target)
|
||||
return
|
||||
|
||||
return 1
|
||||
if(target == "Custom")
|
||||
var/custom_name = params["custom_name"]
|
||||
if(custom_name)
|
||||
id_card.assignment = custom_name
|
||||
id_card.update_label()
|
||||
else
|
||||
if(minor && !(target in head_subordinates))
|
||||
return
|
||||
var/list/new_access = list()
|
||||
if(is_centcom)
|
||||
new_access = get_centcom_access(target)
|
||||
else
|
||||
var/datum/job/job
|
||||
for(var/jobtype in subtypesof(/datum/job))
|
||||
var/datum/job/J = new jobtype
|
||||
if(J.title == target)
|
||||
job = J
|
||||
break
|
||||
if(!job)
|
||||
to_chat(user, "<span class='warning'>No class exists for this job: [target]</span>")
|
||||
return
|
||||
new_access = job.get_access()
|
||||
id_card.access -= get_all_centcom_access() + get_all_accesses()
|
||||
id_card.access |= new_access
|
||||
id_card.assignment = target
|
||||
id_card.update_label()
|
||||
playsound(computer, 'sound/machines/terminal_prompt_confirm.ogg', 50, FALSE)
|
||||
return TRUE
|
||||
if("PRG_access")
|
||||
if(!computer || !authenticated)
|
||||
return
|
||||
var/access_type = text2num(params["access_target"])
|
||||
if(access_type in (is_centcom ? get_all_centcom_access() : get_all_accesses()))
|
||||
if(access_type in id_card.access)
|
||||
id_card.access -= access_type
|
||||
else
|
||||
id_card.access |= access_type
|
||||
playsound(computer, "terminal_type", 50, FALSE)
|
||||
return TRUE
|
||||
if("PRG_grantall")
|
||||
if(!computer || !authenticated || minor)
|
||||
return
|
||||
id_card.access |= (is_centcom ? get_all_centcom_access() : get_all_accesses())
|
||||
playsound(computer, 'sound/machines/terminal_prompt_confirm.ogg', 50, FALSE)
|
||||
return TRUE
|
||||
if("PRG_denyall")
|
||||
if(!computer || !authenticated || minor)
|
||||
return
|
||||
id_card.access.Cut()
|
||||
playsound(computer, 'sound/machines/terminal_prompt_deny.ogg', 50, FALSE)
|
||||
return TRUE
|
||||
if("PRG_grantregion")
|
||||
if(!computer || !authenticated)
|
||||
return
|
||||
var/region = text2num(params["region"])
|
||||
if(isnull(region))
|
||||
return
|
||||
id_card.access |= get_region_accesses(region)
|
||||
playsound(computer, 'sound/machines/terminal_prompt_confirm.ogg', 50, FALSE)
|
||||
return TRUE
|
||||
if("PRG_denyregion")
|
||||
if(!computer || !authenticated)
|
||||
return
|
||||
var/region = text2num(params["region"])
|
||||
if(isnull(region))
|
||||
return
|
||||
id_card.access -= get_region_accesses(region)
|
||||
playsound(computer, 'sound/machines/terminal_prompt_deny.ogg', 50, FALSE)
|
||||
return TRUE
|
||||
|
||||
/datum/computer_file/program/card_mod/proc/remove_nt_access(obj/item/card/id/id_card)
|
||||
id_card.access -= get_all_accesses()
|
||||
id_card.access -= get_all_centcom_access()
|
||||
|
||||
/datum/computer_file/program/card_mod/proc/apply_access(obj/item/card/id/id_card, list/accesses)
|
||||
id_card.access |= accesses
|
||||
|
||||
/datum/computer_file/program/card_mod/ui_static_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["station_name"] = station_name()
|
||||
data["centcom_access"] = is_centcom
|
||||
data["minor"] = target_dept || minor ? TRUE : FALSE
|
||||
|
||||
var/list/departments = target_dept
|
||||
if(is_centcom)
|
||||
departments = list("CentCom" = get_all_centcom_jobs())
|
||||
else if(isnull(departments))
|
||||
departments = list(
|
||||
CARDCON_DEPARTMENT_COMMAND = list("Captain"),
|
||||
CARDCON_DEPARTMENT_ENGINEERING = GLOB.engineering_positions,
|
||||
CARDCON_DEPARTMENT_MEDICAL = GLOB.medical_positions,
|
||||
CARDCON_DEPARTMENT_SCIENCE = GLOB.science_positions,
|
||||
CARDCON_DEPARTMENT_SECURITY = GLOB.security_positions,
|
||||
CARDCON_DEPARTMENT_SUPPLY = GLOB.supply_positions,
|
||||
CARDCON_DEPARTMENT_SERVICE = GLOB.civilian_positions
|
||||
)
|
||||
data["jobs"] = list()
|
||||
for(var/department in departments)
|
||||
var/list/job_list = departments[department]
|
||||
var/list/department_jobs = list()
|
||||
for(var/job in job_list)
|
||||
if(minor && !(job in head_subordinates))
|
||||
continue
|
||||
department_jobs += list(list(
|
||||
"display_name" = replacetext(job, " ", " "),
|
||||
"job" = job
|
||||
))
|
||||
if(length(department_jobs))
|
||||
data["jobs"][department] = department_jobs
|
||||
|
||||
var/list/regions = list()
|
||||
for(var/i in 1 to 7)
|
||||
if((minor || target_dept) && !(i in region_access))
|
||||
continue
|
||||
|
||||
var/list/accesses = list()
|
||||
for(var/access in get_region_accesses(i))
|
||||
if (get_access_desc(access))
|
||||
accesses += list(list(
|
||||
"desc" = replacetext(get_access_desc(access), " ", " "),
|
||||
"ref" = access,
|
||||
))
|
||||
|
||||
regions += list(list(
|
||||
"name" = get_region_accesses_name(i),
|
||||
"regid" = i,
|
||||
"accesses" = accesses
|
||||
))
|
||||
|
||||
data["regions"] = regions
|
||||
|
||||
return data
|
||||
|
||||
/datum/computer_file/program/card_mod/ui_data(mob/user)
|
||||
|
||||
var/list/data = get_header_data()
|
||||
|
||||
var/obj/item/computer_hardware/card_slot/card_slot
|
||||
@@ -301,181 +330,34 @@
|
||||
card_slot = computer.all_components[MC_CARD]
|
||||
printer = computer.all_components[MC_PRINT]
|
||||
|
||||
data["mmode"] = mod_mode
|
||||
|
||||
var/authed = 0
|
||||
if(computer)
|
||||
if(card_slot)
|
||||
var/obj/item/card/id/auth_card = card_slot.stored_card2
|
||||
data["auth_name"] = auth_card ? strip_html_simple(auth_card.name) : "-----"
|
||||
authed = authorized()
|
||||
|
||||
|
||||
if(mod_mode == 2)
|
||||
data["slots"] = list()
|
||||
var/list/pos = list()
|
||||
for(var/datum/job/job in SSjob.occupations)
|
||||
if(job.title in blacklisted)
|
||||
continue
|
||||
|
||||
var/list/status_open = build_manage(job,1)
|
||||
var/list/status_close = build_manage(job,0)
|
||||
|
||||
pos.Add(list(list(
|
||||
"title" = job.title,
|
||||
"current" = job.current_positions,
|
||||
"total" = job.total_positions,
|
||||
"status_open" = (authed && !minor) ? status_open["enable"]: 0,
|
||||
"status_close" = (authed && !minor) ? status_close["enable"] : 0,
|
||||
"desc_open" = status_open["desc"],
|
||||
"desc_close" = status_close["desc"])))
|
||||
data["slots"] = pos
|
||||
|
||||
data["src"] = "[REF(src)]"
|
||||
data["station_name"] = station_name()
|
||||
|
||||
|
||||
if(!mod_mode)
|
||||
data["manifest"] = list()
|
||||
var/list/crew = list()
|
||||
for(var/datum/data/record/t in sortRecord(GLOB.data_core.general))
|
||||
crew.Add(list(list(
|
||||
"name" = t.fields["name"],
|
||||
"rank" = t.fields["rank"])))
|
||||
|
||||
data["manifest"] = crew
|
||||
data["assignments"] = show_assignments
|
||||
if(computer)
|
||||
data["have_id_slot"] = !!card_slot
|
||||
data["have_printer"] = !!printer
|
||||
if(!card_slot && mod_mode == 1)
|
||||
mod_mode = 0 //We can't modify IDs when there is no card reader
|
||||
else
|
||||
data["have_id_slot"] = 0
|
||||
data["have_printer"] = 0
|
||||
data["have_id_slot"] = FALSE
|
||||
data["have_printer"] = FALSE
|
||||
|
||||
data["centcom_access"] = is_centcom
|
||||
|
||||
|
||||
data["authenticated"] = authed
|
||||
|
||||
|
||||
if(mod_mode == 1 && computer)
|
||||
if(card_slot)
|
||||
var/obj/item/card/id/id_card = card_slot.stored_card
|
||||
|
||||
data["has_id"] = !!id_card
|
||||
data["id_rank"] = id_card && id_card.assignment ? html_encode(id_card.assignment) : "Unassigned"
|
||||
data["id_owner"] = id_card && id_card.registered_name ? html_encode(id_card.registered_name) : "-----"
|
||||
data["id_name"] = id_card ? strip_html_simple(id_card.name) : "-----"
|
||||
|
||||
if(show_assignments)
|
||||
data["engineering_jobs"] = format_jobs(GLOB.engineering_positions)
|
||||
data["medical_jobs"] = format_jobs(GLOB.medical_positions)
|
||||
data["science_jobs"] = format_jobs(GLOB.science_positions)
|
||||
data["security_jobs"] = format_jobs(GLOB.security_positions)
|
||||
data["cargo_jobs"] = format_jobs(GLOB.supply_positions)
|
||||
data["civilian_jobs"] = format_jobs(GLOB.civilian_positions)
|
||||
data["centcom_jobs"] = format_jobs(get_all_centcom_jobs())
|
||||
|
||||
|
||||
if(card_slot.stored_card)
|
||||
var/obj/item/card/id/id_card = card_slot.stored_card
|
||||
if(is_centcom)
|
||||
var/list/all_centcom_access = list()
|
||||
for(var/access in get_all_centcom_access())
|
||||
all_centcom_access.Add(list(list(
|
||||
"desc" = replacetext(get_centcom_access_desc(access), " ", " "),
|
||||
"ref" = access,
|
||||
"allowed" = (access in id_card.access) ? 1 : 0)))
|
||||
data["all_centcom_access"] = all_centcom_access
|
||||
else
|
||||
var/list/regions = list()
|
||||
for(var/i = 1; i <= 7; i++)
|
||||
if((minor || target_dept) && !(i in region_access))
|
||||
continue
|
||||
|
||||
var/list/accesses = list()
|
||||
if(i in reg_ids)
|
||||
for(var/access in get_region_accesses(i))
|
||||
if (get_access_desc(access))
|
||||
accesses.Add(list(list(
|
||||
"desc" = replacetext(get_access_desc(access), " ", " "),
|
||||
"ref" = access,
|
||||
"allowed" = (access in id_card.access) ? 1 : 0)))
|
||||
|
||||
regions.Add(list(list(
|
||||
"name" = get_region_accesses_name(i),
|
||||
"regid" = i,
|
||||
"selected" = (i in reg_ids) ? 1 : null,
|
||||
"accesses" = accesses)))
|
||||
data["regions"] = regions
|
||||
|
||||
data["minor"] = target_dept || minor ? 1 : 0
|
||||
data["authenticated"] = authenticated
|
||||
|
||||
if(computer)
|
||||
var/obj/item/card/id/id_card = card_slot.stored_card
|
||||
data["has_id"] = !!id_card
|
||||
data["id_name"] = id_card ? id_card.name : "-----"
|
||||
if(id_card)
|
||||
data["id_rank"] = id_card.assignment ? id_card.assignment : "Unassigned"
|
||||
data["id_owner"] = id_card.registered_name ? id_card.registered_name : "-----"
|
||||
data["access_on_card"] = id_card.access
|
||||
|
||||
return data
|
||||
|
||||
|
||||
/datum/computer_file/program/card_mod/proc/build_manage(datum/job,open = FALSE)
|
||||
var/out = "Denied"
|
||||
var/can_change= 0
|
||||
if(open)
|
||||
can_change = can_open_job(job)
|
||||
else
|
||||
can_change = can_close_job(job)
|
||||
var/enable = 0
|
||||
if(can_change == 1)
|
||||
out = "[open ? "Open Position" : "Close Position"]"
|
||||
enable = 1
|
||||
else if(can_change == -2)
|
||||
var/time_to_wait = round(change_position_cooldown - ((world.time / 10) - GLOB.time_last_changed_position), 1)
|
||||
var/mins = round(time_to_wait / 60)
|
||||
var/seconds = time_to_wait - (60*mins)
|
||||
out = "Cooldown ongoing: [mins]:[(seconds < 10) ? "0[seconds]" : "[seconds]"]"
|
||||
else
|
||||
out = "Denied"
|
||||
|
||||
return list("enable" = enable, "desc" = out)
|
||||
|
||||
|
||||
/datum/computer_file/program/card_mod/proc/authorized()
|
||||
if(!authenticated && computer)
|
||||
var/obj/item/computer_hardware/card_slot/card_slot = computer.all_components[MC_CARD]
|
||||
if(card_slot)
|
||||
var/obj/item/card/id/auth_card = card_slot.stored_card2
|
||||
if(auth_card)
|
||||
region_access = list()
|
||||
if(ACCESS_CHANGE_IDS in auth_card.GetAccess())
|
||||
minor = 0
|
||||
authenticated = 1
|
||||
return 1
|
||||
else
|
||||
if((ACCESS_HOP in auth_card.access) && ((target_dept==1) || !target_dept))
|
||||
region_access |= 1
|
||||
region_access |= 6
|
||||
get_subordinates("Head of Personnel")
|
||||
if((ACCESS_HOS in auth_card.access) && ((target_dept==2) || !target_dept))
|
||||
region_access |= 2
|
||||
get_subordinates("Head of Security")
|
||||
if((ACCESS_CMO in auth_card.access) && ((target_dept==3) || !target_dept))
|
||||
region_access |= 3
|
||||
get_subordinates("Chief Medical Officer")
|
||||
if((ACCESS_RD in auth_card.access) && ((target_dept==4) || !target_dept))
|
||||
region_access |= 4
|
||||
get_subordinates("Research Director")
|
||||
if((ACCESS_CE in auth_card.access) && ((target_dept==5) || !target_dept))
|
||||
region_access |= 5
|
||||
get_subordinates("Chief Engineer")
|
||||
if(region_access.len)
|
||||
minor = 1
|
||||
authenticated = 1
|
||||
return 1
|
||||
else
|
||||
return authenticated
|
||||
|
||||
/datum/computer_file/program/card_mod/proc/get_subordinates(rank)
|
||||
head_subordinates = list()
|
||||
for(var/datum/job/job in SSjob.occupations)
|
||||
if(rank in job.department_head)
|
||||
head_subordinates += job.title
|
||||
#undef CARDCON_DEPARTMENT_SERVICE
|
||||
#undef CARDCON_DEPARTMENT_SECURITY
|
||||
#undef CARDCON_DEPARTMENT_MEDICAL
|
||||
#undef CARDCON_DEPARTMENT_SCIENCE
|
||||
#undef CARDCON_DEPARTMENT_SUPPLY
|
||||
#undef CARDCON_DEPARTMENT_ENGINEERING
|
||||
#undef CARDCON_DEPARTMENT_COMMAND
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/datum/computer_file/program/shipping
|
||||
filename = "shipping"
|
||||
filedesc = "Nanotrasen Shipping Scanner"
|
||||
program_icon_state = "shipping"
|
||||
extended_desc = "A combination printer/scanner app that enables modular computers to print barcodes for easy scanning and shipping."
|
||||
network_destination = "ship scanner"
|
||||
size = 6
|
||||
tgui_id = "NtosShipping"
|
||||
ui_x = 450
|
||||
ui_y = 350
|
||||
///Account used for creating barcodes.
|
||||
var/datum/bank_account/payments_acc
|
||||
///The amount which the tagger will recieve for the sale.
|
||||
var/percent_cut = 20
|
||||
|
||||
/datum/computer_file/program/shipping/ui_data(mob/user)
|
||||
var/list/data = get_header_data()
|
||||
|
||||
var/obj/item/computer_hardware/card_slot/card_slot = computer.all_components[MC_CARD]
|
||||
var/obj/item/computer_hardware/printer/printer = computer.all_components[MC_PRINT]
|
||||
var/obj/item/card/id/id_card = card_slot ? card_slot.stored_card : null
|
||||
data["has_id_slot"] = !!card_slot
|
||||
data["has_printer"] = !!printer
|
||||
data["paperamt"] = printer ? "[printer.stored_paper] / [printer.max_paper]" : null
|
||||
data["card_owner"] = card_slot && card_slot.stored_card ? id_card.registered_name : "No Card Inserted."
|
||||
data["current_user"] = payments_acc ? payments_acc.account_holder : null
|
||||
data["barcode_split"] = percent_cut
|
||||
return data
|
||||
|
||||
/datum/computer_file/program/shipping/ui_act(action, list/params)
|
||||
if(..())
|
||||
return TRUE
|
||||
if(!computer)
|
||||
return
|
||||
|
||||
// Get components
|
||||
var/obj/item/computer_hardware/card_slot/card_slot = computer.all_components[MC_CARD]
|
||||
var/obj/item/computer_hardware/printer/printer = computer.all_components[MC_PRINT]
|
||||
var/obj/item/card/id/id_card = card_slot ? card_slot.stored_card : null
|
||||
if(!card_slot || !printer) //We need both to successfully use this app.
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("ejectid")
|
||||
if(id_card)
|
||||
card_slot.try_eject(TRUE, usr)
|
||||
if("selectid")
|
||||
if(!id_card)
|
||||
return
|
||||
if(!id_card.registered_account)
|
||||
playsound(get_turf(ui_host()), 'sound/machines/buzz-sigh.ogg', 50, TRUE, -1)
|
||||
return
|
||||
payments_acc = id_card.registered_account
|
||||
playsound(get_turf(ui_host()), 'sound/machines/ping.ogg', 50, TRUE, -1)
|
||||
if("resetid")
|
||||
payments_acc = null
|
||||
if("setsplit")
|
||||
var/potential_cut = input("How much would you like to payout to the registered card?","Percentage Profit") as num|null
|
||||
percent_cut = potential_cut ? clamp(round(potential_cut, 1), 1, 50) : 20
|
||||
if("print")
|
||||
if(!printer)
|
||||
to_chat(usr, "<span class='notice'>Hardware error: A printer is required to print barcodes.</span>")
|
||||
return
|
||||
if(printer.stored_paper <= 0)
|
||||
to_chat(usr, "<span class='notice'>Hardware error: Printer is out of paper.</span>")
|
||||
return
|
||||
if(!payments_acc)
|
||||
to_chat(usr, "<span class='notice'>Software error: Please set a current user first.</span>")
|
||||
return
|
||||
var/obj/item/barcode/barcode = new /obj/item/barcode(get_turf(ui_host()))
|
||||
barcode.payments_acc = payments_acc
|
||||
barcode.percent_cut = percent_cut
|
||||
printer.stored_paper--
|
||||
to_chat(usr, "<span class='notice'>The computer prints out a barcode.</span>")
|
||||
@@ -14,7 +14,7 @@
|
||||
ui_y = 630
|
||||
available_on_ntnet = 0
|
||||
requires_ntnet = 0
|
||||
tgui_id = "ntos_configuration"
|
||||
tgui_id = "NtosConfiguration"
|
||||
|
||||
var/obj/item/modular_computer/movable = null
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/datum/computer_file/program/crew_manifest
|
||||
filename = "crewmani"
|
||||
filedesc = "Crew Manifest"
|
||||
program_icon_state = "id"
|
||||
extended_desc = "Program for viewing and printing the current crew manifest"
|
||||
transfer_access = ACCESS_HEADS
|
||||
requires_ntnet = FALSE
|
||||
size = 4
|
||||
tgui_id = "NtosCrewManifest"
|
||||
ui_x = 400
|
||||
ui_y = 480
|
||||
|
||||
/datum/computer_file/program/crew_manifest/ui_static_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["manifest"] = GLOB.data_core.get_manifest()
|
||||
return data
|
||||
|
||||
/datum/computer_file/program/crew_manifest/ui_data(mob/user)
|
||||
var/list/data = get_header_data()
|
||||
|
||||
var/obj/item/computer_hardware/printer/printer
|
||||
if(computer)
|
||||
printer = computer.all_components[MC_PRINT]
|
||||
|
||||
if(computer)
|
||||
data["have_printer"] = !!printer
|
||||
else
|
||||
data["have_printer"] = FALSE
|
||||
return data
|
||||
|
||||
/datum/computer_file/program/crew_manifest/ui_act(action, params, datum/tgui/ui)
|
||||
if(..())
|
||||
return
|
||||
|
||||
var/obj/item/computer_hardware/printer/printer
|
||||
if(computer)
|
||||
printer = computer.all_components[MC_PRINT]
|
||||
|
||||
switch(action)
|
||||
if("PRG_print")
|
||||
if(computer && printer) //This option should never be called if there is no printer
|
||||
var/contents = {"<h4>Crew Manifest</h4>
|
||||
<br>
|
||||
[GLOB.data_core ? GLOB.data_core.get_manifest_html(0) : ""]
|
||||
"}
|
||||
if(!printer.print_text(contents,text("crew manifest ([])", station_time_timestamp())))
|
||||
to_chat(usr, "<span class='notice'>Hardware error: Printer was unable to print the file. It may be out of paper.</span>")
|
||||
return
|
||||
else
|
||||
computer.visible_message("<span class='notice'>\The [computer] prints out a paper.</span>")
|
||||
@@ -4,186 +4,67 @@
|
||||
extended_desc = "This program allows management of files."
|
||||
program_icon_state = "generic"
|
||||
size = 8
|
||||
requires_ntnet = 0
|
||||
available_on_ntnet = 0
|
||||
undeletable = 1
|
||||
tgui_id = "ntos_file_manager"
|
||||
requires_ntnet = FALSE
|
||||
available_on_ntnet = FALSE
|
||||
undeletable = TRUE
|
||||
tgui_id = "NtosFileManager"
|
||||
|
||||
var/open_file
|
||||
var/error
|
||||
|
||||
/datum/computer_file/program/filemanager/ui_act(action, params)
|
||||
if(..())
|
||||
return 1
|
||||
return
|
||||
|
||||
var/obj/item/computer_hardware/hard_drive/HDD = computer.all_components[MC_HDD]
|
||||
var/obj/item/computer_hardware/hard_drive/RHDD = computer.all_components[MC_SDD]
|
||||
var/obj/item/computer_hardware/printer/printer = computer.all_components[MC_PRINT]
|
||||
|
||||
switch(action)
|
||||
if("PRG_openfile")
|
||||
. = 1
|
||||
open_file = params["name"]
|
||||
if("PRG_newtextfile")
|
||||
. = 1
|
||||
var/newname = stripped_input(usr, "Enter file name or leave blank to cancel:", "File rename", max_length=50)
|
||||
if(!newname)
|
||||
return 1
|
||||
if(!HDD)
|
||||
return 1
|
||||
var/datum/computer_file/data/F = new/datum/computer_file/data()
|
||||
F.filename = newname
|
||||
F.filetype = "TXT"
|
||||
HDD.store_file(F)
|
||||
if("PRG_deletefile")
|
||||
. = 1
|
||||
if(!HDD)
|
||||
return 1
|
||||
return
|
||||
var/datum/computer_file/file = HDD.find_file_by_name(params["name"])
|
||||
if(!file || file.undeletable)
|
||||
return 1
|
||||
return
|
||||
HDD.remove_file(file)
|
||||
return TRUE
|
||||
if("PRG_usbdeletefile")
|
||||
. = 1
|
||||
if(!RHDD)
|
||||
return 1
|
||||
return
|
||||
var/datum/computer_file/file = RHDD.find_file_by_name(params["name"])
|
||||
if(!file || file.undeletable)
|
||||
return 1
|
||||
RHDD.remove_file(file)
|
||||
if("PRG_closefile")
|
||||
. = 1
|
||||
open_file = null
|
||||
error = null
|
||||
if("PRG_clone")
|
||||
. = 1
|
||||
if(!HDD)
|
||||
return 1
|
||||
var/datum/computer_file/F = HDD.find_file_by_name(params["name"])
|
||||
if(!F || !istype(F))
|
||||
return 1
|
||||
var/datum/computer_file/C = F.clone(1)
|
||||
HDD.store_file(C)
|
||||
if("PRG_rename")
|
||||
. = 1
|
||||
if(!HDD)
|
||||
return 1
|
||||
var/datum/computer_file/file = HDD.find_file_by_name(params["name"])
|
||||
if(!file || !istype(file))
|
||||
return 1
|
||||
var/newname = stripped_input(usr, "Enter new file name:", "File rename", file.filename, max_length=50)
|
||||
if(file && newname)
|
||||
file.filename = newname
|
||||
if("PRG_edit")
|
||||
. = 1
|
||||
if(!open_file)
|
||||
return 1
|
||||
if(!HDD)
|
||||
return 1
|
||||
var/datum/computer_file/data/F = HDD.find_file_by_name(open_file)
|
||||
if(!F || !istype(F))
|
||||
return 1
|
||||
if(F.do_not_edit && (alert("WARNING: This file is not compatible with editor. Editing it may result in permanently corrupted formatting or damaged data consistency. Edit anyway?", "Incompatible File", "No", "Yes") == "No"))
|
||||
return 1
|
||||
// 16384 is the limit for file length in characters. Currently, papers have value of 2048 so this is 8 times as long, since we can't edit parts of the file independently.
|
||||
var/newtext = stripped_multiline_input(usr, "Editing file [open_file]. You may use most tags used in paper formatting:", "Text Editor", html_decode(F.stored_data), 16384, TRUE)
|
||||
if(!newtext)
|
||||
return
|
||||
if(F)
|
||||
var/datum/computer_file/data/backup = F.clone()
|
||||
HDD.remove_file(F)
|
||||
F.stored_data = newtext
|
||||
F.calculate_size()
|
||||
// We can't store the updated file, it's probably too large. Print an error and restore backed up version.
|
||||
// This is mostly intended to prevent people from losing texts they spent lot of time working on due to running out of space.
|
||||
// They will be able to copy-paste the text from error screen and store it in notepad or something.
|
||||
if(!HDD.store_file(F))
|
||||
error = "I/O error: Unable to overwrite file. Hard drive is probably full. You may want to backup your changes before closing this window:<br><br>[F.stored_data]<br><br>"
|
||||
HDD.store_file(backup)
|
||||
if("PRG_printfile")
|
||||
. = 1
|
||||
if(!open_file)
|
||||
return 1
|
||||
RHDD.remove_file(file)
|
||||
return TRUE
|
||||
if("PRG_rename")
|
||||
if(!HDD)
|
||||
return 1
|
||||
var/datum/computer_file/data/F = HDD.find_file_by_name(open_file)
|
||||
if(!F || !istype(F))
|
||||
return 1
|
||||
if(!printer)
|
||||
error = "Missing Hardware: Your computer does not have required hardware to complete this operation."
|
||||
return 1
|
||||
if(!printer.print_text("<font face=\"[(computer.obj_flags & EMAGGED) ? CRAYON_FONT : PRINTER_FONT]\">" + prepare_printjob(F.stored_data) + "</font>", open_file))
|
||||
error = "Hardware error: Printer was unable to print the file. It may be out of paper."
|
||||
return 1
|
||||
return
|
||||
var/datum/computer_file/file = HDD.find_file_by_name(params["name"])
|
||||
if(!file)
|
||||
return
|
||||
var/newname = params["new_name"]
|
||||
if(!newname)
|
||||
return
|
||||
file.filename = newname
|
||||
return TRUE
|
||||
if("PRG_copytousb")
|
||||
. = 1
|
||||
if(!HDD || !RHDD)
|
||||
return 1
|
||||
return
|
||||
var/datum/computer_file/F = HDD.find_file_by_name(params["name"])
|
||||
if(!F || !istype(F))
|
||||
return 1
|
||||
var/datum/computer_file/C = F.clone(0)
|
||||
if(!F)
|
||||
return
|
||||
var/datum/computer_file/C = F.clone(FALSE)
|
||||
RHDD.store_file(C)
|
||||
return TRUE
|
||||
if("PRG_copyfromusb")
|
||||
. = 1
|
||||
if(!HDD || !RHDD)
|
||||
return 1
|
||||
return
|
||||
var/datum/computer_file/F = RHDD.find_file_by_name(params["name"])
|
||||
if(!F || !istype(F))
|
||||
return 1
|
||||
var/datum/computer_file/C = F.clone(0)
|
||||
return
|
||||
var/datum/computer_file/C = F.clone(FALSE)
|
||||
HDD.store_file(C)
|
||||
|
||||
/datum/computer_file/program/filemanager/proc/parse_tags(t)
|
||||
t = replacetext(t, "\[center\]", "<center>")
|
||||
t = replacetext(t, "\[/center\]", "</center>")
|
||||
t = replacetext(t, "\[br\]", "<BR>")
|
||||
t = replacetext(t, "\n", "<BR>")
|
||||
t = replacetext(t, "\[b\]", "<B>")
|
||||
t = replacetext(t, "\[/b\]", "</B>")
|
||||
t = replacetext(t, "\[i\]", "<I>")
|
||||
t = replacetext(t, "\[/i\]", "</I>")
|
||||
t = replacetext(t, "\[u\]", "<U>")
|
||||
t = replacetext(t, "\[/u\]", "</U>")
|
||||
t = replacetext(t, "\[time\]", "[STATION_TIME_TIMESTAMP("hh:mm:ss", world.time)]")
|
||||
t = replacetext(t, "\[date\]", "[time2text(world.realtime, "MMM DD")] [GLOB.year_integer]")
|
||||
t = replacetext(t, "\[large\]", "<font size=\"4\">")
|
||||
t = replacetext(t, "\[/large\]", "</font>")
|
||||
t = replacetext(t, "\[h1\]", "<H1>")
|
||||
t = replacetext(t, "\[/h1\]", "</H1>")
|
||||
t = replacetext(t, "\[h2\]", "<H2>")
|
||||
t = replacetext(t, "\[/h2\]", "</H2>")
|
||||
t = replacetext(t, "\[h3\]", "<H3>")
|
||||
t = replacetext(t, "\[/h3\]", "</H3>")
|
||||
t = replacetext(t, "\[*\]", "<li>")
|
||||
t = replacetext(t, "\[hr\]", "<HR>")
|
||||
t = replacetext(t, "\[small\]", "<font size = \"1\">")
|
||||
t = replacetext(t, "\[/small\]", "</font>")
|
||||
t = replacetext(t, "\[list\]", "<ul>")
|
||||
t = replacetext(t, "\[/list\]", "</ul>")
|
||||
t = replacetext(t, "\[table\]", "<table border=1 cellspacing=0 cellpadding=3 style='border: 1px solid black;'>")
|
||||
t = replacetext(t, "\[/table\]", "</td></tr></table>")
|
||||
t = replacetext(t, "\[grid\]", "<table>")
|
||||
t = replacetext(t, "\[/grid\]", "</td></tr></table>")
|
||||
t = replacetext(t, "\[row\]", "</td><tr>")
|
||||
t = replacetext(t, "\[tr\]", "</td><tr>")
|
||||
t = replacetext(t, "\[td\]", "<td>")
|
||||
t = replacetext(t, "\[cell\]", "<td>")
|
||||
t = replacetext(t, "\[tab\]", " ")
|
||||
|
||||
t = parsemarkdown_basic(t)
|
||||
|
||||
return t
|
||||
|
||||
/datum/computer_file/program/filemanager/proc/prepare_printjob(t) // Additional stuff to parse if we want to print it and make a happy Head of Personnel. Forms FTW.
|
||||
t = replacetext(t, "\[field\]", "<span class=\"paper_field\"></span>")
|
||||
t = replacetext(t, "\[sign\]", "<span class=\"paper_field\"></span>")
|
||||
|
||||
t = parse_tags(t)
|
||||
|
||||
t = replacetext(t, regex("(?:%s(?:ign)|%f(?:ield))(?=\\s|$)", "ig"), "<span class=\"paper_field\"></span>")
|
||||
|
||||
return t
|
||||
return TRUE
|
||||
|
||||
/datum/computer_file/program/filemanager/ui_data(mob/user)
|
||||
var/list/data = get_header_data()
|
||||
@@ -192,41 +73,28 @@
|
||||
var/obj/item/computer_hardware/hard_drive/portable/RHDD = computer.all_components[MC_SDD]
|
||||
if(error)
|
||||
data["error"] = error
|
||||
if(open_file)
|
||||
var/datum/computer_file/data/file
|
||||
|
||||
if(!computer || !HDD)
|
||||
data["error"] = "I/O ERROR: Unable to access hard drive."
|
||||
else
|
||||
file = HDD.find_file_by_name(open_file)
|
||||
if(!istype(file))
|
||||
data["error"] = "I/O ERROR: Unable to open file."
|
||||
else
|
||||
data["filedata"] = parse_tags(file.stored_data)
|
||||
data["filename"] = "[file.filename].[file.filetype]"
|
||||
if(!computer || !HDD)
|
||||
data["error"] = "I/O ERROR: Unable to access hard drive."
|
||||
else
|
||||
if(!computer || !HDD)
|
||||
data["error"] = "I/O ERROR: Unable to access hard drive."
|
||||
else
|
||||
var/list/files[0]
|
||||
for(var/datum/computer_file/F in HDD.stored_files)
|
||||
files.Add(list(list(
|
||||
var/list/files = list()
|
||||
for(var/datum/computer_file/F in HDD.stored_files)
|
||||
files += list(list(
|
||||
"name" = F.filename,
|
||||
"type" = F.filetype,
|
||||
"size" = F.size,
|
||||
"undeletable" = F.undeletable
|
||||
))
|
||||
data["files"] = files
|
||||
if(RHDD)
|
||||
data["usbconnected"] = TRUE
|
||||
var/list/usbfiles = list()
|
||||
for(var/datum/computer_file/F in RHDD.stored_files)
|
||||
usbfiles += list(list(
|
||||
"name" = F.filename,
|
||||
"type" = F.filetype,
|
||||
"size" = F.size,
|
||||
"undeletable" = F.undeletable
|
||||
)))
|
||||
data["files"] = files
|
||||
if(RHDD)
|
||||
data["usbconnected"] = 1
|
||||
var/list/usbfiles[0]
|
||||
for(var/datum/computer_file/F in RHDD.stored_files)
|
||||
usbfiles.Add(list(list(
|
||||
"name" = F.filename,
|
||||
"type" = F.filetype,
|
||||
"size" = F.size,
|
||||
"undeletable" = F.undeletable
|
||||
)))
|
||||
data["usbfiles"] = usbfiles
|
||||
))
|
||||
data["usbfiles"] = usbfiles
|
||||
|
||||
return data
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
/datum/computer_file/program/job_management
|
||||
filename = "job_manage"
|
||||
filedesc = "Job Manager"
|
||||
program_icon_state = "id"
|
||||
extended_desc = "Program for viewing and changing job slot avalibility."
|
||||
transfer_access = ACCESS_HEADS
|
||||
requires_ntnet = 0
|
||||
size = 4
|
||||
tgui_id = "NtosJobManager"
|
||||
ui_x = 400
|
||||
ui_y = 620
|
||||
|
||||
var/change_position_cooldown = 30
|
||||
//Jobs you cannot open new positions for
|
||||
var/list/blacklisted = list(
|
||||
"AI",
|
||||
"Assistant",
|
||||
"Cyborg",
|
||||
"Captain",
|
||||
"Head of Personnel",
|
||||
"Head of Security",
|
||||
"Chief Engineer",
|
||||
"Research Director",
|
||||
"Chief Medical Officer")
|
||||
|
||||
//The scaling factor of max total positions in relation to the total amount of people on board the station in %
|
||||
var/max_relative_positions = 30 //30%: Seems reasonable, limit of 6 @ 20 players
|
||||
|
||||
//This is used to keep track of opened positions for jobs to allow instant closing
|
||||
//Assoc array: "JobName" = (int)<Opened Positions>
|
||||
var/list/opened_positions = list()
|
||||
|
||||
/datum/computer_file/program/job_management/New()
|
||||
..()
|
||||
change_position_cooldown = CONFIG_GET(number/id_console_jobslot_delay)
|
||||
|
||||
/datum/computer_file/program/job_management/proc/can_open_job(datum/job/job)
|
||||
if(!(job?.title in blacklisted))
|
||||
if((job.total_positions <= length(GLOB.player_list) * (max_relative_positions / 100)))
|
||||
var/delta = (world.time / 10) - GLOB.time_last_changed_position
|
||||
if((change_position_cooldown < delta) || (opened_positions[job.title] < 0))
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/computer_file/program/job_management/proc/can_close_job(datum/job/job)
|
||||
if(!(job?.title in blacklisted))
|
||||
if(job.total_positions > length(GLOB.player_list) * (max_relative_positions / 100))
|
||||
var/delta = (world.time / 10) - GLOB.time_last_changed_position
|
||||
if((change_position_cooldown < delta) || (opened_positions[job.title] > 0))
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/computer_file/program/job_management/ui_act(action, params, datum/tgui/ui)
|
||||
if(..())
|
||||
return
|
||||
|
||||
var/authed = FALSE
|
||||
var/mob/user = usr
|
||||
var/obj/item/card/id/user_id = user.get_idcard()
|
||||
if(user_id)
|
||||
if(ACCESS_CHANGE_IDS in user_id.access)
|
||||
authed = TRUE
|
||||
|
||||
if(!authed)
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("PRG_open_job")
|
||||
var/edit_job_target = params["target"]
|
||||
var/datum/job/j = SSjob.GetJob(edit_job_target)
|
||||
if(!j || !can_open_job(j))
|
||||
return
|
||||
if(opened_positions[edit_job_target] >= 0)
|
||||
GLOB.time_last_changed_position = world.time / 10
|
||||
j.total_positions++
|
||||
opened_positions[edit_job_target]++
|
||||
playsound(computer, 'sound/machines/terminal_prompt_confirm.ogg', 50, FALSE)
|
||||
return TRUE
|
||||
if("PRG_close_job")
|
||||
var/edit_job_target = params["target"]
|
||||
var/datum/job/j = SSjob.GetJob(edit_job_target)
|
||||
if(!j || !can_close_job(j))
|
||||
return
|
||||
//Allow instant closing without cooldown if a position has been opened before
|
||||
if(opened_positions[edit_job_target] <= 0)
|
||||
GLOB.time_last_changed_position = world.time / 10
|
||||
j.total_positions--
|
||||
opened_positions[edit_job_target]--
|
||||
playsound(computer, 'sound/machines/terminal_prompt_confirm.ogg', 50, FALSE)
|
||||
return TRUE
|
||||
if("PRG_priority")
|
||||
if(length(SSjob.prioritized_jobs) >= 5)
|
||||
return
|
||||
var/priority_target = params["target"]
|
||||
var/datum/job/j = SSjob.GetJob(priority_target)
|
||||
if(!j)
|
||||
return
|
||||
if(j.total_positions <= j.current_positions)
|
||||
return
|
||||
if(j in SSjob.prioritized_jobs)
|
||||
SSjob.prioritized_jobs -= j
|
||||
else
|
||||
SSjob.prioritized_jobs += j
|
||||
playsound(computer, 'sound/machines/terminal_prompt_confirm.ogg', 50, FALSE)
|
||||
return TRUE
|
||||
|
||||
|
||||
/datum/computer_file/program/job_management/ui_data(mob/user)
|
||||
var/list/data = get_header_data()
|
||||
|
||||
var/authed = FALSE
|
||||
var/obj/item/card/id/user_id = user.get_idcard(FALSE)
|
||||
if(user_id)
|
||||
if(ACCESS_CHANGE_IDS in user_id.access)
|
||||
authed = TRUE
|
||||
|
||||
data["authed"] = authed
|
||||
|
||||
var/list/pos = list()
|
||||
for(var/j in SSjob.occupations)
|
||||
var/datum/job/job = j
|
||||
if(job.title in blacklisted)
|
||||
continue
|
||||
|
||||
pos += list(list(
|
||||
"title" = job.title,
|
||||
"current" = job.current_positions,
|
||||
"total" = job.total_positions,
|
||||
"status_open" = authed ? can_open_job(job) : FALSE,
|
||||
"status_close" = authed ? can_close_job(job) : FALSE,
|
||||
))
|
||||
data["slots"] = pos
|
||||
var/delta = round(change_position_cooldown - ((world.time / 10) - GLOB.time_last_changed_position), 1)
|
||||
data["cooldown"] = delta < 0 ? 0 : delta
|
||||
var/list/priority = list()
|
||||
for(var/j in SSjob.prioritized_jobs)
|
||||
var/datum/job/job = j
|
||||
priority += job.title
|
||||
data["prioritized"] = priority
|
||||
return data
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
requires_ntnet_feature = NTNET_SOFTWAREDOWNLOAD
|
||||
available_on_ntnet = 0
|
||||
ui_header = "downloader_finished.gif"
|
||||
tgui_id = "ntos_net_downloader"
|
||||
tgui_id = "NtosNetDownloader"
|
||||
ui_x = 480
|
||||
ui_y = 735
|
||||
|
||||
var/datum/computer_file/program/downloaded_file = null
|
||||
var/hacked_download = 0
|
||||
@@ -113,49 +115,50 @@
|
||||
|
||||
var/list/data = get_header_data()
|
||||
|
||||
// This IF cuts on data transferred to client, so i guess it's worth it.
|
||||
if(downloaderror) // Download errored. Wait until user resets the program.
|
||||
data["error"] = downloaderror
|
||||
else if(downloaded_file) // Download running. Wait please..
|
||||
data["downloading"] = !!downloaded_file
|
||||
data["error"] = downloaderror || FALSE
|
||||
|
||||
// Download running. Wait please..
|
||||
if(downloaded_file)
|
||||
data["downloadname"] = downloaded_file.filename
|
||||
data["downloaddesc"] = downloaded_file.filedesc
|
||||
data["downloadsize"] = downloaded_file.size
|
||||
data["downloadspeed"] = download_netspeed
|
||||
data["downloadcompletion"] = round(download_completion, 0.1)
|
||||
else // No download running, pick file.
|
||||
var/obj/item/computer_hardware/hard_drive/hard_drive = my_computer.all_components[MC_HDD]
|
||||
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)
|
||||
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))
|
||||
continue
|
||||
all_entries.Add(list(list(
|
||||
|
||||
var/obj/item/computer_hardware/hard_drive/hard_drive = my_computer.all_components[MC_HDD]
|
||||
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)
|
||||
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))
|
||||
continue
|
||||
all_entries.Add(list(list(
|
||||
"filename" = P.filename,
|
||||
"filedesc" = P.filedesc,
|
||||
"fileinfo" = P.extended_desc,
|
||||
"compatibility" = check_compatibility(P),
|
||||
"size" = P.size
|
||||
)))
|
||||
data["hackedavailable"] = 0
|
||||
if(computer.obj_flags & 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)
|
||||
var/datum/computer_file/program/P = S
|
||||
if(hard_drive.find_file_by_name(P.filename))
|
||||
continue
|
||||
data["hackedavailable"] = 1
|
||||
hacked_programs.Add(list(list(
|
||||
"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
|
||||
var/list/hacked_programs[0]
|
||||
for(var/S in SSnetworks.station_network.available_antag_software)
|
||||
var/datum/computer_file/program/P = S
|
||||
if(hard_drive.find_file_by_name(P.filename))
|
||||
continue
|
||||
data["hackedavailable"] = TRUE
|
||||
hacked_programs.Add(list(list(
|
||||
"filename" = P.filename,
|
||||
"filedesc" = P.filedesc,
|
||||
"fileinfo" = P.extended_desc,
|
||||
"size" = P.size
|
||||
)))
|
||||
data["hacked_programs"] = hacked_programs
|
||||
"size" = P.size,
|
||||
)))
|
||||
data["hacked_programs"] = hacked_programs
|
||||
|
||||
data["downloadable_programs"] = all_entries
|
||||
data["downloadable_programs"] = all_entries
|
||||
|
||||
return data
|
||||
|
||||
@@ -168,4 +171,4 @@
|
||||
|
||||
/datum/computer_file/program/ntnetdownload/kill_program(forced)
|
||||
abort_file_download()
|
||||
return ..(forced)
|
||||
return ..(forced)
|
||||
|
||||
@@ -4,58 +4,48 @@
|
||||
program_icon_state = "comm_monitor"
|
||||
extended_desc = "This program monitors stationwide NTNet network, provides access to logging systems, and allows for configuration changes"
|
||||
size = 12
|
||||
requires_ntnet = 1
|
||||
requires_ntnet = TRUE
|
||||
required_access = ACCESS_NETWORK //NETWORK CONTROL IS A MORE SECURE PROGRAM.
|
||||
available_on_ntnet = 1
|
||||
tgui_id = "ntos_net_monitor"
|
||||
available_on_ntnet = TRUE
|
||||
tgui_id = "NtosNetMonitor"
|
||||
|
||||
/datum/computer_file/program/ntnetmonitor/ui_act(action, params)
|
||||
if(..())
|
||||
return 1
|
||||
return
|
||||
switch(action)
|
||||
if("resetIDS")
|
||||
. = 1
|
||||
if(SSnetworks.station_network)
|
||||
SSnetworks.station_network.resetIDS()
|
||||
return 1
|
||||
return TRUE
|
||||
if("toggleIDS")
|
||||
. = 1
|
||||
if(SSnetworks.station_network)
|
||||
SSnetworks.station_network.toggleIDS()
|
||||
return 1
|
||||
return TRUE
|
||||
if("toggleWireless")
|
||||
. = 1
|
||||
if(!SSnetworks.station_network)
|
||||
return 1
|
||||
return
|
||||
|
||||
// NTNet is disabled. Enabling can be done without user prompt
|
||||
if(SSnetworks.station_network.setting_disabled)
|
||||
SSnetworks.station_network.setting_disabled = 0
|
||||
return 1
|
||||
SSnetworks.station_network.setting_disabled = FALSE
|
||||
return TRUE
|
||||
|
||||
// NTNet is enabled and user is about to shut it down. Let's ask them if they really want to do it, as wirelessly connected computers won't connect without NTNet being enabled (which may prevent people from turning it back on)
|
||||
var/mob/user = usr
|
||||
if(!user)
|
||||
return 1
|
||||
var/response = alert(user, "Really disable NTNet wireless? If your computer is connected wirelessly you won't be able to turn it back on! This will affect all connected wireless devices.", "NTNet shutdown", "Yes", "No")
|
||||
if(response == "Yes")
|
||||
SSnetworks.station_network.setting_disabled = 1
|
||||
return 1
|
||||
SSnetworks.station_network.setting_disabled = TRUE
|
||||
return TRUE
|
||||
if("purgelogs")
|
||||
. = 1
|
||||
if(SSnetworks.station_network)
|
||||
SSnetworks.station_network.purge_logs()
|
||||
return TRUE
|
||||
if("updatemaxlogs")
|
||||
. = 1
|
||||
var/mob/user = usr
|
||||
var/logcount = text2num(input(user,"Enter amount of logs to keep in memory ([MIN_NTNET_LOGS]-[MAX_NTNET_LOGS]):"))
|
||||
var/logcount = params["new_number"]
|
||||
if(SSnetworks.station_network)
|
||||
SSnetworks.station_network.update_max_log_count(logcount)
|
||||
return TRUE
|
||||
if("toggle_function")
|
||||
. = 1
|
||||
if(!SSnetworks.station_network)
|
||||
return 1
|
||||
return
|
||||
SSnetworks.station_network.toggle_function(text2num(params["id"]))
|
||||
return TRUE
|
||||
|
||||
/datum/computer_file/program/ntnetmonitor/ui_data(mob/user)
|
||||
if(!SSnetworks.station_network)
|
||||
@@ -73,9 +63,11 @@
|
||||
data["config_systemcontrol"] = SSnetworks.station_network.setting_systemcontrol
|
||||
|
||||
data["ntnetlogs"] = list()
|
||||
data["minlogs"] = MIN_NTNET_LOGS
|
||||
data["maxlogs"] = MAX_NTNET_LOGS
|
||||
|
||||
for(var/i in SSnetworks.station_network.logs)
|
||||
data["ntnetlogs"] += list(list("entry" = i))
|
||||
data["ntnetmaxlogs"] = SSnetworks.station_network.setting_maxlogcount
|
||||
|
||||
return data
|
||||
return data
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
network_destination = "NTNRC server"
|
||||
ui_header = "ntnrc_idle.gif"
|
||||
available_on_ntnet = 1
|
||||
tgui_id = "ntos_net_chat"
|
||||
tgui_id = "NtosNetChat"
|
||||
ui_x = 900
|
||||
ui_y = 675
|
||||
|
||||
|
||||
@@ -11,8 +11,7 @@
|
||||
requires_ntnet = 0
|
||||
network_destination = "power monitoring system"
|
||||
size = 9
|
||||
tgui_id = "ntos_power_monitor"
|
||||
ui_style = "ntos"
|
||||
tgui_id = "NtosPowerMonitor"
|
||||
ui_x = 550
|
||||
ui_y = 700
|
||||
|
||||
|
||||
@@ -0,0 +1,249 @@
|
||||
/datum/computer_file/program/radar //generic parent that handles most of the process
|
||||
filename = "genericfinder"
|
||||
filedesc = "debug_finder"
|
||||
ui_header = "borg_mon.gif" //DEBUG -- new icon before PR
|
||||
program_icon_state = "generic"
|
||||
extended_desc = "generic"
|
||||
requires_ntnet = TRUE
|
||||
transfer_access = null
|
||||
available_on_ntnet = FALSE
|
||||
network_destination = "tracking program"
|
||||
size = 5
|
||||
tgui_id = "NtosRadar"
|
||||
ui_x = 800
|
||||
ui_y = 600
|
||||
special_assets = list(
|
||||
/datum/asset/simple/radar_assets,
|
||||
)
|
||||
///List of trackable entities. Updated by the scan() proc.
|
||||
var/list/objects
|
||||
///Ref of the last trackable object selected by the user in the tgui window. Updated in the ui_act() proc.
|
||||
var/atom/selected
|
||||
///Used to store when the next scan is available. Updated by the scan() proc.
|
||||
var/next_scan = 0
|
||||
|
||||
/datum/computer_file/program/radar/kill_program(forced = FALSE)
|
||||
objects = list()
|
||||
selected = null
|
||||
return ..()
|
||||
|
||||
/datum/computer_file/program/radar/ui_data(mob/user)
|
||||
var/list/data = get_header_data()
|
||||
data["selected"] = selected
|
||||
data["objects"] = list()
|
||||
data["scanning"] = (world.time < next_scan)
|
||||
for(var/list/i in objects)
|
||||
var/list/objectdata = list(
|
||||
ref = i["ref"],
|
||||
name = i["name"],
|
||||
)
|
||||
data["object"] += list(objectdata)
|
||||
|
||||
data["target"] = list()
|
||||
var/list/trackinfo = track()
|
||||
if(trackinfo)
|
||||
data["target"] = trackinfo
|
||||
return data
|
||||
|
||||
/datum/computer_file/program/radar/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("selecttarget")
|
||||
selected = params["ref"]
|
||||
if("scan")
|
||||
scan()
|
||||
|
||||
/**
|
||||
*Updates tracking information of the selected target.
|
||||
*
|
||||
*The track() proc updates the entire set of information about the location
|
||||
*of the target, including whether the Ntos window should use a pinpointer
|
||||
*crosshair over the up/down arrows, or none in favor of a rotating arrow
|
||||
*for far away targets. This information is returned in the form of a list.
|
||||
*
|
||||
*/
|
||||
/datum/computer_file/program/radar/proc/track()
|
||||
return
|
||||
|
||||
/**
|
||||
*
|
||||
*Checks the trackability of the selected target.
|
||||
*
|
||||
*If the target is on the computer's Z level, or both are on station Z
|
||||
*levels, and the target isn't untrackable, return TRUE.
|
||||
*Arguments:
|
||||
**arg1 is the atom being evaluated.
|
||||
*/
|
||||
/datum/computer_file/program/radar/proc/trackable(atom/movable/signal)
|
||||
if(!signal)
|
||||
return FALSE
|
||||
var/turf/here = get_turf(computer)
|
||||
var/turf/there = get_turf(signal)
|
||||
return (there.z == here.z) || (is_station_level(here.z) && is_station_level(there.z))
|
||||
|
||||
/**
|
||||
*
|
||||
*Runs a scan of all the trackable atoms.
|
||||
*
|
||||
*Checks each entry in the GLOB of the specific trackable atoms against
|
||||
*the track() proc, and fill the objects list with lists containing the
|
||||
*atoms' names and REFs. The objects list is handed to the tgui screen
|
||||
*for displaying to, and being selected by, the user. A two second
|
||||
*sleep is used to delay the scan, both for thematical reasons as well
|
||||
*as to limit the load players may place on the server using these
|
||||
*somewhat costly loops.
|
||||
*/
|
||||
/datum/computer_file/program/radar/proc/scan()
|
||||
return
|
||||
|
||||
///////////////////
|
||||
//Suit Sensor App//
|
||||
///////////////////
|
||||
|
||||
///A program that tracks crew members via suit sensors
|
||||
/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/scan()
|
||||
if(world.time < next_scan)
|
||||
return
|
||||
next_scan = world.time + (2 SECONDS)
|
||||
objects = list()
|
||||
for(var/i in GLOB.human_list)
|
||||
var/mob/living/carbon/human/humanoid = i
|
||||
if(!trackable(humanoid))
|
||||
continue
|
||||
var/crewmember_name = "Unknown"
|
||||
if(humanoid.wear_id)
|
||||
var/obj/item/card/id/ID = humanoid.wear_id.GetID()
|
||||
if(ID && ID.registered_name)
|
||||
crewmember_name = ID.registered_name
|
||||
var/list/crewinfo = list(
|
||||
ref = REF(humanoid),
|
||||
name = crewmember_name,
|
||||
)
|
||||
objects += list(crewinfo)
|
||||
|
||||
/datum/computer_file/program/radar/lifeline/trackable(mob/living/carbon/human/humanoid)
|
||||
if(!humanoid || !istype(humanoid))
|
||||
return FALSE
|
||||
if(..() && istype(humanoid.w_uniform, /obj/item/clothing/under))
|
||||
|
||||
var/obj/item/clothing/under/uniform = humanoid.w_uniform
|
||||
if(!uniform.has_sensor || (uniform.sensor_mode < SENSOR_COORDS)) // Suit sensors must be on maximum.
|
||||
return FALSE
|
||||
|
||||
return TRUE
|
||||
|
||||
////////////////////////
|
||||
//Nuke Disk Finder App//
|
||||
////////////////////////
|
||||
|
||||
///A program that tracks crew members via suit sensors
|
||||
/datum/computer_file/program/radar/fission360
|
||||
filename = "Fission360"
|
||||
filedesc = "Fission360"
|
||||
program_icon_state = "generic"
|
||||
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"
|
||||
|
||||
/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/scan()
|
||||
if(world.time < next_scan)
|
||||
return
|
||||
next_scan = world.time + (2 SECONDS)
|
||||
objects = list()
|
||||
for(var/i in GLOB.nuke_list)
|
||||
var/obj/machinery/nuclearbomb/nuke = i
|
||||
if(!trackable(nuke))
|
||||
continue
|
||||
|
||||
var/list/nukeinfo = list(
|
||||
ref = REF(nuke),
|
||||
name = nuke.name,
|
||||
)
|
||||
objects += list(nukeinfo)
|
||||
var/obj/item/disk/nuclear/disk = locate() in GLOB.poi_list
|
||||
if(trackable(disk))
|
||||
var/list/nukeinfo = list(
|
||||
ref = REF(disk),
|
||||
name = disk.name,
|
||||
)
|
||||
objects += list(nukeinfo)
|
||||
@@ -0,0 +1,86 @@
|
||||
|
||||
/datum/computer_file/program/robocontrol
|
||||
filename = "robocontrol"
|
||||
filedesc = "Bot Remote Controller"
|
||||
program_icon_state = "robot"
|
||||
extended_desc = "A remote controller used for giving basic commands to non-sentient robots."
|
||||
transfer_access = ACCESS_ROBOTICS
|
||||
requires_ntnet = TRUE
|
||||
network_destination = "robotics control network"
|
||||
size = 12
|
||||
tgui_id = "NtosRoboControl"
|
||||
ui_x = 550
|
||||
ui_y = 550
|
||||
///Number of simple robots on-station.
|
||||
var/botcount = 0
|
||||
///Used to find the location of the user for the purposes of summoning robots.
|
||||
var/mob/current_user
|
||||
///Access granted by the used to summon robots.
|
||||
var/list/current_access = list()
|
||||
|
||||
/datum/computer_file/program/robocontrol/ui_data(mob/user)
|
||||
var/list/data = get_header_data()
|
||||
var/turf/current_turf = get_turf(ui_host())
|
||||
var/zlevel = current_turf.z
|
||||
var/list/botlist = list()
|
||||
var/list/mulelist = list()
|
||||
|
||||
var/obj/item/computer_hardware/card_slot/card_slot = computer ? computer.all_components[MC_CARD] : null
|
||||
data["have_id_slot"] = !!card_slot
|
||||
if(computer)
|
||||
var/obj/item/card/id/id_card = card_slot ? card_slot.stored_card : null
|
||||
data["has_id"] = !!id_card
|
||||
data["id_owner"] = id_card ? id_card.registered_name : "No Card Inserted."
|
||||
data["access_on_card"] = id_card ? id_card.access : null
|
||||
|
||||
botcount = 0
|
||||
current_user = user
|
||||
|
||||
for(var/B in GLOB.bots_list)
|
||||
var/mob/living/simple_animal/bot/Bot = B
|
||||
if(!Bot.on || Bot.z != zlevel || Bot.remote_disabled) //Only non-emagged bots on the same Z-level are detected!
|
||||
continue //Also, the PDA must have access to the bot type.
|
||||
var/list/newbot = list("name" = Bot.name, "mode" = Bot.get_mode_ui(), "model" = Bot.model, "locat" = get_area(Bot), "bot_ref" = REF(Bot), "mule_check" = FALSE)
|
||||
if(Bot.bot_type == MULE_BOT)
|
||||
var/mob/living/simple_animal/bot/mulebot/MULE = Bot
|
||||
mulelist += list(list("name" = MULE.name, "dest" = MULE.destination, "power" = MULE.cell ? MULE.cell.percent() : 0, "home" = MULE.home_destination, "autoReturn" = MULE.auto_return, "autoPickup" = MULE.auto_pickup, "reportDelivery" = MULE.report_delivery, "mule_ref" = REF(MULE)))
|
||||
if(MULE.load)
|
||||
data["load"] = MULE.load.name
|
||||
newbot["mule_check"] = TRUE
|
||||
botlist += list(newbot)
|
||||
|
||||
data["bots"] = botlist
|
||||
data["mules"] = mulelist
|
||||
data["botcount"] = botlist.len
|
||||
|
||||
return data
|
||||
|
||||
/datum/computer_file/program/robocontrol/ui_act(action, list/params)
|
||||
if(..())
|
||||
return TRUE
|
||||
var/obj/item/computer_hardware/card_slot/card_slot
|
||||
var/obj/item/card/id/id_card
|
||||
if(computer)
|
||||
card_slot = computer.all_components[MC_CARD]
|
||||
if(card_slot)
|
||||
id_card = card_slot.stored_card
|
||||
|
||||
var/list/standard_actions = list("patroloff", "patrolon", "ejectpai")
|
||||
var/list/MULE_actions = list("stop", "go", "home", "destination", "setid", "sethome", "unload", "autoret", "autopick", "report", "ejectpai")
|
||||
var/mob/living/simple_animal/bot/Bot = locate(params["robot"]) in GLOB.bots_list
|
||||
if (action in standard_actions)
|
||||
Bot.bot_control(action, current_user, current_access)
|
||||
if (action in MULE_actions)
|
||||
Bot.bot_control(action, current_user, current_access, TRUE)
|
||||
switch(action)
|
||||
if("summon")
|
||||
Bot.bot_control(action, current_user, id_card ? id_card.access : current_access)
|
||||
if("ejectcard")
|
||||
if(!computer || !card_slot)
|
||||
return
|
||||
if(id_card)
|
||||
GLOB.data_core.manifest_modify(id_card.registered_name, id_card.assignment)
|
||||
card_slot.try_eject(TRUE, current_user)
|
||||
else
|
||||
playsound(get_turf(ui_host()) , 'sound/machines/buzz-sigh.ogg', 25, FALSE)
|
||||
return
|
||||
@@ -8,8 +8,7 @@
|
||||
transfer_access = ACCESS_CONSTRUCTION
|
||||
network_destination = "supermatter monitoring system"
|
||||
size = 5
|
||||
tgui_id = "ntos_supermatter_monitor"
|
||||
ui_style = "ntos"
|
||||
tgui_id = "NtosSupermatterMonitor"
|
||||
ui_x = 600
|
||||
ui_y = 350
|
||||
var/last_status = SUPERMATTER_INACTIVE
|
||||
@@ -73,20 +72,22 @@
|
||||
data["active"] = TRUE
|
||||
data["SM_integrity"] = active.get_integrity()
|
||||
data["SM_power"] = active.power
|
||||
data["SM_ambienttemp"] = air.temperature
|
||||
data["SM_ambienttemp"] = air.return_temperature()
|
||||
data["SM_ambientpressure"] = air.return_pressure()
|
||||
//data["SM_EPR"] = round((air.total_moles / air.group_multiplier) / 23.1, 0.01)
|
||||
var/list/gasdata = list()
|
||||
|
||||
|
||||
if(air.total_moles())
|
||||
for(var/gasid in air.gases)
|
||||
gasdata.Add(list(list(
|
||||
"name"= GLOB.meta_gas_names[gasid],
|
||||
"amount" = round(100*air.gases[gasid]/air.total_moles(),0.01))))
|
||||
for(var/gasid in air.get_gases())
|
||||
var/amount = air.get_moles(gasid)
|
||||
if(amount)
|
||||
gasdata.Add(list(list(
|
||||
"name"= GLOB.meta_gas_names[gasid],
|
||||
"amount" = round(100*amount/air.total_moles(),0.01))))
|
||||
|
||||
else
|
||||
for(var/gasid in air.gases)
|
||||
for(var/gasid in air.get_gases())
|
||||
gasdata.Add(list(list(
|
||||
"name"= GLOB.meta_gas_names[gasid],
|
||||
"amount" = 0)))
|
||||
@@ -124,4 +125,4 @@
|
||||
for(var/obj/machinery/power/supermatter_crystal/S in supermatters)
|
||||
if(S.uid == newuid)
|
||||
active = S
|
||||
return TRUE
|
||||
return TRUE
|
||||
|
||||
@@ -27,13 +27,11 @@
|
||||
|
||||
// Damaged printer causes the resulting paper to be somewhat harder to read.
|
||||
if(damage > damage_malfunction)
|
||||
P.info = stars(text_to_print, 100-malfunction_probability)
|
||||
P.setText(stars(text_to_print, 100-malfunction_probability))
|
||||
else
|
||||
P.info = text_to_print
|
||||
P.setText(text_to_print)
|
||||
if(paper_title)
|
||||
P.name = paper_title
|
||||
P.update_icon()
|
||||
P.reload_fields()
|
||||
stored_paper--
|
||||
P = null
|
||||
return TRUE
|
||||
@@ -59,4 +57,4 @@
|
||||
icon_state = "printer_mini"
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
stored_paper = 5
|
||||
max_paper = 15
|
||||
max_paper = 15
|
||||
|
||||
@@ -232,7 +232,7 @@
|
||||
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "computer_fabricator", "Personal Computer Vendor", ui_x, ui_y, state = state)
|
||||
ui = new(user, src, ui_key, "ComputerFabricator", "Personal Computer Vendor", ui_x, ui_y, state = state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/lapvend/attackby(obj/item/I, mob/user)
|
||||
|
||||
Reference in New Issue
Block a user