mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-27 18:12:00 +00:00
Replaces like 70-80% of 0 and such, as a side effect cleaned up a bunch of returns Edit: Most left out ones are in mecha which should be done in mecha refactor already Oh my look how clean it is Co-authored-by: TiviPlus <TiviPlus> Co-authored-by: Couls <coul422@gmail.com> Co-authored-by: TiviPlus <57223640+TiviPlus@users.noreply.github.com> Co-authored-by: Couls <coul422@gmail.com>
263 lines
11 KiB
Plaintext
263 lines
11 KiB
Plaintext
/obj/item/gun/ballistic/revolver
|
|
name = "\improper .357 revolver"
|
|
desc = "A suspicious revolver. Uses .357 ammo." //usually used by syndicates
|
|
icon_state = "revolver"
|
|
mag_type = /obj/item/ammo_box/magazine/internal/cylinder
|
|
fire_sound = 'sound/weapons/gun/revolver/shot_alt.ogg'
|
|
load_sound = 'sound/weapons/gun/revolver/load_bullet.ogg'
|
|
eject_sound = 'sound/weapons/gun/revolver/empty.ogg'
|
|
vary_fire_sound = FALSE
|
|
fire_sound_volume = 90
|
|
dry_fire_sound = 'sound/weapons/gun/revolver/dry_fire.ogg'
|
|
casing_ejector = FALSE
|
|
internal_magazine = TRUE
|
|
bolt_type = BOLT_TYPE_NO_BOLT
|
|
tac_reloads = FALSE
|
|
var/spin_delay = 10
|
|
var/recent_spin = 0
|
|
|
|
/obj/item/gun/ballistic/revolver/chamber_round(keep_bullet, spin_cylinder = TRUE, replace_new_round)
|
|
if(!magazine) //if it mag was qdel'd somehow.
|
|
CRASH("revolver tried to chamber a round without a magazine!")
|
|
if(spin_cylinder)
|
|
chambered = magazine.get_round(TRUE)
|
|
else
|
|
chambered = magazine.stored_ammo[1]
|
|
|
|
/obj/item/gun/ballistic/revolver/shoot_with_empty_chamber(mob/living/user as mob|obj)
|
|
..()
|
|
chamber_round()
|
|
|
|
/obj/item/gun/ballistic/revolver/AltClick(mob/user)
|
|
..()
|
|
spin()
|
|
|
|
/obj/item/gun/ballistic/revolver/verb/spin()
|
|
set name = "Spin Chamber"
|
|
set category = "Object"
|
|
set desc = "Click to spin your revolver's chamber."
|
|
|
|
var/mob/M = usr
|
|
|
|
if(M.stat || !in_range(M,src))
|
|
return
|
|
|
|
if (recent_spin > world.time)
|
|
return
|
|
recent_spin = world.time + spin_delay
|
|
|
|
if(do_spin())
|
|
playsound(usr, "revolver_spin", 30, FALSE)
|
|
usr.visible_message("<span class='notice'>[usr] spins [src]'s chamber.</span>", "<span class='notice'>You spin [src]'s chamber.</span>")
|
|
else
|
|
verbs -= /obj/item/gun/ballistic/revolver/verb/spin
|
|
|
|
/obj/item/gun/ballistic/revolver/proc/do_spin()
|
|
var/obj/item/ammo_box/magazine/internal/cylinder/C = magazine
|
|
. = istype(C)
|
|
if(.)
|
|
C.spin()
|
|
chamber_round(spin_cylinder = FALSE)
|
|
|
|
/obj/item/gun/ballistic/revolver/get_ammo(countchambered = FALSE, countempties = TRUE)
|
|
var/boolets = 0 //mature var names for mature people
|
|
if (chambered && countchambered)
|
|
boolets++
|
|
if (magazine)
|
|
boolets += magazine.ammo_count(countempties)
|
|
return boolets
|
|
|
|
/obj/item/gun/ballistic/revolver/examine(mob/user)
|
|
. = ..()
|
|
var/live_ammo = get_ammo(FALSE, FALSE)
|
|
. += "[live_ammo ? live_ammo : "None"] of those are live rounds."
|
|
if (current_skin)
|
|
. += "It can be spun with <b>alt+click</b>"
|
|
|
|
/obj/item/gun/ballistic/revolver/detective
|
|
name = "\improper Colt Detective Special"
|
|
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
|
|
obj_flags = UNIQUE_RENAME
|
|
unique_reskin = list("Default" = "detective",
|
|
"Fitz Special" = "detective_fitz",
|
|
"Police Positive Special" = "detective_police",
|
|
"Blued Steel" = "detective_blued",
|
|
"Stainless Steel" = "detective_stainless",
|
|
"Gold Trim" = "detective_gold",
|
|
"Leopard Spots" = "detective_leopard",
|
|
"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) && chambered.BB && !skip_357_missfire_check)
|
|
if(prob(70 - (magazine.ammo_count() * 10))) //minimum probability of 10, maximum of 60
|
|
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/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")
|
|
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
|
|
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
|
|
name = "\improper Unica 6 auto-revolver"
|
|
desc = "A retro high-powered autorevolver typically used by officers of the New Russia military. Uses .357 ammo."
|
|
icon_state = "mateba"
|
|
|
|
/obj/item/gun/ballistic/revolver/golden
|
|
name = "\improper Golden revolver"
|
|
desc = "This ain't no game, ain't never been no show, And I'll gladly gun down the oldest lady you know. Uses .357 ammo."
|
|
icon_state = "goldrevolver"
|
|
fire_sound = 'sound/weapons/resonator_blast.ogg'
|
|
recoil = 8
|
|
pin = /obj/item/firing_pin
|
|
|
|
/obj/item/gun/ballistic/revolver/nagant
|
|
name = "\improper Nagant revolver"
|
|
desc = "An old model of revolver that originated in Russia. Able to be suppressed. Uses 7.62x38mmR ammo."
|
|
icon_state = "nagant"
|
|
can_suppress = TRUE
|
|
|
|
mag_type = /obj/item/ammo_box/magazine/internal/cylinder/rev762
|
|
|
|
|
|
// A gun to play Russian Roulette!
|
|
// You can spin the chamber to randomize the position of the bullet.
|
|
|
|
/obj/item/gun/ballistic/revolver/russian
|
|
name = "\improper Russian revolver"
|
|
desc = "A Russian-made revolver for drinking games. Uses .357 ammo, and has a mechanism requiring you to spin the chamber before each trigger pull."
|
|
icon_state = "russianrevolver"
|
|
mag_type = /obj/item/ammo_box/magazine/internal/cylinder/rus357
|
|
var/spun = FALSE
|
|
|
|
/obj/item/gun/ballistic/revolver/russian/do_spin()
|
|
. = ..()
|
|
if(.)
|
|
spun = TRUE
|
|
|
|
/obj/item/gun/ballistic/revolver/russian/attackby(obj/item/A, mob/user, params)
|
|
..()
|
|
if(get_ammo() > 0)
|
|
spin()
|
|
update_icon()
|
|
A.update_icon()
|
|
return
|
|
|
|
/obj/item/gun/ballistic/revolver/russian/attack_self(mob/user)
|
|
if(!spun)
|
|
spin()
|
|
spun = TRUE
|
|
return
|
|
..()
|
|
|
|
/obj/item/gun/ballistic/revolver/russian/afterattack(atom/target, mob/living/user, flag, params)
|
|
. = ..(null, user, flag, params)
|
|
|
|
if(flag)
|
|
if(!(target in user.contents) && ismob(target))
|
|
if(user.a_intent == INTENT_HARM) // Flogging action
|
|
return
|
|
|
|
if(isliving(user))
|
|
if(!can_trigger_gun(user))
|
|
return
|
|
if(target != user)
|
|
if(ismob(target))
|
|
to_chat(user, "<span class='warning'>A mechanism prevents you from shooting anyone but yourself!</span>")
|
|
return
|
|
|
|
if(ishuman(user))
|
|
var/mob/living/carbon/human/H = user
|
|
if(!spun)
|
|
to_chat(user, "<span class='warning'>You need to spin \the [src]'s chamber first!</span>")
|
|
return
|
|
|
|
spun = FALSE
|
|
|
|
if(chambered)
|
|
var/obj/item/ammo_casing/AC = chambered
|
|
if(AC.fire_casing(user, user))
|
|
playsound(user, fire_sound, fire_sound_volume, vary_fire_sound)
|
|
var/zone = check_zone(user.zone_selected)
|
|
var/obj/item/bodypart/affecting = H.get_bodypart(zone)
|
|
if(zone == BODY_ZONE_HEAD || zone == BODY_ZONE_PRECISE_EYES || zone == BODY_ZONE_PRECISE_MOUTH)
|
|
shoot_self(user, affecting)
|
|
else
|
|
user.visible_message("<span class='danger'>[user.name] cowardly fires [src] at [user.p_their()] [affecting.name]!</span>", "<span class='userdanger'>You cowardly fire [src] at your [affecting.name]!</span>", "<span class='hear'>You hear a gunshot!</span>")
|
|
chambered = null
|
|
return
|
|
|
|
user.visible_message("<span class='danger'>*click*</span>")
|
|
playsound(src, dry_fire_sound, 30, TRUE)
|
|
|
|
/obj/item/gun/ballistic/revolver/russian/process_fire(atom/target, mob/living/user, message = TRUE, params = null, zone_override = "", bonus_spread = 0)
|
|
add_fingerprint(user)
|
|
playsound(src, dry_fire_sound, 30, TRUE)
|
|
user.visible_message("<span class='danger'>[user.name] tries to fire \the [src] at the same time, but only succeeds at looking like an idiot.</span>", "<span class='danger'>\The [src]'s anti-combat mechanism prevents you from firing it at the same time!</span>")
|
|
|
|
/obj/item/gun/ballistic/revolver/russian/proc/shoot_self(mob/living/carbon/human/user, affecting = BODY_ZONE_HEAD)
|
|
user.apply_damage(300, BRUTE, affecting)
|
|
user.visible_message("<span class='danger'>[user.name] fires [src] at [user.p_their()] head!</span>", "<span class='userdanger'>You fire [src] at your head!</span>", "<span class='hear'>You hear a gunshot!</span>")
|
|
|
|
/obj/item/gun/ballistic/revolver/russian/soul
|
|
name = "cursed Russian revolver"
|
|
desc = "To play with this revolver requires wagering your very soul."
|
|
|
|
/obj/item/gun/ballistic/revolver/russian/soul/shoot_self(mob/living/user)
|
|
..()
|
|
var/obj/item/soulstone/anybody/revolver/SS = new /obj/item/soulstone/anybody/revolver(get_turf(src))
|
|
if(!SS.transfer_soul("FORCE", user)) //Something went wrong
|
|
qdel(SS)
|
|
return
|
|
user.visible_message("<span class='danger'>[user.name]'s soul is captured by \the [src]!</span>", "<span class='userdanger'>You've lost the gamble! Your soul is forfeit!</span>")
|
|
|
|
/obj/item/gun/ballistic/revolver/reverse //Fires directly at its user... unless the user is a clown, of course.
|
|
clumsy_check = FALSE
|
|
|
|
/obj/item/gun/ballistic/revolver/reverse/can_trigger_gun(mob/living/user)
|
|
if((HAS_TRAIT(user, TRAIT_CLUMSY)) || (user.mind && user.mind.assigned_role == "Clown"))
|
|
return ..()
|
|
if(process_fire(user, user, FALSE, null, BODY_ZONE_HEAD))
|
|
user.visible_message("<span class='warning'>[user] somehow manages to shoot [user.p_them()]self in the face!</span>", "<span class='userdanger'>You somehow shoot yourself in the face! How the hell?!</span>")
|
|
user.emote("scream")
|
|
user.drop_all_held_items()
|
|
user.Paralyze(80)
|