mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 05:00:55 +01:00
[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>
This commit is contained in:
@@ -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, "<span class='userdanger'>[src] blows up in your face!</span>")
|
||||
user.take_bodypart_damage(0,20)
|
||||
user.dropItemToGround(src)
|
||||
return FALSE
|
||||
to_chat(user, "<span class='userdanger'>[src] misfires!</span>")
|
||||
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, "<span class='notice'>You need to hold [src] to modify its barrel.</span>")
|
||||
return TRUE
|
||||
to_chat(user, "<span class='notice'>You begin to loosen the barrel of [src]...</span>")
|
||||
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("<span class='danger'>[src]'s hammer drops while you're handling it!</span>") //...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, "<span class='notice'>You begin to reinforce the barrel of [src]...</span>")
|
||||
if(magazine.ammo_count())
|
||||
afterattack(user, user) //you know the drill
|
||||
user.visible_message("<span class='danger'>[src] goes off!</span>", "<span class='userdanger'>[src] goes off in your face!</span>")
|
||||
return TRUE
|
||||
if(I.use_tool(src, user, 30))
|
||||
if(magazine.ammo_count())
|
||||
to_chat(user, "<span class='warning'>You can't modify it!</span>")
|
||||
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, "<span class='notice'>You reinforce the barrel of [src]. Now it will fire .357 rounds.</span>")
|
||||
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, "<span class='notice'>You loosen the barrel of [src]. Now it will fire .357 rounds.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You begin to revert the modifications to [src]...</span>")
|
||||
if(magazine.ammo_count())
|
||||
afterattack(user, user) //and again
|
||||
user.visible_message("<span class='danger'>[src] goes off!</span>", "<span class='userdanger'>[src] goes off in your face!</span>")
|
||||
return TRUE
|
||||
if(I.use_tool(src, user, 30))
|
||||
if(magazine.ammo_count())
|
||||
to_chat(user, "<span class='warning'>You can't modify it!</span>")
|
||||
return
|
||||
magazine.caliber = "38"
|
||||
fire_sound = 'sound/weapons/gun/revolver/shot.ogg'
|
||||
desc = initial(desc)
|
||||
to_chat(user, "<span class='notice'>You remove the modifications on [src]. Now it will fire .38 rounds.</span>")
|
||||
return TRUE
|
||||
magazine.caliber = "38"
|
||||
fire_sound = 'sound/weapons/gun/revolver/shot.ogg'
|
||||
desc = initial(desc)
|
||||
to_chat(user, "<span class='notice'>You tighten the barrel of [src]. Now it will fire .38 rounds.</span>")
|
||||
|
||||
|
||||
/obj/item/gun/ballistic/revolver/mateba
|
||||
|
||||
Reference in New Issue
Block a user