mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-01-09 17:02:00 +00:00
* tgui the beginning * binaries and the like * Bring in the last of it * Example radio UI * delete example * NTOS Main Menu, start on manifest, tgui states * tasks.json * gunnery ui pt 1 * okay * fix everything * scss update * oops * manifest gigablast * downloader part 1 * download prt 2 * NTOSDownloader final * mfw committing to_worlds * gunnery console pt2 * i cooked * targeting (finished) * one vueui down * voting ui almost done * MY MIND FEELS LIKE AN ARCH ENEMYYYY * voting ui down * photocopier * ntos config + download fixes * photocopier 2 * refactor define * NTOS client manager + fixes * fax machine final (it also uses toner now) * marching forwards... left behind... * ntnrc part 1 * canister * add quotes * portable pumps pt1 + more backgrounds * oops * finish the portable pump * freezers so I'll keep on pushing forward... you haven't seen the last of me... oooooooh... * doors ui pt1 * finish doors UI (forgive me wildkins it's a bit of shitcode) * vitals monitor, make things use labeled lists, new backgrounds * mais j'envoyé aucun mayday... * maglock pt1 * pour ça je me suis perdu... * infrared * fix that * prox sensor pt1 * prox sensor * signaler (this was actually pretty hard) * atmos control pt1 * atmos control pt1.1 * atmos pt 2 * fuel injector * multitool UI * jammer * list viewer * APC * portgen * targeting console updates + SMES ui * new themes, shield generator * supermatter * Add ore detector and (shitty) NTNet Relay * orderterminal pt1 * orderterminal pt2 * smartfridge * Add (air-)tank GUI update ore detector size * Adds Transfer Valves * Add AtmoScrubber * analyzer pt1 * weapons analyzer pt2 * bodyscanner pt1 * bodyscanner pt2 * fix this shitcode * seed storage * appearance changer * appearance changer final * sleeper pt1 * sleeper * gps * vehicles * chem dispenser * lily request * holopad * tgui modules pt1 * ppanel * damage menu * fixes * im here too now * follow menu, search bars * quikpay * quikpay fixes * circuit printer * ppanel * ppanel updates * pai * turret controls (i want to kill myself) * tweak * remove the boardgame * guntracker * implant tracker * penal mechs come close to me, come close to me * chem codex * pai radio * doorjack * pai directives * signaler removal, sensors * ghost spawner * spawnpoint * fixes * teleporter * one more to the chopping block * account database * remove divider * scanner, atmos * latejoin ui pt1 * latejoin * records pt1 * RECORDS UI DONE * delete interpreter & records * CHAT FUCKING CLIENT * data updates * fix some things * final UI, log * basic nanoui fix * antag panel * remove vueui * atm update * vending update * warrants, cameras * ntmonitor * time comes for all * preserve this legacy * bring that back (oops) * rcon, ui auto update for computer UIs, remove rcon computers * alarm monitoring (a bit broke and also todo: add custom alarm monitoring programs to a few consoles) * A LIKE SUPREME * a * power monitor * lights on * fuck this code, fuck nanoui modules, and fuck nanoui * LEAVE IT OH SO FAR BEHIND * fix alarm monitoring for synths * I SAW IN YOU WHAT LIFE WAS MISSING * comms console * idcard and record updates * turn the light on * arcade * pt2 * news browser * static * crusher * f * COULD I JUST SLEIGH THE GOLD FROM THE BALLS? I'M SO FRUSTRATED OH COULD YOU TELL? IF I HEAR ONE MORE VUEUI OR ONE NANOUI I'M GONNA LOSE IT SO LET ME GOOOOOOOOOOOOOOOOO * codeowners & suit sensors * html ui style removal * make lint happy * resist and disorder * i slowly get up and turn off the noise, already fed up... * pleaseeeeeeeeeeeeeee * THE CREDIT LARP IS NECESSARY * i hold the keys * RISE UP * fix that? * harry's suggestions xoxo * runtime fix pt2 * You are the only thing that I still care about * adds build workflow * Update update_tgui.yml * adds some needed steps * ATM * misc fixes and tweaks * fixes 2 * make newscasters usable and fix use power on freezers * turret control is clearer --------- Co-authored-by: John Wildkins <john.wildkins@gmail.com> Co-authored-by: Matt Atlas <liermattia@gmail.com> Co-authored-by: harryob <55142896+harryob@users.noreply.github.com> Co-authored-by: Werner <Arrow768@users.noreply.github.com> Co-authored-by: Geeves <ggrobler447@gmail.com> Co-authored-by: harryob <me@harryob.live>
323 lines
11 KiB
Plaintext
323 lines
11 KiB
Plaintext
var/list/obj/machinery/photocopier/faxmachine/allfaxes = list()
|
|
var/list/arrived_faxes = list() //cache for faxes that have been sent to the admins
|
|
var/list/sent_faxes = list() //cache for faxes that have been sent by the admins
|
|
var/list/alldepartments = list()
|
|
var/list/admin_departments
|
|
|
|
/obj/machinery/photocopier/faxmachine
|
|
name = "fax machine"
|
|
icon = 'icons/obj/library.dmi'
|
|
icon_state = "fax"
|
|
insert_anim = "faxsend"
|
|
req_one_access = list(access_lawyer, access_heads)
|
|
density = 0
|
|
idle_power_usage = 30
|
|
active_power_usage = 200
|
|
print_animation = "faxreceive"
|
|
|
|
var/static/const/adminfax_cooldown = 1800
|
|
var/static/const/normalfax_cooldown = 300
|
|
var/static/const/broadcastfax_cooldown = 3000
|
|
|
|
var/static/const/broadcast_departments = "Stationwide broadcast (WARNING)"
|
|
/// Identification.
|
|
var/obj/item/card/id/identification
|
|
/// Time since the last fax was sent.
|
|
var/sendtime = 0
|
|
/// Delay before another fax can be sent (in deciseconds). Used by set_cooldown() and get_remaining_cooldown().
|
|
var/sendcooldown = 0
|
|
/// Our department.
|
|
var/department = "Unknown"
|
|
/// Destination we are sending to.
|
|
var/destination
|
|
/// A list of PDAs to alert upon arrival of the fax.
|
|
var/list/obj/item/modular_computer/alert_pdas = list()
|
|
|
|
/obj/machinery/photocopier/faxmachine/Initialize()
|
|
. = ..()
|
|
allfaxes += src
|
|
if( !(("[department]" in alldepartments) || ("[department]" in admin_departments)) )
|
|
alldepartments |= department
|
|
destination = current_map.boss_name
|
|
|
|
/obj/machinery/photocopier/faxmachine/ui_data(mob/user)
|
|
var/list/data = list()
|
|
data["destination"] = destination
|
|
data["bossname"] = current_map.boss_name
|
|
data["auth"] = is_authenticated()
|
|
data["cooldown_end"] = sendtime + sendcooldown
|
|
data["world_time"] = world.time
|
|
data["destination"] = destination
|
|
if(identification)
|
|
data["idname"] = identification.name
|
|
else
|
|
data["idname"] = ""
|
|
data["paper"] = (copy_item ? copy_item.name : "")
|
|
|
|
data["alertpdas"] = list()
|
|
if (alert_pdas && alert_pdas.len)
|
|
for (var/obj/item/modular_computer/pda in alert_pdas)
|
|
data["alertpdas"] += list(list("name" = "[alert_pdas[pda]]", "ref" = "\ref[pda]"))
|
|
data["departments"] = list()
|
|
for (var/dept in (alldepartments + admin_departments + broadcast_departments))
|
|
data["departments"] += "[dept]"
|
|
|
|
return data
|
|
|
|
/obj/machinery/photocopier/faxmachine/ui_interact(mob/user, var/datum/tgui/ui)
|
|
ui = SStgui.try_update_ui(user, src, ui)
|
|
if (!ui)
|
|
ui = new(user, src, "Fax", "Fax Machine", 400, 500)
|
|
ui.open()
|
|
|
|
/obj/machinery/photocopier/faxmachine/attackby(obj/item/O as obj, mob/user as mob)
|
|
. = ..()
|
|
SStgui.update_uis(src)
|
|
|
|
/obj/machinery/photocopier/faxmachine/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
|
|
switch(action)
|
|
if("send")
|
|
if (get_remaining_cooldown() > 0)
|
|
// Rate-limit sending faxes
|
|
to_chat(usr, "<span class='warning'>The fax machine isn't ready, yet!</span>")
|
|
return
|
|
|
|
if(copy_item && is_authenticated())
|
|
if (destination in admin_departments)
|
|
send_admin_fax(usr, destination)
|
|
else if (destination == broadcast_departments)
|
|
send_broadcast_fax()
|
|
else
|
|
sendfax(destination)
|
|
return TRUE
|
|
|
|
if("remove")
|
|
if(copy_item)
|
|
copy_item.forceMove(loc)
|
|
if (get_dist(usr, src) < 2)
|
|
usr.put_in_hands(copy_item)
|
|
to_chat(usr, "<span class='notice'>You take \the [copy_item] out of \the [src].</span>")
|
|
else
|
|
to_chat(usr, "<span class='notice'>You eject \the [copy_item] from \the [src].</span>")
|
|
copy_item = null
|
|
return TRUE
|
|
|
|
if("remove_id")
|
|
if (identification)
|
|
if(ishuman(usr))
|
|
identification.forceMove(usr.loc)
|
|
if(!usr.get_active_hand())
|
|
usr.put_in_hands(identification)
|
|
identification = null
|
|
return TRUE
|
|
else
|
|
identification.forceMove(src.loc)
|
|
identification = null
|
|
return TRUE
|
|
else
|
|
var/obj/item/I = usr.get_active_hand()
|
|
if (istype(I, /obj/item/card/id) && usr.unEquip(I))
|
|
I.forceMove(src)
|
|
identification = I
|
|
return TRUE
|
|
|
|
if("linkpda")
|
|
var/obj/item/modular_computer/pda = usr.get_active_hand()
|
|
if (!pda || !istype(pda))
|
|
to_chat(usr, "<span class='warning'>You need to be holding a PDA to link it.</span>")
|
|
else if (pda in alert_pdas)
|
|
to_chat(usr, "<span class='notice'>\The [pda] appears to be already linked.</span>")
|
|
//Update the name real quick.
|
|
alert_pdas[pda] = pda.name
|
|
return TRUE
|
|
else
|
|
alert_pdas += pda
|
|
alert_pdas[pda] = pda.name
|
|
to_chat(usr, "<span class='notice'>You link \the [pda] to \the [src]. It will now ping upon the arrival of a fax to this machine.</span>")
|
|
return TRUE
|
|
|
|
if("unlink")
|
|
var/obj/item/modular_computer/pda = locate(params["unlink"])
|
|
if (pda && istype(pda))
|
|
if (pda in alert_pdas)
|
|
to_chat(usr, "<span class='notice'>You unlink [alert_pdas[pda]] from \the [src]. It will no longer be notified of new faxes.</span>")
|
|
alert_pdas -= pda
|
|
return TRUE
|
|
|
|
if("select_destination")
|
|
if(!params["select_destination"])
|
|
return
|
|
destination = params["select_destination"]
|
|
return TRUE
|
|
|
|
/obj/machinery/photocopier/faxmachine/process()
|
|
.=..()
|
|
var/static/ui_update_delay = 0
|
|
|
|
if ((sendtime + sendcooldown) < world.time)
|
|
sendcooldown = 0
|
|
|
|
/*
|
|
* Check if current id in machine is autenthicated
|
|
*/
|
|
/obj/machinery/photocopier/faxmachine/proc/is_authenticated()
|
|
return identification ? check_access(identification) : FALSE
|
|
|
|
/*
|
|
* Set the send cooldown
|
|
* cooldown: duration in ~1/10s
|
|
*/
|
|
/obj/machinery/photocopier/faxmachine/proc/set_cooldown(var/cooldown)
|
|
// Reset send time
|
|
sendtime = world.time
|
|
|
|
// Set cooldown length
|
|
sendcooldown = cooldown
|
|
|
|
/*
|
|
* Get remaining cooldown duration in ~1/10s
|
|
*/
|
|
/obj/machinery/photocopier/faxmachine/proc/get_remaining_cooldown()
|
|
var/remaining_time = (sendtime + sendcooldown) - world.time
|
|
if ((remaining_time < 0) || (sendcooldown == 0))
|
|
// Time is up, but Process() hasn't caught up, yet
|
|
// or no cooldown has been set
|
|
remaining_time = 0
|
|
return remaining_time
|
|
|
|
/*
|
|
* Send normal fax message to on-station fax machine
|
|
* destination: (string) from /allfaxes
|
|
* display_message: (bool) 1=display info text, 0="silent mode"
|
|
*/
|
|
/obj/machinery/photocopier/faxmachine/proc/sendfax(var/destination, var/display_message = 1)
|
|
if(stat & (BROKEN|NOPOWER))
|
|
return 0
|
|
|
|
use_power_oneoff(200)
|
|
|
|
var/success = 0
|
|
for(var/obj/machinery/photocopier/faxmachine/F in allfaxes)
|
|
if( F.department == destination )
|
|
success = F.receivefax(copy_item)
|
|
|
|
if (success)
|
|
set_cooldown(normalfax_cooldown)
|
|
|
|
if (display_message)
|
|
// Normal fax
|
|
if (success)
|
|
visible_message("[src] beeps, \"Message transmitted successfully.\"")
|
|
else
|
|
visible_message("[src] beeps, \"Error transmitting message.\"")
|
|
return success
|
|
|
|
/obj/machinery/photocopier/faxmachine/proc/receivefax(var/obj/item/incoming)
|
|
if(stat & (BROKEN|NOPOWER))
|
|
return 0
|
|
|
|
if(department == "Unknown")
|
|
return 0 //You can't send faxes to "Unknown"
|
|
|
|
if (!istype(incoming, /obj/item/paper) && !istype(incoming, /obj/item/photo) && !istype(incoming, /obj/item/paper_bundle))
|
|
return 0
|
|
|
|
playsound(loc, "sound/bureaucracy/print.ogg", 75, 1)
|
|
|
|
// give the sprite some time to flick
|
|
spawn(20)
|
|
if (istype(incoming, /obj/item/paper))
|
|
copy(src, incoming, 1, 0, 0, toner = src.toner)
|
|
else if (istype(incoming, /obj/item/photo))
|
|
photocopy(src, incoming, toner = src.toner)
|
|
else if (istype(incoming, /obj/item/paper_bundle))
|
|
bundlecopy(src, incoming, toner = src.toner)
|
|
do_pda_alerts()
|
|
use_power_oneoff(active_power_usage)
|
|
|
|
return 1
|
|
|
|
/obj/machinery/photocopier/faxmachine/proc/send_broadcast_fax()
|
|
var success = 1
|
|
for (var/dest in (alldepartments - department))
|
|
// Send to everyone except this department
|
|
sleep(1)
|
|
success &= sendfax(dest, 0) // 0: don't display success/error messages
|
|
|
|
if(!success)// Stop on first error
|
|
break
|
|
if (success)
|
|
visible_message("[src] beeps, \"Messages transmitted successfully.\"")
|
|
set_cooldown(broadcastfax_cooldown)
|
|
else
|
|
visible_message("[src] beeps, \"Error transmitting messages.\"")
|
|
set_cooldown(normalfax_cooldown)
|
|
|
|
/obj/machinery/photocopier/faxmachine/proc/send_admin_fax(var/mob/sender, var/destination)
|
|
if(stat & (BROKEN|NOPOWER))
|
|
return
|
|
|
|
use_power_oneoff(200)
|
|
|
|
var/obj/item/rcvdcopy
|
|
if (istype(copy_item, /obj/item/paper))
|
|
rcvdcopy = copy(src, copy_item, 0, toner = src.toner)
|
|
else if (istype(copy_item, /obj/item/photo))
|
|
rcvdcopy = photocopy(src, copy_item, toner = src.toner)
|
|
else if (istype(copy_item, /obj/item/paper_bundle))
|
|
rcvdcopy = bundlecopy(src, copy_item, 0, toner = src.toner)
|
|
else
|
|
visible_message("[src] beeps, \"Error transmitting message.\"")
|
|
return
|
|
|
|
rcvdcopy.forceMove(null) //hopefully this shouldn't cause trouble
|
|
arrived_faxes += rcvdcopy
|
|
|
|
//message badmins that a fax has arrived
|
|
if (destination == current_map.boss_name)
|
|
message_admins(sender, "[uppertext(current_map.boss_short)] FAX", rcvdcopy, "CentcommFaxReply", "#006100")
|
|
else if (destination == "External Routing")
|
|
message_admins(sender, "EXTERNAL ROUTING FAX", rcvdcopy, "CentcommFaxReply", "#1F66A0")
|
|
|
|
set_cooldown(adminfax_cooldown)
|
|
spawn(50)
|
|
visible_message("[src] beeps, \"Message transmitted successfully.\"")
|
|
|
|
|
|
/obj/machinery/photocopier/faxmachine/proc/message_admins(var/mob/sender, var/faxname, var/obj/item/sent, var/reply_type, font_colour="#006100")
|
|
var/msg = "<span class='notice'> <b><font color='[font_colour]'>[faxname]: </font>[key_name(sender, 1)] (<A HREF='?_src_=holder;adminplayeropts=\ref[sender]'>PP</A>) (<A HREF='?_src_=vars;Vars=\ref[sender]'>VV</A>) (<A HREF='?_src_=holder;subtlemessage=\ref[sender]'>SM</A>) (<A HREF='?_src_=holder;adminplayerobservejump=\ref[sender]'>JMP</A>) (<A HREF='?_src_=holder;secretsadmin=check_antagonist'>CA</A>) (<a href='?_src_=holder;[reply_type]=\ref[src];faxMachine=\ref[src]'>REPLY</a>)</b>: Receiving '[sent.name]' via secure connection ... <a href='?_src_=holder;AdminFaxView=\ref[sent]'>view message</a></span>"
|
|
|
|
var/cciaa_present = 0
|
|
var/cciaa_afk = 0
|
|
for(var/s in staff)
|
|
var/client/C = s
|
|
var/flags = C.holder.rights & (R_ADMIN|R_CCIAA)
|
|
if(flags)
|
|
to_chat(C, msg)
|
|
if (flags == R_CCIAA) // Admins sometimes get R_CCIAA, but CCIAA never get R_ADMIN
|
|
cciaa_present++
|
|
if (C.is_afk())
|
|
cciaa_afk++
|
|
|
|
var/discord_msg = "New fax arrived! [faxname]: \"[sent.name]\" by [sender]. ([cciaa_present] agents online"
|
|
if (cciaa_present)
|
|
if ((cciaa_present - cciaa_afk) <= 0)
|
|
discord_msg += ", **all AFK!**)"
|
|
else
|
|
discord_msg += ", [cciaa_afk] AFK.)"
|
|
else
|
|
discord_msg += ".)"
|
|
|
|
discord_msg += " Gamemode: [SSticker.mode]"
|
|
|
|
discord_bot.send_to_cciaa(discord_msg)
|
|
|
|
/obj/machinery/photocopier/faxmachine/proc/do_pda_alerts()
|
|
for(var/obj/item/modular_computer/pda in alert_pdas)
|
|
var/message = "New message has arrived!"
|
|
pda.get_notification(message, 1, "[department] [name]")
|