[MIRROR] Makes labor camp sustenance vendor cost labor points [MDB IGNORE] (#23040)

* Makes labor camp sustenance vendor cost labor points

* Update _vending.dm

---------

Co-authored-by: Sealed101 <cool.bullseye@yandex.ru>
Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-08-12 19:42:39 -04:00
committed by GitHub
co-authored by Sealed101 Bloop
parent d45b0e5fc0
commit 76cda90cef
6 changed files with 401 additions and 244 deletions
+20 -20
View File
@@ -2771,9 +2771,9 @@
"aTJ" = (
/obj/effect/spawner/structure/window/reinforced,
/obj/machinery/door/poddoor/shutters/preopen{
dir = 4;
id = "pharmacy_shutters";
name = "Pharmacy Shutters";
dir = 4
name = "Pharmacy Shutters"
},
/turf/open/floor/plating,
/area/station/medical/pharmacy)
@@ -7978,9 +7978,9 @@
},
/obj/effect/turf_decal/tile/yellow/fourcorners,
/obj/machinery/door/poddoor/shutters/preopen{
dir = 4;
id = "pharmacy_shutters";
name = "Pharmacy Shutters";
dir = 4
name = "Pharmacy Shutters"
},
/turf/open/floor/iron,
/area/station/medical/pharmacy)
@@ -32462,8 +32462,8 @@
/turf/open/floor/iron/white/corner,
/area/station/engineering/atmos)
"kqs" = (
/obj/machinery/vending/sustenance,
/obj/effect/decal/cleanable/dirt,
/obj/machinery/vending/sustenance/labor_camp,
/turf/open/floor/iron,
/area/mine/laborcamp)
"kqw" = (
@@ -39693,9 +39693,9 @@
"mIt" = (
/obj/effect/spawner/structure/window/reinforced,
/obj/machinery/door/poddoor/shutters/preopen{
dir = 1;
id = "pharmacy_shutters3";
name = "Pharmacy Shutters";
dir = 1
name = "Pharmacy Shutters"
},
/turf/open/floor/plating,
/area/station/medical/pharmacy)
@@ -45893,15 +45893,15 @@
"oCA" = (
/obj/structure/closet/secure_closet/cytology,
/obj/machinery/button/door/directional/north{
name = "Containment Blast Doors";
id = "xenobiomain";
req_access = list("xenobiology");
pixel_y = 32
name = "Containment Blast Doors";
pixel_y = 32;
req_access = list("xenobiology")
},
/obj/machinery/button/door/directional/north{
pixel_y = 23;
name = "Test Chamber Blast Doors";
id = "misclab";
name = "Test Chamber Blast Doors";
pixel_y = 23;
req_access = list("xenobiology")
},
/turf/open/floor/glass/reinforced,
@@ -46334,9 +46334,9 @@
"oKb" = (
/obj/effect/spawner/structure/window/reinforced,
/obj/machinery/door/poddoor/shutters/preopen{
dir = 1;
id = "pharmacy_shutters3";
name = "Pharmacy Shutters";
dir = 1
name = "Pharmacy Shutters"
},
/turf/open/floor/plating,
/area/station/service/kitchen)
@@ -48169,8 +48169,8 @@
},
/obj/effect/landmark/event_spawn,
/obj/machinery/door/window/brigdoor/left/directional/west{
req_access = list("morgue_secure");
name = "Coroner's Office"
name = "Coroner's Office";
req_access = list("morgue_secure")
},
/obj/effect/turf_decal/tile/neutral/fourcorners,
/turf/open/floor/iron/dark,
@@ -59211,8 +59211,8 @@
req_access = list("hop")
},
/obj/machinery/flasher/directional/south{
pixel_y = -23;
id = "hopflash"
id = "hopflash";
pixel_y = -23
},
/turf/open/floor/iron,
/area/station/command/heads_quarters/hop)
@@ -60721,9 +60721,9 @@
},
/obj/effect/turf_decal/tile/yellow/fourcorners,
/obj/machinery/door/poddoor/shutters/preopen{
dir = 4;
id = "pharmacy_shutters2";
name = "Pharmacy Shutters";
dir = 4
name = "Pharmacy Shutters"
},
/turf/open/floor/iron,
/area/station/medical/pharmacy)
+1 -1
View File
@@ -3496,8 +3496,8 @@
/turf/open/floor/carpet/neon/simple/red/nodots,
/area/mine/cafeteria)
"tZ" = (
/obj/machinery/vending/sustenance,
/obj/effect/decal/cleanable/dirt,
/obj/machinery/vending/sustenance/labor_camp,
/turf/open/floor/iron/smooth_edge{
dir = 8
},
File diff suppressed because it is too large Load Diff
+42
View File
@@ -29,3 +29,45 @@
/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"
onstation_override = TRUE
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 labor points account found. Vending is not permitted.")
return
return ..()
/obj/machinery/vending/sustenance/proceed_payment(obj/item/card/id/paying_id_card, 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/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
Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 114 KiB

+18 -6
View File
@@ -8,6 +8,8 @@ type VendingData = {
onstation: boolean;
department: string;
jobDiscount: number;
displayed_currency_icon: string;
displayed_currency_name: string;
product_records: ProductRecord[];
coin_records: CoinRecord[];
hidden_records: HiddenRecord[];
@@ -177,7 +179,13 @@ const ProductDisplay = (
) => {
const { data } = useBackend<VendingData>(context);
const { custom, inventory, selectedCategory } = props;
const { stock, onstation, user } = data;
const {
stock,
onstation,
user,
displayed_currency_icon,
displayed_currency_name,
} = data;
return (
<Section
@@ -188,7 +196,9 @@ const ProductDisplay = (
!!onstation &&
user && (
<Box fontSize="16px" color="green">
{(user && user.cash) || 0} cr <Icon name="coins" color="gold" />
{(user && user.cash) || 0}
{displayed_currency_name}{' '}
<Icon name={displayed_currency_icon} color="gold" />
</Box>
)
}>
@@ -320,14 +330,14 @@ const ProductStock = (props) => {
/** The main button to purchase an item. */
const ProductButton = (props, context) => {
const { act, data } = useBackend<VendingData>(context);
const { access } = data;
const { access, displayed_currency_name } = data;
const { custom, discount, disabled, free, product, redPrice } = props;
const customPrice = access ? 'FREE' : product.price + ' cr';
let standardPrice = product.price + ' cr';
const customPrice = access ? 'FREE' : product.price;
let standardPrice = product.price;
if (free) {
standardPrice = 'FREE';
} else if (discount) {
standardPrice = redPrice + ' cr';
standardPrice = redPrice;
}
return custom ? (
<Button
@@ -339,6 +349,7 @@ const ProductButton = (props, context) => {
})
}>
{customPrice}
{displayed_currency_name}
</Button>
) : (
<Button
@@ -350,6 +361,7 @@ const ProductButton = (props, context) => {
})
}>
{standardPrice}
{displayed_currency_name}
</Button>
);
};