Merge pull request #14489 from LetterN/amogus

Fixes NIRM
This commit is contained in:
Lin
2021-03-22 15:37:56 -05:00
committed by GitHub
4 changed files with 98 additions and 47 deletions
@@ -80,16 +80,25 @@
name = "private crate"
desc = "A crate cover designed to only open for who purchased its contents."
icon_state = "privatecrate"
///Account of the person buying the crate if private purchasing.
var/datum/bank_account/buyer_account
///Department of the person buying the crate if buying via the NIRN app.
var/datum/bank_account/department/department_account
///Is the secure crate opened or closed?
var/privacy_lock = TRUE
///Is the crate being bought by a person, or a budget card?
var/department_purchase = FALSE
/obj/structure/closet/crate/secure/owned/examine(mob/user)
. = ..()
to_chat(user, "<span class='notice'>It's locked with a privacy lock, and can only be unlocked by the buyer's ID.</span>")
. += "<span class='notice'>It's locked with a privacy lock, and can only be unlocked by the buyer's ID.</span>"
/obj/structure/closet/crate/secure/owned/Initialize(mapload, datum/bank_account/_buyer_account)
. = ..()
buyer_account = _buyer_account
if(istype(buyer_account, /datum/bank_account/department))
department_purchase = TRUE
department_account = buyer_account
/obj/structure/closet/crate/secure/owned/togglelock(mob/living/user, silent)
if(privacy_lock)
@@ -97,7 +106,7 @@
var/obj/item/card/id/id_card = user.get_idcard(TRUE)
if(id_card)
if(id_card.registered_account)
if(id_card.registered_account == buyer_account)
if(id_card.registered_account == buyer_account || (department_purchase && (id_card.registered_account?.account_job?.paycheck_department) == (department_account.department_id)))
if(iscarbon(user))
add_fingerprint(user)
locked = !locked