From ae9241beaecf66d83cc7655c0679bf330311d3b2 Mon Sep 17 00:00:00 2001 From: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Date: Wed, 25 Jan 2023 20:04:26 +0000 Subject: [PATCH] Moves mining points from the ID to the bank account (+credit type shown on order console) (#72726) ## About The Pull Request Mining points are now stored on the ID's bank accounts instead of the individual IDs, bringing them on-par with credits. This allows miners to safely replace their ID and keep their mining points just like they can for their credits. I also added the cost type on Produce Consoles, so people using them will know whether they're using mining points or credits. Because all IDs have a bank account by default, this won't be a problem to Golems or the like. ## Why It's Good For The Game 1. It's more clear to the player what type of credit is being used in the order console 2. Mining points being tied to the ID is no longer needed as all IDs have a bank account 3. Brings mining points up to the same standard as credits. ## Changelog :cl: qol: Mining points is now tied to bank accounts instead of individual IDs, so they transfer over in cases of an ID replacement. /:cl: --- .../orders/order_computer/mining_order.dm | 24 +++++++++++-------- .../orders/order_computer/order_computer.dm | 6 ++++- code/game/objects/items/cards_ids.dm | 6 ++--- .../objects/structures/lavaland/geyser.dm | 2 +- code/modules/economy/account.dm | 2 ++ code/modules/mining/machine_redemption.dm | 2 +- .../tgui/interfaces/ProduceConsole.js | 11 ++++++--- 7 files changed, 33 insertions(+), 20 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 c5a95241aeb..6a20a20d8ee 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,6 @@ #define MINING_SHIPPING_MULTIPLIER 0.65 -#define GET_MINING_SHIPPING_MULTIPLIER(cost) round(cost * MINING_SHIPPING_MULTIPLIER,5) +#define GET_MINING_SHIPPING_MULTIPLIER(cost) round(cost * MINING_SHIPPING_MULTIPLIER, 5) +#define CREDIT_TYPE_MINING "mp" /obj/machinery/computer/order_console/mining name = "mining equipment order console" @@ -17,6 +18,8 @@ 35% cheaper than express delivery."} express_tooltip = @{"Sends your purchases instantly."} + credit_type = CREDIT_TYPE_MINING + order_categories = list( CATEGORY_MINING, CATEGORY_CONSUMABLES, @@ -29,8 +32,8 @@ var/failure_message = "Sorry, but you do not have enough mining points." if(!express) final_cost = GET_MINING_SHIPPING_MULTIPLIER(final_cost) - if(final_cost <= card.mining_points) - card.mining_points -= final_cost + if(final_cost <= card.registered_account.mining_points) + card.registered_account.mining_points -= final_cost return TRUE say(failure_message) return FALSE @@ -56,7 +59,7 @@ coupon = null, charge_on_purchase = FALSE, manifest_can_fail = FALSE, - cost_type = "mp", + cost_type = credit_type, can_be_cancelled = FALSE, ) say("Thank you for your purchase! It will arrive on the next cargo shuttle!") @@ -72,7 +75,7 @@ var/mob/living/living_user = user var/obj/item/card/id/id_card = living_user.get_idcard(TRUE) if(id_card) - data["points"] = id_card.mining_points + data["points"] = id_card.registered_account.mining_points return data @@ -186,23 +189,24 @@ var/point_movement = tgui_alert(user, "To ID (from card) or to card (from ID)?", "Mining Points Transfer", list(TO_USER_ID, TO_POINT_CARD)) if(!point_movement) return - var/amount = tgui_input_number(user, "How much do you want to transfer? ID Balance: [attacking_id.mining_points], Card Balance: [points]", "Transfer Points", min_value = 0, round_value = 1) + var/amount = tgui_input_number(user, "How much do you want to transfer? ID Balance: [attacking_id.registered_account.mining_points], Card Balance: [points]", "Transfer Points", min_value = 0, round_value = 1) if(!amount) return switch(point_movement) if(TO_USER_ID) if(amount > points) amount = points - attacking_id.mining_points += amount + attacking_id.registered_account.mining_points += amount points -= amount to_chat(user, span_notice("You transfer [amount] mining points from [src] to [attacking_id].")) if(TO_POINT_CARD) - if(amount > attacking_id.mining_points) - amount = attacking_id.mining_points - attacking_id.mining_points -= amount + if(amount > attacking_id.registered_account.mining_points) + amount = attacking_id.registered_account.mining_points + attacking_id.registered_account.mining_points -= amount points += amount to_chat(user, span_notice("You transfer [amount] mining points from [attacking_id] to [src].")) +#undef CREDIT_TYPE_MINING #undef TO_POINT_CARD #undef TO_USER_ID #undef MINING_SHIPPING_MULTIPLIER 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 b5a16fbf8f3..552666fc510 100644 --- a/code/game/machinery/computer/orders/order_computer/order_computer.dm +++ b/code/game/machinery/computer/orders/order_computer/order_computer.dm @@ -1,5 +1,6 @@ ///List of all items that can be found in the different types of order consoles, to purchase. GLOBAL_LIST_EMPTY(order_console_products) +#define CREDIT_TYPE_CREDIT "credit" /obj/machinery/computer/order_console name = "Orders Console" @@ -23,6 +24,8 @@ GLOBAL_LIST_EMPTY(order_console_products) ///The channel we will attempt to speak into through our radio. var/radio_channel = RADIO_CHANNEL_SUPPLY + ///The kind of cash does the console use. + var/credit_type = CREDIT_TYPE_CREDIT ///Whether the console can only use express mode ONLY var/forced_express = FALSE ///Multiplied cost to use express mode @@ -67,7 +70,7 @@ GLOBAL_LIST_EMPTY(order_console_products) /obj/machinery/computer/order_console/ui_data(mob/user) var/list/data = list() var/cost = get_total_cost() - data["total_cost"] = "[cost] (Express: [cost*express_cost_multiplier])" + data["total_cost"] = "[cost] (Express: [cost * express_cost_multiplier])" data["off_cooldown"] = COOLDOWN_FINISHED(src, order_cooldown) if(!isliving(user)) @@ -81,6 +84,7 @@ GLOBAL_LIST_EMPTY(order_console_products) /obj/machinery/computer/order_console/ui_static_data(mob/user) var/list/data = list() + data["credit_type"] = credit_type data["express_tooltip"] = express_tooltip data["purchase_tooltip"] = purchase_tooltip data["forced_express"] = forced_express diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm index 1db32a0c12d..56af97af92c 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -56,8 +56,6 @@ /// Cached icon that has been built for this card. Intended for use in chat. var/icon/cached_flat_icon - /// How many magical mining Disney Dollars this card has for spending at the mining equipment vendors. - var/mining_points = 0 /// The name registered on the card (for example: Dr Bryan See) var/registered_name = null /// Linked bank account. @@ -730,9 +728,9 @@ if(registered_age) . += "The card indicates that the holder is [registered_age] years old. [(registered_age < AGE_MINOR) ? "There's a holographic stripe that reads [span_danger("'MINOR: DO NOT SERVE ALCOHOL OR TOBACCO'")] along the bottom of the card." : ""]" - if(mining_points) - . += "There's [mining_points] mining equipment redemption point\s loaded onto this card." if(registered_account) + if(registered_account.mining_points) + . += "There's [registered_account.mining_points] mining point\s loaded onto the card's bank account." . += "The account linked to the ID belongs to '[registered_account.account_holder]' and reports a balance of [registered_account.account_balance] cr." if(registered_account.account_job) var/datum/bank_account/D = SSeconomy.get_dep_account(registered_account.account_job.paycheck_department) diff --git a/code/game/objects/structures/lavaland/geyser.dm b/code/game/objects/structures/lavaland/geyser.dm index cd556a79165..c959a006a7e 100644 --- a/code/game/objects/structures/lavaland/geyser.dm +++ b/code/game/objects/structures/lavaland/geyser.dm @@ -82,7 +82,7 @@ var/obj/item/card/id/card = living.get_idcard() if(card) to_chat(user, span_notice("[point_value] mining points have been paid out!")) - card.mining_points += point_value + card.registered_account.mining_points += point_value /obj/structure/geyser/wittel reagent_id = /datum/reagent/wittel diff --git a/code/modules/economy/account.dm b/code/modules/economy/account.dm index dddc9a5afb5..7f578bb1b39 100644 --- a/code/modules/economy/account.dm +++ b/code/modules/economy/account.dm @@ -5,6 +5,8 @@ var/account_holder = "Rusty Venture" ///How many credits are currently held in the bank account. var/account_balance = 0 + ///How many mining points (shaft miner credits) is held in the bank account, used for mining vendors. + var/mining_points = 0 ///If there are things effecting how much income a player will get, it's reflected here 1 is standard for humans. var/payday_modifier ///The job datum of the account owner. diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm index a8d93501d73..c11db146a06 100644 --- a/code/modules/mining/machine_redemption.dm +++ b/code/modules/mining/machine_redemption.dm @@ -241,7 +241,7 @@ user_id_card = user.get_idcard(TRUE) if(points) if(user_id_card) - user_id_card.mining_points += points + user_id_card.registered_account.mining_points += points points = 0 else to_chat(usr, span_warning("No valid ID detected.")) diff --git a/tgui/packages/tgui/interfaces/ProduceConsole.js b/tgui/packages/tgui/interfaces/ProduceConsole.js index 1a885820e5b..e1b91b7fa85 100644 --- a/tgui/packages/tgui/interfaces/ProduceConsole.js +++ b/tgui/packages/tgui/interfaces/ProduceConsole.js @@ -16,7 +16,7 @@ const TAB2NAME = [ const ShoppingTab = (props, context) => { const { data, act } = useBackend(context); - const { order_categories, order_datums } = data; + const { credit_type, order_categories, order_datums } = data; const [shopIndex, setShopIndex] = useLocalState(context, 'shop-index', 1); const [condensed, setCondensed] = useLocalState(context, 'condensed', false); const mapped_food = order_datums.filter( @@ -84,7 +84,7 @@ const ShoppingTab = (props, context) => { - {' costs ' + item.cost + ' per order.'} + {' costs ' + item.cost + item.credit_type + ' per order.'}