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
+1 -1
View File
@@ -559,7 +559,7 @@ GLOBAL_LIST_EMPTY(apcs)
"You start adding cables to the APC frame...")
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 20))
if(C.amount >= 10 && !terminal && opened && has_electronics != APC_HAS_ELECTRONICS_SECURED)
if(C.get_amount() >= 10 && !terminal && opened && has_electronics != APC_HAS_ELECTRONICS_SECURED)
var/obj/structure/cable/N = T.get_cable_node()
if(prob(50) && electrocute_mob(usr, N, N))
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
+3 -5
View File
@@ -163,10 +163,8 @@
//Removes one stack's worth of material from the generator.
/obj/machinery/power/port_gen/pacman/DropFuel()
if(sheets)
var/obj/item/stack/material/S = new sheet_path(loc)
var/amount = min(sheets, S.max_amount)
S.amount = amount
sheets -= amount
var/obj/item/stack/material/S = new sheet_path(loc, sheets)
sheets -= S.get_amount()
/obj/machinery/power/port_gen/pacman/UseFuel()
@@ -265,7 +263,7 @@
/obj/machinery/power/port_gen/pacman/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(istype(O, sheet_path))
var/obj/item/stack/addstack = O
var/amount = min((max_sheets - sheets), addstack.amount)
var/amount = min((max_sheets - sheets), addstack.get_amount())
if(amount < 1)
to_chat(user, "<span class='warning'>The [src.name] is full!</span>")
return
+1 -1
View File
@@ -216,7 +216,7 @@
to_chat(user, "<span class='notice'>\The [src] is already fully repaired.</span>")
return
var/obj/item/stack/P = W
if(P.amount < amt)
if(!P.can_use(amt))
to_chat(user, "<span class='warning'>You don't have enough sheets to repair this! You need at least [amt] sheets.</span>")
return
to_chat(user, "<span class='notice'>You begin repairing \the [src]...</span>")
+1 -2
View File
@@ -63,8 +63,7 @@ GLOBAL_LIST_EMPTY(solars_list)
if(do_after(user, 50))
var/obj/item/solar_assembly/S = new(loc)
S.anchored = TRUE
var/obj/item/stack/glass = new glass_type(loc)
glass.amount = 2
new glass_type(loc, 2)
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
user.visible_message("<span class='notice'>[user] takes the glass off the solar panel.</span>")
qdel(src)
+1 -2
View File
@@ -58,8 +58,7 @@
var/obj/item/solar_assembly/S = new(loc)
S.tracker = TRUE
S.anchored = TRUE
var/obj/item/stack/glass = new glass_type(loc)
glass.amount = 2
new glass_type(loc, 2)
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
user.visible_message("<span class='notice'>[user] takes the glass off the tracker.</span>")
qdel(src)