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:
Contrabang
2023-01-18 21:52:09 -06:00
committed by GitHub
parent ea7bff0779
commit 276bf58f49
8 changed files with 122 additions and 146 deletions
+41
View File
@@ -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)