mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
Fix #6521.
This commit is contained in:
@@ -251,12 +251,13 @@ var/global/num_vending_terminals = 1
|
||||
|
||||
/obj/machinery/vending/proc/build_inventory(var/list/productlist,hidden=0,req_coin=0)
|
||||
//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)
|
||||
var/amount = productlist[typepath]
|
||||
var/price = prices[typepath]
|
||||
if(isnull(amount)) amount = 1
|
||||
|
||||
var/obj/item/temp = new typepath(null)
|
||||
var/datum/data/vending_product/R = new /datum/data/vending_product()
|
||||
R.product_path = typepath
|
||||
R.amount = amount
|
||||
@@ -274,13 +275,13 @@ var/global/num_vending_terminals = 1
|
||||
R.category=CAT_NORMAL
|
||||
product_records += R
|
||||
|
||||
if(delay_product_spawn)
|
||||
temp = typepath
|
||||
|
||||
if (delay_product_spawn)
|
||||
sleep(1)
|
||||
R.product_name = temp.name
|
||||
R.subcategory = temp.vending_cat
|
||||
else
|
||||
R.product_name = temp.name
|
||||
R.subcategory = temp.vending_cat
|
||||
|
||||
R.product_name = initial(temp.name)
|
||||
R.subcategory = initial(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]")
|
||||
@@ -887,29 +888,41 @@ var/global/num_vending_terminals = 1
|
||||
//Somebody cut an important wire and now we're following a new definition of "pitch."
|
||||
/obj/machinery/vending/proc/throw_item()
|
||||
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/machinery/vending/proc/throw_item() called tick#: [world.time]")
|
||||
var/obj/throw_item = null
|
||||
var/mob/living/target = locate() in view(7,src)
|
||||
if(!target)
|
||||
|
||||
var/mob/living/target = locate() in view(7, src)
|
||||
|
||||
if (!target)
|
||||
return 0
|
||||
|
||||
var/list/throwable = product_records
|
||||
var/obj/throw_item
|
||||
var/list/throwable = product_records.Copy()
|
||||
var/tries = 10 //Give up eventually
|
||||
if(extended_inventory) throwable += hidden_records
|
||||
var/datum/data/vending_product/R
|
||||
var/dump_path
|
||||
|
||||
while(tries)
|
||||
var/datum/data/vending_product/R = pick(throwable)
|
||||
var/obj/item/dump_path = R.product_path
|
||||
if(R.amount <= 0 || !dump_path)
|
||||
if (extended_inventory)
|
||||
throwable += hidden_records
|
||||
|
||||
while (tries)
|
||||
R = pick(throwable)
|
||||
dump_path = R.product_path
|
||||
|
||||
if (R.amount <= 0 || !dump_path)
|
||||
tries--
|
||||
continue
|
||||
|
||||
R.amount--
|
||||
throw_item = new dump_path(src.loc)
|
||||
if(!throw_item)
|
||||
|
||||
if (!throw_item)
|
||||
return 0
|
||||
|
||||
spawn(0)
|
||||
throw_item.throw_at(target, 16, 3)
|
||||
|
||||
src.visible_message("<span class='danger'>[src] launches [throw_item.name] at [target.name]!</span>")
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
/obj/machinery/vending/update_icon()
|
||||
|
||||
Reference in New Issue
Block a user