diff --git a/code/game/objects/items/cigs_lighters.dm b/code/game/objects/items/cigs_lighters.dm
index 20ec57354c..2303278f5c 100644
--- a/code/game/objects/items/cigs_lighters.dm
+++ b/code/game/objects/items/cigs_lighters.dm
@@ -707,10 +707,10 @@ CIGARETTE PACKETS ARE IN FANCY.DM
desc = "A classy and highly sophisticated electronic cigarette, for classy and dignified gentlemen. A warning label reads \"Warning: Do not fill with flammable materials.\""//<<< i'd vape to that.
icon = 'icons/obj/clothing/masks.dmi'
icon_state = "black_vape"
- item_state = null
+ item_state = "black_vape"
w_class = WEIGHT_CLASS_TINY
var/chem_volume = 100
- var/vapetime = FALSE //this so it won't puff out clouds every tick
+ var/vapetime = FALSE //this so it won't puff out clouds every tick
var/screw = FALSE // kinky
var/super = FALSE //for the fattest vapes dude.
@@ -723,11 +723,10 @@ CIGARETTE PACKETS ARE IN FANCY.DM
. = ..()
create_reagents(chem_volume, NO_REACT, NO_REAGENTS_VALUE) // so it doesn't react until you light it
reagents.add_reagent(/datum/reagent/drug/nicotine, 50)
- if(!icon_state)
- if(!param_color)
- param_color = pick("red","blue","black","white","green","purple","yellow","orange")
- icon_state = "[param_color]_vape"
- item_state = "[param_color]_vape"
+ if(!param_color)
+ param_color = pick("red","blue","black","white","green","purple","yellow","orange")
+ icon_state = "[param_color]_vape"
+ item_state = "[param_color]_vape"
/obj/item/clothing/mask/vape/attackby(obj/item/O, mob/user, params)
if(O.tool_behaviour == TOOL_SCREWDRIVER)
diff --git a/code/modules/vending/_vending.dm b/code/modules/vending/_vending.dm
index d2ea0ada47..8fdc1c7c0c 100644
--- a/code/modules/vending/_vending.dm
+++ b/code/modules/vending/_vending.dm
@@ -120,8 +120,6 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C
var/scan_id = TRUE
///Coins that we accept?
var/obj/item/coin/coin
- ///Bills we accept?
- var/obj/item/stack/spacecash/bill
///Default price of items if not overridden
/**
* Is this item on station or not
@@ -184,7 +182,6 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C
/obj/machinery/vending/Destroy()
QDEL_NULL(wires)
QDEL_NULL(coin)
- QDEL_NULL(bill)
return ..()
/obj/machinery/vending/can_speak()
@@ -356,7 +353,6 @@ GLOBAL_LIST_EMPTY(vending_products)
..()
if(panel_open)
default_unfasten_wrench(user, I, time = 60)
- unbuckle_all_mobs(TRUE)
return TRUE
/obj/machinery/vending/screwdriver_act(mob/living/user, obj/item/I)
@@ -380,9 +376,6 @@ GLOBAL_LIST_EMPTY(vending_products)
if(coin)
to_chat(user, "[src] already has [coin] inserted")
return
- if(bill)
- to_chat(user, "[src] already has [bill] inserted")
- return
if(!premium.len)
to_chat(user, "[src] doesn't have a coin slot.")
return
@@ -391,21 +384,6 @@ GLOBAL_LIST_EMPTY(vending_products)
coin = I
to_chat(user, "You insert [I] into [src].")
return
- else if(istype(I, /obj/item/stack/spacecash))
- if(coin)
- to_chat(user, "[src] already has [coin] inserted")
- return
- if(bill)
- to_chat(user, "[src] already has [bill] inserted")
- return
- var/obj/item/stack/S = I
- if(!premium.len)
- to_chat(user, "[src] doesn't have a bill slot.")
- return
- S.use(1)
- bill = new S.type(src, 1)
- to_chat(user, "You insert [I] into [src].")
- return
else if(refill_canister && istype(I, refill_canister))
if (!panel_open)
to_chat(user, "You should probably unscrew the service panel first!")
@@ -424,6 +402,7 @@ GLOBAL_LIST_EMPTY(vending_products)
else
to_chat(user, "There's nothing to restock!")
return
+
if(compartmentLoadAccessCheck(user) && user.a_intent != INTENT_HARM)
if(canLoadItem(I))
loadingAttempt(I,user)
@@ -514,10 +493,12 @@ GLOBAL_LIST_EMPTY(vending_products)
. = ..()
/obj/machinery/vending/emag_act(mob/user)
+ . = ..()
if(obj_flags & EMAGGED)
return
obj_flags |= EMAGGED
to_chat(user, "You short out the product lock on [src].")
+ return TRUE
/obj/machinery/vending/_try_interact(mob/user)
if(seconds_electrified && !(stat & NOPOWER))
@@ -534,7 +515,7 @@ GLOBAL_LIST_EMPTY(vending_products)
if(!ui)
var/datum/asset/assets = get_asset_datum(/datum/asset/spritesheet/vending)
assets.send(user)
- ui = new(user, src, ui_key, "vending", ui_key, 450, 600, master_ui, state)
+ ui = new(user, src, ui_key, "vending", name, 450, 600, master_ui, state)
ui.open()
/obj/machinery/vending/ui_static_data(mob/user)
@@ -575,6 +556,7 @@ GLOBAL_LIST_EMPTY(vending_products)
for(var/datum/data/vending_product/R in product_records + coin_records + hidden_records)
.["stock"][R.name] = R.amount
.["extended_inventory"] = extended_inventory
+ .["coin"] = coin
/obj/machinery/vending/ui_act(action, params)
. = ..()
@@ -588,11 +570,12 @@ GLOBAL_LIST_EMPTY(vending_products)
if(panel_open)
to_chat(usr, "The vending machine cannot dispense products while its service panel is open!")
return
+ if((!allowed(usr)) && !(obj_flags & EMAGGED) && scan_id) //For SECURE VENDING MACHINES YEAH
+ to_chat(usr, "Access denied." )
+ flick(icon_deny,src)
+ return
vend_ready = FALSE //One thing at a time!!
var/datum/data/vending_product/R = locate(params["ref"])
- var/list/record_to_check = product_records + coin_records
- if(extended_inventory)
- record_to_check = product_records + coin_records + hidden_records
if(!R || !istype(R) || !R.product_path)
vend_ready = TRUE
return
@@ -600,28 +583,60 @@ GLOBAL_LIST_EMPTY(vending_products)
if(!extended_inventory)
vend_ready = TRUE
return
- else if(!(R in record_to_check))
+ else if(R in coin_records)
+ if(!(coin))
+ to_chat(usr, "You need to a coin to get this item!")
+ vend_ready = TRUE
+ return
+ if(coin && coin.string_attached)
+ if(!prob(50))
+ to_chat(usr, "You weren't able to pull [coin] out fast enough, the machine ate it, string and all!")
+ QDEL_NULL(coin)
+ return
+ if(!usr.CanReach(src))
+ to_chat(usr, "You successfully pull [coin] out of [src] to the floor.")
+ coin = null
+ if(!usr.put_in_hands(coin))
+ to_chat(usr, "You couldn't pull [coin] out because your hands are full!")
+ QDEL_NULL(coin)
+ to_chat(usr, "You successfully pull [coin] out before [src] could swallow it.")
+ coin = null
+ QDEL_NULL(coin)
+ else if(!(R in product_records))
vend_ready = TRUE
message_admins("Vending machine exploit attempted by [ADMIN_LOOKUPFLW(usr)]!")
return
- if (R.amount <= 0)
- say("Sold out of [R.name].")
- flick(icon_deny,src)
+ if(R.amount <= 0)
+ to_chat(usr, "Sold out.")
vend_ready = TRUE
return
- if(last_shopper != usr || purchase_message_cooldown < world.time)
- say("Thank you for shopping with [src]!")
- purchase_message_cooldown = world.time + 5 SECONDS
- last_shopper = usr
+ else
+ R.amount--
+ if(((last_reply + 200) <= world.time) && vend_reply)
+ speak(vend_reply)
+ last_reply = world.time
use_power(5)
if(icon_vend) //Show the vending animation if needed
flick(icon_vend,src)
- playsound(src, 'sound/machines/machine_vend.ogg', 50, TRUE, extrarange = -3)
- new R.product_path(get_turf(src))
- R.amount--
+ var/vended = new R.product_path(get_turf(src))
+ if(usr.CanReach(src) && usr.put_in_hands(vended))
+ to_chat(usr, "You take [R.name] out of the slot.")
+ else
+ to_chat(usr, "[capitalize(R.name)] falls onto the floor!")
+
+
SSblackbox.record_feedback("nested tally", "vending_machine_usage", 1, list("[type]", "[R.product_path]"))
vend_ready = TRUE
-
+ return
+ if("takeoutcoin")
+ usr.put_in_hands(coin)
+ to_chat(usr, "You remove [coin] from [src].")
+ coin = null
+ return
+
+ else if("togglevoice" && panel_open)
+ shut_up = !shut_up
+
/obj/machinery/vending/process()
if(stat & (BROKEN|NOPOWER))
return PROCESS_KILL
@@ -669,28 +684,26 @@ GLOBAL_LIST_EMPTY(vending_products)
*/
/obj/machinery/vending/proc/throw_item()
var/obj/throw_item = null
- var/mob/living/target = locate() in view(7,src)
+ var/mob/living/target = locate() in view(7, src)
if(!target)
- return 0
-
+ return FALSE
for(var/datum/data/vending_product/R in shuffle(product_records))
if(R.amount <= 0) //Try to use a record that actually has something to dump.
continue
var/dump_path = R.product_path
if(!dump_path)
continue
-
R.amount--
throw_item = new dump_path(loc)
break
if(!throw_item)
- return 0
+ return FALSE
pre_throw(throw_item)
throw_item.throw_at(target, 16, 3)
visible_message("[src] launches [throw_item] at [target]!")
- return 1
+ return TRUE
/**
* A callback called before an item is tossed out
*
diff --git a/tgui-next/packages/tgui/interfaces/Vending.js b/tgui-next/packages/tgui/interfaces/Vending.js
index ab8f180048..b6ffde015d 100644
--- a/tgui-next/packages/tgui/interfaces/Vending.js
+++ b/tgui-next/packages/tgui/interfaces/Vending.js
@@ -2,7 +2,6 @@ import { Fragment } from 'inferno';
import { act } from '../byond';
import { Section, Box, Button, Table } from '../components';
import { classes } from 'common/react';
-import { useBackend } from '../backend';
export const Vending = props => {
const { state } = props;
@@ -10,24 +9,37 @@ export const Vending = props => {
const { ref } = config;
let inventory;
let custom = false;
- if (data.vending_machine_input) {
- inventory = data.vending_machine_input;
- custom = true;
+ const onstation = true;
+ if (data.extended_inventory && data.coin) {
+ inventory = [
+ ...data.product_records,
+ ...data.hidden_records,
+ ...data.coin_records,
+ ];
} else if (data.extended_inventory) {
inventory = [
...data.product_records,
- ...data.coin_records,
...data.hidden_records,
];
+ } else if (data.coin) {
+ inventory = [
+ ...data.product_records,
+ ...data.coin_records,
+ ];
} else {
inventory = [
...data.product_records,
- ...data.coin_records,
];
}
return (
- )
+ {data.coin && (
+
+
+ )}
{inventory.map((product => {
@@ -65,16 +77,13 @@ export const Vending = props => {
{custom && (