Skip to content

Commit

Permalink
Fix ammo check for revolvers (#3025)
Browse files Browse the repository at this point in the history
Loading rockets and rifle ammo into the revolver is prohibited

<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## Why It's Good For The Game

<!-- Please add a short description of why you think these changes would
benefit the game. If you can't justify it in words, it might not be
worth adding. -->

## Changelog

:cl:

fix: Fix revolver ammo check

/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->

---------

Co-authored-by: Sun-Soaked <[email protected]>
  • Loading branch information
Mirag19 and Sun-Soaked authored May 27, 2024
1 parent 1a4f9e8 commit a1356a1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions code/modules/projectiles/guns/ballistic/revolver.dm
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@
/obj/item/gun/ballistic/revolver/proc/insert_casing(mob/living/user, obj/item/ammo_casing/casing_to_insert, allow_ejection)
if(!casing_to_insert)
return FALSE

// Check if the bullet's caliber matches the magazine's caliber.If not, send a warning message to the user and return FALSE.
if(casing_to_insert.caliber != magazine.caliber)
to_chat(user, "<span class='warning'>\The [casing_to_insert] is not suitable for [src].</span>")
return FALSE

var/list/rounds = magazine.ammo_list()
var/obj/item/ammo_casing/slot = rounds[gate_offset+1] //byond arrays start at 1, so we add 1 to get the correct index
var/doafter_time = 0.4 SECONDS
Expand Down

0 comments on commit a1356a1

Please sign in to comment.