diff --git a/code/game/jobs/access.dm b/code/game/jobs/access.dm index deff61f50a7..b7abbce7e79 100644 --- a/code/game/jobs/access.dm +++ b/code/game/jobs/access.dm @@ -414,29 +414,45 @@ /proc/get_all_centcom_jobs() return list("VIP Guest","Custodian","Thunderdome Overseer","Intel Officer","Medical Officer","Death Commando","Research Officer","BlackOps Commander","Supreme Commander") -/obj/proc/GetJobName() +//gets the actual job rank (ignoring alt titles) +//this is used solely for sechuds +/obj/proc/GetJobRealName() if (!istype(src, /obj/item/device/pda) && !istype(src,/obj/item/weapon/card/id)) return - var/jobName - var/realJobName - - // hack for alt titles - if(istype(loc, /mob)) - var/mob/M = loc - if(M.mind && M.mind.role_alt_title == jobName && M.mind.assigned_role in get_all_jobs()) - return M.mind.assigned_role - + var/rank + var/assignment if(istype(src, /obj/item/device/pda)) if(src:id) - jobName = src:id:assignment - realJobName = src:id:assignment_real_title - if(istype(src, /obj/item/weapon/card/id)) - jobName = src:assignment - realJobName = src:assignment_real_title + rank = src:id:rank + assignment = src:id:assignment + else if(istype(src, /obj/item/weapon/card/id)) + rank = src:rank + assignment = src:assignment - if( (realJobName in get_all_jobs()) || (jobName in get_all_jobs()) ) - return jobName + if( rank in get_all_jobs() ) + return rank + + if( assignment in get_all_jobs() ) + return assignment + + return "Unknown" + +//gets the alt title, failing that the actual job rank +//this is unused +/obj/proc/sdsdsd() //GetJobDisplayName + if (!istype(src, /obj/item/device/pda) && !istype(src,/obj/item/weapon/card/id)) + return + + var/assignment + if(istype(src, /obj/item/device/pda)) + if(src:id) + assignment = src:id:assignment + else if(istype(src, /obj/item/weapon/card/id)) + assignment = src:assignment + + if(assignment) + return assignment return "Unknown" diff --git a/code/game/jobs/job_controller.dm b/code/game/jobs/job_controller.dm index 137d725c721..dd1c2c0f48f 100644 --- a/code/game/jobs/job_controller.dm +++ b/code/game/jobs/job_controller.dm @@ -38,8 +38,8 @@ var/global/datum/controller/occupations/job_master if(J.title == rank) return J return null - proc/GetAltTitle(mob/new_player/player, rank) - return player.client.prefs.GetAltTitle(GetJob(rank)) + proc/GetPlayerAltTitle(mob/new_player/player, rank) + return player.client.prefs.GetPlayerAltTitle(GetJob(rank)) proc/AssignRole(var/mob/new_player/player, var/rank, var/latejoin = 0) Debug("Running AR, Player: [player], Rank: [rank], LJ: [latejoin]") @@ -53,7 +53,7 @@ var/global/datum/controller/occupations/job_master if((job.current_positions < position_limit) || position_limit == -1) Debug("Player: [player] is now Rank: [rank], JCP:[job.current_positions], JPL:[position_limit]") player.mind.assigned_role = rank - player.mind.role_alt_title = GetAltTitle(player, rank) + player.mind.role_alt_title = GetPlayerAltTitle(player, rank) unassigned -= player job.current_positions++ return 1 @@ -299,9 +299,6 @@ var/global/datum/controller/occupations/job_master H << "Your job is [rank] and the game just can't handle it! Please report this bug to an administrator." H.job = rank - if(H.mind && H.mind.assigned_role != rank) - H.mind.assigned_role = rank - H.mind.role_alt_title = null if(!joined_late) var/obj/S = null @@ -319,6 +316,7 @@ var/global/datum/controller/occupations/job_master if(H.mind) H.mind.assigned_role = rank + H.mind.role_alt_title = null switch(rank) if("Cyborg") @@ -347,10 +345,7 @@ var/global/datum/controller/occupations/job_master if(job.req_admin_notify) H << "You are playing a job that is important for Game Progression. If you have to disconnect, please notify the admins via adminhelp." - if(H.mind.assigned_role == rank && H.mind.role_alt_title) - spawnId(H, rank, H.mind.role_alt_title) - else - spawnId(H,rank) + spawnId(H, rank, H.mind.role_alt_title) H.equip_to_slot_or_del(new /obj/item/device/radio/headset(H), slot_ears) // H.update_icons() return 1 @@ -358,7 +353,6 @@ var/global/datum/controller/occupations/job_master proc/spawnId(var/mob/living/carbon/human/H, rank, title) if(!H) return 0 - if(!title) title = rank var/obj/item/weapon/card/id/C = null var/datum/job/job = null @@ -377,7 +371,8 @@ var/global/datum/controller/occupations/job_master C = new /obj/item/weapon/card/id(H) if(C) C.registered_name = H.real_name - C.assignment = title + C.rank = rank + C.assignment = title ? title : rank C.name = "[C.registered_name]'s ID Card ([C.assignment])" H.equip_to_slot_or_del(C, slot_wear_id) H.equip_to_slot_or_del(new /obj/item/device/pda(H), slot_belt) diff --git a/code/game/machinery/computer/card.dm b/code/game/machinery/computer/card.dm index fc422d6d874..a32e9ea1343 100644 --- a/code/game/machinery/computer/card.dm +++ b/code/game/machinery/computer/card.dm @@ -232,8 +232,9 @@ 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) - if(temp_t) - t1 = temp_t + //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)) @@ -246,8 +247,9 @@ return modify.access = ( istype(src,/obj/machinery/computer/card/centcom) ? get_centcom_access(t1) : jobdatum.get_access() ) - if (modify) - modify.assignment = t1 + if (modify) + modify.assignment = t1 + modify.rank = t1 if ("reg") if (authenticated) var/t2 = modify diff --git a/code/game/objects/items/weapons/cards_ids.dm b/code/game/objects/items/weapons/cards_ids.dm index 0ebd8ed7a02..028b5c93f6b 100644 --- a/code/game/objects/items/weapons/cards_ids.dm +++ b/code/game/objects/items/weapons/cards_ids.dm @@ -74,8 +74,9 @@ var/dna_hash = "\[UNSET\]" var/fingerprint_hash = "\[UNSET\]" - var/assignment = null - var/assignment_real_title = null + //alt titles are handled a bit weirdly in order to unobtrusively integrate into existing ID system + var/assignment = null //can be alt title or the actual job + var/rank = null //actual job var/dorm = 0 // determines if this ID has claimed a dorm already /obj/item/weapon/card/id/attack_self(mob/user as mob) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 55259f65f03..df468ca1b62 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -91,7 +91,7 @@ datum/preferences // will probably not be able to do this for head and torso ;) var/list/organ_data = list() - var/list/job_alt_titles = new() // the default name of a job like "Medical Doctor" + var/list/player_alt_titles = new() // the default name of a job like "Medical Doctor" var/flavor_text = "" var/med_record = "" @@ -425,7 +425,7 @@ datum/preferences else HTML += " \[NEVER]" if(job.alt_titles) - HTML += "
\[[GetAltTitle(job)]\]" + HTML += "
\[[GetPlayerAltTitle(job)]\]" HTML += "" HTML += "" @@ -487,18 +487,18 @@ datum/preferences user << browse(HTML, "window=records;size=350x300") return - proc/GetAltTitle(datum/job/job) - return job_alt_titles.Find(job.title) > 0 \ - ? job_alt_titles[job.title] \ + proc/GetPlayerAltTitle(datum/job/job) + return player_alt_titles.Find(job.title) > 0 \ + ? player_alt_titles[job.title] \ : job.title - proc/SetAltTitle(datum/job/job, new_title) + proc/SetPlayerAltTitle(datum/job/job, new_title) // remove existing entry - if(job_alt_titles.Find(job.title)) - job_alt_titles -= job.title + if(player_alt_titles.Find(job.title)) + player_alt_titles -= job.title // add one if it's not default if(job.title != new_title) - job_alt_titles[job.title] = new_title + player_alt_titles[job.title] = new_title proc/SetJob(mob/user, role) var/datum/job/job = job_master.GetJob(role) @@ -638,9 +638,9 @@ datum/preferences var/datum/job/job = locate(href_list["job"]) if (job) var/choices = list(job.title) + job.alt_titles - var/choice = input("Pick a title for [job.title].", "Character Generation", GetAltTitle(job)) as anything in choices | null + var/choice = input("Pick a title for [job.title].", "Character Generation", GetPlayerAltTitle(job)) as anything in choices | null if(choice) - SetAltTitle(job, choice) + SetPlayerAltTitle(job, choice) SetChoices(user) if("input") SetJob(user, href_list["text"]) diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index fd1ec7ec714..80d5e718df0 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -138,7 +138,7 @@ S["sec_record"] >> sec_record S["be_special"] >> be_special S["disabilities"] >> disabilities - S["job_alt_titles"] >> job_alt_titles + S["player_alt_titles"] >> player_alt_titles S["used_skillpoints"] >> used_skillpoints S["skills"] >> skills S["skill_specialization"] >> skill_specialization @@ -182,7 +182,7 @@ if(!skills) skills = list() if(!used_skillpoints) used_skillpoints= 0 if(isnull(disabilities)) disabilities = 0 - if(!job_alt_titles) job_alt_titles = new() + if(!player_alt_titles) player_alt_titles = new() if(!organ_data) src.organ_data = list() //if(!skin_style) skin_style = "Default" @@ -232,7 +232,7 @@ S["flavor_text"] << flavor_text S["med_record"] << med_record S["sec_record"] << sec_record - S["job_alt_titles"] << job_alt_titles + S["player_alt_titles"] << player_alt_titles S["be_special"] << be_special S["used_skillpoints"] << used_skillpoints S["skills"] << skills diff --git a/code/modules/clothing/glasses/hud.dm b/code/modules/clothing/glasses/hud.dm index c1664274041..18d20cbc855 100644 --- a/code/modules/clothing/glasses/hud.dm +++ b/code/modules/clothing/glasses/hud.dm @@ -83,14 +83,13 @@ var/icon/tempHud = 'icons/mob/hud.dmi' for(var/mob/living/carbon/human/perp in view(M)) if(!C) continue - var/perpname = "wot" + var/perpname = perp.name if(perp.wear_id) var/obj/item/weapon/card/id/I = perp.wear_id.GetID() if(I) - C.images += image(tempHud, perp, "hud[ckey(I.GetJobName())]") + C.images += image(tempHud, perp, "hud[ckey(I.GetJobRealName())]") perpname = I.registered_name else - perpname = perp.name C.images += image(tempHud, perp, "hudunknown") for(var/datum/data/record/E in data_core.general) diff --git a/code/modules/mob/living/carbon/human/hud.dm b/code/modules/mob/living/carbon/human/hud.dm index b5c06386d2f..59961e34f95 100644 --- a/code/modules/mob/living/carbon/human/hud.dm +++ b/code/modules/mob/living/carbon/human/hud.dm @@ -629,7 +629,7 @@ Radar-related things var/mob/living/M = A if(ishuman(M)) if(M:wear_id) - var/job = M:wear_id:GetJobName() + var/job = M:wear_id:GetJobRealName() if(job == "Security Officer") blip.icon_state = "secblip" blip.name = "Security Officer" diff --git a/code/modules/mob/living/silicon/pai/hud.dm b/code/modules/mob/living/silicon/pai/hud.dm index d2f96656d6d..c900ef60a86 100644 --- a/code/modules/mob/living/silicon/pai/hud.dm +++ b/code/modules/mob/living/silicon/pai/hud.dm @@ -10,7 +10,7 @@ var/turf/T = get_turf_or_move(src.loc) for(var/mob/living/carbon/human/perp in view(T)) if(perp.wear_id) - client.images += image(tempHud,perp,"hud[ckey(perp:wear_id:GetJobName())]") + client.images += image(tempHud,perp,"hud[ckey(perp:wear_id:GetJobRealName())]") var/perpname = "wot" if(istype(perp.wear_id,/obj/item/weapon/card/id)) perpname = perp.wear_id:registered_name