Make stack amount var private

This commit is contained in:
Chompstation Bot
2021-08-26 15:39:04 +00:00
parent 145f8172f4
commit af0d7a0f6b
72 changed files with 935 additions and 287 deletions

View File

@@ -100,8 +100,7 @@ using metal and glass, it uses glass and reagents (usually sulphuric acid).
if(materials[f] >= SHEET_MATERIAL_AMOUNT)
var/path = getMaterialType(f)
if(path)
var/obj/item/stack/S = new path(loc)
S.amount = round(materials[f] / SHEET_MATERIAL_AMOUNT)
new path(loc, round(materials[f] / SHEET_MATERIAL_AMOUNT))
..()
/obj/machinery/r_n_d/circuit_imprinter/attackby(var/obj/item/O as obj, var/mob/user as mob)

View File

@@ -233,7 +233,7 @@
new_item.matter[i] = new_item.matter[i] * mat_efficiency
/obj/machinery/r_n_d/protolathe/proc/eject_materials(var/material, var/amount) // 0 amount = 0 means ejecting a full stack; -1 means eject everything
var/recursive = amount == -1 ? 1 : 0
var/recursive = amount == -1 ? TRUE : FALSE
material = lowertext(material)
var/obj/item/stack/material/mattype
var/datum/material/MAT = get_material_by_name(material)
@@ -250,9 +250,7 @@
if(amount <= 0)
amount = S.max_amount
var/ejected = min(round(materials[material] / S.perunit), amount)
S.amount = min(ejected, amount)
if(S.amount <= 0)
qdel(S)
if(!S.set_amount(ejected, amount))
return
materials[material] -= ejected * S.perunit
if(recursive && materials[material] >= S.perunit)

View File

@@ -38,6 +38,5 @@
eject = amount == -1 ? eject : min(eject, amount)
if(eject < 1)
return
var/obj/item/stack/material/S = new sheetType(loc)
S.amount = eject
new sheetType(loc, eject)
materials[material] -= eject * perUnit