//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31 #define GENERAL_RECORD_LIST 2 #define GENERAL_RECORD_MAINT 3 #define GENERAL_RECORD_DATA 4 #define FIELD(N, V, E) list(field = N, value = V, edit = E) /obj/machinery/computer/skills//TODO:SANITY name = "employment records console" desc = "Used to view, edit and maintain employment records." icon_state = "laptop" icon_keyboard = "laptop_key" icon_screen = "medlaptop" light_color = "#00b000" req_one_access = list(access_heads) circuit = /obj/item/weapon/circuitboard/skills density = 0 var/obj/item/weapon/card/id/scan = null var/authenticated = null var/rank = null var/screen = null var/datum/data/record/active1 = null var/a_id = null var/list/temp = null var/printing = null var/can_change_id = 0 // The below are used to make modal generation more convenient var/static/list/field_edit_questions var/static/list/field_edit_choices /obj/machinery/computer/skills/Initialize() ..() field_edit_questions = list( // General "name" = "Please input new name:", "id" = "Please input new ID:", "sex" = "Please select new sex:", "age" = "Please input new age:", "fingerprint" = "Please input new fingerprint hash:", ) field_edit_choices = list( // General "sex" = all_genders_text_list, "p_stat" = list("*Deceased*", "*SSD*", "Active", "Physically Unfit", "Disabled"), "m_stat" = list("*Insane*", "*Unstable*", "*Watch*", "Stable"), ) /obj/machinery/computer/skills/Destroy() active1 = null return ..() /obj/machinery/computer/skills/attackby(obj/item/O as obj, var/mob/user) if(istype(O, /obj/item/weapon/card/id) && !scan && user.unEquip(O)) O.loc = src scan = O to_chat(user, "You insert [O].") tgui_interact(user) else ..() /obj/machinery/computer/skills/attack_ai(mob/user as mob) return attack_hand(user) //Someone needs to break down the dat += into chunks instead of long ass lines. /obj/machinery/computer/skills/attack_hand(mob/user as mob) if(..()) return if (using_map && !(src.z in using_map.contact_levels)) to_chat(user, "Unable to establish a connection: You're too far away from the station!") return tgui_interact(user) /obj/machinery/computer/skills/tgui_interact(mob/user, datum/tgui/ui = null) ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "GeneralRecords", "Employee Records") // 800, 380 ui.open() ui.set_autoupdate(FALSE) /obj/machinery/computer/skills/tgui_data(mob/user) var/data[0] data["temp"] = temp data["scan"] = scan ? scan.name : null data["authenticated"] = authenticated data["rank"] = rank data["screen"] = screen data["printing"] = printing data["isAI"] = isAI(user) data["isRobot"] = isrobot(user) if(authenticated) switch(screen) if(GENERAL_RECORD_LIST) if(!isnull(data_core.general)) var/list/records = list() data["records"] = records for(var/datum/data/record/R in sortRecord(data_core.general)) records[++records.len] = list( "ref" = "\ref[R]", "id" = R.fields["id"], "name" = R.fields["name"], "b_dna" = R.fields["b_dna"]) if(GENERAL_RECORD_DATA) var/list/general = list() data["general"] = general if(istype(active1, /datum/data/record) && data_core.general.Find(active1)) var/list/fields = list() general["fields"] = fields fields[++fields.len] = FIELD("Name", active1.fields["name"], "name") fields[++fields.len] = FIELD("ID", active1.fields["id"], "id") fields[++fields.len] = FIELD("Sex", active1.fields["sex"], "sex") fields[++fields.len] = FIELD("Age", active1.fields["age"], "age") fields[++fields.len] = FIELD("Fingerprint", active1.fields["fingerprint"], "fingerprint") fields[++fields.len] = FIELD("Physical Status", active1.fields["p_stat"], null) fields[++fields.len] = FIELD("Mental Status", active1.fields["m_stat"], null) var/list/photos = list() general["photos"] = photos photos[++photos.len] = active1.fields["photo-south"] photos[++photos.len] = active1.fields["photo-west"] general["has_photos"] = (active1.fields["photo-south"] || active1.fields["photo-west"] ? 1 : 0) if(!active1.fields["comments"] || !islist(active1.fields["comments"])) active1.fields["comments"] = list() general["skills"] = active1.fields["notes"] general["comments"] = active1.fields["comments"] general["empty"] = 0 else general["empty"] = 1 data["modal"] = tgui_modal_data(src) return data /obj/machinery/computer/skills/tgui_act(action, params) if(..()) return TRUE add_fingerprint(usr) if(!data_core.general.Find(active1)) active1 = null . = TRUE if(tgui_act_modal(action, params)) return switch(action) if("scan") if(scan) scan.forceMove(loc) if(ishuman(usr) && !usr.get_active_hand()) usr.put_in_hands(scan) scan = null else var/obj/item/I = usr.get_active_hand() if(istype(I, /obj/item/weapon/card/id)) usr.drop_item() I.forceMove(src) scan = I if("cleartemp") temp = null if("login") var/login_type = text2num(params["login_type"]) if(login_type == LOGIN_TYPE_NORMAL && istype(scan)) if(check_access(scan)) authenticated = scan.registered_name rank = scan.assignment else if(login_type == LOGIN_TYPE_AI && isAI(usr)) authenticated = usr.name rank = "AI" else if(login_type == LOGIN_TYPE_ROBOT && isrobot(usr)) authenticated = usr.name var/mob/living/silicon/robot/R = usr rank = "[R.modtype] [R.braintype]" if(authenticated) active1 = null screen = GENERAL_RECORD_LIST else . = FALSE if(.) return if(authenticated) . = TRUE switch(action) if("logout") if(scan) scan.forceMove(loc) if(ishuman(usr) && !usr.get_active_hand()) usr.put_in_hands(scan) scan = null authenticated = null screen = null active1 = null if("screen") screen = clamp(text2num(params["screen"]) || 0, GENERAL_RECORD_LIST, GENERAL_RECORD_MAINT) active1 = null if("del_all") if(PDA_Manifest) PDA_Manifest.Cut() for(var/datum/data/record/R in data_core.general) qdel(R) set_temp("All employment records deleted.") if("del_r") if(PDA_Manifest) PDA_Manifest.Cut() if(active1) for(var/datum/data/record/R in data_core.medical) if ((R.fields["name"] == active1.fields["name"] || R.fields["id"] == active1.fields["id"])) qdel(R) set_temp("Employment record deleted.") QDEL_NULL(active1) if("d_rec") var/datum/data/record/general_record = locate(params["d_rec"] || "") if(!data_core.general.Find(general_record)) set_temp("Record not found.", "danger") return active1 = general_record screen = GENERAL_RECORD_DATA if("new") if(PDA_Manifest) PDA_Manifest.Cut() active1 = data_core.CreateGeneralRecord() screen = GENERAL_RECORD_DATA set_temp("Employment record created.", "success") if("del_c") var/index = text2num(params["del_c"] || "") if(!index || !istype(active1, /datum/data/record)) return <<<<<<< HEAD var/list/comments = active1.fields["comments"] index = clamp(index, 1, length(comments)) if(comments[index]) comments.Cut(index, index + 1) if("print_p") if(!printing) printing = TRUE // playsound(loc, 'sound/goonstation/machines/printer_dotmatrix.ogg', 50, TRUE) SStgui.update_uis(src) addtimer(CALLBACK(src, .proc/print_finish), 5 SECONDS) else return FALSE ======= //FIELD FUNCTIONS if ("Edit Field") var/a1 = active1 switch(href_list["field"]) if("name") if (istype(active1, /datum/data/record)) var/t1 = sanitizeName(input("Please input name:", "Secure. records", active1.fields["name"], null) as text) if ((!( t1 ) || !length(trim(t1)) || !( authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon)))) || active1 != a1) return active1.fields["name"] = t1 if("id") if (istype(active1, /datum/data/record)) var/t1 = sanitize(input("Please input id:", "Secure. records", active1.fields["id"], null) as text) if ((!( t1 ) || !( authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || active1 != a1)) return active1.fields["id"] = t1 if("fingerprint") if (istype(active1, /datum/data/record)) var/t1 = sanitize(input("Please input fingerprint hash:", "Secure. records", active1.fields["fingerprint"], null) as text) if ((!( t1 ) || !( authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || active1 != a1)) return active1.fields["fingerprint"] = t1 if("sex") if (istype(active1, /datum/data/record)) if (active1.fields["sex"] == "Male") active1.fields["sex"] = "Female" else active1.fields["sex"] = "Male" if("age") if (istype(active1, /datum/data/record)) var/t1 = input("Please input age:", "Secure. records", active1.fields["age"], null) as num if ((!( t1 ) || !( authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || active1 != a1)) return active1.fields["age"] = t1 if("rank") var/list/L = list( "Head of Personnel", "Site Manager", "AI" ) //This was so silly before the change. Now it actually works without beating your head against the keyboard. /N if ((istype(active1, /datum/data/record) && L.Find(rank))) temp = "