Skip to content

Commit

Permalink
adds random ID card to maint (#8360)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
vode-code and Firefox13 authored Dec 1, 2023
1 parent d75bd7c commit 8814ec9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
23 changes: 23 additions & 0 deletions code/game/objects/items/weapons/cards_ids.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
19 changes: 8 additions & 11 deletions code/game/objects/items/weapons/storage/wallets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 8814ec9

Please sign in to comment.