Unhardcodes mech ammo empty sprites (#70056)

* Does some code for improving mecha ammo sprites, de-hardcoding it for downstreams, and adds a var to delete itself when empty instead.
This commit is contained in:
TiviPlus
2022-09-22 23:50:16 -04:00
committed by GitHub
parent 12a5792047
commit 03ec953a60
3 changed files with 6 additions and 1 deletions
@@ -10,6 +10,8 @@
var/direct_load //For weapons where we re-load the weapon itself rather than adding to the ammo storage.
var/load_audio = 'sound/weapons/gun/general/mag_bullet_insert.ogg'
var/ammo_type
/// whether to qdel this mecha_ammo when it becomes empty
var/qdel_on_empty = FALSE
/obj/item/mecha_ammo/update_name()
. = ..()
@@ -20,7 +22,7 @@
desc = rounds ? initial(desc) : "An exosuit ammuniton box that has since been emptied. It can be safely folded for recycling."
/obj/item/mecha_ammo/update_icon_state()
icon_state = rounds ? initial(icon_state) : "empty"
icon_state = rounds ? initial(icon_state) : "[initial(icon_state)]_e"
return ..()
/obj/item/mecha_ammo/attack_self(mob/user)
@@ -418,6 +418,9 @@
gun.projectiles_cache = gun.projectiles_cache + A.rounds
playsound(get_turf(user),A.load_audio,50,TRUE)
to_chat(user, span_notice("You add [A.rounds] [A.ammo_type][A.rounds > 1?"s":""] to the [gun.name]"))
if(A.qdel_on_empty)
qdel(A)
return TRUE
A.rounds = 0
A.set_custom_materials(list(/datum/material/iron=2000))
A.update_appearance()
Binary file not shown.

Before

Width:  |  Height:  |  Size: 874 B

After

Width:  |  Height:  |  Size: 1.1 KiB