mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
@@ -42,7 +42,6 @@ var/global/num_vending_terminals = 1
|
||||
var/vend_delay = 10 //How long does it take to vend?
|
||||
var/shoot_chance = 2 //How often do we throw items?
|
||||
var/datum/data/vending_product/currently_vending = null // A /datum/data/vending_product instance of what we're paying for right now.
|
||||
var/delay_product_spawn // If set, uses sleep() in product spawn proc (mostly for seeds to retrieve correct names).
|
||||
// To be filled out at compile time
|
||||
var/list/products = list() // For each, use the following pattern:
|
||||
var/list/contraband = list() // list(/type/path = amount,/type/path2 = amount2)
|
||||
@@ -112,10 +111,6 @@ var/global/num_vending_terminals = 1
|
||||
// so if slogantime is 10 minutes, it will say it at somewhere between 10 and 20 minutes after the machine is crated.
|
||||
src.last_slogan = world.time + rand(0, slogan_delay)
|
||||
|
||||
if(!product_records.len)
|
||||
src.build_inventory(products)
|
||||
src.build_inventory(contraband, 1)
|
||||
src.build_inventory(premium, 0, 1)
|
||||
power_change()
|
||||
|
||||
coinbox = new(src)
|
||||
@@ -125,6 +120,12 @@ var/global/num_vending_terminals = 1
|
||||
|
||||
return
|
||||
|
||||
/obj/machinery/vending/initialize()
|
||||
product_records = new/list()
|
||||
build_inventory(products)
|
||||
build_inventory(contraband, 1)
|
||||
build_inventory(premium, 0, 1)
|
||||
|
||||
/obj/machinery/vending/RefreshParts()
|
||||
var/manipcount = 0
|
||||
for(var/obj/item/weapon/stock_parts/SP in component_parts)
|
||||
@@ -253,35 +254,34 @@ var/global/num_vending_terminals = 1
|
||||
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/machinery/vending/proc/build_inventory() called tick#: [world.time]")
|
||||
var/obj/item/temp
|
||||
|
||||
for(var/typepath in productlist)
|
||||
for (var/typepath in productlist)
|
||||
var/amount = productlist[typepath]
|
||||
var/price = prices[typepath]
|
||||
if(isnull(amount)) amount = 1
|
||||
|
||||
var/datum/data/vending_product/R = new /datum/data/vending_product()
|
||||
if (isnull(amount))
|
||||
amount = 1
|
||||
|
||||
var/datum/data/vending_product/R = new()
|
||||
R.product_path = typepath
|
||||
R.amount = amount
|
||||
R.original_amount = amount
|
||||
R.price = price
|
||||
R.display_color = pick("red","blue","green")
|
||||
R.display_color = pick("red", "blue", "green")
|
||||
|
||||
if(hidden)
|
||||
if (hidden)
|
||||
R.category=CAT_HIDDEN
|
||||
hidden_records += R
|
||||
else if(req_coin)
|
||||
else if (req_coin)
|
||||
R.category=CAT_COIN
|
||||
coin_records += R
|
||||
else
|
||||
R.category=CAT_NORMAL
|
||||
product_records += R
|
||||
R.category = CAT_NORMAL
|
||||
product_records.Add(R)
|
||||
|
||||
temp = typepath
|
||||
temp = new typepath(null)
|
||||
|
||||
if (delay_product_spawn)
|
||||
sleep(1)
|
||||
|
||||
R.product_name = initial(temp.name)
|
||||
R.subcategory = initial(temp.vending_cat)
|
||||
R.product_name = temp.name
|
||||
R.subcategory = temp.vending_cat
|
||||
|
||||
/obj/machinery/vending/proc/get_item_by_type(var/this_type)
|
||||
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/machinery/vending/proc/get_item_by_type() called tick#: [world.time]")
|
||||
@@ -759,30 +759,26 @@ var/global/num_vending_terminals = 1
|
||||
|
||||
/obj/machinery/vending/proc/add_item(var/obj/item/I)
|
||||
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/machinery/vending/proc/add_item() called tick#: [world.time]")
|
||||
var/found = 0
|
||||
for (var/datum/data/vending_product/D in product_records)
|
||||
if(D.product_path == I.type)
|
||||
D.amount++
|
||||
found = 1
|
||||
var/found = FALSE
|
||||
|
||||
if(!found)
|
||||
var/datum/data/vending_product/R = new /datum/data/vending_product()
|
||||
for (var/datum/data/vending_product/D in product_records)
|
||||
if (D.product_path == I.type)
|
||||
D.amount++
|
||||
found = TRUE
|
||||
break
|
||||
|
||||
if (!found)
|
||||
var/datum/data/vending_product/R = new()
|
||||
R.product_path = I.type
|
||||
R.amount = 1
|
||||
R.original_amount = 0
|
||||
R.price = 0
|
||||
R.display_color = pick("red","blue","green")
|
||||
R.display_color = pick("red", "blue", "green")
|
||||
R.product_name = I.name
|
||||
R.category = CAT_NORMAL
|
||||
R.subcategory = I.vending_cat
|
||||
|
||||
R.category=CAT_NORMAL
|
||||
product_records += R
|
||||
|
||||
if(delay_product_spawn)
|
||||
sleep(1)
|
||||
R.product_name = I.name
|
||||
R.subcategory = I.vending_cat
|
||||
else
|
||||
R.product_name = I.name
|
||||
R.subcategory = I.vending_cat
|
||||
product_records.Add(R)
|
||||
|
||||
qdel(I)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user