//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31
/obj/machinery/computer/card
name = "Identification Computer"
desc = "You can use this to change ID's."
icon_state = "id"
req_access = list(access_change_ids)
circuit = "/obj/item/weapon/circuitboard/card"
var/obj/item/weapon/card/id/scan = null
var/obj/item/weapon/card/id/modify = null
var/authenticated = 0.0
var/mode = 0.0
var/printing = null
/obj/machinery/computer/card/attackby(O as obj, user as mob)//TODO:SANITY
if(istype(O, /obj/item/weapon/card/id))
var/obj/item/weapon/card/id/idcard = O
if(access_change_ids in idcard.access)
if(!scan)
usr.drop_item()
idcard.loc = src
scan = idcard
else if(!modify)
usr.drop_item()
idcard.loc = src
modify = idcard
else
if(!modify)
usr.drop_item()
idcard.loc = src
modify = idcard
else
..()
/obj/machinery/computer/card/attack_ai(var/mob/user as mob)
return attack_hand(user)
/obj/machinery/computer/card/attack_paw(var/mob/user as mob)
return attack_hand(user)
/obj/machinery/computer/card/attack_hand(var/mob/user as mob)
if(..())
return
user.set_machine(src)
var/dat
if (!( ticker ))
return
if (mode) // accessing crew manifest
dat += "
Crew Manifest
"
dat += "Entries cannot be modified from this terminal.
"
if(data_core)
dat += data_core.get_manifest(0) // make it monochrome
dat += "
"
dat += "Print
"
dat += "
"
dat += "Access ID modification console.
"
/*var/crew = ""
var/list/L = list()
for (var/datum/data/record/t in data_core.general)
var/R = t.fields["name"] + " - " + t.fields["rank"]
L += R
for(var/R in sortList(L))
crew += "[R]
"*/
//dat = "Crew Manifest:
Please use security record computer to modify entries.
[crew]Print
Access ID modification console.
"
else
var/header = "Identification Card Modifier
"
var/target_name
var/target_owner
var/target_rank
if(modify)
target_name = modify.name
else
target_name = "--------"
if(modify && modify.registered_name)
target_owner = modify.registered_name
else
target_owner = "--------"
if(modify && modify.assignment)
target_rank = modify.assignment
else
target_rank = "Unassigned"
var/scan_name
if(scan)
scan_name = scan.name
else
scan_name = "--------"
if(!authenticated)
header += "
Please insert the cards into the slots
"
header += "Target: [target_name]
"
header += "Confirm Identity: [scan_name]
"
else
header += ""
header += "
"
var/jobs_all = ""
var/list/alljobs = (istype(src,/obj/machinery/computer/card/centcom)? get_all_centcom_jobs() : get_all_jobs()) + "Custom"
for(var/job in alljobs)
jobs_all += "[replacetext(job, " ", " ")] " //make sure there isn't a line break in the middle of a job
var/body
if (authenticated && modify)
var/carddesc = {""}
carddesc += ""
carddesc += ""
carddesc += "Assignment: "
var/jobs = "[target_rank]" //CHECK THIS
var/accesses = ""
if(istype(src,/obj/machinery/computer/card/centcom))
accesses += "Central Command:
"
for(var/A in get_all_centcom_access())
if(A in modify.access)
accesses += "[replacetext(get_centcom_access_desc(A), " ", " ")] "
else
accesses += "[replacetext(get_centcom_access_desc(A), " ", " ")] "
else
accesses += "Access
"
accesses += ""
body = "[carddesc]
[jobs]
[accesses]" //CHECK THIS
else
body = "{Log in}
"
body += "Access Crew Manifest"
dat = "[header][body]
"
user << browse(dat, "window=id_com;size=900x520")
onclose(user, "id_com")
return
/obj/machinery/computer/card/Topic(href, href_list)
if(..())
return
usr.set_machine(src)
switch(href_list["choice"])
if ("modify")
if (modify)
data_core.manifest_modify(modify.registered_name, modify.assignment)
modify.name = text("[modify.registered_name]'s ID Card ([modify.assignment])")
if(ishuman(usr))
modify.loc = usr.loc
if(!usr.get_active_hand())
usr.put_in_hands(modify)
modify = null
else
modify.loc = loc
modify = null
else
var/obj/item/I = usr.get_active_hand()
if (istype(I, /obj/item/weapon/card/id))
usr.drop_item()
I.loc = src
modify = I
authenticated = 0
if ("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 ("auth")
if ((!( authenticated ) && (scan || (istype(usr, /mob/living/silicon))) && (modify || mode)))
if (check_access(scan))
authenticated = 1
else if ((!( authenticated ) && (istype(usr, /mob/living/silicon))) && (!modify))
usr << "You can't modify an ID without an ID inserted to modify. Once one is in the modify slot on the computer, you can log in."
if ("logout")
authenticated = 0
if("access")
if(href_list["allowed"])
if(authenticated)
var/access_type = text2num(href_list["access_target"])
var/access_allowed = text2num(href_list["allowed"])
if(access_type in (istype(src,/obj/machinery/computer/card/centcom)?get_all_centcom_access() : get_all_accesses()))
modify.access -= access_type
if(access_allowed == 1)
modify.access += access_type
if ("assign")
if (authenticated)
var/t1 = href_list["assign_target"]
if(t1 == "Custom")
var/temp_t = copytext(sanitize(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/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)
usr << "\red No log exists for this job."
return
modify.access = ( istype(src,/obj/machinery/computer/card/centcom) ? get_centcom_access(t1) : jobdatum.get_access() )
if (modify)
modify.assignment = t1
modify.rank = t1
if ("reg")
if (authenticated)
var/t2 = modify
//var/t1 = input(usr, "What name?", "ID computer", null) as text
if ((authenticated && modify == t2 && (in_range(src, usr) || (istype(usr, /mob/living/silicon))) && istype(loc, /turf)))
var/temp_name = reject_bad_name(href_list["reg"])
if(temp_name)
modify.registered_name = temp_name
else
src.visible_message("[src] buzzes rudely.")
if ("account")
if (authenticated)
var/t2 = modify
//var/t1 = input(usr, "What name?", "ID computer", null) as text
if ((authenticated && modify == t2 && (in_range(src, usr) || (istype(usr, /mob/living/silicon))) && istype(loc, /turf)))
var/account_num = text2num(href_list["account"])
modify.associated_account_number = account_num
if ("mode")
mode = text2num(href_list["mode_target"])
if ("print")
if (!( printing ))
printing = 1
sleep(50)
var/obj/item/weapon/paper/P = new /obj/item/weapon/paper( loc )
/*var/t1 = "Crew Manifest:
"
var/list/L = list()
for (var/datum/data/record/t in data_core.general)
var/R = t.fields["name"] + " - " + t.fields["rank"]
L += R
for(var/R in sortList(L))
t1 += "[R]
"*/
var/t1 = "Crew Manifest
"
t1 += "
"
if(data_core)
t1 += data_core.get_manifest(0) // make it monochrome
P.info = t1
P.name = "paper- 'Crew Manifest'"
printing = null
if (modify)
modify.name = text("[modify.registered_name]'s ID Card ([modify.assignment])")
updateUsrDialog()
return
/obj/machinery/computer/card/centcom
name = "CentCom Identification Computer"
circuit = "/obj/item/weapon/circuitboard/card/centcom"
req_access = list(access_cent_captain)