From 68b1a3e355ae0fd536972277bbe0a59ba9251179 Mon Sep 17 00:00:00 2001 From: Neerti Date: Sat, 17 Dec 2016 03:30:14 -0500 Subject: [PATCH] Vending machines now correctly throw products --- code/datums/vending/stored_item.dm | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/code/datums/vending/stored_item.dm b/code/datums/vending/stored_item.dm index 4fed107d77..7c27776aa9 100644 --- a/code/datums/vending/stored_item.dm +++ b/code/datums/vending/stored_item.dm @@ -3,11 +3,11 @@ */ /datum/stored_item var/item_name = "name" //Name of the item(s) displayed - var/item_path = null + var/item_path = null var/amount = 0 var/list/instances //What items are actually stored var/stored //The thing holding it is - + /datum/stored_item/New(var/stored, var/path, var/name = null, var/amount = 0) src.item_path = path @@ -16,10 +16,10 @@ src.item_name = initial(tmp.name) else src.item_name = name - + src.amount = amount src.stored = stored - + ..() /datum/stored_item/Destroy() @@ -29,10 +29,10 @@ qdel(product) instances.Cut() . = ..() - + /datum/stored_item/proc/get_amount() return instances ? instances.len : amount - + /datum/stored_item/proc/get_product(var/product_location) if(!get_amount() || !product_location) return @@ -41,14 +41,15 @@ var/atom/movable/product = instances[instances.len] // Remove the last added product instances -= product product.forceMove(product_location) - + return product + /datum/stored_item/proc/add_product(var/atom/movable/product) if(product.type != item_path) return 0 init_products() product.forceMove(stored) instances += product - + /datum/stored_item/proc/init_products() if(instances) return