From 2b60f3f31a2e4d946d1e5612ca49e57cd9d38fd5 Mon Sep 17 00:00:00 2001 From: CacheAtWork <133615617+CacheAtWork@users.noreply.github.com> Date: Fri, 30 Jun 2023 01:02:40 +0100 Subject: [PATCH 1/4] Update wrecks.dm --- code/game/objects/structures/wrecks.dm | 206 +++++++++++++++++++++++++ 1 file changed, 206 insertions(+) diff --git a/code/game/objects/structures/wrecks.dm b/code/game/objects/structures/wrecks.dm index a46ad559538..d5e2cf8825c 100644 --- a/code/game/objects/structures/wrecks.dm +++ b/code/game/objects/structures/wrecks.dm @@ -9,11 +9,93 @@ icon = 'icons/obj/vehicles/medium_vehicles.dmi' icon_state = "derelict" bound_width = 64 + var/uses_left = 2 + var/inuse = FALSE + +/obj/structure/wreck/car/welder_act(mob/living/user, obj/item/I) + . = TRUE + + if(inuse || uses_left <= 0) //this means that if mappers or admins want an nonharvestable version, set the uses_left to 0 + return + inuse = TRUE //one at a time boys, this isn't some kind of weird party + if(!I.tool_start_check(user, amount=0)) //this seems to be called everywhere, so for consistency's sake + inuse = FALSE + return //the tool fails this check, so stop + user.visible_message("[user] starts disassembling [src].") + for(var/i1 in 1 to 2) + if(!I.use_tool(src, user, 75, volume=100)) + user.visible_message("[user] stops disassembling [src].") + inuse = FALSE + return //you did something, like moving, so stop + var/fake_dismantle = pick("plating", "rod", "rim", "part of the frame") + user.visible_message("[user] slices through a [fake_dismantle].") + + var/turf/usr_turf = get_turf(user) //Bellow are the changes made by PR#256 + var/modifier = 0 + if(HAS_TRAIT(user,TRAIT_TECHNOPHREAK)) + modifier += rand(1,3) + var/obj/item/l = user.get_inactive_held_item() + if(istype(l,/obj/item/weldingtool)) + var/obj/item/weldingtool/WO = l + if(WO.tool_start_check(user, amount=3)) + WO.use(3) + modifier++ + for(var/i2 in 1 to (2+modifier)) + new /obj/item/salvage/low(usr_turf) + for(var/i3 in 1 to (1+modifier)) //this is just less lines for the same thing + if(prob(6)) + new /obj/item/salvage/high(usr_turf) + uses_left-- + inuse = FALSE //putting this after the -- because the first check prevents cheesing + if(uses_left <= 0) //I prefer to put any qdel stuff at the very end, with src being the very last thing + visible_message("[src] falls apart, the final components having been removed.") + qdel(src) /obj/structure/wreck/car/bike name = "wrecked motorcycle" desc = "An old pre-war motorcycle, rusted and destroyed with age and weathering." icon_state = "rust_light_no_wheels" + var/uses_left = 2 + var/inuse = FALSE + +/obj/structure/wreck/car/bike/welder_act(mob/living/user, obj/item/I) + . = TRUE + + if(inuse || uses_left <= 0) //this means that if mappers or admins want an nonharvestable version, set the uses_left to 0 + return + inuse = TRUE //one at a time boys, this isn't some kind of weird party + if(!I.tool_start_check(user, amount=0)) //this seems to be called everywhere, so for consistency's sake + inuse = FALSE + return //the tool fails this check, so stop + user.visible_message("[user] starts disassembling [src].") + for(var/i1 in 1 to 2) + if(!I.use_tool(src, user, 75, volume=100)) + user.visible_message("[user] stops disassembling [src].") + inuse = FALSE + return //you did something, like moving, so stop + var/fake_dismantle = pick("plating", "chassis", "suspension arm", "part of the frame") + user.visible_message("[user] slices through a [fake_dismantle].") + + var/turf/usr_turf = get_turf(user) //Bellow are the changes made by PR#256 + var/modifier = 0 + if(HAS_TRAIT(user,TRAIT_TECHNOPHREAK)) + modifier += rand(1,3) + var/obj/item/l = user.get_inactive_held_item() + if(istype(l,/obj/item/weldingtool)) + var/obj/item/weldingtool/WO = l + if(WO.tool_start_check(user, amount=3)) + WO.use(3) + modifier++ + for(var/i2 in 1 to (2+modifier)) + new /obj/item/salvage/low(usr_turf) + for(var/i3 in 1 to (1+modifier)) //this is just less lines for the same thing + if(prob(6)) + new /obj/item/salvage/high(usr_turf) + uses_left-- + inuse = FALSE //putting this after the -- because the first check prevents cheesing + if(uses_left <= 0) //I prefer to put any qdel stuff at the very end, with src being the very last thing + visible_message("[src] falls apart, the final components having been removed.") + qdel(src) /obj/structure/wreck/bus name = "wrecked bus" @@ -21,6 +103,47 @@ bound_width = 192 bound_height = 64 icon = 'icons/obj/vehicles/bus1.dmi' + var/uses_left = 4 + var/inuse = FALSE + +/obj/structure/wreck/bus/welder_act(mob/living/user, obj/item/I) + . = TRUE + + if(inuse || uses_left <= 0) //this means that if mappers or admins want an nonharvestable version, set the uses_left to 0 + return + inuse = TRUE //one at a time boys, this isn't some kind of weird party + if(!I.tool_start_check(user, amount=0)) //this seems to be called everywhere, so for consistency's sake + inuse = FALSE + return //the tool fails this check, so stop + user.visible_message("[user] starts disassembling [src].") + for(var/i1 in 1 to 2) + if(!I.use_tool(src, user, 75, volume=100)) + user.visible_message("[user] stops disassembling [src].") + inuse = FALSE + return //you did something, like moving, so stop + var/fake_dismantle = pick("plating", "rod", "rim", "part of the frame") + user.visible_message("[user] slices through a [fake_dismantle].") + + var/turf/usr_turf = get_turf(user) //Bellow are the changes made by PR#256 + var/modifier = 0 + if(HAS_TRAIT(user,TRAIT_TECHNOPHREAK)) + modifier += rand(1,3) + var/obj/item/l = user.get_inactive_held_item() + if(istype(l,/obj/item/weldingtool)) + var/obj/item/weldingtool/WO = l + if(WO.tool_start_check(user, amount=3)) + WO.use(3) + modifier++ + for(var/i2 in 1 to (2+modifier)) + new /obj/item/salvage/low(usr_turf) + for(var/i3 in 1 to (1+modifier)) //this is just less lines for the same thing + if(prob(6)) + new /obj/item/salvage/high(usr_turf) + uses_left-- + inuse = FALSE //putting this after the -- because the first check prevents cheesing + if(uses_left <= 0) //I prefer to put any qdel stuff at the very end, with src being the very last thing + visible_message("[src] falls apart, the final components having been removed.") + qdel(src) /obj/structure/wreck/bus/blue icon_state = "blue" @@ -30,6 +153,7 @@ bound_width = 192 bound_height = 64 + /obj/structure/wreck/bus/orange icon_state = "orange" @@ -53,6 +177,8 @@ icon_state = "bus1" bound_width = 32 bound_height = 32 + var/uses_left = 2 + var/inuse = FALSE /obj/structure/wreck/bus/rusted/segmented1 name = "wrecked bus" @@ -324,6 +450,45 @@ icon_state = "secwaybroke" bound_width = 32 bound_height = 32 + var/uses_left = 2 + var/inuse = FALSE + +/obj/structure/wreck/trash/secway/attackby(obj/item/I, mob/living/user, params) + if(istype(I, /obj/item/weldingtool)) + var/obj/item/weldingtool/W = I + if(inuse) //this means that if mappers or admins want an nonharvestable version, set the uses_left to 0 + return + inuse = TRUE //one at a time boys, this isn't some kind of weird party + if(!I.tool_start_check(user, amount=0)) //this seems to be called everywhere, so for consistency's sake + inuse = FALSE + return //the tool fails this check, so stop + user.visible_message("[user] starts disassembling [src].") + if(!I.use_tool(src, user, 0, volume=100)) //here is the dilemma, use_tool doesn't work like do_after, so moving away screws it(?) + inuse = FALSE + return //you can't use the tool, so stop + for(var/i1 in 1 to 2) //so, I hate waiting + if(!do_after(user, 1 SECONDS*W.toolspeed, target = src)) //this is my work around, because do_After does have a move away + user.visible_message("[user] stops disassembling [src].") + inuse = FALSE + return //you did something, like moving, so stop + var/fake_dismantle = pick("plating", "rod", "rim", "part of the frame") + user.visible_message("[user] slices through a [fake_dismantle].") + I.play_tool_sound(src, 100) + var/turf/usr_turf = get_turf(user) + var/modifier = 0 + if(HAS_TRAIT(user,TRAIT_TECHNOPHREAK)) + modifier = rand(1, 3) + for(var/i2 in 1 to (3+modifier)) + if(prob(25)) + new /obj/item/salvage/low(usr_turf) + for(var/i3 in 1 to (1+modifier)) //this is just less lines for the same thing + if(prob(10)) + new /obj/item/salvage/high(usr_turf) + if(prob(10)) + new /obj/item/salvage/tool(usr_turf) + inuse = FALSE //putting this after the -- because the first check prevents cheesing + visible_message("[src] falls apart, the final components having been removed.") + qdel(src) /obj/structure/wreck/trash/brokenvendor name = "broken vendor" @@ -332,6 +497,45 @@ icon_state = "technical_pile3" bound_width = 32 bound_height = 32 + var/uses_left = 2 + var/inuse = FALSE + +/obj/structure/wreck/trash/brokenvendor/attackby(obj/item/I, mob/living/user, params) + if(istype(I, /obj/item/weldingtool)) + var/obj/item/weldingtool/W = I + if(inuse) //this means that if mappers or admins want an nonharvestable version, set the uses_left to 0 + return + inuse = TRUE //one at a time boys, this isn't some kind of weird party + if(!I.tool_start_check(user, amount=0)) //this seems to be called everywhere, so for consistency's sake + inuse = FALSE + return //the tool fails this check, so stop + user.visible_message("[user] starts disassembling [src].") + if(!I.use_tool(src, user, 0, volume=100)) //here is the dilemma, use_tool doesn't work like do_after, so moving away screws it(?) + inuse = FALSE + return //you can't use the tool, so stop + for(var/i1 in 1 to 2) //so, I hate waiting + if(!do_after(user, 1 SECONDS*W.toolspeed, target = src)) //this is my work around, because do_After does have a move away + user.visible_message("[user] stops disassembling [src].") + inuse = FALSE + return //you did something, like moving, so stop + var/fake_dismantle = pick("plating", "rod", "rim", "part of the frame") + user.visible_message("[user] slices through a [fake_dismantle].") + I.play_tool_sound(src, 100) + var/turf/usr_turf = get_turf(user) + var/modifier = 0 + if(HAS_TRAIT(user,TRAIT_TECHNOPHREAK)) + modifier = rand(1, 3) + for(var/i2 in 1 to (3+modifier)) + if(prob(25)) + new /obj/item/salvage/low(usr_turf) + for(var/i3 in 1 to (1+modifier)) //this is just less lines for the same thing + if(prob(10)) + new /obj/item/salvage/high(usr_turf) + if(prob(10)) + new /obj/item/salvage/tool(usr_turf) + inuse = FALSE //putting this after the -- because the first check prevents cheesing + visible_message("[src] falls apart, the final components having been removed.") + qdel(src) /obj/structure/wreck/trash/machinepile name = "broken machinery" @@ -340,6 +544,7 @@ icon_state = "technical_pile1" bound_width = 32 bound_height = 32 + var/uses_left = 2 var/inuse = FALSE /obj/structure/wreck/trash/machinepile/attackby(obj/item/I, mob/living/user, params) @@ -387,6 +592,7 @@ icon_state = "technical_pile2" bound_width = 32 bound_height = 32 + var/uses_left = 2 var/inuse = FALSE /obj/structure/wreck/trash/machinepiletwo/attackby(obj/item/I, mob/living/user, params) From 812d9b3e41e94020787cb93bc861a41c7b3ac745 Mon Sep 17 00:00:00 2001 From: CacheAtWork <133615617+CacheAtWork@users.noreply.github.com> Date: Fri, 30 Jun 2023 01:15:23 +0100 Subject: [PATCH 2/4] Update wrecks.dm --- code/game/objects/structures/wrecks.dm | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/code/game/objects/structures/wrecks.dm b/code/game/objects/structures/wrecks.dm index d5e2cf8825c..75f297fa558 100644 --- a/code/game/objects/structures/wrecks.dm +++ b/code/game/objects/structures/wrecks.dm @@ -55,8 +55,8 @@ name = "wrecked motorcycle" desc = "An old pre-war motorcycle, rusted and destroyed with age and weathering." icon_state = "rust_light_no_wheels" - var/uses_left = 2 - var/inuse = FALSE + uses_left = 2 + inuse = FALSE /obj/structure/wreck/car/bike/welder_act(mob/living/user, obj/item/I) . = TRUE @@ -103,8 +103,8 @@ bound_width = 192 bound_height = 64 icon = 'icons/obj/vehicles/bus1.dmi' - var/uses_left = 4 - var/inuse = FALSE + uses_left = 4 + inuse = FALSE /obj/structure/wreck/bus/welder_act(mob/living/user, obj/item/I) . = TRUE @@ -177,8 +177,8 @@ icon_state = "bus1" bound_width = 32 bound_height = 32 - var/uses_left = 2 - var/inuse = FALSE + uses_left = 2 + inuse = FALSE /obj/structure/wreck/bus/rusted/segmented1 name = "wrecked bus" @@ -450,8 +450,8 @@ icon_state = "secwaybroke" bound_width = 32 bound_height = 32 - var/uses_left = 2 - var/inuse = FALSE + uses_left = 2 + inuse = FALSE /obj/structure/wreck/trash/secway/attackby(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/weldingtool)) @@ -497,8 +497,8 @@ icon_state = "technical_pile3" bound_width = 32 bound_height = 32 - var/uses_left = 2 - var/inuse = FALSE + uses_left = 2 + inuse = FALSE /obj/structure/wreck/trash/brokenvendor/attackby(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/weldingtool)) @@ -544,8 +544,8 @@ icon_state = "technical_pile1" bound_width = 32 bound_height = 32 - var/uses_left = 2 - var/inuse = FALSE + uses_left = 2 + inuse = FALSE /obj/structure/wreck/trash/machinepile/attackby(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/weldingtool)) @@ -592,8 +592,8 @@ icon_state = "technical_pile2" bound_width = 32 bound_height = 32 - var/uses_left = 2 - var/inuse = FALSE + uses_left = 2 + inuse = FALSE /obj/structure/wreck/trash/machinepiletwo/attackby(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/weldingtool)) From 25416ff9def86cd48c51ef062dd76171e6689847 Mon Sep 17 00:00:00 2001 From: CacheAtWork <133615617+CacheAtWork@users.noreply.github.com> Date: Fri, 30 Jun 2023 01:31:10 +0100 Subject: [PATCH 3/4] Update wrecks.dm --- code/game/objects/structures/wrecks.dm | 48 ++------------------------ 1 file changed, 3 insertions(+), 45 deletions(-) diff --git a/code/game/objects/structures/wrecks.dm b/code/game/objects/structures/wrecks.dm index 75f297fa558..4a6b0e01f3d 100644 --- a/code/game/objects/structures/wrecks.dm +++ b/code/game/objects/structures/wrecks.dm @@ -55,47 +55,6 @@ name = "wrecked motorcycle" desc = "An old pre-war motorcycle, rusted and destroyed with age and weathering." icon_state = "rust_light_no_wheels" - uses_left = 2 - inuse = FALSE - -/obj/structure/wreck/car/bike/welder_act(mob/living/user, obj/item/I) - . = TRUE - - if(inuse || uses_left <= 0) //this means that if mappers or admins want an nonharvestable version, set the uses_left to 0 - return - inuse = TRUE //one at a time boys, this isn't some kind of weird party - if(!I.tool_start_check(user, amount=0)) //this seems to be called everywhere, so for consistency's sake - inuse = FALSE - return //the tool fails this check, so stop - user.visible_message("[user] starts disassembling [src].") - for(var/i1 in 1 to 2) - if(!I.use_tool(src, user, 75, volume=100)) - user.visible_message("[user] stops disassembling [src].") - inuse = FALSE - return //you did something, like moving, so stop - var/fake_dismantle = pick("plating", "chassis", "suspension arm", "part of the frame") - user.visible_message("[user] slices through a [fake_dismantle].") - - var/turf/usr_turf = get_turf(user) //Bellow are the changes made by PR#256 - var/modifier = 0 - if(HAS_TRAIT(user,TRAIT_TECHNOPHREAK)) - modifier += rand(1,3) - var/obj/item/l = user.get_inactive_held_item() - if(istype(l,/obj/item/weldingtool)) - var/obj/item/weldingtool/WO = l - if(WO.tool_start_check(user, amount=3)) - WO.use(3) - modifier++ - for(var/i2 in 1 to (2+modifier)) - new /obj/item/salvage/low(usr_turf) - for(var/i3 in 1 to (1+modifier)) //this is just less lines for the same thing - if(prob(6)) - new /obj/item/salvage/high(usr_turf) - uses_left-- - inuse = FALSE //putting this after the -- because the first check prevents cheesing - if(uses_left <= 0) //I prefer to put any qdel stuff at the very end, with src being the very last thing - visible_message("[src] falls apart, the final components having been removed.") - qdel(src) /obj/structure/wreck/bus name = "wrecked bus" @@ -103,8 +62,8 @@ bound_width = 192 bound_height = 64 icon = 'icons/obj/vehicles/bus1.dmi' - uses_left = 4 - inuse = FALSE + var/uses_left = 4 + var/inuse = FALSE /obj/structure/wreck/bus/welder_act(mob/living/user, obj/item/I) . = TRUE @@ -177,8 +136,7 @@ icon_state = "bus1" bound_width = 32 bound_height = 32 - uses_left = 2 - inuse = FALSE + var/uses_left = 2 /obj/structure/wreck/bus/rusted/segmented1 name = "wrecked bus" From bd637176bf501387da32d11e40745497ec0b5b0e Mon Sep 17 00:00:00 2001 From: CacheAtWork <133615617+CacheAtWork@users.noreply.github.com> Date: Fri, 30 Jun 2023 01:45:18 +0100 Subject: [PATCH 4/4] Update wrecks.dm --- code/game/objects/structures/wrecks.dm | 34 +++++++++++++++++++------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/code/game/objects/structures/wrecks.dm b/code/game/objects/structures/wrecks.dm index 4a6b0e01f3d..ece88e608d4 100644 --- a/code/game/objects/structures/wrecks.dm +++ b/code/game/objects/structures/wrecks.dm @@ -136,7 +136,7 @@ icon_state = "bus1" bound_width = 32 bound_height = 32 - var/uses_left = 2 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented1 name = "wrecked bus" @@ -145,6 +145,7 @@ icon_state = "bus2" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented2 name = "wrecked bus" @@ -153,6 +154,7 @@ icon_state = "bus3" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented3 name = "wrecked bus" @@ -161,6 +163,7 @@ icon_state = "bus4" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented4 name = "wrecked bus" @@ -169,6 +172,7 @@ icon_state = "bus5" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented5 name = "wrecked bus" @@ -177,6 +181,7 @@ icon_state = "bus6" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented6 name = "wrecked bus" @@ -186,6 +191,7 @@ density = 0 bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented7 name = "wrecked bus" @@ -194,6 +200,7 @@ icon_state = "bus8" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented8 name = "wrecked bus" @@ -202,6 +209,7 @@ icon_state = "bus9" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented9 name = "wrecked bus" @@ -210,6 +218,7 @@ icon_state = "bus10" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented10 name = "wrecked bus" @@ -218,6 +227,7 @@ icon_state = "bus11" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented11 name = "wrecked bus" @@ -226,6 +236,7 @@ icon_state = "bus12" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented12 name = "wrecked bus" @@ -234,6 +245,7 @@ icon_state = "bus13" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented13 name = "wrecked bus" @@ -243,6 +255,7 @@ density = 0 bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented14 name = "wrecked bus" @@ -252,6 +265,7 @@ density = 0 bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented15 name = "wrecked bus" @@ -261,6 +275,7 @@ density = 0 bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented16 name = "wrecked bus" @@ -270,6 +285,7 @@ density = 0 bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented17 name = "wrecked bus" @@ -279,6 +295,7 @@ density = 0 bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented18 name = "wrecked bus" @@ -288,6 +305,7 @@ density = 0 bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented19 name = "wrecked bus" @@ -297,6 +315,7 @@ density = 0 bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented20 name = "wrecked bus" @@ -306,6 +325,7 @@ density = 0 bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/trash/five_tires name = "tire pile" @@ -408,8 +428,7 @@ icon_state = "secwaybroke" bound_width = 32 bound_height = 32 - uses_left = 2 - inuse = FALSE + var/inuse = FALSE /obj/structure/wreck/trash/secway/attackby(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/weldingtool)) @@ -455,8 +474,7 @@ icon_state = "technical_pile3" bound_width = 32 bound_height = 32 - uses_left = 2 - inuse = FALSE + var/inuse = FALSE /obj/structure/wreck/trash/brokenvendor/attackby(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/weldingtool)) @@ -502,8 +520,7 @@ icon_state = "technical_pile1" bound_width = 32 bound_height = 32 - uses_left = 2 - inuse = FALSE + var/inuse = FALSE /obj/structure/wreck/trash/machinepile/attackby(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/weldingtool)) @@ -550,8 +567,7 @@ icon_state = "technical_pile2" bound_width = 32 bound_height = 32 - uses_left = 2 - inuse = FALSE + var/inuse = FALSE /obj/structure/wreck/trash/machinepiletwo/attackby(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/weldingtool))