diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index 777a34fa10c..89e61042920 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -240,21 +240,20 @@ if(reinforced) user << "[src] is already reinforced." return - if(P.amount < 2) + if(P.get_amount() < 2) user << "You need more plasteel to reinforce [src]." return user.visible_message("[user] begins reinforcing [src]...", \ "You begin reinforcing [src]...") playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1) - if(!do_after(user, 60, target = src)) - return - if(constructionStep != CONSTRUCTION_PANEL_OPEN || reinforced || P.amount < 2) - return - user.visible_message("[user] reinforces [src].", \ - "You reinforce [src].") - playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1) - P.use(2) - reinforced = 1 + if(do_after(user, 60, target = src)) + if(constructionStep != CONSTRUCTION_PANEL_OPEN || reinforced || P.get_amount() < 2 || !P) + return + user.visible_message("[user] reinforces [src].", \ + "You reinforce [src].") + playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1) + P.use(2) + reinforced = 1 return if(CONSTRUCTION_WIRES_EXPOSED) @@ -307,22 +306,21 @@ return if(istype(C, /obj/item/stack/cable_coil)) var/obj/item/stack/cable_coil/B = C - if(B.amount < 5) + if(B.get_amount() < 5) user << "You need more wires to add wiring to [src]." return user.visible_message("[user] begins wiring [src]...", \ "You begin adding wires to [src]...") playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1) - if(!do_after(user, 60, target = src)) - return - if(constructionStep != CONSTRUCTION_GUTTED || B.amount < 5) - return - user.visible_message("[user] adds wires to [src].", \ - "You wire [src].") - playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1) - B.use(5) - constructionStep = CONSTRUCTION_WIRES_EXPOSED - update_icon() + if(do_after(user, 60, target = src)) + if(constructionStep != CONSTRUCTION_GUTTED || B.get_amount() < 5 || !B) + return + user.visible_message("[user] adds wires to [src].", \ + "You wire [src].") + playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1) + B.use(5) + constructionStep = CONSTRUCTION_WIRES_EXPOSED + update_icon() return if(CONSTRUCTION_NOCIRCUIT) if(istype(C, /obj/item/weapon/weldingtool)) @@ -364,4 +362,4 @@ /obj/structure/firelock_frame/heavy name = "heavy firelock frame" - reinforced = 1 + reinforced = 1 diff --git a/code/game/mecha/mecha_construction_paths.dm b/code/game/mecha/mecha_construction_paths.dm index 053a9d9f14b..ddae085d50f 100644 --- a/code/game/mecha/mecha_construction_paths.dm +++ b/code/game/mecha/mecha_construction_paths.dm @@ -27,7 +27,7 @@ return 0 else if(istype(used_atom, /obj/item/stack)) var/obj/item/stack/S = used_atom - if(S.amount < 5) + if(S.get_amount() < 5) user << ("There's not enough material in this stack!") return 0 else @@ -59,7 +59,7 @@ return 0 else if(istype(used_atom, /obj/item/stack)) var/obj/item/stack/S = used_atom - if(S.amount < 5) + if(S.get_amount() < 5) user << ("There's not enough material in this stack!") return 0 else diff --git a/code/game/objects/items/weapons/handcuffs.dm b/code/game/objects/items/weapons/handcuffs.dm index 7c7f53d0a65..623d39330c0 100644 --- a/code/game/objects/items/weapons/handcuffs.dm +++ b/code/game/objects/items/weapons/handcuffs.dm @@ -168,11 +168,13 @@ return else if(istype(I, /obj/item/stack/sheet/metal)) var/obj/item/stack/sheet/metal/M = I - if(M.amount < 6) + if(M.get_amount() < 6) user << "You need at least six metal sheets to make good enough weights!" return user << "You begin to apply [I] to [src]..." if(do_after(user, 35, target = src)) + if(M.get_amount() < 6 || !M) + return var/obj/item/weapon/restraints/legcuffs/bola/S = new /obj/item/weapon/restraints/legcuffs/bola M.use(6) user.put_in_hands(S) diff --git a/code/game/objects/structures/girders.dm b/code/game/objects/structures/girders.dm index ed54a367368..5e87acfbb70 100644 --- a/code/game/objects/structures/girders.dm +++ b/code/game/objects/structures/girders.dm @@ -99,12 +99,12 @@ if(istype(W,/obj/item/stack/rods)) var/obj/item/stack/rods/S = W if(state == GIRDER_DISPLACED) - if(S.amount < 2) + if(S.get_amount() < 2) user << "You need at least two rods to create a false wall!" return user << "You start building a reinforced false wall..." if(do_after(user, 20, target = src)) - if(!src.loc || !S || S.amount < 2) + if(!src.loc || !S || S.get_amount() < 2) return S.use(2) user << "You create a false wall. Push on it to open or close the passage." @@ -112,12 +112,12 @@ transfer_fingerprints_to(FW) qdel(src) else - if(S.amount < 5) + if(S.get_amount() < 5) user << "You need at least five rods to add plating!" return user << "You start adding plating..." if (do_after(user, 40, target = src)) - if(!src.loc || !S || S.amount < 5) + if(!src.loc || !S || S.get_amount() < 5) return S.use(5) user << "You add the plating." @@ -163,12 +163,12 @@ if(istype(S,/obj/item/stack/sheet/plasteel)) if(state == GIRDER_DISPLACED) - if(S.amount < 2) + if(S.get_amount() < 2) user << "You need at least two sheets to create a false wall!" return user << "You start building a reinforced false wall..." if(do_after(user, 20, target = src)) - if(!src.loc || !S || S.amount < 2) + if(!src.loc || !S || S.get_amount() < 2) return S.use(2) user << "You create a reinforced false wall. Push on it to open or close the passage." @@ -177,11 +177,11 @@ qdel(src) else if(state == GIRDER_REINF) - if(S.amount < 1) + if(S.get_amount() < 1) return user << "You start finalizing the reinforced wall..." if(do_after(user, 50, target = src)) - if(!src.loc || !S || S.amount < 1) + if(!src.loc || !S || S.get_amount() < 1) return S.use(1) user << "You fully reinforce the wall." @@ -191,11 +191,11 @@ qdel(src) return else - if(S.amount < 1) + if(S.get_amount() < 1) return user << "You start reinforcing the girder..." if (do_after(user, 60, target = src)) - if(!src.loc || !S || S.amount < 1) + if(!src.loc || !S || S.get_amount() < 1) return S.use(1) user << "You reinforce the girder." @@ -207,22 +207,25 @@ if(S.sheettype) var/M = S.sheettype if(state == GIRDER_DISPLACED) - if(S.amount < 2) + if(S.get_amount() < 2) user << "You need at least two sheets to create a false wall!" return - S.use(2) - user << "You create a false wall. Push on it to open or close the passage." - var/F = text2path("/obj/structure/falsewall/[M]") - var/obj/structure/FW = new F (loc) - transfer_fingerprints_to(FW) - qdel(src) + if(do_after(user, 20, target = src)) + if(!src.loc || !S || S.get_amount() < 2) + return + S.use(2) + user << "You create a false wall. Push on it to open or close the passage." + var/F = text2path("/obj/structure/falsewall/[M]") + var/obj/structure/FW = new F (loc) + transfer_fingerprints_to(FW) + qdel(src) else - if(S.amount < 2) + if(S.get_amount() < 2) user << "You need at least two sheets to add plating!" return user << "You start adding plating..." if (do_after(user, 40, target = src)) - if(!src.loc || !S || S.amount < 2) + if(!src.loc || !S || S.get_amount() < 2) return S.use(2) user << "You add the plating." @@ -366,17 +369,18 @@ else if(istype(W, /obj/item/stack/sheet/runed_metal)) var/obj/item/stack/sheet/runed_metal/R = W - if(R.amount < 1) + if(R.get_amount() < 1) user << "You need at least one sheet of runed metal to construct a runed wall!" return 0 user.visible_message("[user] begins laying runed metal on [src]...", "You begin constructing a runed wall...") - if(!do_after(user, 50, target = src)) - return 0 - user.visible_message("[user] plates [src] with runed metal.", "You construct a runed wall.") - R.use(1) - var/turf/T = get_turf(src) - T.ChangeTurf(/turf/closed/wall/mineral/cult) - qdel(src) + if(do_after(user, 50, target = src)) + if(R.get_amount() < 1 || !R) + return + user.visible_message("[user] plates [src] with runed metal.", "You construct a runed wall.") + R.use(1) + var/turf/T = get_turf(src) + T.ChangeTurf(/turf/closed/wall/mineral/cult) + qdel(src) else return ..() diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm index 8ffce5565d9..13e6ea0570f 100644 --- a/code/game/objects/structures/windoor_assembly.dm +++ b/code/game/objects/structures/windoor_assembly.dm @@ -136,13 +136,13 @@ //Adding plasteel makes the assembly a secure windoor assembly. Step 2 (optional) complete. else if(istype(W, /obj/item/stack/sheet/plasteel) && !secure) var/obj/item/stack/sheet/plasteel/P = W - if(P.amount < 2) + if(P.get_amount() < 2) user << "You need more plasteel to do this!" return user << "You start to reinforce the windoor with plasteel..." if(do_after(user,40, target = src)) - if(!src || secure) + if(!src || secure || P.get_amount() < 2) return P.use(2) diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 9c17ba8db9b..fcaa71dbfd9 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -471,7 +471,9 @@ "You start adding cables to the APC frame...") playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1) if(do_after(user, 20, target = src)) - if (C.amount >= 10 && !terminal && opened && has_electronics != 2) + if (C.get_amount() < 10 || !C) + return + if (C.get_amount() >= 10 && !terminal && opened && has_electronics != 2) var/turf/T = get_turf(src) var/obj/structure/cable/N = T.get_cable_node() if (prob(50) && electrocute_mob(usr, N, N)) diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm index 2efa48ff28f..a5471f8667e 100644 --- a/code/modules/power/gravitygenerator.dm +++ b/code/modules/power/gravitygenerator.dm @@ -204,7 +204,7 @@ var/const/GRAV_NEEDS_WRENCH = 3 if(GRAV_NEEDS_PLASTEEL) if(istype(I, /obj/item/stack/sheet/plasteel)) var/obj/item/stack/sheet/plasteel/PS = I - if(PS.amount >= 10) + if(PS.get_amount() >= 10) PS.use(10) user << "You add the plating to the framework." playsound(src.loc, 'sound/machines/click.ogg', 75, 1) diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index 2fa1e2e1c65..6e3eda3027f 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -135,14 +135,16 @@ var/obj/item/stack/cable_coil/C = I - if(C.amount < 10) + if(C.get_amount() < 10) user << "You need more wires!" return user << "You start building the power terminal..." playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1) - if(do_after(user, 20, target = src) && C.amount >= 10) + if(do_after(user, 20, target = src) && C.get_amount() >= 10) + if(C.get_amount() < 10 || !C) + return var/obj/structure/cable/N = T.get_cable_node() //get the connecting node cable, if there's one if (prob(50) && electrocute_mob(usr, N, N)) //animate the electrocution if uncautious and unlucky var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread diff --git a/code/modules/vehicles/scooter.dm b/code/modules/vehicles/scooter.dm index dcd29d0a221..3e0e50bdf07 100644 --- a/code/modules/vehicles/scooter.dm +++ b/code/modules/vehicles/scooter.dm @@ -104,11 +104,13 @@ else if(istype(I, /obj/item/stack/sheet/metal)) var/obj/item/stack/sheet/metal/M = I - if(M.amount < 5) + if(M.get_amount() < 5) user << "You need at least five metal sheets to make proper wheels!" return user << "You begin to add wheels to [src]." if(do_after(user, 80, target = src)) + if(!M || M.get_amount() < 5) + return M.use(5) user << "You finish making wheels for [src]." new /obj/vehicle/scooter/skateboard(user.loc) @@ -131,6 +133,8 @@ return user << "You begin making handlebars for [src]." if(do_after(user, 25, target = src)) + if(!C || C.get_amount() < 2) + return user << "You add the rods to [src], creating handlebars." C.use(2) new/obj/vehicle/scooter(get_turf(src))