From e79ca9fcac21f6d75f6ee23de88ca786061ab401 Mon Sep 17 00:00:00 2001 From: SteelSlayer Date: Sat, 2 May 2020 22:18:30 -0500 Subject: [PATCH] crossbow cell fix --- .../projectiles/guns/throw/crossbow.dm | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/code/modules/projectiles/guns/throw/crossbow.dm b/code/modules/projectiles/guns/throw/crossbow.dm index ca626534320..08fc39271da 100644 --- a/code/modules/projectiles/guns/throw/crossbow.dm +++ b/code/modules/projectiles/guns/throw/crossbow.dm @@ -94,25 +94,29 @@ user.visible_message("[usr] draws back the string of [src]!","[src] clunks as you draw the string to its maximum tension!!") update_icon() -/obj/item/gun/throw/crossbow/attackby(obj/item/W as obj, mob/user as mob, params) - if(istype(W, /obj/item/stock_parts/cell)) - if(!cell) - user.drop_item() - W.loc = src - cell = W - to_chat(user, "You jam [cell] into [src] and wire it to the firing coil.") - process_chamber() - else - to_chat(user, "[src] already has a cell installed.") - else if(istype(W, /obj/item/screwdriver)) - if(cell) - cell.loc = get_turf(src) - to_chat(user, "You jimmy [cell] out of [src] with [W].") - cell = null - else - to_chat(user, "[src] doesn't have a cell installed.") - else - ..() +/obj/item/gun/throw/crossbow/attackby(obj/item/I, mob/user, params) + if(!istype(I, /obj/item/stock_parts/cell)) + return ..() + + if(cell) + to_chat(user, "[src] already has a cell installed.") + return + + user.drop_item() + I.loc = src + cell = I + to_chat(user, "You jam [cell] into [src] and wire it to the firing coil.") + process_chamber() + +/obj/item/gun/throw/crossbow/screwdriver_act(mob/user, obj/item/I) + . = ..() + if(!cell) + to_chat(user, "[src] doesn't have a cell installed.") + return + + cell.forceMove(get_turf(src)) + to_chat(user, "You jimmy [cell] out of [src] with [I].") + cell = null /obj/item/gun/throw/crossbow/verb/set_tension() set name = "Adjust Tension"