diff --git a/code/modules/cargo/orderconsole.dm b/code/modules/cargo/orderconsole.dm index 6e797db64d5..e3a17a52ff9 100644 --- a/code/modules/cargo/orderconsole.dm +++ b/code/modules/cargo/orderconsole.dm @@ -121,7 +121,7 @@ "id" = order.id, "amount" = 1, "orderer" = order.orderer, - "paid" = !!order.paying_account?.add_to_accounts, //number of orders purchased privatly + "paid" = !isnull(order.paying_account), //number of orders purchased privatly "dep_order" = !!order.department_destination, //number of orders purchased by a department "can_be_cancelled" = order.can_be_cancelled, )) @@ -271,7 +271,7 @@ if(!dept_choice) return if(dept_choice == "Cargo Budget") - personal_department = SSeconomy.get_dep_account(cargo_account) + personal_department = null if(pack.goody && !self_paid) playsound(src, 'sound/machines/buzz/buzz-sigh.ogg', 50, FALSE) @@ -298,13 +298,13 @@ break var/datum/supply_order/order = new( - pack = pack , + pack = pack, orderer = name, orderer_rank = rank, orderer_ckey = ckey, reason = reason, paying_account = account, - coupon = applied_coupon + coupon = applied_coupon, ) working_list += order diff --git a/code/modules/modular_computers/file_system/programs/budgetordering.dm b/code/modules/modular_computers/file_system/programs/budgetordering.dm index a181a702fad..78234a9fcf1 100644 --- a/code/modules/modular_computers/file_system/programs/budgetordering.dm +++ b/code/modules/modular_computers/file_system/programs/budgetordering.dm @@ -127,11 +127,9 @@ if(SSshuttle.supply_blocked) message = blockade_warning data["message"] = message - var/list/amount_by_name = list() var/cart_list = list() for(var/datum/supply_order/order in SSshuttle.shopping_list) if(cart_list[order.pack.name]) - amount_by_name[order.pack.name] += 1 cart_list[order.pack.name][1]["amount"]++ cart_list[order.pack.name][1]["cost"] += order.get_final_cost() if(order.department_destination) @@ -147,27 +145,26 @@ "id" = order.id, "amount" = 1, "orderer" = order.orderer, - "paid" = !isnull(order.paying_account) ? 1 : 0, //number of orders purchased privatly - "dep_order" = order.department_destination ? 1 : 0, //number of orders purchased by a department + "paid" = !isnull(order.paying_account), //number of orders purchased privatly + "dep_order" = !!order.department_destination, //number of orders purchased by a department "can_be_cancelled" = order.can_be_cancelled, )) data["cart"] = list() for(var/item_id in cart_list) data["cart"] += cart_list[item_id] + data["requests"] = list() for(var/datum/supply_order/order in SSshuttle.request_list) var/datum/supply_pack/pack = order.pack - amount_by_name[pack.name] += 1 data["requests"] += list(list( "object" = pack.name, "cost" = pack.get_cost(), "orderer" = order.orderer, "reason" = order.reason, "id" = order.id, - "account" = order.paying_account?.account_holder || "Cargo Department" + "account" = order.paying_account ? order.paying_account.account_holder : "Cargo Department" )) - data["amount_by_name"] = amount_by_name return data @@ -178,6 +175,7 @@ /datum/computer_file/program/budgetorders/ui_act(action, params, datum/tgui/ui, datum/ui_state/state) . = ..() + var/mob/user = ui.user switch(action) if("send") if(!SSshuttle.supply.canMove()) @@ -189,9 +187,9 @@ if(SSshuttle.supply.getDockedId() == docking_home) SSshuttle.moveShuttle(cargo_shuttle, docking_away, TRUE) computer.say("The supply shuttle is departing.") - usr.investigate_log("sent the supply shuttle away.", INVESTIGATE_CARGO) + user.investigate_log("sent the supply shuttle away.", INVESTIGATE_CARGO) else - usr.investigate_log("called the supply shuttle.", INVESTIGATE_CARGO) + user.investigate_log("called the supply shuttle.", INVESTIGATE_CARGO) computer.say("The supply shuttle has been called and will arrive in [SSshuttle.supply.timeLeft(600)] minute\s.") SSshuttle.moveShuttle(cargo_shuttle, docking_home, TRUE) . = TRUE @@ -210,8 +208,8 @@ else SSshuttle.shuttle_loan.loan_shuttle() computer.say("The supply shuttle has been loaned to CentCom.") - usr.investigate_log("accepted a shuttle loan event.", INVESTIGATE_CARGO) - usr.log_message("accepted a shuttle loan event.", LOG_GAME) + user.investigate_log("accepted a shuttle loan event.", INVESTIGATE_CARGO) + user.log_message("accepted a shuttle loan event.", LOG_GAME) . = TRUE if("add") var/id = text2path(params["id"]) @@ -223,17 +221,17 @@ var/name = "*None Provided*" var/rank = "*None Provided*" - var/ckey = usr.ckey + var/ckey = user.ckey var/mob/living/carbon/human/hwoman - if(ishuman(usr)) - hwoman = usr + if(ishuman(user)) + hwoman = user rank = hwoman.get_assignment(hand_first = TRUE) - else if(issilicon(usr)) - name = usr.real_name + else if(issilicon(user)) + name = user.real_name rank = "Silicon" - // Our account that we want to end up paying with. Defaults to the cargo budget! - var/datum/bank_account/account = SSeconomy.get_dep_account(ACCOUNT_CAR) + // Our account that we want to end up paying with. + var/datum/bank_account/account // Our ID card that we want to pull from for identification. Modifies either name, account, or neither depending on function. var/obj/item/card/id/id_card_customer = computer.stored_id?.GetID() if(!id_card_customer) @@ -254,20 +252,20 @@ return var/reason = "" + var/datum/bank_account/personal_department if((requestonly && !self_paid) || !(computer.stored_id?.GetID())) - reason = tgui_input_text(usr, "Reason", name, max_length = MAX_MESSAGE_LEN) + reason = tgui_input_text(user, "Reason", name, max_length = MAX_MESSAGE_LEN) if(isnull(reason) || ..()) return if(id_card_customer?.registered_account?.account_job && !self_paid) //Find a budget to pull from - var/datum/bank_account/personal_department = SSeconomy.get_dep_account(id_card_customer.registered_account.account_job.paycheck_department) + personal_department = SSeconomy.get_dep_account(id_card_customer.registered_account.account_job.paycheck_department) if(!(personal_department.account_holder == "Cargo Budget")) - var/choice = tgui_alert(usr, "Which department are you requesting this for?", "Choose request department", list("Cargo Budget", "[personal_department.account_holder]")) - if(!choice) + var/dept_choice = tgui_alert(user, "Which department are you requesting this for?", "Choose request department", list("Cargo Budget", "[personal_department.account_holder]")) + if(!dept_choice) return - if(choice != "Cargo Budget") - account = personal_department - name = id_card_customer.registered_account?.account_holder + if(dept_choice == "Cargo Budget") + personal_department = null if(pack.goody && !self_paid) playsound(computer, 'sound/machines/buzz/buzz-sigh.ogg', 50, FALSE) @@ -279,9 +277,8 @@ computer.say("ERROR: No more then [CARGO_MAX_ORDER] of any pack may be ordered at once") return - if(!requestonly && !self_paid && ishuman(usr) && !account) - var/obj/item/card/id/id_card = computer.stored_id?.GetID() - account = SSeconomy.get_dep_account(id_card?.registered_account?.account_job.paycheck_department) + if(!self_paid) + account = personal_department var/turf/T = get_turf(computer) var/datum/supply_order/SO = new(pack, name, rank, ckey, reason, account)