Make stack amount var private

This commit is contained in:
Aronai Sieyes
2021-08-19 21:06:46 -04:00
parent ab7b3fcad9
commit e52031d6aa
72 changed files with 241 additions and 297 deletions
@@ -24,14 +24,14 @@
//Try locating an exisitng stack on the tile and add to there if possible
var/obj/item/stack/hairlesshide/H = null
for(var/obj/item/stack/hairlesshide/HS in user.loc) // Could be scraping something inside a locker, hence the .loc, not get_turf
if(HS.amount < HS.max_amount)
if(HS.get_amount() < HS.max_amount)
H = HS
break
// Either we found a valid stack, in which case increment amount,
// Or we need to make a new stack
if(istype(H))
H.amount++
H.add(1)
else
H = new /obj/item/stack/hairlesshide(user.loc)
@@ -21,14 +21,14 @@
for(var/i in 1 to wateramount)
var/obj/item/stack/wetleather/H = null
for(var/obj/item/stack/wetleather/HS in get_turf(src)) // Doesn't have a user, can't just use their loc
if(HS.amount < HS.max_amount)
if(HS.get_amount() < HS.max_amount)
H = HS
break
// Either we found a valid stack, in which case increment amount,
// Or we need to make a new stack
if(istype(H))
H.amount++
H.add(1)
else
H = new /obj/item/stack/wetleather(get_turf(src))
@@ -38,9 +38,8 @@
dry()
/obj/item/stack/wetleather/proc/dry()
var/obj/item/stack/material/leather/L = new(src.loc)
L.amount = amount
use(amount)
var/obj/item/stack/material/leather/L = new(src.loc, get_amount())
use(get_amount())
return L
/obj/item/stack/wetleather/transfer_to(obj/item/stack/S, var/tamount=null, var/type_verified)
@@ -41,7 +41,7 @@
drying = A
else // Drying something, add if possible
var/obj/item/stack/wetleather/W = A
W.transfer_to(drying, W.amount, TRUE)
W.transfer_to(drying, W.get_amount(), TRUE)
update_icon()
return TRUE
return ..()
@@ -50,9 +50,8 @@
if(drying)
var/obj/item/stack/S = drying
if(!drying.wetness) // If it's dry, make a stack of dry leather and prepare to put that in their hands
var/obj/item/stack/material/leather/L = new(src)
L.amount = drying.amount
drying.use(drying.amount)
var/obj/item/stack/material/leather/L = new(src, drying.get_amount())
drying.set_amount(0)
S = L
if(ishuman(user))
@@ -47,10 +47,9 @@
existing_wood = M
break
var/obj/item/stack/material/wood/new_wood = new plank_type(user.loc)
new_wood.amount = 2
var/obj/item/stack/material/wood/new_wood = new plank_type(user.loc, 2)
if(existing_wood && new_wood.transfer_to(existing_wood))
to_chat(user, "<span class='notice'>You add the newly-formed wood to the stack. It now contains [existing_wood.amount] planks.</span>")
to_chat(user, "<span class='notice'>You add the newly-formed wood to the stack. It now contains [existing_wood.get_amount()] planks.</span>")
else
return ..()