mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-12 23:53:47 +01:00
Organizes programs folder.
This commit is contained in:
@@ -0,0 +1,410 @@
|
||||
/datum/computer_file/program/card_mod
|
||||
filename = "cardmod"
|
||||
filedesc = "ID card modification program"
|
||||
program_icon_state = "id"
|
||||
extended_desc = "Program for programming employee ID cards to access parts of the station."
|
||||
transfer_access = access_change_ids
|
||||
requires_ntnet = 0
|
||||
size = 8
|
||||
var/is_centcom = 0
|
||||
var/mode = 0
|
||||
var/printing = 0
|
||||
|
||||
//Cooldown for closing positions in seconds
|
||||
//if set to -1: No cooldown... probably a bad idea
|
||||
//if set to 0: Not able to close "original" positions. You can only close positions that you have opened before
|
||||
var/change_position_cooldown = 60
|
||||
//Jobs you cannot open new positions for
|
||||
var/list/blacklisted = list(
|
||||
/datum/job/ai,
|
||||
/datum/job/cyborg,
|
||||
/datum/job/captain,
|
||||
/datum/job/hop,
|
||||
/datum/job/hos,
|
||||
/datum/job/chief_engineer,
|
||||
/datum/job/rd,
|
||||
/datum/job/cmo,
|
||||
/datum/job/judge,
|
||||
/datum/job/blueshield,
|
||||
/datum/job/nanotrasenrep,
|
||||
/datum/job/pilot,
|
||||
/datum/job/brigdoc,
|
||||
/datum/job/mechanic,
|
||||
/datum/job/barber,
|
||||
/datum/job/chaplain,
|
||||
/datum/job/ntnavyofficer,
|
||||
/datum/job/ntspecops,
|
||||
/datum/job/civilian
|
||||
)
|
||||
|
||||
//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/card_mod/proc/is_authenticated(var/mob/user)
|
||||
if(user.can_admin_interact())
|
||||
return 1
|
||||
if(computer)
|
||||
var/obj/item/weapon/computer_hardware/card_slot/card_slot = computer.all_components[MC_CARD]
|
||||
if(card_slot)
|
||||
var/obj/item/weapon/card/id/auth_card = card_slot.stored_card2
|
||||
if(auth_card)
|
||||
return check_access(auth_card)
|
||||
return 0
|
||||
|
||||
/datum/computer_file/program/card_mod/proc/check_access(obj/item/I)
|
||||
if(access_change_ids in I.GetAccess())
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/computer_file/program/card_mod/proc/get_target_rank()
|
||||
if(computer)
|
||||
var/obj/item/weapon/computer_hardware/card_slot/card_slot = computer.all_components[MC_CARD]
|
||||
if(card_slot)
|
||||
var/obj/item/weapon/card/id/id_card = card_slot.stored_card
|
||||
if(id_card && id_card.assignment)
|
||||
return id_card.assignment
|
||||
return "Unassigned"
|
||||
|
||||
/datum/computer_file/program/card_mod/proc/format_job_slots()
|
||||
var/list/formatted = list()
|
||||
for(var/datum/job/job in job_master.occupations)
|
||||
if(job_blacklisted(job))
|
||||
continue
|
||||
formatted.Add(list(list(
|
||||
"title" = job.title,
|
||||
"current_positions" = job.current_positions,
|
||||
"total_positions" = job.total_positions,
|
||||
"can_open" = can_open_job(job),
|
||||
"can_close" = can_close_job(job))))
|
||||
|
||||
return formatted
|
||||
|
||||
/datum/computer_file/program/card_mod/proc/format_card_skins(list/card_skins)
|
||||
var/list/formatted = list()
|
||||
for(var/skin in card_skins)
|
||||
formatted.Add(list(list(
|
||||
"display_name" = get_skin_desc(skin),
|
||||
"skin" = skin)))
|
||||
|
||||
return formatted
|
||||
|
||||
|
||||
/datum/computer_file/program/card_mod/proc/job_blacklisted(datum/job/job)
|
||||
return (job.type in blacklisted)
|
||||
|
||||
|
||||
//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))
|
||||
if((job.total_positions <= player_list.len * (max_relative_positions / 100)))
|
||||
var/delta = (world.time / 10) - time_last_changed_position
|
||||
if((change_position_cooldown < delta) || (opened_positions[job.title] < 0))
|
||||
return 1
|
||||
return -2
|
||||
return -1
|
||||
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))
|
||||
if(job.total_positions > job.current_positions)
|
||||
var/delta = (world.time / 10) - time_last_changed_position
|
||||
if((change_position_cooldown < delta) || (opened_positions[job.title] > 0))
|
||||
return 1
|
||||
return -2
|
||||
return -1
|
||||
return 0
|
||||
|
||||
/datum/computer_file/program/card_mod/proc/format_jobs(list/jobs)
|
||||
var/obj/item/weapon/computer_hardware/card_slot/card_slot = computer.all_components[MC_CARD]
|
||||
if(!card_slot || !card_slot.stored_card)
|
||||
return null
|
||||
var/obj/item/weapon/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
|
||||
|
||||
|
||||
/datum/computer_file/program/card_mod/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
var/datum/asset/assets = get_asset_datum(/datum/asset/simple/headers)
|
||||
assets.send(user)
|
||||
ui = new(user, src, ui_key, "card_prog.tmpl", "ID card modification program", 775, 700)
|
||||
ui.open()
|
||||
|
||||
/datum/computer_file/program/card_mod/Topic(href, href_list)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
var/obj/item/weapon/computer_hardware/card_slot/card_slot
|
||||
var/obj/item/weapon/computer_hardware/printer/printer
|
||||
if(computer)
|
||||
card_slot = computer.all_components[MC_CARD]
|
||||
printer = computer.all_components[MC_PRINT]
|
||||
if(!card_slot)
|
||||
return
|
||||
|
||||
var/mob/user = usr
|
||||
|
||||
var/obj/item/weapon/card/id/modify = card_slot.stored_card
|
||||
var/obj/item/weapon/card/id/scan = card_slot.stored_card2
|
||||
|
||||
switch(href_list["action"])
|
||||
if("PRG_modify")
|
||||
if(modify)
|
||||
data_core.manifest_modify(modify.registered_name, modify.assignment)
|
||||
modify.name = "[modify.registered_name]'s ID Card ([modify.assignment])"
|
||||
card_slot.try_eject(1, user)
|
||||
else
|
||||
var/obj/item/I = usr.get_active_hand()
|
||||
if(istype(I, /obj/item/weapon/card/id))
|
||||
if(!usr.drop_item())
|
||||
return
|
||||
I.forceMove(computer)
|
||||
card_slot.stored_card = I
|
||||
|
||||
if("PRG_scan")
|
||||
if(scan)
|
||||
card_slot.try_eject(2, user)
|
||||
else
|
||||
var/obj/item/I = usr.get_active_hand()
|
||||
if(istype(I, /obj/item/weapon/card/id))
|
||||
if(!usr.drop_item())
|
||||
return
|
||||
I.forceMove(computer)
|
||||
card_slot.stored_card2 = I
|
||||
|
||||
if("PRG_access")
|
||||
if(href_list["allowed"])
|
||||
if(is_authenticated(usr))
|
||||
var/access_type = text2num(href_list["access_target"])
|
||||
var/access_allowed = text2num(href_list["allowed"])
|
||||
if(access_type in (is_centcom ? get_all_centcom_access() : get_all_accesses()))
|
||||
modify.access -= access_type
|
||||
if(!access_allowed)
|
||||
modify.access += access_type
|
||||
|
||||
if("PRG_skin")
|
||||
var/skin = href_list["skin_target"]
|
||||
if(is_authenticated(usr) && modify && ((skin in get_station_card_skins()) || ((skin in get_centcom_card_skins()) && is_centcom)))
|
||||
modify.icon_state = href_list["skin_target"]
|
||||
|
||||
if("PRG_assign")
|
||||
if(is_authenticated(usr) && modify)
|
||||
var/t1 = href_list["assign_target"]
|
||||
if(t1 == "Custom")
|
||||
var/temp_t = sanitize(copytext(input("Enter a custom job assignment.","Assignment"),1,MAX_MESSAGE_LEN))
|
||||
//let custom jobs function as an impromptu alt title, mainly for sechuds
|
||||
if(temp_t && modify)
|
||||
modify.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, "\red No log exists for this job: [t1]")
|
||||
return
|
||||
|
||||
access = jobdatum.get_access()
|
||||
|
||||
modify.access = access
|
||||
modify.assignment = t1
|
||||
modify.rank = t1
|
||||
|
||||
callHook("reassign_employee", list(modify))
|
||||
|
||||
if("PRG_reg")
|
||||
if(is_authenticated(usr))
|
||||
var/temp_name = reject_bad_name(href_list["reg"])
|
||||
if(temp_name)
|
||||
modify.registered_name = temp_name
|
||||
else
|
||||
computer.visible_message("<span class='notice'>[src] buzzes rudely.</span>")
|
||||
|
||||
if("PRG_account")
|
||||
if(is_authenticated(usr))
|
||||
var/account_num = text2num(href_list["account"])
|
||||
modify.associated_account_number = account_num
|
||||
|
||||
if("PRG_mode")
|
||||
mode = text2num(href_list["mode_target"])
|
||||
|
||||
if("PRG_print")
|
||||
if(!printing && computer)
|
||||
printing = 1
|
||||
playsound(computer.loc, 'sound/goonstation/machines/printer_dotmatrix.ogg', 50, 1)
|
||||
spawn(50)
|
||||
printing = 0
|
||||
nanomanager.update_uis(src)
|
||||
var/title
|
||||
var/content
|
||||
if(mode == 2)
|
||||
title = "crew manifest ([worldtime2text()])"
|
||||
content = "<h4>Crew Manifest</h4><br>[data_core ? data_core.get_manifest(0) : ""]"
|
||||
else if(modify && !mode)
|
||||
title = "access report"
|
||||
content = {"<h4>Access Report</h4>
|
||||
<u>Prepared By:</u> [scan && scan.registered_name ? scan.registered_name : "Unknown"]<br>
|
||||
<u>For:</u> [modify.registered_name ? modify.registered_name : "Unregistered"]<br>
|
||||
<hr>
|
||||
<u>Assignment:</u> [modify.assignment]<br>
|
||||
<u>Account Number:</u> #[modify.associated_account_number]<br>
|
||||
<u>Blood Type:</u> [modify.blood_type]<br><br>
|
||||
<u>Access:</u><div style="margin-left:1em">"}
|
||||
|
||||
var/first = 1
|
||||
for(var/A in modify.access)
|
||||
content += "[first ? "" : ", "][get_access_desc(A)]"
|
||||
first = 0
|
||||
content += "</div>"
|
||||
|
||||
if(content)
|
||||
if(!printer.print_text(content, title))
|
||||
to_chat(user, "<span class='notice'>Hardware error: Printer was unable to print the file. It may be out of paper.</span>")
|
||||
return 1
|
||||
else
|
||||
computer.visible_message("<span class='notice'>\The [computer] prints out paper.</span>")
|
||||
|
||||
if("PRG_terminate")
|
||||
if(is_authenticated(usr))
|
||||
modify.assignment = "Terminated"
|
||||
modify.access = list()
|
||||
|
||||
callHook("terminate_employee", list(modify))
|
||||
|
||||
if("PRG_make_job_available")
|
||||
// MAKE ANOTHER JOB POSITION AVAILABLE FOR LATE JOINERS
|
||||
if(is_authenticated(usr))
|
||||
var/edit_job_target = href_list["job"]
|
||||
var/datum/job/j = job_master.GetJob(edit_job_target)
|
||||
if(!j)
|
||||
return 1
|
||||
if(can_open_job(j) != 1)
|
||||
return 1
|
||||
if(opened_positions[edit_job_target] >= 0)
|
||||
time_last_changed_position = world.time / 10
|
||||
j.total_positions++
|
||||
opened_positions[edit_job_target]++
|
||||
|
||||
if("PRG_make_job_unavailable")
|
||||
// MAKE JOB POSITION UNAVAILABLE FOR LATE JOINERS
|
||||
if(is_authenticated(usr))
|
||||
var/edit_job_target = href_list["job"]
|
||||
var/datum/job/j = job_master.GetJob(edit_job_target)
|
||||
if(!j)
|
||||
return 1
|
||||
if(can_close_job(j) != 1)
|
||||
return 1
|
||||
//Allow instant closing without cooldown if a position has been opened before
|
||||
if(opened_positions[edit_job_target] <= 0)
|
||||
time_last_changed_position = world.time / 10
|
||||
j.total_positions--
|
||||
opened_positions[edit_job_target]--
|
||||
|
||||
if(modify)
|
||||
modify.name = text("[modify.registered_name]'s ID Card ([modify.assignment])")
|
||||
|
||||
nanomanager.update_uis(src)
|
||||
return 1
|
||||
|
||||
/datum/computer_file/program/card_mod/ui_data(mob/user)
|
||||
var/list/data = get_header_data()
|
||||
|
||||
var/obj/item/weapon/card/id/modify = null
|
||||
var/obj/item/weapon/card/id/scan = null
|
||||
|
||||
var/obj/item/weapon/computer_hardware/card_slot/card_slot
|
||||
var/obj/item/weapon/computer_hardware/printer/printer
|
||||
if(computer)
|
||||
card_slot = computer.all_components[MC_CARD]
|
||||
printer = computer.all_components[MC_PRINT]
|
||||
if(card_slot)
|
||||
modify = card_slot.stored_card
|
||||
scan = card_slot.stored_card2
|
||||
|
||||
data["src"] = UID()
|
||||
data["station_name"] = station_name()
|
||||
data["mode"] = mode
|
||||
data["printing"] = printing
|
||||
data["printer"] = printer ? TRUE : FALSE
|
||||
data["manifest"] = data_core ? data_core.get_manifest(0) : null
|
||||
data["target_name"] = modify ? modify.name : "-----"
|
||||
data["target_owner"] = modify && modify.registered_name ? modify.registered_name : "-----"
|
||||
data["target_rank"] = get_target_rank()
|
||||
data["scan_name"] = scan ? scan.name : "-----"
|
||||
data["authenticated"] = is_authenticated(user)
|
||||
data["has_modify"] = !!modify
|
||||
data["account_number"] = modify ? modify.associated_account_number : null
|
||||
data["centcom_access"] = is_centcom
|
||||
data["all_centcom_access"] = null
|
||||
data["regions"] = null
|
||||
|
||||
data["engineering_jobs"] = format_jobs(engineering_positions)
|
||||
data["medical_jobs"] = format_jobs(medical_positions)
|
||||
data["science_jobs"] = format_jobs(science_positions)
|
||||
data["security_jobs"] = format_jobs(security_positions)
|
||||
data["support_jobs"] = format_jobs(support_positions)
|
||||
data["civilian_jobs"] = format_jobs(civilian_positions)
|
||||
data["special_jobs"] = format_jobs(whitelisted_positions)
|
||||
data["centcom_jobs"] = format_jobs(get_all_centcom_jobs())
|
||||
data["card_skins"] = format_card_skins(get_station_card_skins())
|
||||
|
||||
data["job_slots"] = format_job_slots()
|
||||
|
||||
var/time_to_wait = round(change_position_cooldown - ((world.time / 10) - time_last_changed_position), 1)
|
||||
var/mins = round(time_to_wait / 60)
|
||||
var/seconds = time_to_wait - (60*mins)
|
||||
data["cooldown_mins"] = mins
|
||||
data["cooldown_secs"] = (seconds < 10) ? "0[seconds]" : seconds
|
||||
|
||||
if(modify)
|
||||
data["current_skin"] = modify.icon_state
|
||||
|
||||
if(modify && 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 modify.access) ? 1 : 0)))
|
||||
|
||||
data["all_centcom_access"] = all_centcom_access
|
||||
data["all_centcom_skins"] = format_card_skins(get_centcom_card_skins())
|
||||
|
||||
else if(modify)
|
||||
var/list/regions = list()
|
||||
for(var/i = 1; i <= 7; i++)
|
||||
var/list/accesses = list()
|
||||
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 modify.access) ? 1 : 0)))
|
||||
|
||||
regions.Add(list(list(
|
||||
"name" = get_region_accesses_name(i),
|
||||
"accesses" = accesses)))
|
||||
|
||||
data["regions"] = regions
|
||||
|
||||
return data
|
||||
@@ -0,0 +1,401 @@
|
||||
/datum/computer_file/program/comm
|
||||
filename = "comm"
|
||||
filedesc = "Command and communications program."
|
||||
program_icon_state = "comm"
|
||||
extended_desc = "Used to command and control the station. Can relay long-range communications. This program can not be run on tablet computers."
|
||||
required_access = access_heads
|
||||
requires_ntnet = 1
|
||||
size = 12
|
||||
usage_flags = PROGRAM_CONSOLE | PROGRAM_LAPTOP
|
||||
network_destination = "station long-range communication array"
|
||||
|
||||
var/authenticated = COMM_AUTHENTICATION_NONE
|
||||
var/list/messagetitle = list()
|
||||
var/list/messagetext = list()
|
||||
var/currmsg = 0
|
||||
var/aicurrmsg = 0
|
||||
var/menu_state = COMM_SCREEN_MAIN
|
||||
var/ai_menu_state = COMM_SCREEN_MAIN
|
||||
var/message_cooldown = 0
|
||||
var/centcomm_message_cooldown = 0
|
||||
var/tmp_alertlevel = 0
|
||||
|
||||
var/status_display_freq = "1435"
|
||||
var/stat_msg1
|
||||
var/stat_msg2
|
||||
var/display_type="blank"
|
||||
|
||||
var/datum/announcement/priority/crew_announcement = new
|
||||
|
||||
/datum/computer_file/program/comm/New()
|
||||
shuttle_caller_list += src
|
||||
..()
|
||||
crew_announcement.newscast = 0
|
||||
|
||||
/datum/computer_file/program/comm/Destroy()
|
||||
shuttle_caller_list -= src
|
||||
shuttle_master.autoEvac()
|
||||
return ..()
|
||||
|
||||
/datum/computer_file/program/comm/proc/is_authenticated(mob/user, loud = 1)
|
||||
if(authenticated == COMM_AUTHENTICATION_MAX)
|
||||
return COMM_AUTHENTICATION_MAX
|
||||
else if(user.can_admin_interact())
|
||||
return COMM_AUTHENTICATION_MAX
|
||||
else if(authenticated)
|
||||
return COMM_AUTHENTICATION_MIN
|
||||
else
|
||||
if(loud)
|
||||
to_chat(user, "<span class='warning'>Access denied.</span>")
|
||||
return COMM_AUTHENTICATION_NONE
|
||||
|
||||
/datum/computer_file/program/comm/proc/change_security_level(mob/user, new_level)
|
||||
tmp_alertlevel = new_level
|
||||
var/old_level = security_level
|
||||
if(!tmp_alertlevel)
|
||||
tmp_alertlevel = SEC_LEVEL_GREEN
|
||||
if(tmp_alertlevel < SEC_LEVEL_GREEN)
|
||||
tmp_alertlevel = SEC_LEVEL_GREEN
|
||||
if(tmp_alertlevel > SEC_LEVEL_BLUE)
|
||||
tmp_alertlevel = SEC_LEVEL_BLUE //Cannot engage delta with this
|
||||
set_security_level(tmp_alertlevel)
|
||||
if(security_level != old_level)
|
||||
log_game("[key_name(user)] has changed the security level to [get_security_level()].")
|
||||
message_admins("[key_name_admin(user)] has changed the security level to [get_security_level()].")
|
||||
switch(security_level)
|
||||
if(SEC_LEVEL_GREEN)
|
||||
feedback_inc("alert_comms_green", 1)
|
||||
if(SEC_LEVEL_BLUE)
|
||||
feedback_inc("alert_comms_blue", 1)
|
||||
tmp_alertlevel = 0
|
||||
|
||||
/datum/computer_file/program/comm/proc/setCurrentMessage(mob/user, value)
|
||||
if(isAI(user) || isrobot(user))
|
||||
aicurrmsg = value
|
||||
else
|
||||
currmsg = value
|
||||
|
||||
/datum/computer_file/program/comm/proc/getCurrentMessage(mob/user)
|
||||
if(isAI(user) || isrobot(user))
|
||||
return aicurrmsg
|
||||
else
|
||||
return currmsg
|
||||
|
||||
/datum/computer_file/program/comm/proc/setMenuState(mob/user, value)
|
||||
if(isAI(user) || isrobot(user))
|
||||
ai_menu_state=value
|
||||
else
|
||||
menu_state=value
|
||||
|
||||
/datum/computer_file/program/comm/proc/getMenuState(mob/user)
|
||||
if(isAI(user) || isrobot(user))
|
||||
return ai_menu_state
|
||||
else
|
||||
return menu_state
|
||||
|
||||
/datum/computer_file/program/comm/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui)
|
||||
if(!ui)
|
||||
var/datum/asset/assets = get_asset_datum(/datum/asset/simple/headers)
|
||||
assets.send(user)
|
||||
ui = new(user, src, ui_key, "comm_program.tmpl", "Command and communications program", 575, 500)
|
||||
ui.open()
|
||||
|
||||
/datum/computer_file/program/comm/ui_data(mob/user, ui_key = "main", datum/topic_state/state = default_state)
|
||||
var/list/data = get_header_data()
|
||||
data["is_ai"] = isAI(user) || isrobot(user)
|
||||
data["menu_state"] = data["is_ai"] ? ai_menu_state : menu_state
|
||||
data["emagged"] = computer ? computer.emagged : null
|
||||
data["authenticated"] = is_authenticated(user, 0)
|
||||
data["screen"] = getMenuState(usr)
|
||||
|
||||
data["stat_display"] = list(
|
||||
"type" = display_type,
|
||||
"line_1" = (stat_msg1 ? stat_msg1 : "-----"),
|
||||
"line_2" = (stat_msg2 ? stat_msg2 : "-----"),
|
||||
|
||||
"presets" = list(
|
||||
list("name" = "blank", "label" = "Clear", "desc" = "Blank slate"),
|
||||
list("name" = "shuttle", "label" = "Shuttle ETA", "desc" = "Display how much time is left."),
|
||||
list("name" = "message", "label" = "Message", "desc" = "A custom message.")
|
||||
),
|
||||
|
||||
"alerts"=list(
|
||||
list("alert" = "default", "label" = "Nanotrasen", "desc" = "Oh god."),
|
||||
list("alert" = "redalert", "label" = "Red Alert", "desc" = "Nothing to do with communists."),
|
||||
list("alert" = "lockdown", "label" = "Lockdown", "desc" = "Let everyone know they're on lockdown."),
|
||||
list("alert" = "biohazard", "label" = "Biohazard", "desc" = "Great for virus outbreaks and parties."),
|
||||
)
|
||||
)
|
||||
|
||||
data["security_level"] = security_level
|
||||
data["str_security_level"] = capitalize(get_security_level())
|
||||
data["levels"] = list(
|
||||
list("id" = SEC_LEVEL_GREEN, "name" = "Green"),
|
||||
list("id" = SEC_LEVEL_BLUE, "name" = "Blue"),
|
||||
)
|
||||
|
||||
var/list/msg_data = list()
|
||||
for(var/i = 1; i <= messagetext.len; i++)
|
||||
msg_data.Add(list(list("title" = messagetitle[i], "body" = messagetext[i], "id" = i)))
|
||||
|
||||
data["messages"] = msg_data
|
||||
if((data["is_ai"] && aicurrmsg) || (!data["is_ai"] && currmsg))
|
||||
data["current_message"] = data["is_ai"] ? messagetext[aicurrmsg] : messagetext[currmsg]
|
||||
data["current_message_title"] = data["is_ai"] ? messagetitle[aicurrmsg] : messagetitle[currmsg]
|
||||
|
||||
data["lastCallLoc"] = shuttle_master.emergencyLastCallLoc ? format_text(shuttle_master.emergencyLastCallLoc.name) : null
|
||||
|
||||
var/shuttle[0]
|
||||
switch(shuttle_master.emergency.mode)
|
||||
if(SHUTTLE_IDLE, SHUTTLE_RECALL)
|
||||
shuttle["callStatus"] = 2 //#define
|
||||
else
|
||||
shuttle["callStatus"] = 1
|
||||
if(shuttle_master.emergency.mode == SHUTTLE_CALL)
|
||||
var/timeleft = shuttle_master.emergency.timeLeft()
|
||||
shuttle["eta"] = "[timeleft / 60 % 60]:[add_zero(num2text(timeleft % 60), 2)]"
|
||||
|
||||
data["shuttle"] = shuttle
|
||||
|
||||
if(trade_dockrequest_timelimit > world.time)
|
||||
data["dock_request"] = 1
|
||||
else
|
||||
data["dock_request"] = 0
|
||||
|
||||
return data
|
||||
|
||||
/datum/computer_file/program/comm/Topic(href, href_list)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
var/turf/T = get_turf(computer)
|
||||
if(!is_secure_level(T.z))
|
||||
to_chat(usr, "<span class='warning'>Unable to establish a connection: You're too far away from the station!</span>")
|
||||
return 1
|
||||
|
||||
if(href_list["PRG_login"])
|
||||
if(!ishuman(usr))
|
||||
to_chat(usr, "<span class='warning'>Access denied.</span>")
|
||||
return
|
||||
|
||||
var/list/access = usr.get_access()
|
||||
if(access_heads in access)
|
||||
authenticated = COMM_AUTHENTICATION_MIN
|
||||
|
||||
if(access_captain in access)
|
||||
authenticated = COMM_AUTHENTICATION_MAX
|
||||
var/mob/living/carbon/human/H = usr
|
||||
var/obj/item/weapon/card/id = H.get_idcard(TRUE)
|
||||
if(istype(id))
|
||||
crew_announcement.announcer = GetNameAndAssignmentFromId(id)
|
||||
|
||||
nanomanager.update_uis(src)
|
||||
return 1
|
||||
|
||||
if(href_list["PRG_logout"])
|
||||
authenticated = COMM_AUTHENTICATION_NONE
|
||||
crew_announcement.announcer = ""
|
||||
setMenuState(usr, COMM_SCREEN_MAIN)
|
||||
nanomanager.update_uis(src)
|
||||
return 1
|
||||
|
||||
if(is_authenticated(usr))
|
||||
switch(href_list["PRG_operation"])
|
||||
if("main")
|
||||
setMenuState(usr, COMM_SCREEN_MAIN)
|
||||
|
||||
if("changeseclevel")
|
||||
setMenuState(usr,COMM_SCREEN_SECLEVEL)
|
||||
|
||||
if("newalertlevel")
|
||||
if(isAI(usr) || isrobot(usr))
|
||||
to_chat(usr, "<span class='warning'>Firewalls prevent you from changing the alert level.</span>")
|
||||
return 1
|
||||
else if(usr.can_admin_interact())
|
||||
change_security_level(usr, text2num(href_list["level"]))
|
||||
return 1
|
||||
else if(!ishuman(usr))
|
||||
to_chat(usr, "<span class='warning'>Security measures prevent you from changing the alert level.</span>")
|
||||
return 1
|
||||
|
||||
var/mob/living/carbon/human/L = usr
|
||||
var/obj/item/card = L.get_active_hand()
|
||||
var/obj/item/weapon/card/id/I = (card && card.GetID()) || L.wear_id || L.wear_pda
|
||||
if(istype(I, /obj/item/device/pda))
|
||||
var/obj/item/device/pda/pda = I
|
||||
I = pda.id
|
||||
if(I && istype(I))
|
||||
if(access_captain in I.access)
|
||||
change_security_level(usr, text2num(href_list["level"]))
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>You are not authorized to do this.</span>")
|
||||
setMenuState(usr, COMM_SCREEN_MAIN)
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>You need to swipe your ID.</span>")
|
||||
|
||||
if("announce")
|
||||
if(is_authenticated(usr) == COMM_AUTHENTICATION_MAX)
|
||||
if(message_cooldown)
|
||||
to_chat(usr, "<span class='warning'>Please allow at least one minute to pass between announcements.</span>")
|
||||
nanomanager.update_uis(src)
|
||||
return 1
|
||||
var/input = input(usr, "Please write a message to announce to the station crew.", "Priority Announcement")
|
||||
if(!input || message_cooldown || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX))
|
||||
nanomanager.update_uis(src)
|
||||
return 1
|
||||
crew_announcement.Announce(input)
|
||||
message_cooldown = 1
|
||||
spawn(600)//One minute cooldown
|
||||
message_cooldown = 0
|
||||
|
||||
if("callshuttle")
|
||||
var/input = input(usr, "Please enter the reason for calling the shuttle.", "Shuttle Call Reason.","") as text|null
|
||||
if(!input || ..() || !is_authenticated(usr))
|
||||
nanomanager.update_uis(src)
|
||||
return 1
|
||||
|
||||
call_shuttle_proc(usr, input)
|
||||
if(shuttle_master.emergency.timer)
|
||||
post_status("shuttle")
|
||||
setMenuState(usr, COMM_SCREEN_MAIN)
|
||||
|
||||
if("cancelshuttle")
|
||||
if(isAI(usr) || isrobot(usr))
|
||||
to_chat(usr, "<span class='warning'>Firewalls prevent you from recalling the shuttle.</span>")
|
||||
nanomanager.update_uis(src)
|
||||
return 1
|
||||
var/response = alert("Are you sure you wish to recall the shuttle?", "Confirm", "Yes", "No")
|
||||
if(response == "Yes")
|
||||
cancel_call_proc(usr)
|
||||
if(shuttle_master.emergency.timer)
|
||||
post_status("shuttle")
|
||||
setMenuState(usr, COMM_SCREEN_MAIN)
|
||||
|
||||
if("messagelist")
|
||||
currmsg = 0
|
||||
if(href_list["msgid"])
|
||||
setCurrentMessage(usr, text2num(href_list["msgid"]))
|
||||
setMenuState(usr,COMM_SCREEN_MESSAGES)
|
||||
|
||||
if("delmessage")
|
||||
if(href_list["msgid"])
|
||||
currmsg = text2num(href_list["msgid"])
|
||||
var/response = alert("Are you sure you wish to delete this message?", "Confirm", "Yes", "No")
|
||||
if(response == "Yes")
|
||||
if(currmsg)
|
||||
var/id = getCurrentMessage()
|
||||
var/title = messagetitle[id]
|
||||
var/text = messagetext[id]
|
||||
messagetitle.Remove(title)
|
||||
messagetext.Remove(text)
|
||||
if(currmsg == id)
|
||||
currmsg = 0
|
||||
if(aicurrmsg == id)
|
||||
aicurrmsg = 0
|
||||
setMenuState(usr,COMM_SCREEN_MESSAGES)
|
||||
|
||||
if("status")
|
||||
setMenuState(usr,COMM_SCREEN_STAT)
|
||||
|
||||
// Status display stuff
|
||||
if("setstat")
|
||||
display_type=href_list["statdisp"]
|
||||
switch(display_type)
|
||||
if("message")
|
||||
post_status("message", stat_msg1, stat_msg2, usr)
|
||||
if("alert")
|
||||
post_status("alert", href_list["alert"], user = usr)
|
||||
else
|
||||
post_status(href_list["statdisp"], user = usr)
|
||||
setMenuState(usr, COMM_SCREEN_STAT)
|
||||
|
||||
if("setmsg1")
|
||||
stat_msg1 = input("Line 1", "Enter Message Text", stat_msg1) as text|null
|
||||
setMenuState(usr, COMM_SCREEN_STAT)
|
||||
|
||||
if("setmsg2")
|
||||
stat_msg2 = input("Line 2", "Enter Message Text", stat_msg2) as text|null
|
||||
setMenuState(usr, COMM_SCREEN_STAT)
|
||||
|
||||
if("nukerequest")
|
||||
if(is_authenticated(usr) == COMM_AUTHENTICATION_MAX)
|
||||
if(centcomm_message_cooldown)
|
||||
to_chat(usr, "<span class='warning'>Arrays recycling. Please stand by.</span>")
|
||||
nanomanager.update_uis(src)
|
||||
return 1
|
||||
var/input = stripped_input(usr, "Please enter the reason for requesting the nuclear self-destruct codes. Misuse of the nuclear request system will not be tolerated under any circumstances. Transmission does not guarantee a response.", "Self Destruct Code Request.","") as text|null
|
||||
if(!input || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX))
|
||||
nanomanager.update_uis(src)
|
||||
return 1
|
||||
Nuke_request(input, usr)
|
||||
to_chat(usr, "<span class='notice'>Request sent.</span>")
|
||||
log_say("[key_name(usr)] has requested the nuclear codes from Centcomm")
|
||||
priority_announcement.Announce("The codes for the on-station nuclear self-destruct have been requested by [usr]. Confirmation or denial of this request will be sent shortly.", "Nuclear Self Destruct Codes Requested",'sound/AI/commandreport.ogg')
|
||||
centcomm_message_cooldown = 1
|
||||
spawn(6000)//10 minute cooldown
|
||||
centcomm_message_cooldown = 0
|
||||
setMenuState(usr,COMM_SCREEN_MAIN)
|
||||
|
||||
if("MessageCentcomm")
|
||||
if(is_authenticated(usr) == COMM_AUTHENTICATION_MAX)
|
||||
if(centcomm_message_cooldown)
|
||||
to_chat(usr, "<span class='warning'>Arrays recycling. Please stand by.</span>")
|
||||
nanomanager.update_uis(src)
|
||||
return 1
|
||||
var/input = stripped_input(usr, "Please choose a message to transmit to Centcomm via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", "") as text|null
|
||||
if(!input || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX))
|
||||
nanomanager.update_uis(src)
|
||||
return 1
|
||||
Centcomm_announce(input, usr)
|
||||
to_chat(usr, "Message transmitted.")
|
||||
log_say("[key_name(usr)] has made a Centcomm announcement: [input]")
|
||||
centcomm_message_cooldown = 1
|
||||
spawn(6000)//10 minute cooldown
|
||||
centcomm_message_cooldown = 0
|
||||
setMenuState(usr,COMM_SCREEN_MAIN)
|
||||
|
||||
// OMG SYNDICATE ...LETTERHEAD
|
||||
if("MessageSyndicate")
|
||||
if((is_authenticated(usr) == COMM_AUTHENTICATION_MAX) && (computer && computer.emagged))
|
||||
if(centcomm_message_cooldown)
|
||||
to_chat(usr, "Arrays recycling. Please stand by.")
|
||||
nanomanager.update_uis(src)
|
||||
return 1
|
||||
var/input = stripped_input(usr, "Please choose a message to transmit to \[ABNORMAL ROUTING CORDINATES\] via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", "") as text|null
|
||||
if(!input || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX))
|
||||
nanomanager.update_uis(src)
|
||||
return 1
|
||||
Syndicate_announce(input, usr)
|
||||
to_chat(usr, "Message transmitted.")
|
||||
log_say("[key_name(usr)] has made a Syndicate announcement: [input]")
|
||||
centcomm_message_cooldown = 1
|
||||
spawn(6000)//10 minute cooldown
|
||||
centcomm_message_cooldown = 0
|
||||
setMenuState(usr,COMM_SCREEN_MAIN)
|
||||
|
||||
if("RestartNanoMob")
|
||||
if(mob_hunt_server)
|
||||
if(mob_hunt_server.manual_reboot())
|
||||
var/loading_msg = pick("Respawning spawns", "Reticulating splines", "Flipping hat",
|
||||
"Capturing all of them", "Fixing minor text issues", "Being the very best",
|
||||
"Nerfing this", "Not communicating with playerbase", "Coding a ripoff in a 2D spaceman game")
|
||||
to_chat(usr, "<span class='notice'>Restarting Nano-Mob Hunter GO! game server. [loading_msg]...</span>")
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>Nano-Mob Hunter GO! game server reboot failed due to recent restart. Please wait before re-attempting.</span>")
|
||||
else
|
||||
to_chat(usr, "<span class='danger'>Nano-Mob Hunter GO! game server is offline for extended maintenance. Contact your Central Command administrators for more info if desired.</span>")
|
||||
|
||||
if("AcceptDocking")
|
||||
to_chat(usr, "Docking request accepted!")
|
||||
trade_dock_timelimit = world.time + 1200
|
||||
trade_dockrequest_timelimit = 0
|
||||
event_announcement.Announce("Docking request for trading ship approved, please dock at port bay 4.", "Docking Request")
|
||||
if("DenyDocking")
|
||||
to_chat(usr, "Docking requeset denied!")
|
||||
trade_dock_timelimit = 0
|
||||
trade_dockrequest_timelimit = 0
|
||||
event_announcement.Announce("Docking request for trading ship denied.", "Docking request")
|
||||
|
||||
nanomanager.update_uis(src)
|
||||
return 1
|
||||
Reference in New Issue
Block a user