From 99c7bbed55a6eb0c62a95bf4d6dfe967c72b4b1a Mon Sep 17 00:00:00 2001 From: Markolie Date: Mon, 10 Aug 2015 16:00:58 +0200 Subject: [PATCH] Add card skin descriptions, let agent ID's change photo, re-add photos and job blacklist update --- code/game/machinery/computer/card.dm | 93 ++++++-------------- code/game/objects/items/weapons/cards_ids.dm | 91 ++++++++++++++++++- nano/templates/identification_computer.tmpl | 4 +- 3 files changed, 116 insertions(+), 72 deletions(-) diff --git a/code/game/machinery/computer/card.dm b/code/game/machinery/computer/card.dm index e01706b3bb5..62629ca59ec 100644 --- a/code/game/machinery/computer/card.dm +++ b/code/game/machinery/computer/card.dm @@ -21,23 +21,23 @@ var/time_last_changed_position = 0 var/change_position_cooldown = 60 //Jobs you cannot open new positions for var/list/blacklisted = list( - "AI", - "Cyborg", - "Captain", - "Head of Personnel", - "Head of Security", - "Chief Engineer", - "Research Director", - "Chief Medical Officer", - "Magistrate", - "Blueshield", - "Nanotrasen Representative", - "Security Pod Pilot", - "Brig Physician", - "Mechanic", - "Barber", - "Civilian", - "Chaplain" + /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/civilian ) //The scaling factor of max total positions in relation to the total amount of people on board the station in % @@ -47,39 +47,6 @@ var/time_last_changed_position = 0 //Assoc array: "JobName" = (int) var/list/opened_positions = list(); - var/list/card_skins = list( - "data", - "id", - "gold", - "silver", - "security", - "medical", - "research", - "engineering", - "HoS", - "CMO", - "RD", - "CE", - "clown", - "mime", - "prisoner" - ) - var/list/centcom_card_skins = list( - "centcom", - "centcom_old", - "ERT_leader", - "ERT_empty", - "ERT_security", - "ERT_engineering", - "ERT_medical", - "ERT_janitorial", - "deathsquad", - "commander", - "syndie", - "TDred", - "TDgreen" - ) - /obj/machinery/computer/card/proc/is_centcom() return istype(src, /obj/machinery/computer/card/centcom) @@ -102,7 +69,7 @@ var/time_last_changed_position = 0 /obj/machinery/computer/card/proc/format_job_slots() var/list/formatted = list() for(var/datum/job/job in job_master.occupations) - if(job.title in blacklisted) + if(job_blacklisted(job)) continue formatted.Add(list(list( "title" = job.title, @@ -117,7 +84,7 @@ var/time_last_changed_position = 0 var/list/formatted = list() for(var/skin in card_skins) formatted.Add(list(list( - "display_name" = replacetext(skin, " ", " "), + "display_name" = get_skin_desc(skin), "skin" = skin))) return formatted @@ -162,14 +129,13 @@ var/time_last_changed_position = 0 attack_hand(user) //Check if you can't open a new position for a certain job -/obj/machinery/computer/card/proc/job_blacklisted(jobtitle) - return (jobtitle in blacklisted) - +/obj/machinery/computer/card/proc/job_blacklisted(datum/job/job) + return (job.type in blacklisted) //Logic check for Topic() if you can open the job /obj/machinery/computer/card/proc/can_open_job(datum/job/job) if(job) - if(!job_blacklisted(job.title)) + 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)) @@ -181,7 +147,7 @@ var/time_last_changed_position = 0 //Logic check for Topic() if you can close the job /obj/machinery/computer/card/proc/can_close_job(datum/job/job) if(job) - if(!job_blacklisted(job.title)) + 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)) @@ -229,7 +195,7 @@ var/time_last_changed_position = 0 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(card_skins) + data["card_skins"] = format_card_skins(get_station_card_skins()) data["job_slots"] = format_job_slots() @@ -251,14 +217,7 @@ var/time_last_changed_position = 0 "allowed" = (access in modify.access) ? 1 : 0))) data["all_centcom_access"] = all_centcom_access - - var/list/all_centcom_skins = list() - for(var/skin in centcom_card_skins) - all_centcom_skins.Add(list(list( - "display_name" = replacetext(skin, " ", " "), - "skin" = skin))) - - data["all_centcom_skins"] = all_centcom_skins + data["all_centcom_skins"] = format_card_skins(get_centcom_card_skins()) else if (modify) var/list/regions = list() @@ -336,7 +295,7 @@ var/time_last_changed_position = 0 if("skin") var/skin = href_list["skin_target"] - if(is_authenticated() && modify && ((skin in card_skins) || ((skin in centcom_card_skins) && is_centcom()))) + if(is_authenticated() && modify && ((skin in get_station_card_skins()) || ((skin in get_centcom_card_skins()) && is_centcom()))) modify.icon_state = href_list["skin_target"] if ("assign") diff --git a/code/game/objects/items/weapons/cards_ids.dm b/code/game/objects/items/weapons/cards_ids.dm index 296ca45debb..6322947feae 100644 --- a/code/game/objects/items/weapons/cards_ids.dm +++ b/code/game/objects/items/weapons/cards_ids.dm @@ -123,10 +123,16 @@ usr << "It is too far away." /obj/item/weapon/card/id/proc/show(mob/user as mob) + if(!front) + front = new(photo, dir = SOUTH) + if(!side) + side = new(photo, dir = WEST) + user << browse_rsc(front, "front.png") + user << browse_rsc(side, "side.png") var/datum/browser/popup = new(user, "idcard", name, 600, 400) popup.set_content(dat) + popup.set_title_image(usr.browse_rsc_icon(src.icon, src.icon_state)) popup.open() - return /obj/item/weapon/card/id/attack_self(mob/user as mob) @@ -158,7 +164,8 @@ dat += text("Fingerprint: []
\n", fingerprint_hash) dat += text("Blood Type: []
\n", blood_type) dat += text("DNA Hash: []

\n", dna_hash) - dat += "" + dat +="Photo:
\ + " /obj/item/weapon/card/id/GetAccess() return access @@ -217,6 +224,30 @@ usr << "The card's microscanners activate as you pass it over \the [I], copying its access." src.access |= I.access //Don't copy access if user isn't an antag -- to prevent metagaming +/obj/item/weapon/card/id/syndicate/proc/fake_id_photo(var/mob/living/carbon/human/H, var/side=0)//get_id_photo wouldn't work correctly + if(!istype(H)) + return + var/storedDir = H.dir //don't want to lose track of this + + var/icon/faked + if(!side) + if(!H.equip_to_slot_if_possible(src, slot_l_store, 0, 1)) + H << "You need to empty your pockets before taking the ID picture." + return + + if(side) + H.dir = WEST //ensure the icon is actually the proper direction before copying it + faked = getFlatIcon(H) + H.dir = storedDir //reset the user back to their original direction, not even noticable they changed + H.equip_to_slot_if_possible(src, slot_l_hand, 0, 1) + + else + H.dir = SOUTH + faked = getFlatIcon(H) + H.dir = storedDir + + return faked + /obj/item/weapon/card/id/syndicate/attack_self(mob/user as mob) if(!src.registered_name) var t = reject_bad_name(input(user, "What name would you like to use on this card?", "Agent Card name", ishuman(user) ? user.real_name : user.name)) @@ -242,7 +273,7 @@ if("Show") return ..() if("Edit") - switch(input(user,"What would you like to edit on \the [src]?") in list("Name","Appearance","Sex","Age","Occupation","Money Account","Blood Type","DNA Hash","Fingerprint Hash","Reset Card")) + switch(input(user,"What would you like to edit on \the [src]?") in list("Name","Photo","Appearance","Sex","Age","Occupation","Money Account","Blood Type","DNA Hash","Fingerprint Hash","Reset Card")) if("Name") var/new_name = reject_bad_name(input(user,"What name would you like to put on this card?","Agent Card Name", ishuman(user) ? user.real_name : user.name)) if(!Adjacent(user)) @@ -251,6 +282,16 @@ UpdateName() user << "Name changed to [new_name]." + if("Photo") + if(!Adjacent(user)) + return + photo = fake_id_photo(user) + var/icon/photoside = fake_id_photo(user,1) + front = new(photo) + side = new(photoside) + if(photo && photoside) + user << "Photo changed." + if("Appearance") var/list/appearances = list( "data", @@ -598,3 +639,47 @@ decal_desc = "It's a card with a magnetic strip attached to some circuitry." decal_icon_state = "emag" override_name = 1 + +/proc/get_station_card_skins() + return list("data","id","gold","silver","security","medical","research","engineering","HoS","CMO","RD","CE","clown","mime","prisoner") + +/proc/get_centcom_card_skins() + return list("centcom","centcom_old","ERT_leader","ERT_empty","ERT_security","ERT_engineering","ERT_medical","ERT_janitorial","deathsquad","commander","syndie","TDred","TDgreen") + +/proc/get_all_card_skins() + return get_station_card_skins() + get_centcom_card_skins() + +/proc/get_skin_desc(skin) + switch(skin) + if("id") + return "Standard" + if("HoS") + return "Head of Security" + if("CMO") + return "Chief Medical Officer" + if("RD") + return "Research Director" + if("CE") + return "Chief Engineer" + if("centcom_old") + return "Centcom Old" + if("ERT_leader") + return "ERT Leader" + if("ERT_empty") + return "ERT Default" + if("ERT_security") + return "ERT Security" + if("ERT_engineering") + return "ERT Engineering" + if("ERT_medical") + return "ERT Medical" + if("ERT_janitorial") + return "ERT Janitorial" + if("syndie") + return "Syndicate" + if("TDred") + return "Thunderdome Red" + if("TDgreen") + return "Thunderdome Green" + else + return capitalize(skin) \ No newline at end of file diff --git a/nano/templates/identification_computer.tmpl b/nano/templates/identification_computer.tmpl index 7344e740efd..f6739383633 100644 --- a/nano/templates/identification_computer.tmpl +++ b/nano/templates/identification_computer.tmpl @@ -39,8 +39,8 @@ {{for data.job_slots}}
{{:value.title}}: {{:value.current_positions}}/{{:value.total_positions}} - {{:helper.link('', 'minus', {'choice' : 'make_job_unavailable', 'job' : value.title}, value.can_close == 1 && data.authenticated ? null : 'disabled')}} - {{:helper.link('', 'plus', {'choice' : 'make_job_available', 'job' : value.title}, value.can_open == 1 && data.authenticated ? null : 'disabled')}} + {{:helper.link('-', null, {'choice' : 'make_job_unavailable', 'job' : value.title}, value.can_close == 1 && data.authenticated ? null : 'disabled')}} + {{:helper.link('+', null, {'choice' : 'make_job_available', 'job' : value.title}, value.can_open == 1 && data.authenticated ? null : 'disabled')}}
{{/for}}