From 7daf219ec0db1b4de86da6470f26ca68012c9e3f Mon Sep 17 00:00:00 2001 From: larentoun <31931237+larentoun@users.noreply.github.com> Date: Wed, 1 May 2024 13:37:08 +0300 Subject: [PATCH] More Crowbar Acts (#24986) * crowbar acts part 1 * livings checked * convert istypes to tool behaviour * solars * use tool_volume * Update code/modules/research/server.dm Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> Signed-off-by: larentoun <31931237+larentoun@users.noreply.github.com> * Update code/modules/power/generators/portable generators/pacman.dm Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> Signed-off-by: larentoun <31931237+larentoun@users.noreply.github.com> * return * return returns * Update code/modules/mob/living/simple_animal/bot/mulebot.dm Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com> Signed-off-by: larentoun <31931237+larentoun@users.noreply.github.com> * Update code/game/objects/structures/janicart.dm Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com> Signed-off-by: larentoun <31931237+larentoun@users.noreply.github.com> --------- Signed-off-by: larentoun <31931237+larentoun@users.noreply.github.com> Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com> --- code/__HELPERS/tool_helpers.dm | 5 -- code/game/atoms.dm | 1 + code/game/machinery/constructable_frame.dm | 2 +- code/game/machinery/mass_driver.dm | 2 +- code/game/machinery/portable_turret.dm | 6 +- code/game/machinery/suit_storage_unit.dm | 29 ++++--- .../objects/items/devices/geiger_counter.dm | 2 +- .../objects/items/tools/tool_behaviour.dm | 6 +- .../structures/crates_lockers/largecrate.dm | 80 ++++++++++--------- code/game/objects/structures/janicart.dm | 50 +++++++----- code/game/objects/structures/kitchen_spike.dm | 21 ++--- code/game/objects/structures/railings.dm | 2 +- code/modules/arcade/prize_counter.dm | 25 ++++-- code/modules/mining/machine_vending.dm | 16 ++-- code/modules/mining/satchel_ore_boxdm.dm | 13 +-- .../living/silicon/robot/drone/maint_drone.dm | 8 +- .../mob/living/simple_animal/bot/mulebot.dm | 63 ++++++++++----- .../power/engines/singularity/collector.dm | 2 +- .../generators/portable generators/pacman.dm | 49 +++++++----- code/modules/power/generators/solar.dm | 48 ++++++----- code/modules/research/circuitprinter.dm | 39 ++++----- code/modules/research/protolathe.dm | 28 ++++--- code/modules/research/server.dm | 16 ++-- 23 files changed, 293 insertions(+), 220 deletions(-) diff --git a/code/__HELPERS/tool_helpers.dm b/code/__HELPERS/tool_helpers.dm index 03e14b56141..c88ee7c6046 100644 --- a/code/__HELPERS/tool_helpers.dm +++ b/code/__HELPERS/tool_helpers.dm @@ -26,11 +26,6 @@ return TRUE return FALSE -/proc/iscrowbar(O) - if(istype(O, /obj/item/crowbar)) - return TRUE - return FALSE - /proc/iscoil(O) if(istype(O, /obj/item/stack/cable_coil)) return TRUE diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 7c8d91b18b7..7753e8cd3a6 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -536,6 +536,7 @@ if(reagents) reagents.temperature_reagents(exposed_temperature) +/// If it returns TRUE, attack chain stops /atom/proc/tool_act(mob/living/user, obj/item/I, tool_type) switch(tool_type) if(TOOL_CROWBAR) diff --git a/code/game/machinery/constructable_frame.dm b/code/game/machinery/constructable_frame.dm index 28001aa8ba6..5890c24d07f 100644 --- a/code/game/machinery/constructable_frame.dm +++ b/code/game/machinery/constructable_frame.dm @@ -128,7 +128,7 @@ A.amount = 5 return if(3) - if(istype(P, /obj/item/crowbar)) + if(P.tool_behaviour == TOOL_CROWBAR) playsound(src.loc, P.usesound, 50, 1) state = 2 circuit.loc = src.loc diff --git a/code/game/machinery/mass_driver.dm b/code/game/machinery/mass_driver.dm index fe00d9091f1..13275d3d61e 100644 --- a/code/game/machinery/mass_driver.dm +++ b/code/game/machinery/mass_driver.dm @@ -142,7 +142,7 @@ return FALSE if(4) // Grille in place - if(istype(W, /obj/item/crowbar)) + if(W.tool_behaviour == TOOL_CROWBAR) to_chat(user, "You begin to pry off the grille from \the [src]...") playsound(get_turf(src), W.usesound, 50, 1) if(do_after(user, 30 * W.toolspeed, target = src) && (build == 4)) diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm index 65a02ec584d..9954d7b9eca 100644 --- a/code/game/machinery/portable_turret.dm +++ b/code/game/machinery/portable_turret.dm @@ -334,7 +334,7 @@ GLOBAL_LIST_EMPTY(turret_icons) /obj/machinery/porta_turret/attackby(obj/item/I, mob/user) if((stat & BROKEN) && !syndicate) - if(istype(I, /obj/item/crowbar)) + if(I.tool_behaviour == TOOL_CROWBAR) //If the turret is destroyed, you can remove it with a crowbar to //try and salvage its components to_chat(user, "You begin prying the metal coverings off.") @@ -861,7 +861,7 @@ GLOBAL_LIST_EMPTY(turret_icons) build_step = 1 return - else if(istype(I, /obj/item/crowbar) && !anchored) + else if(I.tool_behaviour == TOOL_CROWBAR && !anchored) playsound(loc, I.usesound, 75, 1) to_chat(user, "You dismantle the turret construction.") new /obj/item/stack/sheet/metal( loc, 5) @@ -955,7 +955,7 @@ GLOBAL_LIST_EMPTY(turret_icons) return if(7) - if(istype(I, /obj/item/crowbar)) + if(I.tool_behaviour == TOOL_CROWBAR) playsound(loc, I.usesound, 75, 1) to_chat(user, "You pry off the turret's exterior armor.") new /obj/item/stack/sheet/metal(loc, 2) diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index 3024e39b960..70a8a6e387f 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -347,16 +347,6 @@ to_chat(usr, "The unit is not operational.") return if(panel_open) - if(istype(I, /obj/item/crowbar)) - if(occupant || helmet || suit || storage || boots) - to_chat(user, "There are contents that prevent you from deconstructing [src]!") - return - if(locked) - to_chat(user, "The security system prevents you from deconstructing [src]!") - return - dump_contents() // probably still a good idea for just incase? - default_deconstruction_crowbar(user, I) - return wires.Interact(user) return if(state_open) @@ -369,10 +359,25 @@ return return ..() -/obj/machinery/suit_storage_unit/screwdriver_act(mob/user, obj/item/I) - if(!I.use_tool(src, user, 0, volume = I.tool_volume)) +/obj/machinery/suit_storage_unit/crowbar_act(mob/living/user, obj/item/I) + if(!panel_open) return . = TRUE + if(!I.use_tool(src, user, volume = I.tool_volume)) + return + if(occupant || helmet || suit || storage || boots) + to_chat(user, "There are contents that prevent you from deconstructing [src]!") + return + if(locked) + to_chat(user, "The security system prevents you from deconstructing [src]!") + return + dump_contents() // probably still a good idea for just incase? + default_deconstruction_crowbar(user, I) + +/obj/machinery/suit_storage_unit/screwdriver_act(mob/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, I.tool_volume)) + return if(shocked && !(stat & NOPOWER)) if(shock(user, 100)) return diff --git a/code/game/objects/items/devices/geiger_counter.dm b/code/game/objects/items/devices/geiger_counter.dm index cda7f5e34e3..5bc73814f78 100644 --- a/code/game/objects/items/devices/geiger_counter.dm +++ b/code/game/objects/items/devices/geiger_counter.dm @@ -154,7 +154,7 @@ to_chat(user, "Turn off [src] before you perform this action!") return FALSE user.visible_message("[user] unscrews [src]'s maintenance panel and begins fiddling with its innards...", "You begin resetting [src]...") - if(!I.use_tool(src, user, 40, volume = 50)) + if(!I.use_tool(src, user, 40, I.tool_volume)) return FALSE user.visible_message("[user] refastens [src]'s maintenance panel!", "You reset [src] to its factory settings!") emagged = FALSE diff --git a/code/game/objects/items/tools/tool_behaviour.dm b/code/game/objects/items/tools/tool_behaviour.dm index ea45a32d0cf..fa7de207820 100644 --- a/code/game/objects/items/tools/tool_behaviour.dm +++ b/code/game/objects/items/tools/tool_behaviour.dm @@ -1,5 +1,7 @@ -// Called when a mob tries to use the item as a tool. -// Handles most checks. +/** + * Called when a mob tries to use the item as a tool. + * Handles most checks. +*/ /obj/item/proc/use_tool(atom/target, mob/living/user, delay, amount=0, volume=0, datum/callback/extra_checks) // No delay means there is no start message, and no reason to call tool_start_check before use_tool. // Run the start check here so we wouldn't have to call it manually. diff --git a/code/game/objects/structures/crates_lockers/largecrate.dm b/code/game/objects/structures/crates_lockers/largecrate.dm index fe235a3fca6..d06e21da38c 100644 --- a/code/game/objects/structures/crates_lockers/largecrate.dm +++ b/code/game/objects/structures/crates_lockers/largecrate.dm @@ -30,25 +30,27 @@ return /obj/structure/largecrate/attackby(obj/item/W as obj, mob/user as mob, params) - if(istype(W, /obj/item/crowbar)) - if(manifest) - manifest.forceMove(loc) - manifest = null - update_icon() - new /obj/item/stack/sheet/wood(src) - var/turf/T = get_turf(src) - for(var/O in contents) - var/atom/movable/A = O - A.forceMove(T) - user.visible_message("[user] pries \the [src] open.", \ - "You pry open \the [src].", \ - "You hear splitting wood.") - qdel(src) - else if(user.a_intent != INTENT_HARM) + if(user.a_intent != INTENT_HARM) attack_hand(user) else return ..() +/obj/structure/largecrate/crowbar_act(mob/living/user, obj/item/I) + . = TRUE + if(manifest) + manifest.forceMove(loc) + manifest = null + update_icon() + new /obj/item/stack/sheet/wood(src) + var/turf/T = get_turf(src) + for(var/O in contents) + var/atom/movable/A = O + A.forceMove(T) + user.visible_message("[user] pries [src] open.", \ + "You pry open [src].", \ + "You hear splitting wood.") + qdel(src) + /obj/structure/largecrate/Destroy() var/turf/src_turf = get_turf(src) for(var/obj/O in contents) @@ -60,54 +62,60 @@ /obj/structure/largecrate/lisa icon_state = "lisacrate" -/obj/structure/largecrate/lisa/attackby(obj/item/W as obj, mob/user as mob) //ugly but oh well - if(istype(W, /obj/item/crowbar)) - new /mob/living/simple_animal/pet/dog/corgi/Lisa(loc) +/obj/structure/largecrate/lisa/crowbar_act(mob/living/user, obj/item/I) + if(!I.use_tool(src, user, I.tool_volume)) + return + new /mob/living/simple_animal/pet/dog/corgi/Lisa(loc) return ..() /obj/structure/largecrate/cow name = "cow crate" icon_state = "lisacrate" -/obj/structure/largecrate/cow/attackby(obj/item/W as obj, mob/user as mob, params) - if(istype(W, /obj/item/crowbar)) - new /mob/living/simple_animal/cow(loc) +/obj/structure/largecrate/cow/crowbar_act(mob/living/user, obj/item/I) + if(!I.use_tool(src, user, I.tool_volume)) + return + new /mob/living/simple_animal/cow(loc) return ..() /obj/structure/largecrate/goat name = "goat crate" icon_state = "lisacrate" -/obj/structure/largecrate/goat/attackby(obj/item/W as obj, mob/user as mob, params) - if(istype(W, /obj/item/crowbar)) - new /mob/living/simple_animal/hostile/retaliate/goat(loc) +/obj/structure/largecrate/goat/crowbar_act(mob/living/user, obj/item/I) + if(!I.use_tool(src, user, I.tool_volume)) + return + new /mob/living/simple_animal/hostile/retaliate/goat(loc) return ..() /obj/structure/largecrate/chick name = "chicken crate" icon_state = "lisacrate" -/obj/structure/largecrate/chick/attackby(obj/item/W as obj, mob/user as mob, params) - if(istype(W, /obj/item/crowbar)) - var/num = rand(4, 6) - for(var/i in 1 to num) - new /mob/living/simple_animal/chick(loc) +/obj/structure/largecrate/chick/crowbar_act(mob/living/user, obj/item/I) + if(!I.use_tool(src, user, I.tool_volume)) + return + var/num = rand(4, 6) + for(var/i in 1 to num) + new /mob/living/simple_animal/chick(loc) return ..() /obj/structure/largecrate/cat name = "cat crate" icon_state = "lisacrate" -/obj/structure/largecrate/cat/attackby(obj/item/W as obj, mob/user as mob, params) - if(istype(W, /obj/item/crowbar)) - new /mob/living/simple_animal/pet/cat(loc) +/obj/structure/largecrate/cat/crowbar_act(mob/living/user, obj/item/I) + if(!I.use_tool(src, user, I.tool_volume)) + return + new /mob/living/simple_animal/pet/cat(loc) return ..() /obj/structure/largecrate/secway name = "secway crate" -/obj/structure/largecrate/secway/attackby(obj/item/W, mob/user, params) - if(istype(W, /obj/item/crowbar)) - new /obj/vehicle/secway(loc) - new /obj/item/key/security(loc) +/obj/structure/largecrate/secway/crowbar_act(mob/living/user, obj/item/I) + if(!I.use_tool(src, user, I.tool_volume)) + return + new /obj/vehicle/secway(loc) + new /obj/item/key/security(loc) return ..() diff --git a/code/game/objects/structures/janicart.dm b/code/game/objects/structures/janicart.dm index 28500ee389b..dc855f327fc 100644 --- a/code/game/objects/structures/janicart.dm +++ b/code/game/objects/structures/janicart.dm @@ -87,32 +87,40 @@ put_in_cart(I, user) else to_chat(user, "[src] can't hold any more signs.") - else if(istype(I, /obj/item/crowbar)) - user.visible_message("[user] begins to empty the contents of [src].") - if(do_after(user, 30 * I.toolspeed, target = src)) - to_chat(usr, "You empty the contents of [src]'s bucket onto the floor.") - reagents.reaction(src.loc) - src.reagents.clear_reagents() - else if(istype(I, /obj/item/wrench)) - if(!anchored && !isinspace()) - playsound(src.loc, I.usesound, 50, 1) - user.visible_message( \ - "[user] tightens \the [src]'s casters.", \ - " You have tightened \the [src]'s casters.", \ - "You hear ratchet.") - anchored = TRUE - else if(anchored) - playsound(src.loc, I.usesound, 50, 1) - user.visible_message( \ - "[user] loosens \the [src]'s casters.", \ - " You have loosened \the [src]'s casters.", \ - "You hear ratchet.") - anchored = FALSE else if(mybag) mybag.attackby(I, user, params) else to_chat(usr, "You cannot interface your modules [src]!") +/obj/structure/janitorialcart/crowbar_act(mob/living/user, obj/item/I) + . = TRUE + user.visible_message("[user] begins to empty the contents of [src].") + if(!I.use_tool(src, user, 3 SECONDS, I.tool_volume)) + return + to_chat(user, "You empty the contents of [src]'s bucket onto the floor.") + reagents.reaction(loc) + reagents.clear_reagents() + +/obj/structure/janitorialcart/wrench_act(mob/living/user, obj/item/I) + . = TRUE + if(!anchored && !isinspace()) + if(!I.use_tool(src, user, I.tool_volume)) + return + user.visible_message( \ + "[user] tightens [src]'s casters.", \ + "You have tightened [src]'s casters.", \ + "You hear ratchet.") + anchored = TRUE + return + if(anchored) + if(!I.use_tool(src, user, I.tool_volume)) + return + user.visible_message( \ + "[user] loosens [src]'s casters.", \ + "You have loosened [src]'s casters.", \ + "You hear ratchet.") + anchored = FALSE + /obj/structure/janitorialcart/attack_hand(mob/user) var/list/cart_items = list() diff --git a/code/game/objects/structures/kitchen_spike.dm b/code/game/objects/structures/kitchen_spike.dm index c0d34365027..921d18accf5 100644 --- a/code/game/objects/structures/kitchen_spike.dm +++ b/code/game/objects/structures/kitchen_spike.dm @@ -68,21 +68,22 @@ ..() /obj/structure/kitchenspike/attackby(obj/item/I, mob/user) - if(istype(I, /obj/item/crowbar)) - if(!has_buckled_mobs()) - playsound(loc, I.usesound, 100, 1) - if(do_after(user, 20 * I.toolspeed, target = src)) - to_chat(user, "You pry the spikes out of the frame.") - deconstruct(TRUE) - else - to_chat(user, "You can't do that while something's on the spike!") - return - else if(istype(I, /obj/item/grab)) + if(istype(I, /obj/item/grab)) var/obj/item/grab/G = I if(G.affecting && isliving(G.affecting)) start_spike(G.affecting, user) return ..() +/obj/structure/kitchenspike/crowbar_act(mob/living/user, obj/item/I) + . = TRUE + if(has_buckled_mobs()) + to_chat(user, "You can't do that while something's on the spike!") + return + if(!I.use_tool(src, user, 2 SECONDS, I.tool_volume)) + return + to_chat(user, "You pry the spikes out of the frame.") + deconstruct(TRUE) + /obj/structure/kitchenspike/MouseDrop_T(mob/living/victim, mob/living/user) if(!user.Adjacent(src) || !user.Adjacent(victim) || isAI(user) || !ismob(victim)) return diff --git a/code/game/objects/structures/railings.dm b/code/game/objects/structures/railings.dm index 5acfde9058a..efcd184fcbc 100644 --- a/code/game/objects/structures/railings.dm +++ b/code/game/objects/structures/railings.dm @@ -53,7 +53,7 @@ if(!I.tool_start_check(user, amount = 0)) return to_chat(user, "You begin repairing [src]...") - if(I.use_tool(src, user, 40, volume = 50)) + if(I.use_tool(src, user, 4 SECONDS, I.tool_volume)) obj_integrity = max_integrity to_chat(user, "You repair [src].") diff --git a/code/modules/arcade/prize_counter.dm b/code/modules/arcade/prize_counter.dm index 65e7c230c77..fbd8352201d 100644 --- a/code/modules/arcade/prize_counter.dm +++ b/code/modules/arcade/prize_counter.dm @@ -93,24 +93,33 @@ to_chat(user, "\The [T] seems stuck to your hand!") return if(panel_open) - if(istype(O, /obj/item/wrench)) - default_unfasten_wrench(user, O, time = 6 SECONDS) - if(component_parts && istype(O, /obj/item/crowbar)) - if(tickets) //save the tickets! - print_tickets() - default_deconstruction_crowbar(user, O) return return ..() +/obj/machinery/prize_counter/crowbar_act(mob/living/user, obj/item/I) + if(!panel_open || !component_parts) + return + . = TRUE + if(tickets) //save the tickets! + print_tickets() + default_deconstruction_crowbar(user, I) + /obj/machinery/prize_counter/screwdriver_act(mob/living/user, obj/item/I) if(!anchored) return - I.play_tool_sound(src) + . = TRUE + if(!I.use_tool(src, user, I.tool_volume)) + return panel_open = !panel_open to_chat(user, "You [panel_open ? "open" : "close"] the maintenance panel.") update_icon(UPDATE_ICON_STATE) - return TRUE + +/obj/machinery/prize_counter/wrench_act(mob/living/user, obj/item/I) + if(!panel_open) + return + . = TRUE + default_unfasten_wrench(user, I, time = 6 SECONDS) /obj/machinery/prize_counter/attack_hand(mob/user) if(..()) diff --git a/code/modules/mining/machine_vending.dm b/code/modules/mining/machine_vending.dm index 21c91d24f7f..23c82acdd8d 100644 --- a/code/modules/mining/machine_vending.dm +++ b/code/modules/mining/machine_vending.dm @@ -209,12 +209,7 @@ add_fingerprint() /obj/machinery/mineral/equipment_vendor/attackby(obj/item/I, mob/user, params) - if(default_deconstruction_screwdriver(user, "mining-open", "mining", I)) - return if(panel_open) - if(istype(I, /obj/item/crowbar)) - remove_id() - default_deconstruction_crowbar(user, I) return TRUE if(istype(I, /obj/item/mining_voucher)) if(!has_power()) @@ -234,6 +229,17 @@ return return ..() +/obj/machinery/mineral/equipment_vendor/crowbar_act(mob/living/user, obj/item/I) + if(!panel_open) + return + . = TRUE + remove_id() + default_deconstruction_crowbar(user, I) + +/obj/machinery/mineral/equipment_vendor/screwdriver_act(mob/living/user, obj/item/I) + if(default_deconstruction_screwdriver(user, "mining-open", "mining", I)) + return TRUE + /** * Called when someone slaps the machine with a mining voucher * diff --git a/code/modules/mining/satchel_ore_boxdm.dm b/code/modules/mining/satchel_ore_boxdm.dm index fb455af71a1..06b4cd19f0b 100644 --- a/code/modules/mining/satchel_ore_boxdm.dm +++ b/code/modules/mining/satchel_ore_boxdm.dm @@ -21,15 +21,16 @@ S.remove_from_storage(O, src) //This will move the item to this item's contents CHECK_TICK to_chat(user, "You empty the satchel into the box.") - else if(istype(W, /obj/item/crowbar)) - playsound(src, W.usesound, 50, 1) - var/obj/item/crowbar/C = W - if(do_after(user, 50 * C.toolspeed, target = src)) - user.visible_message("[user] pries [src] apart.", "You pry apart [src].", "You hear splitting wood.") - deconstruct(TRUE, user) else return ..() +/obj/structure/ore_box/crowbar_act(mob/living/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, 5 SECONDS, I.tool_volume)) + return + user.visible_message("[user] pries [src] apart.", "You pry apart [src].", "You hear splitting wood.") + deconstruct(TRUE, user) + /obj/structure/ore_box/attack_hand(mob/user) if(Adjacent(user)) show_contents(user) diff --git a/code/modules/mob/living/silicon/robot/drone/maint_drone.dm b/code/modules/mob/living/silicon/robot/drone/maint_drone.dm index d9cf8715059..bb04f17de68 100644 --- a/code/modules/mob/living/silicon/robot/drone/maint_drone.dm +++ b/code/modules/mob/living/silicon/robot/drone/maint_drone.dm @@ -157,10 +157,6 @@ to_chat(user, "The maintenance drone chassis is not compatible with [I].") return - else if(istype(I, /obj/item/crowbar)) - to_chat(user, "The machine is hermetically sealed. You can't open the case.") - return - else if(istype(I, /obj/item/card/id) || istype(I, /obj/item/pda)) if(stat == DEAD) // Currently not functional, so commenting out until it's fixed to avoid confusion @@ -206,6 +202,10 @@ ..() +/mob/living/silicon/robot/drone/crowbar_act(mob/user, obj/item/I) + . = TRUE + to_chat(user, "The machine is hermetically sealed. You can't open the case.") + /mob/living/silicon/robot/drone/Destroy() . = ..() QDEL_NULL(stack_glass) diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index 8db8e6c708d..a904e808a0e 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -106,25 +106,6 @@ visible_message("[user] inserts a cell into [src].", "You insert the new cell into [src].") update_controls() - else if(istype(I, /obj/item/crowbar) && open && cell) - cell.add_fingerprint(usr) - cell.forceMove(loc) - cell = null - visible_message("[user] crowbars out the power cell from [src].", - "You pry the powercell out of [src].") - update_controls() - else if(istype(I, /obj/item/wrench)) - if(health < maxHealth) - adjustBruteLoss(-25) - updatehealth() - user.visible_message( - "[user] repairs [src]!", - "You repair [src]!" - ) - else - to_chat(user, "[src] does not need a repair!") - else if((istype(I, /obj/item/multitool) || istype(I, /obj/item/wirecutters)) && open) - return attack_hand(user) else if(load && ismob(load)) // chance to knock off rider if(prob(1 + I.force * 2)) unload(0) @@ -138,16 +119,58 @@ update_icon() return +/mob/living/simple_animal/bot/mulebot/crowbar_act(mob/living/user, obj/item/I) + if(!open || !cell) + return + . = TRUE + if(!I.use_tool(src, user, I.tool_volume)) + return + cell.add_fingerprint(user) + cell.forceMove(loc) + cell = null + visible_message("[user] crowbars out the power cell from [src].", + "You pry the powercell out of [src].") + update_controls() + +/mob/living/simple_animal/bot/mulebot/multitool_act(mob/living/user, obj/item/I) + if(!open) + return + . = TRUE + if(!I.use_tool(src, user, I.tool_volume)) + return + attack_hand(user) + /mob/living/simple_animal/bot/mulebot/screwdriver_act(mob/living/user, obj/item/I) . = ..() if(!.) return - if(open) on = FALSE update_controls() update_icon() +/mob/living/simple_animal/bot/mulebot/wrench_act(mob/living/user, obj/item/I) + . = TRUE + if(health >= maxHealth) + to_chat(user, "[src] does not need a repair!") + return + if(!I.use_tool(src, user, I.tool_volume)) + return + adjustBruteLoss(-25) + updatehealth() + user.visible_message( + "[user] repairs [src]!", + "You repair [src]!" + ) + +/mob/living/simple_animal/bot/mulebot/wirecutter_act(mob/living/user, obj/item/I) + if(!open) + return + . = TRUE + if(!I.use_tool(src, user, I.tool_volume)) + return + attack_hand(user) + /mob/living/simple_animal/bot/mulebot/emag_act(mob/user) if(!emagged) emagged = TRUE diff --git a/code/modules/power/engines/singularity/collector.dm b/code/modules/power/engines/singularity/collector.dm index 12a99fe1b3d..9f6d13842cf 100644 --- a/code/modules/power/engines/singularity/collector.dm +++ b/code/modules/power/engines/singularity/collector.dm @@ -60,7 +60,7 @@ loaded_tank = I I.forceMove(src) update_icons() - else if(iscrowbar(I)) + else if(I.tool_behaviour == TOOL_CROWBAR) if(loaded_tank && !locked) eject() return TRUE diff --git a/code/modules/power/generators/portable generators/pacman.dm b/code/modules/power/generators/portable generators/pacman.dm index e53bbc554c1..3fa64a39583 100644 --- a/code/modules/power/generators/portable generators/pacman.dm +++ b/code/modules/power/generators/portable generators/pacman.dm @@ -201,38 +201,43 @@ addstack.use(amount) SStgui.update_uis(src) return - else if(!active) - if(istype(O, /obj/item/wrench)) - - if(!anchored) - connect_to_network() - to_chat(user, "You secure the generator to the floor.") - else - disconnect_from_network() - to_chat(user, "You unsecure the generator from the floor.") - - playsound(src.loc, O.usesound, 50, 1) - anchored = !anchored - - else if(istype(O, /obj/item/storage/part_replacer) && panel_open) + if(!active) + if(istype(O, /obj/item/storage/part_replacer) && panel_open) exchange_parts(user, O) - return - else if(istype(O, /obj/item/crowbar) && panel_open) - default_deconstruction_crowbar(user, O) - else - return ..() + return + return ..() + +/obj/machinery/power/port_gen/pacman/crowbar_act(mob/living/user, obj/item/I) + if(active || !panel_open) + return + . = TRUE + default_deconstruction_crowbar(user, I) /obj/machinery/power/port_gen/pacman/screwdriver_act(mob/living/user, obj/item/I) if(active) return - + . = TRUE + if(!I.use_tool(src, user, I.tool_volume)) + return panel_open = !panel_open - I.play_tool_sound(src) if(panel_open) to_chat(user, "You open the access panel.") else to_chat(user, "You close the access panel.") - return TRUE + +/obj/machinery/power/port_gen/pacman/wrench_act(mob/living/user, obj/item/I) + if(active) + return + . = TRUE + if(!I.use_tool(src, user, I.tool_volume)) + return + if(!anchored) + connect_to_network() + to_chat(user, "You secure the generator to the floor.") + else + disconnect_from_network() + to_chat(user, "You unsecure the generator from the floor.") + anchored = !anchored /obj/machinery/power/port_gen/pacman/attack_hand(mob/user as mob) ..() diff --git a/code/modules/power/generators/solar.dm b/code/modules/power/generators/solar.dm index 8af1ed8f693..9971f556edb 100644 --- a/code/modules/power/generators/solar.dm +++ b/code/modules/power/generators/solar.dm @@ -211,19 +211,7 @@ /obj/item/solar_assembly/attackby(obj/item/W, mob/user, params) - if(!anchored && isturf(loc)) - if(istype(W, /obj/item/wrench)) - anchored = TRUE - user.visible_message("[user] wrenches the solar assembly into place.", "You wrench the solar assembly into place.") - playsound(src.loc, W.usesound, 50, 1) - return 1 - else - if(istype(W, /obj/item/wrench)) - anchored = FALSE - user.visible_message("[user] unwrenches the solar assembly from its place.", "You unwrench the solar assembly from its place.") - playsound(src.loc, W.usesound, 50, 1) - return 1 - + if(anchored || !isturf(loc)) if(istype(W, /obj/item/stack/sheet/glass) || istype(W, /obj/item/stack/sheet/rglass)) var/obj/item/stack/sheet/S = W if(S.use(2)) @@ -237,25 +225,41 @@ else to_chat(user, "You need two sheets of glass to put them into a solar panel.") return - return 1 + return TRUE if(!tracker) if(istype(W, /obj/item/tracker_electronics)) if(!user.drop_item()) return - tracker = 1 + tracker = TRUE qdel(W) user.visible_message("[user] inserts the electronics into the solar assembly.", "You insert the electronics into the solar assembly.") - return 1 - else if(istype(W, /obj/item/crowbar)) - new /obj/item/tracker_electronics(src.loc) - tracker = 0 - playsound(loc, W.usesound, 50, 1) - user.visible_message("[user] takes out the electronics from the solar assembly.", "You take out the electronics from the solar assembly.") - return 1 + return TRUE else return ..() +/obj/item/solar_assembly/crowbar_act(mob/living/user, obj/item/I) + if(!tracker) + return + . = TRUE + if(!I.use_tool(src, user, I.tool_volume)) + return + new /obj/item/tracker_electronics(loc) + tracker = FALSE + user.visible_message("[user] takes out the electronics from the solar assembly.", "You take out the electronics from the solar assembly.") + +/obj/item/solar_assembly/wrench_act(mob/living/user, obj/item/I) + if(!anchored && isturf(loc)) + if(I.use_tool(src, user, I.tool_volume)) + anchored = TRUE + user.visible_message("[user] wrenches the solar assembly into place.", "You wrench the solar assembly into place.") + return TRUE + else + if(I.use_tool(src, user, I.tool_volume)) + anchored = FALSE + user.visible_message("[user] unwrenches the solar assembly from its place.", "You unwrench the solar assembly from its place.") + return TRUE + // // Solar Control Computer // diff --git a/code/modules/research/circuitprinter.dm b/code/modules/research/circuitprinter.dm index 1223c44553c..e24bb030391 100644 --- a/code/modules/research/circuitprinter.dm +++ b/code/modules/research/circuitprinter.dm @@ -75,28 +75,31 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis). return round(A / max(1, (all_materials[M] * efficiency_coeff))) /obj/machinery/r_n_d/circuit_imprinter/attackby(obj/item/O as obj, mob/user as mob, params) - if(default_deconstruction_screwdriver(user, "circuit_imprinter_t", "circuit_imprinter", O)) - if(linked_console) - linked_console.linked_imprinter = null - linked_console = null - return - if(exchange_parts(user, O)) return - if(panel_open) - if(istype(O, /obj/item/crowbar)) - for(var/obj/I in component_parts) - if(istype(I, /obj/item/reagent_containers/glass/beaker)) - reagents.trans_to(I, reagents.total_volume) - I.loc = src.loc - materials.retrieve_all() - default_deconstruction_crowbar(user, O) - return - else - to_chat(user, "You can't load [src] while it's opened.") - return + to_chat(user, "You can't load [src] while it's opened.") + return if(O.is_open_container()) return FALSE else return ..() + +/obj/machinery/r_n_d/circuit_imprinter/crowbar_act(mob/living/user, obj/item/I) + if(!panel_open) + return + . = TRUE + for(var/obj/component in component_parts) + if(istype(component, /obj/item/reagent_containers/glass/beaker)) + reagents.trans_to(component, reagents.total_volume) + component.loc = src.loc + materials.retrieve_all() + default_deconstruction_crowbar(user, I) + +/obj/machinery/r_n_d/circuit_imprinter/screwdriver_act(mob/living/user, obj/item/I) + . = TRUE + if(!default_deconstruction_screwdriver(user, "circuit_imprinter_t", "circuit_imprinter", I)) + return + if(linked_console) + linked_console.linked_imprinter = null + linked_console = null diff --git a/code/modules/research/protolathe.dm b/code/modules/research/protolathe.dm index 2b78ebd2f94..8708de882fc 100644 --- a/code/modules/research/protolathe.dm +++ b/code/modules/research/protolathe.dm @@ -87,21 +87,23 @@ Note: Must be placed west/left of and R&D console to function. return FALSE if(panel_open) - if(istype(O, /obj/item/crowbar)) - for(var/obj/I in component_parts) - if(istype(I, /obj/item/reagent_containers/glass/beaker)) - reagents.trans_to(I, reagents.total_volume) - I.loc = src.loc - for(var/obj/item/reagent_containers/glass/G in component_parts) - reagents.trans_to(G, G.reagents.maximum_volume) - materials.retrieve_all() - default_deconstruction_crowbar(user, O) - return TRUE - else - to_chat(user, "You can't load [src] while it's opened.") - return TRUE + to_chat(user, "You can't load [src] while it's opened.") + return TRUE if(O.is_open_container()) return FALSE else return ..() + +/obj/machinery/r_n_d/protolathe/crowbar_act(mob/living/user, obj/item/I) + if(!panel_open) + return + . = TRUE + for(var/obj/component in component_parts) + if(istype(component, /obj/item/reagent_containers/glass/beaker)) + reagents.trans_to(component, reagents.total_volume) + component.loc = src.loc + for(var/obj/item/reagent_containers/glass/G in component_parts) + reagents.trans_to(G, G.reagents.maximum_volume) + materials.retrieve_all() + default_deconstruction_crowbar(user, I) diff --git a/code/modules/research/server.dm b/code/modules/research/server.dm index 3d3f71e5174..cceda0d9ae6 100644 --- a/code/modules/research/server.dm +++ b/code/modules/research/server.dm @@ -142,15 +142,15 @@ /obj/machinery/r_n_d/server/attackby(obj/item/O as obj, mob/user as mob, params) if(exchange_parts(user, O)) - return 1 + return TRUE + return ..() - if(panel_open) - if(istype(O, /obj/item/crowbar)) - griefProtection() - default_deconstruction_crowbar(user, O) - return 1 - else - return ..() +/obj/machinery/r_n_d/server/crowbar_act(mob/living/user, obj/item/I) + if(!panel_open) + return + . = TRUE + griefProtection() + default_deconstruction_crowbar(user, I) /obj/machinery/r_n_d/server/screwdriver_act(mob/living/user, obj/item/I) default_deconstruction_screwdriver(user, "RD-server-on_t", "RD-server-on", I)