mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-28 22:47:59 +01:00
Wallets now show proper jobs on Sechuds and Comms (#20089)
* Wallet time * sirryan review * whoops * revert get_id_card change * Farie review
This commit is contained in:
@@ -220,7 +220,7 @@
|
||||
var/image/holder = hud_list[ID_HUD]
|
||||
holder.icon_state = "hudunknown"
|
||||
if(wear_id)
|
||||
holder.icon_state = "hud[ckey(wear_id.GetJobName())]"
|
||||
holder.icon_state = "hud[ckey(wear_id.get_job_name())]"
|
||||
sec_hud_set_security_status()
|
||||
|
||||
|
||||
|
||||
@@ -20,12 +20,6 @@
|
||||
else
|
||||
return check_access_list(acc)
|
||||
|
||||
/obj/item/proc/GetAccess()
|
||||
return list()
|
||||
|
||||
/obj/item/proc/GetID()
|
||||
return null
|
||||
|
||||
/obj/proc/generate_req_lists()
|
||||
//These generations have been moved out of /obj/New() because they were slowing down the creation of objects that never even used the access system.
|
||||
if(!req_access)
|
||||
@@ -406,106 +400,9 @@
|
||||
/proc/get_all_solgov_jobs()
|
||||
return list("Solar Federation Lieutenant","Solar Federation Specops Lieutenant","Solar Federation Marine","Solar Federation Specops Marine","Solar Federation Representative","Sol Trader","Solar Federation General")
|
||||
|
||||
//gets the actual job rank (ignoring alt titles)
|
||||
//this is used solely for sechuds
|
||||
/obj/proc/GetJobRealName()
|
||||
if(!istype(src, /obj/item/pda) && !istype(src,/obj/item/card/id))
|
||||
return
|
||||
|
||||
var/rank
|
||||
var/assignment
|
||||
if(istype(src, /obj/item/pda))
|
||||
if(src:id)
|
||||
rank = src:id:rank
|
||||
assignment = src:id:assignment
|
||||
else if(istype(src, /obj/item/card/id))
|
||||
rank = src:rank
|
||||
assignment = src:assignment
|
||||
|
||||
if( rank in GLOB.joblist )
|
||||
return rank
|
||||
|
||||
if( assignment in GLOB.joblist )
|
||||
return assignment
|
||||
|
||||
return "Unknown"
|
||||
|
||||
|
||||
/proc/GetIdCard(mob/living/carbon/human/H)
|
||||
if(H.wear_id)
|
||||
var/id = H.wear_id.GetID()
|
||||
if(id)
|
||||
return id
|
||||
if(H.get_active_hand())
|
||||
var/obj/item/I = H.get_active_hand()
|
||||
return I.GetID()
|
||||
|
||||
/proc/FindNameFromID(mob/living/carbon/human/H)
|
||||
ASSERT(istype(H))
|
||||
var/obj/item/card/id/C = H.get_active_hand()
|
||||
if( istype(C) || istype(C, /obj/item/pda) )
|
||||
var/obj/item/card/id/ID = C
|
||||
|
||||
if( istype(C, /obj/item/pda) )
|
||||
var/obj/item/pda/pda = C
|
||||
ID = pda.id
|
||||
if(!istype(ID))
|
||||
ID = null
|
||||
|
||||
if(ID)
|
||||
return ID.registered_name
|
||||
|
||||
C = H.wear_id
|
||||
|
||||
if( istype(C) || istype(C, /obj/item/pda) )
|
||||
var/obj/item/card/id/ID = C
|
||||
|
||||
if( istype(C, /obj/item/pda) )
|
||||
var/obj/item/pda/pda = C
|
||||
ID = pda.id
|
||||
if(!istype(ID))
|
||||
ID = null
|
||||
|
||||
if(ID)
|
||||
return ID.registered_name
|
||||
|
||||
/proc/get_all_job_icons() //For all existing HUD icons
|
||||
return GLOB.joblist + get_all_ERT_jobs() + list("Prisoner")
|
||||
|
||||
/obj/proc/GetJobName() //Used in secHUD icon generation
|
||||
var/assignmentName = "Unknown"
|
||||
var/rankName = "Unknown"
|
||||
if(istype(src, /obj/item/pda))
|
||||
var/obj/item/pda/P = src
|
||||
assignmentName = P.ownjob
|
||||
rankName = P.ownrank
|
||||
else if(istype(src, /obj/item/card/id))
|
||||
var/obj/item/card/id/I = src
|
||||
assignmentName = I.assignment
|
||||
rankName = I.rank
|
||||
|
||||
|
||||
var/job_icons = get_all_job_icons()
|
||||
var/centcom = get_all_centcom_jobs()
|
||||
var/solgov = get_all_solgov_jobs()
|
||||
|
||||
if(assignmentName in centcom) //Return with the NT logo if it is a Centcom job
|
||||
return "Centcom"
|
||||
if(rankName in centcom)
|
||||
return "Centcom"
|
||||
|
||||
if(assignmentName in solgov) //Return with the SolGov logo if it is a SolGov job
|
||||
return "solgov"
|
||||
if(rankName in solgov)
|
||||
return "solgov"
|
||||
|
||||
if(assignmentName in job_icons) //Check if the job has a hud icon
|
||||
return assignmentName
|
||||
if(rankName in job_icons)
|
||||
return rankName
|
||||
|
||||
return "Unknown" //Return unknown if none of the above apply
|
||||
|
||||
/proc/get_accesslist_static_data(num_min_region = REGION_GENERAL, num_max_region = REGION_COMMAND)
|
||||
var/list/retval
|
||||
for(var/i in num_min_region to num_max_region)
|
||||
|
||||
@@ -376,7 +376,7 @@
|
||||
return threatcount
|
||||
|
||||
//Agent cards lower threatlevel.
|
||||
var/obj/item/card/id/id = GetIdCard(perp)
|
||||
var/obj/item/card/id/id = perp.get_id_card()
|
||||
if(id && istype(id, /obj/item/card/id/syndicate))
|
||||
threatcount -= 2
|
||||
// A proper CentCom id is hard currency.
|
||||
|
||||
@@ -818,3 +818,44 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons
|
||||
/// Called on cyborg items that need special charging behavior. Override as needed for specific items.
|
||||
/obj/item/proc/cyborg_recharge(coeff = 1, emagged = FALSE)
|
||||
return
|
||||
|
||||
// Access and Job stuff
|
||||
|
||||
/obj/item/proc/get_job_name() //Used in secHUD icon generation
|
||||
var/assignmentName = get_ID_assignment(if_no_id = "Unknown")
|
||||
var/rankName = get_ID_rank(if_no_id = "Unknown")
|
||||
|
||||
var/static/list/job_icons = get_all_job_icons()
|
||||
var/static/list/centcom = get_all_centcom_jobs()
|
||||
var/static/list/solgov = get_all_solgov_jobs()
|
||||
|
||||
if((assignmentName in centcom) || (rankName in centcom)) //Return with the NT logo if it is a Centcom job
|
||||
return "Centcom"
|
||||
|
||||
if((assignmentName in solgov) || (rankName in solgov)) //Return with the SolGov logo if it is a SolGov job
|
||||
return "solgov"
|
||||
|
||||
if(assignmentName in job_icons) //Check if the job has a hud icon
|
||||
return assignmentName
|
||||
if(rankName in job_icons)
|
||||
return rankName
|
||||
|
||||
return "Unknown" //Return unknown if none of the above apply
|
||||
|
||||
/obj/item/proc/get_ID_assignment(if_no_id = "No id")
|
||||
var/obj/item/card/id/id = GetID()
|
||||
if(istype(id)) // Make sure its actually an ID
|
||||
return id.assignment
|
||||
return if_no_id
|
||||
|
||||
/obj/item/proc/get_ID_rank(if_no_id = "No id")
|
||||
var/obj/item/card/id/id = GetID()
|
||||
if(istype(id)) // Make sure its actually an ID
|
||||
return id.rank
|
||||
return if_no_id
|
||||
|
||||
/obj/item/proc/GetAccess()
|
||||
return list()
|
||||
|
||||
/obj/item/proc/GetID()
|
||||
return null
|
||||
|
||||
@@ -34,19 +34,30 @@
|
||||
var/obj/item/card/id/front_id = null
|
||||
|
||||
|
||||
/obj/item/storage/wallet/remove_from_storage(obj/item/W as obj, atom/new_location)
|
||||
. = ..(W, new_location)
|
||||
if(.)
|
||||
if(W == front_id)
|
||||
front_id = null
|
||||
update_icon(UPDATE_ICON_STATE)
|
||||
/obj/item/storage/wallet/remove_from_storage(obj/item/I, atom/new_location)
|
||||
. = ..()
|
||||
if(. && istype(I, /obj/item/card/id))
|
||||
refresh_ID()
|
||||
|
||||
/obj/item/storage/wallet/handle_item_insertion(obj/item/W as obj, prevent_warning = 0)
|
||||
. = ..(W, prevent_warning)
|
||||
if(.)
|
||||
if(!front_id && istype(W, /obj/item/card/id))
|
||||
front_id = W
|
||||
update_icon(UPDATE_ICON_STATE)
|
||||
/obj/item/storage/wallet/handle_item_insertion(obj/item/I, prevent_warning = FALSE)
|
||||
. = ..()
|
||||
if(. && istype(I, /obj/item/card/id))
|
||||
refresh_ID()
|
||||
|
||||
/obj/item/storage/wallet/orient2hud(mob/user)
|
||||
. = ..()
|
||||
refresh_ID()
|
||||
|
||||
/obj/item/storage/wallet/proc/refresh_ID()
|
||||
// Locate the first ID in the wallet
|
||||
front_id = (locate(/obj/item/card/id) in contents)
|
||||
|
||||
if(ishuman(loc))
|
||||
var/mob/living/carbon/human/wearing_human = loc
|
||||
if(wearing_human.wear_id == src)
|
||||
wearing_human.sec_hud_set_ID()
|
||||
|
||||
update_icon(UPDATE_ICON_STATE)
|
||||
|
||||
/obj/item/storage/wallet/update_icon_state()
|
||||
if(front_id)
|
||||
|
||||
Reference in New Issue
Block a user