vendors now accept dollar bills again (#12109)
* make vendors accept bills * build * forgot that function * this is better * i thought i had a hook for this
This commit is contained in:
@@ -120,6 +120,8 @@ 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 that we accept?
|
||||
var/obj/item/stack/spacecash/bill
|
||||
///Default price of items if not overridden
|
||||
/**
|
||||
* Is this item on station or not
|
||||
@@ -182,6 +184,7 @@ 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()
|
||||
@@ -376,6 +379,9 @@ GLOBAL_LIST_EMPTY(vending_products)
|
||||
if(coin)
|
||||
to_chat(user, "<span class='warning'>[src] already has [coin] inserted</span>")
|
||||
return
|
||||
if(bill)
|
||||
to_chat(user, "<span class='warning'>[src] already has [bill] inserted</span>")
|
||||
return
|
||||
if(!premium.len)
|
||||
to_chat(user, "<span class='warning'>[src] doesn't have a coin slot.</span>")
|
||||
return
|
||||
@@ -384,6 +390,23 @@ GLOBAL_LIST_EMPTY(vending_products)
|
||||
coin = I
|
||||
to_chat(user, "<span class='notice'>You insert [I] into [src].</span>")
|
||||
return
|
||||
else if(istype(I, /obj/item/stack/spacecash))
|
||||
if(coin)
|
||||
to_chat(user, "<span class='warning'>[src] already has [coin] inserted</span>")
|
||||
return
|
||||
if(bill)
|
||||
to_chat(user, "<span class='warning'>[src] already has [bill] inserted</span>")
|
||||
return
|
||||
if(!premium.len)
|
||||
to_chat(user, "<span class='warning'>[src] doesn't have a bill slot.</span>")
|
||||
return
|
||||
if(!user.transferItemToLoc(I, src))
|
||||
return
|
||||
var/obj/item/stack/S = I
|
||||
S.use(1)
|
||||
bill = new S.type(src, 1)
|
||||
to_chat(user, "<span class='notice'>You insert [I] into [src].</span>")
|
||||
return
|
||||
else if(refill_canister && istype(I, refill_canister))
|
||||
if (!panel_open)
|
||||
to_chat(user, "<span class='warning'>You should probably unscrew the service panel first!</span>")
|
||||
@@ -439,7 +462,7 @@ GLOBAL_LIST_EMPTY(vending_products)
|
||||
vending_machine_input[format_text(I.name)] = 1
|
||||
to_chat(user, "<span class='notice'>You insert [I] into [src]'s input compartment.</span>")
|
||||
loaded_items++
|
||||
|
||||
|
||||
/**
|
||||
* Is the passed in user allowed to load this vending machines compartments
|
||||
*
|
||||
@@ -557,6 +580,7 @@ GLOBAL_LIST_EMPTY(vending_products)
|
||||
.["stock"][R.name] = R.amount
|
||||
.["extended_inventory"] = extended_inventory
|
||||
.["coin"] = coin
|
||||
.["bill"] = bill
|
||||
|
||||
/obj/machinery/vending/ui_act(action, params)
|
||||
. = ..()
|
||||
@@ -588,7 +612,7 @@ GLOBAL_LIST_EMPTY(vending_products)
|
||||
vend_ready = TRUE
|
||||
return
|
||||
else if(R in coin_records)
|
||||
if(!coin)
|
||||
if(!(coin || bill))
|
||||
to_chat(usr, "<span class='warning'>You need to insert a coin to get this item!</span>")
|
||||
vend_ready = TRUE
|
||||
return
|
||||
@@ -605,6 +629,7 @@ GLOBAL_LIST_EMPTY(vending_products)
|
||||
QDEL_NULL(coin)
|
||||
else
|
||||
QDEL_NULL(coin)
|
||||
QDEL_NULL(bill)
|
||||
else if(!(R in product_records))
|
||||
vend_ready = TRUE
|
||||
message_admins("Vending machine exploit attempted by [ADMIN_LOOKUPFLW(usr)]!")
|
||||
@@ -629,11 +654,16 @@ GLOBAL_LIST_EMPTY(vending_products)
|
||||
to_chat(usr, "<span class='notice'>You remove [coin] from [src].</span>")
|
||||
coin = null
|
||||
return
|
||||
|
||||
if("takeoutbill")
|
||||
usr.put_in_hands(bill)
|
||||
to_chat(usr, "<span class='notice'>You remove [bill] from [src].</span>")
|
||||
bill = null
|
||||
return
|
||||
|
||||
if("togglevoice")
|
||||
if(panel_open)
|
||||
shut_up = !shut_up
|
||||
|
||||
|
||||
/obj/machinery/vending/process()
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return PROCESS_KILL
|
||||
|
||||
Reference in New Issue
Block a user