Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions code/modules/cargo/console.dm
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
"cost" = SO.pack.get_cost(),
"id" = SO.id,
"orderer" = SO.orderer,
"paid" = !isnull(SO.paying_account) //paid by requester
"paid" = !isnull(SO.paying_account), //paid by requester
"budget" = SO.budget
))

data["requests"] = list()
Expand All @@ -100,7 +101,8 @@
"cost" = SO.pack.get_cost(),
"orderer" = SO.orderer,
"reason" = SO.reason,
"id" = SO.id
"id" = SO.id,
"budget" = SO.budget
))

return data
Expand Down
6 changes: 5 additions & 1 deletion code/modules/cargo/order.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,19 @@
var/orderer_rank
var/orderer_ckey
var/reason
var/budget
var/datum/supply_pack/pack
var/datum/bank_account/paying_account

/datum/supply_order/New(datum/supply_pack/pack, orderer, orderer_rank, orderer_ckey, reason, paying_account)
/datum/supply_order/New(datum/supply_pack/pack, orderer, orderer_rank, orderer_ckey, reason, paying_account, budget)
id = SSshuttle.ordernum++
src.pack = pack
src.orderer = orderer
src.orderer_rank = orderer_rank
src.orderer_ckey = orderer_ckey
src.reason = reason
src.paying_account = paying_account
src.budget = budget

/datum/supply_order/proc/generateRequisition(turf/T)
var/obj/item/paper/P = new(T)
Expand All @@ -51,6 +53,7 @@
P.info += "Requested by: [orderer]<br/>"
if(paying_account)
P.info += "Paid by: [paying_account.account_holder]<br/>"
P.info += "Crate Type: [budget? "[paying_account.account_holder] Crate":"Normal Crate"]<br/>"
P.info += "Rank: [orderer_rank]<br/>"
P.info += "Comment: [reason]<br/>"

Expand All @@ -70,6 +73,7 @@
P.name += " - Purchased by [owner]"
P.info += "Order[packname?"":"s"]: [id]<br/>"
P.info += "Destination: [station_name]<br/>"
P.info += "Crate Type: [budget? "[paying_account.account_holder] Crate":"Normal Crate"]<br/>"
if(packname)
P.info += "Item: [packname]<br/>"
P.info += "Contents: <br/>"
Expand Down
3 changes: 3 additions & 0 deletions code/modules/mob/living/carbon/human/human_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@
if(id)
return id.registered_name
var/obj/item/pda/pda = wear_id
var/obj/item/modular_computer/tablet/tablet = wear_id
if(istype(pda))
return pda.owner
if(istype(tablet))
return tablet.name
return if_no_id

//repurposed proc. Now it combines get_id_name() and get_face_name() to determine a mob's name variable. Made into a separate proc as it'll be useful elsewhere
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
var/blockade_warning = "Bluespace instability detected. Shuttle movement impossible."
/// Can send the shuttle **AWAY** from the station
var/can_send = FALSE
///Is it being bought from a departmental budget?
var/budget_order = FALSE
///If this is true, unlock the ability to order through budgets
var/unlock_budget = TRUE
///account for everything
var/datum/bank_account/account

/datum/computer_file/program/budgetorders/proc/get_export_categories()
. = EXPORT_CARGO
Expand Down Expand Up @@ -67,14 +73,17 @@
. = ..()
var/list/data = get_header_data()
data["location"] = SSshuttle.supply.getStatusText()
var/datum/bank_account/buyer = SSeconomy.get_dep_account(ACCOUNT_CAR)
account = SSeconomy.get_dep_account(ACCOUNT_CAR)
var/obj/item/computer_hardware/card_slot/card_slot = computer.all_components[MC_CARD]
var/obj/item/card/id/id_card = card_slot?.GetID()
if(id_card?.registered_account)
unlock_budget = TRUE
if(id_card?.registered_account?.account_job?.paycheck_department == ACCOUNT_CAR)
unlock_budget = FALSE //cargo tech is already using the same budget.
if(id_card?.registered_account?.account_job?.paycheck_department && budget_order)
account = SSeconomy.get_dep_account(id_card.registered_account.account_job.paycheck_department)
if((ACCESS_HEADS in id_card.access) || (ACCESS_QM in id_card.access) || (ACCESS_CARGO in id_card.access))
requestonly = FALSE
if(id_card?.registered_account?.account_job?.paycheck_department)
buyer = SSeconomy.get_dep_account(id_card.registered_account.account_job.paycheck_department)
can_approve_requests = TRUE
can_send = TRUE
else
Expand All @@ -83,8 +92,9 @@
can_send = FALSE
else
requestonly = TRUE
if(buyer)
data["points"] = buyer.account_balance
unlock_budget = FALSE //none registered account shouldnt be using budget order
if(account)
data["points"] = account.account_balance

//Otherwise static data, that is being applied in ui_data as the crates visible and buyable are not static, and are determined by inserted ID.
data["requestonly"] = requestonly
Expand All @@ -109,9 +119,10 @@
))

//Data regarding the User's capability to buy things.
data["has_id"] = id_card
data["away"] = SSshuttle.supply.getDockedId() == "supply_away"
data["self_paid"] = self_paid
data["unlock_budget"] = unlock_budget
data["budget_order"] = budget_order
data["docked"] = SSshuttle.supply.mode == SHUTTLE_IDLE
data["loan"] = !!SSshuttle.shuttle_loan
data["loan_dispatched"] = SSshuttle.shuttle_loan && SSshuttle.shuttle_loan.dispatched
Expand All @@ -131,7 +142,8 @@
"cost" = SO.pack.cost,
"id" = SO.id,
"orderer" = SO.orderer,
"paid" = !isnull(SO.paying_account) //paid by requester
"paid" = !isnull(SO.paying_account), //paid by requester
"budget" = SO.budget
))

data["requests"] = list()
Expand All @@ -141,7 +153,8 @@
"cost" = SO.pack.cost,
"orderer" = SO.orderer,
"reason" = SO.reason,
"id" = SO.id
"id" = SO.id,
"budget" = SO.budget
))

return data
Expand Down Expand Up @@ -197,13 +210,14 @@
var/ckey = usr.ckey
if(ishuman(usr))
var/mob/living/carbon/human/H = usr
name = H.get_authentification_name()
if(budget_order)
name = account.account_holder
else
name = H.get_authentification_name()
rank = H.get_assignment(hand_first = TRUE)
else if(issilicon(usr))
name = usr.real_name
rank = "Silicon"

var/datum/bank_account/account
if(self_paid && ishuman(usr))
var/mob/living/carbon/human/H = usr
var/obj/item/card/id/id_card = H.get_idcard(TRUE)
Expand All @@ -226,16 +240,17 @@

if(!self_paid && ishuman(usr) && !account)
var/obj/item/card/id/id_card = card_slot?.GetID()
account = SSeconomy.get_dep_account(id_card?.registered_account?.account_job.paycheck_department)
if(budget_order)
account = SSeconomy.get_dep_account(id_card?.registered_account?.account_job.paycheck_department)

var/turf/T = get_turf(src)
var/datum/supply_order/SO = new(pack, name, rank, ckey, reason, account)
var/turf/T = get_turf(computer)
var/datum/supply_order/SO = new(pack, name, rank, ckey, reason, account, account.account_holder)
SO.generateRequisition(T)
if((requestonly && !self_paid) || !(card_slot?.GetID()))
SSshuttle.requestlist += SO
else
SSshuttle.shoppinglist += SO
if(self_paid)
if(self_paid || budget_order)
computer.say("Order processed. The price will be charged to [account.account_holder]'s bank account on delivery.")
. = TRUE
if("remove")
Expand All @@ -252,9 +267,6 @@
var/id = text2num(params["id"])
for(var/datum/supply_order/SO in SSshuttle.requestlist)
if(SO.id == id)
var/obj/item/card/id/id_card = card_slot?.GetID()
if(id_card && id_card?.registered_account)
SO.paying_account = SSeconomy.get_dep_account(id_card?.registered_account?.account_job.paycheck_department)
SSshuttle.requestlist -= SO
SSshuttle.shoppinglist += SO
. = TRUE
Expand All @@ -271,6 +283,13 @@
. = TRUE
if("toggleprivate")
self_paid = !self_paid
if(budget_order)
budget_order = FALSE //incase something fucked
. = TRUE
if("togglebudget")
budget_order = !budget_order
if(self_paid)
self_paid = FALSE //incase something fucked
. = TRUE
if(.)
post_signal("supply")
Expand Down
4 changes: 3 additions & 1 deletion code/modules/shuttle/supply.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
/obj/structure/extraction_point,
/obj/machinery/syndicatebomb,
/obj/item/hilbertshotel,
/obj/structure/closet/crate/secure/owned,
/obj/structure/closet/bluespace // yogs - nope nice try
)))

Expand Down Expand Up @@ -61,6 +60,9 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
for(var/trf in shuttle_area)
var/turf/T = trf
for(var/a in T.get_all_contents())
for(var/obj/structure/closet/crate/secure/owned/crate in a)
if(crate.locked)
return FALSE
if(is_type_in_typecache(a, GLOB.blacklisted_cargo_types))
return FALSE
return TRUE
Expand Down
14 changes: 11 additions & 3 deletions tgui/packages/tgui/interfaces/Cargo.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const CargoCatalog = (props, context) => {
const { express } = props;
const { act, data } = useBackend(context);

const { self_paid, app_cost } = data;
const { self_paid, app_cost, budget_order, unlock_budget } = data;

const supplies = Object.values(data.supplies);
const [
Expand All @@ -144,11 +144,16 @@ export const CargoCatalog = (props, context) => {
buttons={!express && (
<>
<CargoCartButtons />
<Button.Checkbox
{!budget_order && <Button.Checkbox
ml={2}
content="Buy Privately"
checked={self_paid}
onClick={() => act('toggleprivate')} />
onClick={() => act('toggleprivate')} />}
{!self_paid && !!unlock_budget && <Button.Checkbox
ml={2}
content="Departmental Purchasing"
checked={budget_order}
onClick={() => act('togglebudget')} />}
</>
)}>
<Flex>
Expand Down Expand Up @@ -347,6 +352,9 @@ const CargoCart = (props, context) => {
{entry.object}
</Table.Cell>
<Table.Cell collapsing>
{!!entry.budget && (
<b>[{entry.budget}]</b>
)}
{!!entry.paid && (
<b>[Paid Privately]</b>
)}
Expand Down