Allows Multiple Light Printing in Autolathe

Allows light tubes and light bulbs to be printed 5 or 10 at a time.

Changes the is_stack var to be more general. Non-stack items with it will be able to produce 5 or 10 of said item at a time. This means it can be applied to other items if desired.
This commit is contained in:
Nalarac
2019-07-20 15:22:47 -05:00
parent 887804ea10
commit d6ab9c1fc7
3 changed files with 16 additions and 7 deletions

View File

@@ -8,9 +8,12 @@ var/datum/category_collection/autolathe/autolathe_recipes
for(var/material in I.matter) for(var/material in I.matter)
var/coeff = (no_scale ? 1 : 1.25) //most objects are more expensive to produce than to recycle var/coeff = (no_scale ? 1 : 1.25) //most objects are more expensive to produce than to recycle
resources[material] = I.matter[material]*coeff // but if it's a sheet or RCD cartridge, it's 1:1 resources[material] = I.matter[material]*coeff // but if it's a sheet or RCD cartridge, it's 1:1
if(is_stack && istype(I, /obj/item/stack)) if(is_stack)
if(istype(I, /obj/item/stack))
var/obj/item/stack/IS = I var/obj/item/stack/IS = I
max_stack = IS.max_amount max_stack = IS.max_amount
else
max_stack = 10
qdel(I) qdel(I)
/**************************** /****************************
@@ -65,7 +68,7 @@ var/datum/category_collection/autolathe/autolathe_recipes
var/list/resources var/list/resources
var/hidden var/hidden
var/power_use = 0 var/power_use = 0
var/is_stack var/is_stack // Creates multiple of an item if applied to non-stack items
var/max_stack var/max_stack
var/no_scale var/no_scale

View File

@@ -105,10 +105,12 @@
/datum/category_item/autolathe/general/tube /datum/category_item/autolathe/general/tube
name = "light tube" name = "light tube"
path =/obj/item/weapon/light/tube path =/obj/item/weapon/light/tube
is_stack = TRUE
/datum/category_item/autolathe/general/bulb /datum/category_item/autolathe/general/bulb
name = "light bulb" name = "light bulb"
path =/obj/item/weapon/light/bulb path =/obj/item/weapon/light/bulb
is_stack = TRUE
/datum/category_item/autolathe/general/ashtray_glass /datum/category_item/autolathe/general/ashtray_glass
name = "glass ashtray" name = "glass ashtray"

View File

@@ -276,9 +276,13 @@
//Create the desired item. //Create the desired item.
var/obj/item/I = new making.path(src.loc) var/obj/item/I = new making.path(src.loc)
if(multiplier > 1 && istype(I, /obj/item/stack)) if(multiplier > 1)
if(istype(I, /obj/item/stack))
var/obj/item/stack/S = I var/obj/item/stack/S = I
S.amount = multiplier S.amount = multiplier
else
for(multiplier; multiplier > 1; --multiplier) // Create multiple items if it's not a stack.
new making.path(src.loc)
updateUsrDialog() updateUsrDialog()