From 335fd6ca0d349aaa09b1d1b2146bbe7d361d6fbd Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Wed, 26 Aug 2020 01:12:57 +0200 Subject: [PATCH] [MIRROR] Fixes some bugs with the detective's revolver. (#513) * Fixes some bugs with the detective's revolver. (#53107) * Fixes some bugs with the detective's revolver. Co-authored-by: uomo <51800976+uomo91@users.noreply.github.com> --- .../projectiles/guns/ballistic/revolver.dm | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/code/modules/projectiles/guns/ballistic/revolver.dm b/code/modules/projectiles/guns/ballistic/revolver.dm index be861daf21c..8b25b0a64a3 100644 --- a/code/modules/projectiles/guns/ballistic/revolver.dm +++ b/code/modules/projectiles/guns/ballistic/revolver.dm @@ -76,7 +76,7 @@ /obj/item/gun/ballistic/revolver/detective name = "\improper Colt Detective Special" - desc = "A classic, if not outdated, law enforcement firearm. Uses .38-special rounds." + desc = "A classic, if not outdated, law enforcement firearm. Uses .38 Special rounds. \nSome spread rumors that if you loosen the barrel with a wrench, you can \"improve\" it." fire_sound = 'sound/weapons/gun/revolver/shot.ogg' icon_state = "detective" mag_type = /obj/item/ammo_box/magazine/internal/cylinder/rev38 @@ -91,49 +91,49 @@ "The Peacemaker" = "detective_peacemaker", "Black Panther" = "detective_panther" ) + + /// Used to avoid some redundancy on a revolver loaded with 357 regarding misfiring while being wrenched. + var/skip_357_missfire_check = FALSE /obj/item/gun/ballistic/revolver/detective/process_fire(atom/target, mob/living/user, message = TRUE, params = null, zone_override = "", bonus_spread = 0) - if(magazine && magazine.caliber != initial(magazine.caliber)) + if(magazine && magazine.caliber != initial(magazine.caliber) && chambered.BB && !skip_357_missfire_check) if(prob(70 - (magazine.ammo_count() * 10))) //minimum probability of 10, maximum of 60 - playsound(user, fire_sound, fire_sound_volume, vary_fire_sound) - to_chat(user, "[src] blows up in your face!") - user.take_bodypart_damage(0,20) - user.dropItemToGround(src) - return FALSE + to_chat(user, "[src] misfires!") + if(user.get_item_for_held_index(1) == src) + user.dropItemToGround(src) + return ..(user, user, FALSE, null, BODY_ZONE_L_ARM) + else if(user.get_item_for_held_index(2) == src) + user.dropItemToGround(src) + return ..(user, user, FALSE, null, BODY_ZONE_R_ARM) return ..() -/obj/item/gun/ballistic/revolver/detective/screwdriver_act(mob/living/user, obj/item/I) - if(..()) +/obj/item/gun/ballistic/revolver/detective/wrench_act(mob/living/user, obj/item/I) + if(!user.is_holding(src)) + to_chat(user, "You need to hold [src] to modify its barrel.") + return TRUE + to_chat(user, "You begin to loosen the barrel of [src]...") + I.play_tool_sound(src) + if(!I.use_tool(src, user, 3 SECONDS)) + return TRUE + if(magazine.ammo_count()) //If it has any ammo inside.... + user.visible_message("[src]'s hammer drops while you're handling it!") //...you learn an important lesson about firearms safety. + var/drop_the_gun_it_actually_fired = chambered.BB ? TRUE : FALSE //Is a live round chambered? + skip_357_missfire_check = TRUE //We set this true, then back to false after process_fire, to reduce redundacy of a round "misfiring" when it's already misfiring from wrench_act + process_fire(user, user, FALSE) + skip_357_missfire_check = FALSE + if(drop_the_gun_it_actually_fired) //We do it like this instead of directly checking chambered.BB here because process_fire will cycle the chamber. + user.dropItemToGround(src) return TRUE if(magazine.caliber == "38") - to_chat(user, "You begin to reinforce the barrel of [src]...") - if(magazine.ammo_count()) - afterattack(user, user) //you know the drill - user.visible_message("[src] goes off!", "[src] goes off in your face!") - return TRUE - if(I.use_tool(src, user, 30)) - if(magazine.ammo_count()) - to_chat(user, "You can't modify it!") - return TRUE - magazine.caliber = "357" - fire_sound = 'sound/weapons/gun/revolver/shot_alt.ogg' - desc = "The barrel and chamber assembly seems to have been modified." - to_chat(user, "You reinforce the barrel of [src]. Now it will fire .357 rounds.") + magazine.caliber = "357" + fire_sound = 'sound/weapons/gun/revolver/shot_alt.ogg' + desc = "A classic, if not outdated, law enforcement firearm. \nIt has been modified to fire .357 rounds." + to_chat(user, "You loosen the barrel of [src]. Now it will fire .357 rounds.") else - to_chat(user, "You begin to revert the modifications to [src]...") - if(magazine.ammo_count()) - afterattack(user, user) //and again - user.visible_message("[src] goes off!", "[src] goes off in your face!") - return TRUE - if(I.use_tool(src, user, 30)) - if(magazine.ammo_count()) - to_chat(user, "You can't modify it!") - return - magazine.caliber = "38" - fire_sound = 'sound/weapons/gun/revolver/shot.ogg' - desc = initial(desc) - to_chat(user, "You remove the modifications on [src]. Now it will fire .38 rounds.") - return TRUE + magazine.caliber = "38" + fire_sound = 'sound/weapons/gun/revolver/shot.ogg' + desc = initial(desc) + to_chat(user, "You tighten the barrel of [src]. Now it will fire .38 rounds.") /obj/item/gun/ballistic/revolver/mateba