From 8814ec945e42f43c2814862df9011e326e1915cf Mon Sep 17 00:00:00 2001 From: vode-code <65709050+vode-code@users.noreply.github.com> Date: Fri, 1 Dec 2023 09:45:24 -0800 Subject: [PATCH] adds random ID card to maint (#8360) * added random assistant card refactored random wallet population added random assistant card to random wallet population * minor readability update Co-authored-by: Firefox13 <57810301+Firefox13@users.noreply.github.com> * redundant variable removed * whitespace --------- Co-authored-by: Firefox13 <57810301+Firefox13@users.noreply.github.com> --- code/game/objects/items/weapons/cards_ids.dm | 23 +++++++++++++++++++ .../objects/items/weapons/storage/wallets.dm | 19 +++++++-------- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/code/game/objects/items/weapons/cards_ids.dm b/code/game/objects/items/weapons/cards_ids.dm index eedc9602b6c..c501c1e652e 100644 --- a/code/game/objects/items/weapons/cards_ids.dm +++ b/code/game/objects/items/weapons/cards_ids.dm @@ -329,3 +329,26 @@ var/const/NO_EMAG_ACT = -50 /obj/item/card/id/blankwhite icon_state = "id_blankwhite" + +/obj/item/card/id/randomassistant + +/obj/item/card/id/randomassistant/examine(mob/user) + if("\[UNSET\]" != blood_type) // we have to call the parent only if the variables are loaded or else these variables will only appear after the first examine + return ..() + dna_hash = sha1("A"+registered_name) // something is subtly wrong with these IDs + fingerprint_hash = md5("A"+registered_name) + blood_type = pick(GLOB.blood_types) + . = ..() + +/obj/item/card/id/randomassistant/Initialize() + . = ..() + age = num2text(max(18, rand(1, 50)+rand(1,50))) + var/datum/job_flavor/flavortype = pick(subtypesof(/datum/job_flavor/assistant)) + assignment = initial(flavortype.title) + access = list(access_maint_tunnels) + var/csex = pick(MALE, FEMALE) + sex = capitalize(csex) + var/theoretical_first_name = random_first_name(csex) + var/theoretical_last_name = random_last_name() + registered_name = addtext(theoretical_first_name, " ", theoretical_last_name) // is this faster than two concats? probably! + update_name() diff --git a/code/game/objects/items/weapons/storage/wallets.dm b/code/game/objects/items/weapons/storage/wallets.dm index 08c3946f638..4fbe7fa18fe 100644 --- a/code/game/objects/items/weapons/storage/wallets.dm +++ b/code/game/objects/items/weapons/storage/wallets.dm @@ -81,15 +81,12 @@ return ..() /obj/item/storage/wallet/random/populate_contents() - var/item1_type = pick(/obj/item/spacecash/bundle/c10,/obj/item/spacecash/bundle/c100,/obj/item/spacecash/bundle/c1000,/obj/item/spacecash/bundle/c20,/obj/item/spacecash/bundle/c200,/obj/item/spacecash/bundle/c50,/obj/item/spacecash/bundle/c500) - var/item2_type + var/to_add = pick(/obj/item/spacecash/bundle/c10,/obj/item/spacecash/bundle/c100,/obj/item/spacecash/bundle/c1000,/obj/item/spacecash/bundle/c20,/obj/item/spacecash/bundle/c200,/obj/item/spacecash/bundle/c50,/obj/item/spacecash/bundle/c500) + new to_add(src) if(prob(50)) - item2_type = pick(/obj/item/spacecash/bundle/c10,/obj/item/spacecash/bundle/c100,/obj/item/spacecash/bundle/c1000,/obj/item/spacecash/bundle/c20,/obj/item/spacecash/bundle/c200,/obj/item/spacecash/bundle/c50,/obj/item/spacecash/bundle/c500) - var/item3_type = pick(/obj/item/coin/silver, /obj/item/coin/silver, /obj/item/coin/gold, /obj/item/coin/iron, /obj/item/coin/iron, /obj/item/coin/iron) - - if(item1_type) - new item1_type(src) - if(item2_type) - new item2_type(src) - if(item3_type) - new item3_type(src) + to_add = pick(/obj/item/spacecash/bundle/c10,/obj/item/spacecash/bundle/c100,/obj/item/spacecash/bundle/c1000,/obj/item/spacecash/bundle/c20,/obj/item/spacecash/bundle/c200,/obj/item/spacecash/bundle/c50,/obj/item/spacecash/bundle/c500) + new to_add(src) + to_add = pick(/obj/item/coin/silver, /obj/item/coin/silver, /obj/item/coin/gold, /obj/item/coin/iron, /obj/item/coin/iron, /obj/item/coin/iron) + new to_add(src) + if(prob(20)) + new /obj/item/card/id/randomassistant(src)