mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-04-16 17:24:59 +01:00
## About The Pull Request The `onstation` var was being used for too many things (AI brand intelligence + whether the products are free or not), and was overcomplicating the logic. On top of that it makes things like trying to make a vending machine that is considered offstation for purposes of the brand intelligence event but that still dispenses free goods needlessly difficult. This PR just decouples the two behaviors and gives the 'free' behavior its own var. As a result, the majority of the of `onstation` map varedits are no longer necessary Tested with various edge cases, all seem working as intended: <details><summary>arrivals (onstation, all_free_products = null / FALSE)</summary>  </details> <details><summary>arrivals (onstation, all_free_products = TRUE)</summary>  </details> <details><summary>spacehotel (not onstation, all_free_products = null)</summary>  </details> <details><summary>hauntedruins (not onstation, all_free_products = FALSE)</summary>  </details> <details><summary>silverscale shuttle (not onstation, all_free_products = TRUE)</summary>  </details> <details><summary>labor camp (not onstation, all_free_products = FALSE)</summary>  </details> ## Why It's Good For The Game Less complicated vending machines, less varedits in our maps. Less confusing code. Ability to spawn a vending machine and varedit it to be free without affecting any other systems. ## Changelog N/A
74 lines
3.3 KiB
Plaintext
74 lines
3.3 KiB
Plaintext
/obj/machinery/vending/sustenance
|
|
name = "\improper Sustenance Vendor"
|
|
desc = "A vending machine which vends food, as required by section 47-C of the NT's Prisoner Ethical Treatment Agreement."
|
|
product_slogans = "Enjoy your meal.;Enough calories to support strenuous labor."
|
|
product_ads = "Sufficiently healthy.;Efficiently produced tofu!;Mmm! So good!;Have a meal.;You need food to live!;Even prisoners deserve their daily bread!;Have some more candy corn!;Try our new ice cups!"
|
|
light_mask = "snack-light-mask"
|
|
icon_state = "sustenance"
|
|
panel_type = "panel2"
|
|
products = list(
|
|
/obj/item/food/tofu/prison = 24,
|
|
/obj/item/food/breadslice/moldy = 15,
|
|
/obj/item/reagent_containers/cup/glass/ice/prison = 12,
|
|
/obj/item/food/candy_corn/prison = 6,
|
|
/obj/item/kitchen/spoon/plastic = 6,
|
|
)
|
|
contraband = list(
|
|
/obj/item/knife = 6,
|
|
/obj/item/kitchen/spoon = 6,
|
|
/obj/item/reagent_containers/cup/glass/coffee = 12,
|
|
/obj/item/tank/internals/emergency_oxygen = 6,
|
|
/obj/item/clothing/mask/breath = 6,
|
|
)
|
|
|
|
refill_canister = /obj/item/vending_refill/sustenance
|
|
default_price = PAYCHECK_LOWER
|
|
extra_price = PAYCHECK_LOWER * 0.6
|
|
payment_department = NO_FREEBIES
|
|
|
|
/obj/item/vending_refill/sustenance
|
|
machine_name = "Sustenance Vendor"
|
|
icon_state = "refill_snack"
|
|
|
|
//Labor camp subtype that uses labor points obtained from mining and processing ore
|
|
/obj/machinery/vending/sustenance/labor_camp
|
|
name = "\improper Labor Camp Sustenance Vendor"
|
|
desc = "A vending machine which vends food, as required by section 47-C of the NT's Prisoner Ethical Treatment Agreement. \
|
|
This one, however, processes labor points for its products if the user is incarcerated."
|
|
icon_state = "sustenance_labor"
|
|
all_products_free = FALSE
|
|
displayed_currency_icon = "digging"
|
|
displayed_currency_name = " LP"
|
|
|
|
/obj/machinery/vending/sustenance/interact(mob/user)
|
|
if(isliving(user))
|
|
var/mob/living/living_user = user
|
|
if(!(machine_stat & NOPOWER) && !istype(living_user.get_idcard(TRUE), /obj/item/card/id/advanced/prisoner))
|
|
speak("No valid prisoner account found. Vending is not permitted.")
|
|
return
|
|
return ..()
|
|
|
|
/obj/machinery/vending/sustenance/labor_camp/proceed_payment(obj/item/card/id/paying_id_card, mob/living/mob_paying, datum/data/vending_product/product_to_vend, price_to_use)
|
|
if(!istype(paying_id_card, /obj/item/card/id/advanced/prisoner))
|
|
speak("I don't take bribes! Pay with labor points!")
|
|
return FALSE
|
|
var/obj/item/card/id/advanced/prisoner/paying_scum_id = paying_id_card
|
|
if(coin_records.Find(product_to_vend) || hidden_records.Find(product_to_vend))
|
|
price_to_use = product_to_vend.custom_premium_price ? product_to_vend.custom_premium_price : extra_price
|
|
if(LAZYLEN(product_to_vend.returned_products))
|
|
price_to_use = 0 //returned items are free
|
|
if(price_to_use && !(paying_scum_id.points >= price_to_use)) //not enough good prisoner points
|
|
speak("You do not possess enough points to purchase [product_to_vend.name].")
|
|
flick(icon_deny, src)
|
|
vend_ready = TRUE
|
|
return FALSE
|
|
|
|
paying_scum_id.points -= price_to_use
|
|
return TRUE
|
|
|
|
/obj/machinery/vending/sustenance/labor_camp/fetch_balance_to_use(obj/item/card/id/passed_id)
|
|
if(!istype(passed_id, /obj/item/card/id/advanced/prisoner))
|
|
return null //no points balance - no balance at all
|
|
var/obj/item/card/id/advanced/prisoner/paying_scum_id = passed_id
|
|
return paying_scum_id.points
|