/obj/machinery/faxmachine
name = "fax machine"
icon = 'icons/obj/library.dmi'
icon_state = "bigscanner"
req_access = list(access_lawyer)
anchored = 1
density = 1
use_power = 1
idle_power_usage = 30
active_power_usage = 200
power_channel = EQUIP
var/obj/item/weapon/card/id/scan = null // identification
var/authenticated = 0
var/obj/item/weapon/paper/tofax = null // what we're sending to central
var/sendcooldown = 0 // to avoid spamming fax messages
attack_ai(mob/user as mob)
return attack_hand(user)
attack_paw(mob/user as mob)
return attack_hand(user)
attack_hand(mob/user as mob)
user.set_machine(src)
var/dat = "Central Command Fax Machine
"
var/scan_name
if(scan)
scan_name = scan.name
else
scan_name = "--------"
dat += "Confirm Identity: [scan_name]
"
if(authenticated)
dat += "{Log Out}"
else
dat += "{Log In}"
dat += "
"
if(authenticated)
dat += "Logged in to: Central Command Quantum Entanglement Network
"
if(tofax)
dat += "Remove Paper
"
if(sendcooldown)
dat += "Transmitter arrays realigning. Please stand by.
"
else
dat += "Send
"
dat += "Currently sending: [tofax.name]"
else
if(sendcooldown)
dat += "Please insert paper to send to Central Command via secure connection.
"
dat += "Transmitter arrays realigning. Please stand by.
"
else
dat += "Please insert paper to send to Central Command via secure connection.
"
else
dat += "Proper authentication is required to use this device.
"
if(tofax)
dat += "Remove Paper
"
user << browse(dat, "window=copier")
onclose(user, "copier")
return
Topic(href, href_list)
if(href_list["send"])
if(tofax)
Centcomm_fax(tofax.info, tofax.name, usr)
usr << "Message transmitted."
sendcooldown = 1
spawn(3000) // three minute cooldown. might mess with this number a bit as time goes on
sendcooldown = 0
if(href_list["remove"])
if(tofax)
tofax.loc = usr.loc
usr.put_in_hands(tofax)
usr << "You take the paper out of \the [src]."
tofax = null
if(href_list["scan"])
if (scan)
if(ishuman(usr))
scan.loc = usr.loc
if(!usr.get_active_hand())
usr.put_in_hands(scan)
scan = null
else
scan.loc = src.loc
scan = null
else
var/obj/item/I = usr.get_active_hand()
if (istype(I, /obj/item/weapon/card/id))
usr.drop_item()
I.loc = src
scan = I
authenticated = 0
if(href_list["auth"])
if ( (!( authenticated ) && (scan)) )
if (check_access(scan))
authenticated = 1
if(href_list["logout"])
authenticated = 0
updateUsrDialog()
attackby(obj/item/O as obj, mob/user as mob)
if(istype(O, /obj/item/weapon/paper))
if(!tofax)
user.drop_item()
tofax = O
O.loc = src
user << "You insert the paper into \the [src]."
flick("bigscanner1", src)
updateUsrDialog()
else
user << "There is already something in \the [src]."
else if(istype(O, /obj/item/weapon/card/id))
var/obj/item/weapon/card/id/idcard = O
if(!scan)
usr.drop_item()
idcard.loc = src
scan = idcard
else if(istype(O, /obj/item/weapon/wrench))
playsound(loc, 'sound/items/Ratchet.ogg', 50, 1)
anchored = !anchored
user << "You [anchored ? "wrench" : "unwrench"] \the [src]."
return
/proc/Centcomm_fax(var/sent, var/sentname, var/mob/Sender)
var/msg = "\blue CENTCOMM FAX: [key_name(Sender, 1)] (PP) (VV) (SM) (JMP) (CA) (RPLY): Receiving '[sentname]' via secure connection ... view message"
admins << msg