diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index d496d9ffd95..2a9b9b3e4fd 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -1027,20 +1027,27 @@ /obj/item/gun/proc/can_autofire(object, location, params) return (can_autofire && world.time >= next_fire_time) +/// Called when the gun's ammo state changes, checks if it's being held by a mob or in a mob's bag, and then updates the maptext /obj/item/gun/proc/update_maptext() if(displays_maptext) if(!ismob(loc) && !ismob(loc.loc)) maptext = "" return - var/ammo = get_ammo() - if(ammo > 9) - if(ammo < 20) - maptext_x = 20 - else - maptext_x = 18 + handle_maptext() + + +/// Updates the maptext for the gun when a holographic ammo display is attached. Called in update_maptext() in gun.dm +/obj/item/gun/proc/handle_maptext() + SHOULD_NOT_SLEEP(TRUE) + var/ammo = get_ammo() + if(ammo > 9) + if(ammo < 20) + maptext_x = 20 else - maptext_x = 22 - maptext = "[ammo]" + maptext_x = 18 + else + maptext_x = 22 + maptext = "[ammo]" /obj/item/gun/get_print_info(var/no_clear = TRUE) if(no_clear) diff --git a/code/modules/projectiles/guns/projectile/shotgun.dm b/code/modules/projectiles/guns/projectile/shotgun.dm index 386494bf2d7..972405181f1 100644 --- a/code/modules/projectiles/guns/projectile/shotgun.dm +++ b/code/modules/projectiles/guns/projectile/shotgun.dm @@ -66,6 +66,15 @@ ///Whether the item icon has a cycling animation var/cycle_anim = TRUE +/obj/item/gun/projectile/shotgun/pump/handle_maptext() + var/ammo = length(loaded) + if(ammo > 9) + maptext_x = 12 + else + maptext_x = 16 + var/ammo_display = "[ammo]+[chambered?.BB ? "1" : "0"]" + maptext = "[ammo_display]" + /obj/item/gun/projectile/shotgun/pump/consume_next_projectile() if(chambered) return chambered.BB diff --git a/html/changelogs/geeves-shotgun_ammo_display_tweak.yml b/html/changelogs/geeves-shotgun_ammo_display_tweak.yml new file mode 100644 index 00000000000..f88e51a2f0a --- /dev/null +++ b/html/changelogs/geeves-shotgun_ammo_display_tweak.yml @@ -0,0 +1,6 @@ +author: Geeves + +delete-after: True + +changes: + - tweak: "Shotguns now more accurately reflect shells in the tube and whether there's a shell in the chamber." \ No newline at end of file