diff --git a/code/game/objects/structures/wrecks.dm b/code/game/objects/structures/wrecks.dm index a46ad559538..ece88e608d4 100644 --- a/code/game/objects/structures/wrecks.dm +++ b/code/game/objects/structures/wrecks.dm @@ -9,6 +9,47 @@ 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" @@ -21,6 +62,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 +112,7 @@ bound_width = 192 bound_height = 64 + /obj/structure/wreck/bus/orange icon_state = "orange" @@ -53,6 +136,7 @@ icon_state = "bus1" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented1 name = "wrecked bus" @@ -61,6 +145,7 @@ icon_state = "bus2" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented2 name = "wrecked bus" @@ -69,6 +154,7 @@ icon_state = "bus3" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented3 name = "wrecked bus" @@ -77,6 +163,7 @@ icon_state = "bus4" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented4 name = "wrecked bus" @@ -85,6 +172,7 @@ icon_state = "bus5" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented5 name = "wrecked bus" @@ -93,6 +181,7 @@ icon_state = "bus6" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented6 name = "wrecked bus" @@ -102,6 +191,7 @@ density = 0 bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented7 name = "wrecked bus" @@ -110,6 +200,7 @@ icon_state = "bus8" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented8 name = "wrecked bus" @@ -118,6 +209,7 @@ icon_state = "bus9" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented9 name = "wrecked bus" @@ -126,6 +218,7 @@ icon_state = "bus10" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented10 name = "wrecked bus" @@ -134,6 +227,7 @@ icon_state = "bus11" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented11 name = "wrecked bus" @@ -142,6 +236,7 @@ icon_state = "bus12" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented12 name = "wrecked bus" @@ -150,6 +245,7 @@ icon_state = "bus13" bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented13 name = "wrecked bus" @@ -159,6 +255,7 @@ density = 0 bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented14 name = "wrecked bus" @@ -168,6 +265,7 @@ density = 0 bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented15 name = "wrecked bus" @@ -177,6 +275,7 @@ density = 0 bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented16 name = "wrecked bus" @@ -186,6 +285,7 @@ density = 0 bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented17 name = "wrecked bus" @@ -195,6 +295,7 @@ density = 0 bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented18 name = "wrecked bus" @@ -204,6 +305,7 @@ density = 0 bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented19 name = "wrecked bus" @@ -213,6 +315,7 @@ density = 0 bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/bus/rusted/segmented20 name = "wrecked bus" @@ -222,6 +325,7 @@ density = 0 bound_width = 32 bound_height = 32 + uses_left = 2 /obj/structure/wreck/trash/five_tires name = "tire pile" @@ -324,6 +428,44 @@ icon_state = "secwaybroke" bound_width = 32 bound_height = 32 + 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 +474,44 @@ icon_state = "technical_pile3" bound_width = 32 bound_height = 32 + 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"