Files
Bubberstation/code/game/objects/structures/crates_lockers/crates/secure.dm
ArcaneMusic 1b7189d63d Arcononomy: Personal Departmental Cargo Ordering (#53881)
Alright crew, here's the 4-11. This adds a new Modular Computer app, that works functionally identically to the cargo console. but before we delve into that, lets hit the adjacent aspects first.

Cargo Packs now contain a new variable, access_view, that is only applied to cargo packs viewed in this app. It determines the access level required to be able to see those individual packs, in the same way that you need certain accesses to open certain crates anyway. This means that outside of certain inter-departmental crates that see overlap in who can/should be able to order it, heads can browse and purchase crates based on their department's needs and wants.

The cargo ordering console has been renamed on the DM side. Because now that there's another, similar cargo ordering DM that was going to get confusing fast, as just calling it "Console" gets on my nerves and is harder to spot on VSC for me and everyone going forward forever.

Cool, back to buying stuff. heads of staff can download the cargo ordering app on tablets and laptops only, and it gives them access to purchase cargo using their department funds. These purchases are made against the user's department budget, and enables purchasing supplies with cargo without needing to beg them to use their money on your junk, adding it fully to the cargo shuttle's next load, while still giving cargo the first right to refusal if they wanted to, for some reason.
From there on out, cargo's responsibility is primarily getting the goods you bought to you, which is technically already their job!.
2020-10-15 17:30:50 +03:00

114 lines
4.0 KiB
Plaintext

/obj/structure/closet/crate/secure
desc = "A secure crate."
name = "secure crate"
icon_state = "securecrate"
secure = TRUE
locked = TRUE
max_integrity = 500
armor = list(MELEE = 30, BULLET = 50, LASER = 50, ENERGY = 100, BOMB = 0, BIO = 0, RAD = 0, FIRE = 80, ACID = 80)
var/tamperproof = 0
damage_deflection = 25
/obj/structure/closet/crate/secure/update_overlays()
. = ..()
if(broken)
. += "securecrateemag"
else if(locked)
. += "securecrater"
else
. += "securecrateg"
/obj/structure/closet/crate/secure/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1)
if(prob(tamperproof) && damage_amount >= DAMAGE_PRECISION)
boom()
else
return ..()
/obj/structure/closet/crate/secure/proc/boom(mob/user)
if(user)
to_chat(user, "<span class='danger'>The crate's anti-tamper system activates!</span>")
log_bomber(user, "has detonated a", src)
for(var/atom/movable/AM in src)
qdel(AM)
explosion(get_turf(src), 0, 1, 5, 5)
qdel(src)
/obj/structure/closet/crate/secure/weapon
desc = "A secure weapons crate."
name = "weapons crate"
icon_state = "weaponcrate"
/obj/structure/closet/crate/secure/plasma
desc = "A secure plasma crate."
name = "plasma crate"
icon_state = "plasmacrate"
/obj/structure/closet/crate/secure/gear
desc = "A secure gear crate."
name = "gear crate"
icon_state = "secgearcrate"
/obj/structure/closet/crate/secure/hydroponics
desc = "A crate with a lock on it, painted in the scheme of the station's botanists."
name = "secure hydroponics crate"
icon_state = "hydrosecurecrate"
/obj/structure/closet/crate/secure/engineering
desc = "A crate with a lock on it, painted in the scheme of the station's engineers."
name = "secure engineering crate"
icon_state = "engi_secure_crate"
/obj/structure/closet/crate/secure/science
name = "secure science crate"
desc = "A crate with a lock on it, painted in the scheme of the station's scientists."
icon_state = "scisecurecrate"
/obj/structure/closet/crate/secure/owned
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)
. = ..()
. += "<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)
if(!broken)
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 || (department_purchase && (id_card.registered_account?.account_job?.paycheck_department) == (department_account.department_id)))
if(iscarbon(user))
add_fingerprint(user)
locked = !locked
user.visible_message("<span class='notice'>[user] unlocks [src]'s privacy lock.</span>",
"<span class='notice'>You unlock [src]'s privacy lock.</span>")
privacy_lock = FALSE
update_icon()
else if(!silent)
to_chat(user, "<span class='notice'>Bank account does not match with buyer!</span>")
else if(!silent)
to_chat(user, "<span class='notice'>No linked bank account detected!</span>")
else if(!silent)
to_chat(user, "<span class='notice'>No ID detected!</span>")
else if(!silent)
to_chat(user, "<span class='warning'>[src] is broken!</span>")
else ..()