Fixes magazine overflow and russian roulette starting with 6(7) bullets (#84247)

## About The Pull Request
Box magazine code started from ``.len`` instead of ``.len + 1`` when
refilling mags which would be fine if BYOND's ``to`` didn't include the
last number. Unfortunately, it does, and if the mag has bullets when its
refilled it will have one over the limit.

Russian revolver code had a type typo where ammo was added in
nonexistent ``/obj/item/ammo_box/magazine/internal/rus357``'s
``Initialize`` instead of
``/obj/item/ammo_box/magazine/internal/cylinder/rus357``. It was pretty
clearly was meant to start with a single bullet instead of 6, but
neither removing existing ammo nor adding new was implemented properly.
I stuff it with 5 blanks instead of making it empty because this will at
least allow it to click with current guncode instead of bashing yourself
over the head without any feedback, until I rework it.

Related to #84057 but doesn't close it.

## Why It's Good For The Game

Overflow could happen on chaplain's revolver when pray-reloading, giving
them one more shot than intended.
Russian revolver is still broken, just slightly less as it now can at
least tell you that you failed at killing yourself.

## Changelog
🆑
fix: Guns no longer can be overfilled by 1 bullet
fix: Russian revolvers now spawn with only 1 live round as originally
intended, and click when firing a blank.
/🆑

---------

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
SmArtKar
2024-06-29 20:25:05 +03:00
committed by GitHub
parent 66380654b2
commit c20228b67e
2 changed files with 6 additions and 3 deletions

View File

@@ -94,7 +94,7 @@
stack_trace("Tried loading unsupported ammocasing type [load_type] into ammo box [type].")
return
for(var/i in max(1, stored_ammo.len) to max_ammo)
for(var/i in max(1, stored_ammo.len + 1) to max_ammo)
stored_ammo += new round_check(src)
update_appearance()

View File

@@ -16,7 +16,10 @@
caliber = CALIBER_357
max_ammo = 6
multiload = FALSE
start_empty = TRUE
/obj/item/ammo_box/magazine/internal/rus357/Initialize(mapload)
stored_ammo += new ammo_type(src)
/obj/item/ammo_box/magazine/internal/cylinder/rus357/Initialize(mapload)
. = ..()
for (var/i in 1 to max_ammo - 1)
stored_ammo += new /obj/item/ammo_casing/a357/spent(src)
stored_ammo += new /obj/item/ammo_casing/a357(src)