Shotgun Ammo Display Tweak (#18719)

* Shotgun Ammo Display Tweak

* fluffy review
This commit is contained in:
Geeves
2024-03-24 16:12:24 +00:00
committed by GitHub
parent 42da15301f
commit 23f74bd39b
3 changed files with 30 additions and 8 deletions
+15 -8
View File
@@ -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 = "<span style=\"font-family: 'Small Fonts'; -dm-text-outline: 1 black; font-size: 7px;\">[ammo]</span>"
maptext_x = 18
else
maptext_x = 22
maptext = "<span style=\"font-family: 'Small Fonts'; -dm-text-outline: 1 black; font-size: 7px;\">[ammo]</span>"
/obj/item/gun/get_print_info(var/no_clear = TRUE)
if(no_clear)
@@ -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 = "<span style=\"font-family: 'Small Fonts'; -dm-text-outline: 1 black; font-size: 7px;\">[ammo_display]</span>"
/obj/item/gun/projectile/shotgun/pump/consume_next_projectile()
if(chambered)
return chambered.BB
@@ -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."