mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-21 15:51:31 +00: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:
@@ -49,6 +49,8 @@
|
||||
|
||||
#define is_pen(W) (istype(W, /obj/item/pen) || istype(W, /obj/item/flashlight/pen))
|
||||
|
||||
#define is_pda(W) (istype(W, /obj/item/pda))
|
||||
|
||||
#define isspacecash(W) (istype(W, /obj/item/stack/spacecash))
|
||||
|
||||
#define isstorage(A) (istype(A, /obj/item/storage))
|
||||
|
||||
@@ -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,18 +34,29 @@
|
||||
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/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()
|
||||
|
||||
/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/update_icon_state()
|
||||
|
||||
@@ -430,39 +430,45 @@
|
||||
else
|
||||
return if_no_id
|
||||
|
||||
//gets assignment from ID or ID inside PDA or PDA itself
|
||||
//Useful when player do something with computers
|
||||
//gets assignment from ID, PDA, Wallet, etc.
|
||||
//This should not be relied on for authentication, because PDAs show their owner's job, even if an ID is not inserted
|
||||
/mob/living/carbon/human/proc/get_assignment(if_no_id = "No id", if_no_job = "No job")
|
||||
var/obj/item/pda/pda = wear_id
|
||||
var/obj/item/card/id/id = wear_id
|
||||
if(istype(pda))
|
||||
if(pda.id && istype(pda.id, /obj/item/card/id))
|
||||
. = pda.id.assignment
|
||||
else
|
||||
. = pda.ownjob
|
||||
else if(istype(id))
|
||||
. = id.assignment
|
||||
else
|
||||
if(!wear_id)
|
||||
return if_no_id
|
||||
if(!.)
|
||||
. = if_no_job
|
||||
return
|
||||
var/obj/item/card/id/id = wear_id.GetID()
|
||||
if(istype(id)) // Make sure its actually an ID
|
||||
if(!id.assignment)
|
||||
return if_no_job
|
||||
return id.assignment
|
||||
|
||||
//gets name from ID or ID inside PDA or PDA itself
|
||||
//Useful when player do something with computers
|
||||
/mob/living/carbon/human/proc/get_authentification_name(if_no_id = "Unknown")
|
||||
if(is_pda(wear_id))
|
||||
var/obj/item/pda/pda = wear_id
|
||||
var/obj/item/card/id/id = wear_id
|
||||
if(istype(pda))
|
||||
if(pda.id)
|
||||
. = pda.id.registered_name
|
||||
else
|
||||
. = pda.owner
|
||||
else if(istype(id))
|
||||
. = id.registered_name
|
||||
else
|
||||
return pda.ownjob
|
||||
|
||||
return if_no_id
|
||||
return
|
||||
|
||||
//gets name from ID, PDA, Wallet, etc.
|
||||
//This should not be relied on for authentication, because PDAs show their owner's name, even if an ID is not inserted
|
||||
/mob/living/carbon/human/proc/get_authentification_name(if_no_id = "Unknown")
|
||||
if(!wear_id)
|
||||
return if_no_id
|
||||
var/obj/item/card/id/id = wear_id.GetID()
|
||||
if(istype(id) && id.registered_name)
|
||||
return id.registered_name
|
||||
|
||||
if(is_pda(wear_id))
|
||||
var/obj/item/pda/pda = wear_id
|
||||
return pda.owner
|
||||
|
||||
return if_no_id
|
||||
|
||||
/mob/living/carbon/human/get_id_card(mob/living/carbon/human/H)
|
||||
var/obj/item/card/id/id = wear_id.GetID()
|
||||
if(istype(id)) // Make sure its actually an ID
|
||||
return id
|
||||
if(H.get_active_hand())
|
||||
var/obj/item/I = H.get_active_hand()
|
||||
return I.GetID()
|
||||
|
||||
//repurposed proc. Now it combines get_id_name() and get_face_name() to determine a mob's name variable. Made into a seperate proc as it'll be useful elsewhere
|
||||
/mob/living/carbon/human/get_visible_name(id_override = FALSE)
|
||||
|
||||
@@ -189,6 +189,11 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
id = null
|
||||
playsound(src, 'sound/machines/terminal_eject.ogg', 50, TRUE)
|
||||
|
||||
if(ishuman(loc))
|
||||
var/mob/living/carbon/human/wearing_human = loc
|
||||
if(wearing_human.wear_id == src)
|
||||
wearing_human.sec_hud_set_ID()
|
||||
|
||||
/obj/item/pda/verb/verb_remove_id()
|
||||
set category = "Object"
|
||||
set name = "Remove id"
|
||||
@@ -246,7 +251,11 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
id = I
|
||||
user.put_in_hands(old_id)
|
||||
playsound(src, 'sound/machines/pda_button1.ogg', 50, TRUE)
|
||||
return
|
||||
|
||||
if(ishuman(loc))
|
||||
var/mob/living/carbon/human/wearing_human = loc
|
||||
if(wearing_human.wear_id == src)
|
||||
wearing_human.sec_hud_set_ID()
|
||||
|
||||
/obj/item/pda/attackby(obj/item/C, mob/user, params)
|
||||
..()
|
||||
@@ -394,3 +403,13 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
var/datum/data/pda/utility/flashlight/FL = find_program(/datum/data/pda/utility/flashlight)
|
||||
if(FL && FL.fon)
|
||||
FL.start()
|
||||
|
||||
/obj/item/pda/get_ID_assignment(if_no_id = "No id")
|
||||
. = ..()
|
||||
if(. == if_no_id) // We dont have an ID in us, check our cached job
|
||||
return ownjob
|
||||
|
||||
/obj/item/pda/get_ID_rank(if_no_id = "No id")
|
||||
. = ..()
|
||||
if(. == if_no_id) // Ditto but rank
|
||||
return ownrank
|
||||
|
||||
Reference in New Issue
Block a user