From b0f40e8c5bca5363e9b637465c76cab3b75131a0 Mon Sep 17 00:00:00 2001 From: Helg2 <93882977+Helg2@users.noreply.github.com> Date: Sun, 11 Aug 2024 18:01:06 +0300 Subject: [PATCH] delete prices and money interactions for vendors (#75) --- .../machinery/vending/marine_vending.dm | 6 -- .../game/objects/machinery/vending/vending.dm | 89 +------------------ .../machinery/vending/vending_types.dm | 13 --- tgui/packages/tgui/interfaces/Vending.tsx | 35 +------- 4 files changed, 5 insertions(+), 138 deletions(-) diff --git a/code/game/objects/machinery/vending/marine_vending.dm b/code/game/objects/machinery/vending/marine_vending.dm index c34fe9989f3..b591aaff09d 100644 --- a/code/game/objects/machinery/vending/marine_vending.dm +++ b/code/game/objects/machinery/vending/marine_vending.dm @@ -865,8 +865,6 @@ /obj/item/cell/lasgun/lasrifle = 10, /obj/item/cell/lasgun/volkite/powerpack/marine = 2, ) - prices = list() - /obj/machinery/vending/lasgun/Initialize(mapload) . = ..() update_icon() @@ -1198,8 +1196,6 @@ ), ) - prices = list() - /obj/machinery/vending/armor_supply/valhalla resistance_flags = INDESTRUCTIBLE use_power = NO_POWER_USE @@ -1407,8 +1403,6 @@ ) ) - prices = list() - /obj/machinery/vending/uniform_supply/valhalla resistance_flags = INDESTRUCTIBLE use_power = NO_POWER_USE diff --git a/code/game/objects/machinery/vending/vending.dm b/code/game/objects/machinery/vending/vending.dm index 053d96aec8f..b03245ec01b 100644 --- a/code/game/objects/machinery/vending/vending.dm +++ b/code/game/objects/machinery/vending/vending.dm @@ -11,7 +11,6 @@ #define MAKE_VENDING_RECORD_DATA(record) list(\ "product_name" = record.product_name,\ "product_color" = record.display_color,\ - "prod_price" = record.price,\ "prod_desc" = initial(record.product_path.desc),\ "ref" = REF(record),\ "tab" = record.tab,\ @@ -111,8 +110,6 @@ var/list/contraband = list() /// Premium products that are only available when using a coin to pay for it. var/list/premium = list() - /// Prices for each item, list(/type/path = price), items not in the list don't have a price. - var/list/prices = list() /// String of slogans separated by semicolons, optional var/product_slogans = "" ///String of small ad messages in the vending screen - random chance @@ -147,10 +144,6 @@ var/shut_up = FALSE ///If the vending machine is hacked, makes the items on contraband list available. var/extended_inventory = FALSE - /// 1 = requires PIN and checks accounts. 0 = You slide an ID, it vends, SPACE COMMUNISM! - var/check_accounts = 0 - ///Current cash card. - var/obj/item/spacecash/ewallet/ewallet ///How much tipped we are. var/tipped_level = 0 ///Stops the machine from being hacked to shoot inventory or allow all access @@ -257,14 +250,14 @@ var/amount = productlist[entry][typepath] if(isnull(amount)) amount = 1 - var/datum/vending_product/record = new(typepath = typepath, product_amount = amount, product_price = prices[typepath], category = category, tab = entry) + var/datum/vending_product/record = new(typepath = typepath, product_amount = amount, category = category, tab = entry) recordlist += record continue //This item is not tab dependent var/amount = productlist[entry] if(isnull(amount)) amount = 1 - var/datum/vending_product/record = new(typepath = entry, product_amount = amount, product_price = prices[entry], category = category) + var/datum/vending_product/record = new(typepath = entry, product_amount = amount, category = category) recordlist += record ///Makes additional tabs/adds to the tabs based on the seasonal_items vendor specification @@ -347,17 +340,6 @@ attack_hand(user) - else if(istype(I, /obj/item/card)) - var/obj/item/card/C = I - scan_card(C) - - else if(istype(I, /obj/item/spacecash/ewallet)) - if(!user.transferItemToLoc(I, src)) - return - - ewallet = I - to_chat(user, span_notice("You insert the [I] into the [src]")) - else if(iswrench(I)) if(!wrenchable) return @@ -381,70 +363,18 @@ var/obj/item/to_stock = I stock(to_stock, user) -/obj/machinery/vending/proc/scan_card(obj/item/card/I) - if(!currently_vending) - return - if (istype(I, /obj/item/card/id)) - var/obj/item/card/id/C = I - visible_message(span_info("[usr] swipes a card through [src].")) - var/datum/money_account/CH = get_account(C.associated_account_number) - if(CH) // Only proceed if card contains proper account number. - if(!CH.suspended) - if(CH.security_level != 0) //If card requires pin authentication (ie seclevel 1 or 2) - var/attempt_pin = tgui_input_number(usr, "Enter pin code", "Vendor transaction") - var/datum/money_account/D = attempt_account_access(C.associated_account_number, attempt_pin, 2) - transfer_and_vend(D) - else - //Just Vend it. - transfer_and_vend(CH) - else - to_chat(usr, "[icon2html(src, usr)][span_warning("Connected account has been suspended.")]") - else - to_chat(usr, "[icon2html(src, usr)][span_warning("Error: Unable to access your account. Please contact technical support if problem persists.")]") - -/obj/machinery/vending/proc/transfer_and_vend(datum/money_account/acc) - if(!acc) - to_chat(usr, "[icon2html(src, usr)][span_warning("Error: Unable to access your account. Please contact technical support if problem persists.")]") - return - - var/transaction_amount = currently_vending.price - if(transaction_amount > acc.money) - to_chat(usr, "[icon2html(src, usr)][span_warning("You don't have that much money!")]") - return - - //transfer the money - acc.money -= transaction_amount - - //create entries in the two account transaction logs - var/datum/transaction/T = new() - T.purpose = "Purchase of [currently_vending.product_name]" - if(transaction_amount > 0) - T.amount = "([transaction_amount])" - else - T.amount = "[transaction_amount]" - T.source_terminal = src.name - T.date = GLOB.current_date_string - T.time = worldtime2text() - acc.transaction_log.Add(T) - - // Vend the item - vend(currently_vending, usr) - currently_vending = null - /obj/machinery/vending/can_interact(mob/user) . = ..() if(!.) return FALSE if(tipped_level == 2) - user.visible_message(span_notice(" [user] begins to heave the vending machine back into place!"),span_notice(" You start heaving the vending machine back into place..")) + user.visible_message(span_notice("[user] begins to heave the vending machine back into place!"), span_notice("You start heaving the vending machine back into place..")) if(!do_after(user, 80, IGNORE_HELD_ITEM, src, BUSY_ICON_FRIENDLY)) return FALSE - user.visible_message(span_notice(" [user] rights the [src]!"),span_notice(" You right the [src]!")) + user.visible_message(span_notice("[user] rights the [src]!"), span_notice("You right the [src]!")) flip_back() - return TRUE - return TRUE /** @@ -548,17 +478,6 @@ stock_vacuum(usr) . = TRUE - if("cancel_buying") - currently_vending = null - . = TRUE - - if("swipe") - if(!ishuman(usr)) - return - var/mob/living/carbon/human/H = usr - scan_card(H.wear_id) - . = TRUE - /obj/machinery/vending/proc/vend(datum/vending_product/R, mob/user) if(!allowed(user) && (!wires.is_cut(WIRE_IDSCAN) || hacking_safety)) //For SECURE VENDING MACHINES YEAH to_chat(user, span_warning("Access denied.")) diff --git a/code/game/objects/machinery/vending/vending_types.dm b/code/game/objects/machinery/vending/vending_types.dm index e504ce358a5..b91a12afe0e 100644 --- a/code/game/objects/machinery/vending/vending_types.dm +++ b/code/game/objects/machinery/vending/vending_types.dm @@ -136,19 +136,6 @@ /obj/item/reagent_containers/food/drinks/cans/waterbottle = -1, /obj/item/reagent_containers/food/drinks/cans/cola = -1, ) - - prices = list( - /obj/item/reagent_containers/food/drinks/cans/souto = 5, - /obj/item/reagent_containers/food/drinks/cans/souto/diet = 5, - /obj/item/reagent_containers/food/drinks/cans/souto/cherry = 5, - /obj/item/reagent_containers/food/drinks/cans/souto/cherry/diet = 5, - /obj/item/reagent_containers/food/drinks/cans/souto/lime = 5, - /obj/item/reagent_containers/food/drinks/cans/souto/lime/diet = 5, - /obj/item/reagent_containers/food/drinks/cans/souto/grape = 5, - /obj/item/reagent_containers/food/drinks/cans/souto/grape/diet = 5, - /obj/item/reagent_containers/food/drinks/cans/waterbottle = 2, - /obj/item/reagent_containers/food/drinks/cans/cola = 10, - ) idle_power_usage = 200 /obj/machinery/vending/medical diff --git a/tgui/packages/tgui/interfaces/Vending.tsx b/tgui/packages/tgui/interfaces/Vending.tsx index 285ca4dc566..db2d0839384 100644 --- a/tgui/packages/tgui/interfaces/Vending.tsx +++ b/tgui/packages/tgui/interfaces/Vending.tsx @@ -22,7 +22,6 @@ type VendingStock = { type VendingRecord = { product_name: string; product_color: string; - prod_price: number; prod_desc: string; ref: string; tab: string; @@ -63,11 +62,7 @@ export const Vending = (props, context) => { - - - - ); -}; - type VendingProductEntryProps = { stock: number; product_color: string; @@ -232,7 +202,6 @@ const Products = (props, context) => { (showEmpty || !!stock[display_record.product_name]) && ( { return ( { return (