From 5367560fb5862264034be75faf3935ee4b1b8260 Mon Sep 17 00:00:00 2001 From: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Date: Mon, 2 Jan 2023 09:12:36 +0000 Subject: [PATCH] Minor improvements to mining order console (#72239) ## About The Pull Request Mining order consoles are now called 'order console' instead of 'vendor' Cargo orders through the mining vendor can no longer be cancelled ("clear" on the ntos cargo app no longer removes department orders too) Cargo orders made with mining points now state 'mp' (for 'mining points') instead of 'cr' to the Cargo console. The order consoles now have a '+' icon that will instantly add +1 item to your cart, so you don't have to manually type 1 each time. The order console's UI name is now named after the machine, rather than being hardcoded to 'Produce Orders' Also makes the UI resilient to breaking if the wearer doesn't have an ID equipped. ## Why It's Good For The Game Better player-feedback and makes a better distinction between mining order console and normal vendors, as well as fixes some problems like Cargo just deleting people's mining points by deleting their unrefundable orders. The + button was a suggestion in the comments here and thought it would just be a nice harmless inclusion. The departmental order cancelling on the NTos cargo app and UI not breaking if you don't have an ID were just bonuses that I fixed while dealing with everything else. ## Changelog :cl: qol: Mining order consoles are now named 'order console'. qol: Orders from said mining order consoles can now no longer be cancelled, and are listed as 'mp' (mining points) in the Cargo console instead of 'cr'. qol: Order consoles now have a + button that will instantly add 1 of the item. fix: Departmental orders can no longer be cancelled through the NTos cargo application. fix: Wearing an ID will no longer break order consoles. /:cl: --- .../orders/order_computer/mining_order.dm | 20 ++++++++++--------- .../orders/order_computer/order_computer.dm | 4 ++++ code/modules/cargo/order.dm | 7 +++++++ code/modules/cargo/orderconsole.dm | 8 +++++--- .../file_system/programs/budgetordering.dm | 10 ++++++++-- tgui/packages/tgui/interfaces/Cargo.js | 6 +++--- .../tgui/interfaces/ProduceConsole.js | 20 ++++++++++++++----- 7 files changed, 53 insertions(+), 22 deletions(-) diff --git a/code/game/machinery/computer/orders/order_computer/mining_order.dm b/code/game/machinery/computer/orders/order_computer/mining_order.dm index 5245f297639..ca423d41ac2 100644 --- a/code/game/machinery/computer/orders/order_computer/mining_order.dm +++ b/code/game/machinery/computer/orders/order_computer/mining_order.dm @@ -1,5 +1,5 @@ /obj/machinery/computer/order_console/mining - name = "mining equipment vendor" + name = "mining equipment order console" desc = "An equipment shop for miners, points collected at an ore redemption machine can be spent here." icon = 'icons/obj/machines/mining_machines.dmi' icon_state = "mining" @@ -40,16 +40,18 @@ contains = things_to_order, ) var/datum/supply_order/new_order = new( - pack = mining_pack, \ - orderer = purchaser, \ - orderer_rank = "Mining Vendor", \ - orderer_ckey = purchaser.ckey, \ - reason = "", \ - paying_account = card.registered_account, \ - department_destination = null, \ - coupon = null, \ + pack = mining_pack, + orderer = purchaser, + orderer_rank = "Mining Vendor", + orderer_ckey = purchaser.ckey, + reason = "", + paying_account = card.registered_account, + department_destination = null, + coupon = null, charge_on_purchase = FALSE, manifest_can_fail = FALSE, + cost_type = "mp", + can_be_cancelled = FALSE, ) if(ltsrbt_delivered) var/obj/machinery/mining_ltsrbt/ltsrbt diff --git a/code/game/machinery/computer/orders/order_computer/order_computer.dm b/code/game/machinery/computer/orders/order_computer/order_computer.dm index 461a27fa162..f0933f0694a 100644 --- a/code/game/machinery/computer/orders/order_computer/order_computer.dm +++ b/code/game/machinery/computer/orders/order_computer/order_computer.dm @@ -102,6 +102,10 @@ GLOBAL_LIST_EMPTY(order_console_products) return var/mob/living/living_user = usr switch(action) + if("add_one") + var/datum/orderable_item/wanted_item = locate(params["target"]) in GLOB.order_console_products + grocery_list[wanted_item] += 1 + update_static_data(living_user) if("cart_set") //this is null if the action doesn't need it (purchase, quickpurchase) var/datum/orderable_item/wanted_item = locate(params["target"]) in GLOB.order_console_products diff --git a/code/modules/cargo/order.dm b/code/modules/cargo/order.dm index 675e1f4439e..f5b52d38060 100644 --- a/code/modules/cargo/order.dm +++ b/code/modules/cargo/order.dm @@ -39,6 +39,7 @@ /datum/supply_order var/id + var/cost_type var/orderer var/orderer_rank var/orderer_ckey @@ -53,6 +54,8 @@ var/obj/item/coupon/applied_coupon ///Boolean on whether the manifest can fail or not. var/manifest_can_fail = TRUE + ///Boolean on whether the manifest can be cancelled through cargo consoles. + var/can_be_cancelled = TRUE /datum/supply_order/New( datum/supply_pack/pack, @@ -65,8 +68,11 @@ coupon, charge_on_purchase = TRUE, manifest_can_fail = TRUE, + cost_type = "cr", + can_be_cancelled = TRUE, ) id = SSshuttle.order_number++ + src.cost_type = cost_type src.pack = pack src.orderer = orderer src.orderer_rank = orderer_rank @@ -77,6 +83,7 @@ src.applied_coupon = coupon src.charge_on_purchase = charge_on_purchase src.manifest_can_fail = manifest_can_fail + src.can_be_cancelled = can_be_cancelled /datum/supply_order/proc/generateRequisition(turf/T) var/obj/item/paper/requisition_paper = new(T) diff --git a/code/modules/cargo/orderconsole.dm b/code/modules/cargo/orderconsole.dm index a4f98bd3b4e..bee14241912 100644 --- a/code/modules/cargo/orderconsole.dm +++ b/code/modules/cargo/orderconsole.dm @@ -120,12 +120,14 @@ data["cart"] = list() for(var/datum/supply_order/SO in SSshuttle.shopping_list) data["cart"] += list(list( + "cost_type" = SO.cost_type, "object" = SO.pack.name, "cost" = SO.pack.get_cost(), "id" = SO.id, "orderer" = SO.orderer, "paid" = !isnull(SO.paying_account), //paid by requester - "dep_order" = SO.department_destination ? TRUE : FALSE + "dep_order" = !!SO.department_destination, + "can_be_cancelled" = SO.can_be_cancelled, )) data["requests"] = list() @@ -291,8 +293,8 @@ break if("clear") for(var/datum/supply_order/cancelled_order in SSshuttle.shopping_list) - if(cancelled_order.department_destination) - continue //don't cancel other department's orders + if(cancelled_order.department_destination || cancelled_order.can_be_cancelled) + continue //don't cancel other department's orders or orders that can't be cancelled SSshuttle.shopping_list -= cancelled_order . = TRUE if("approve") diff --git a/code/modules/modular_computers/file_system/programs/budgetordering.dm b/code/modules/modular_computers/file_system/programs/budgetordering.dm index 0a64f267c1a..56ff1158b68 100644 --- a/code/modules/modular_computers/file_system/programs/budgetordering.dm +++ b/code/modules/modular_computers/file_system/programs/budgetordering.dm @@ -125,11 +125,14 @@ data["cart"] = list() for(var/datum/supply_order/SO in SSshuttle.shopping_list) data["cart"] += list(list( + "cost_type" = SO.cost_type, "object" = SO.pack.name, "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 + "dep_order" = !!SO.department_destination, + "can_be_cancelled" = SO.can_be_cancelled, )) data["requests"] = list() @@ -251,7 +254,10 @@ . = TRUE break if("clear") - SSshuttle.shopping_list.Cut() + for(var/datum/supply_order/cancelled_order in SSshuttle.shopping_list) + if(cancelled_order.department_destination || cancelled_order.can_be_cancelled) + continue //don't cancel other department's orders or orders that can't be cancelled + SSshuttle.shopping_list -= cancelled_order . = TRUE if("approve") var/id = text2num(params["id"]) diff --git a/tgui/packages/tgui/interfaces/Cargo.js b/tgui/packages/tgui/interfaces/Cargo.js index c25689924ae..1c0626aadc0 100644 --- a/tgui/packages/tgui/interfaces/Cargo.js +++ b/tgui/packages/tgui/interfaces/Cargo.js @@ -400,15 +400,15 @@ const CargoCart = (props, context) => { {(entry.dep_order && (