From 0d5efb3d700089efd5eb388d8a0e9df37b06c7a4 Mon Sep 17 00:00:00 2001 From: Rykka Date: Fri, 3 Sep 2021 18:26:32 -0700 Subject: [PATCH] Fix items attempting to directly access/touch amount on stack var. PR https://github.com/VOREStation/VOREStation/pull/11454 set var amount on stacks to private, necessitating using get_amount() to read the amount currently left in a stack, rather than just directly accessing the var. --- code/game/machinery/feeder.dm | 3 +-- code/game/machinery/telecrystal_storage_ch.dm | 4 ++-- code/game/mecha/mecha_construction_paths_ch.dm | 9 +++------ .../power/fusion/fuel_assembly/fuel_assembly_ch.dm | 2 +- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/code/game/machinery/feeder.dm b/code/game/machinery/feeder.dm index 3178613bda..271fdf1656 100644 --- a/code/game/machinery/feeder.dm +++ b/code/game/machinery/feeder.dm @@ -67,8 +67,7 @@ if(default_deconstruction_screwdriver(user, W)) if(do_after(user, 15)) to_chat(user, "You deconstruct the feeder.") - var/obj/item/stack/material/plastic/A = new /obj/item/stack/material/plastic(src.loc) - A.amount = 4 + new /obj/item/stack/material/plastic(src.loc, 4) if(beaker) beaker.loc = get_turf(src) beaker = null diff --git a/code/game/machinery/telecrystal_storage_ch.dm b/code/game/machinery/telecrystal_storage_ch.dm index 530a084035..4e071ae065 100644 --- a/code/game/machinery/telecrystal_storage_ch.dm +++ b/code/game/machinery/telecrystal_storage_ch.dm @@ -25,12 +25,12 @@ var/hasRecord = FALSE //Check to see if this passes or not. for(var/datum/stored_item/I in item_records) if((O.type == I.item_path) && (O.name == I.item_name)) - mod_amount(I,O.amount) + mod_amount(I,O.get_amount()) hasRecord = TRUE qdel(O) break if(!hasRecord) - var/datum/stored_item/item = new/datum/stored_item(src,O.type,O.name,O.amount) + var/datum/stored_item/item = new/datum/stored_item(src,O.type,O.name,O.get_amount()) item_records.Add(item) qdel(O) diff --git a/code/game/mecha/mecha_construction_paths_ch.dm b/code/game/mecha/mecha_construction_paths_ch.dm index 8d9ce06602..841b3bb4d5 100644 --- a/code/game/mecha/mecha_construction_paths_ch.dm +++ b/code/game/mecha/mecha_construction_paths_ch.dm @@ -142,8 +142,7 @@ holder.icon_state = "scarab_wire2" else user.visible_message("[user] removes the wiring from [holder].", "You remove the wiring from [holder].") - var/obj/item/stack/cable_coil/coil = new /obj/item/stack/cable_coil(get_turf(holder)) - coil.amount = 4 + new /obj/item/stack/cable_coil(get_turf(holder), 4) holder.icon_state = "scarab_chassis_complete" if(16) if(diff==FORWARD) @@ -238,8 +237,7 @@ holder.icon_state = "scarab_chip5" else user.visible_message("[user] pries internal armor layer from [holder].", "You prie internal armor layer from [holder].") - var/obj/item/stack/material/steel/MS = new /obj/item/stack/material/steel(get_turf(holder)) - MS.amount = 5 + new /obj/item/stack/material/steel(get_turf(holder), 5) holder.icon_state = "scarab_chip5" if(4) if(diff==FORWARD) @@ -261,8 +259,7 @@ holder.icon_state = "scarab_weld2" else user.visible_message("[user] pries the external armor layer from [holder].", "You pry external armor layer from [holder].") - var/obj/item/stack/material/plasteel/MS = new /obj/item/stack/material/plasteel(get_turf(holder)) - MS.amount = 5 + new /obj/item/stack/material/plasteel(get_turf(holder), 5) holder.icon_state = "scarab_weld1" if(1) if(diff==FORWARD) diff --git a/code/modules/power/fusion/fuel_assembly/fuel_assembly_ch.dm b/code/modules/power/fusion/fuel_assembly/fuel_assembly_ch.dm index d0e63edd73..48ac9b9ecd 100644 --- a/code/modules/power/fusion/fuel_assembly/fuel_assembly_ch.dm +++ b/code/modules/power/fusion/fuel_assembly/fuel_assembly_ch.dm @@ -31,7 +31,7 @@ ..() var/obj/item/stack/material/lead/M = I if(istype(M)) - if(M.amount>5) + if(M.get_amount() > 5) to_chat(user,"You add a lead shell to the blitz rod.") qdel(src) var/obj/item/weapon/fuel_assembly/blitz/shielded/rod = new(get_turf(user))