Makes toy/riot C20R45's show the correct dart types in their magazines (#84095)

![image](https://github.com/tgstation/tgstation/assets/6209658/d8325450-1ca3-40d4-99d8-1dac74b7b1f1)

🆑 ShizCalev
image: Foam darts in the magazine of a toy/riot C20R45 will now show the
correct color corresponding to the type of said dart loaded in it
instead of a generic bullet sprite.
/🆑
This commit is contained in:
Afevis
2024-06-24 17:43:00 -04:00
committed by GitHub
parent 4f7642cdc2
commit 25c6602196
4 changed files with 19 additions and 3 deletions

View File

@@ -10,6 +10,8 @@
harmful = FALSE
var/modified = FALSE
var/static/list/insertable_items_hint = list(/obj/item/pen)
///For colored magazine overlays.
var/tip_color = "blue"
/obj/item/ammo_casing/foam_dart/Initialize(mapload)
. = ..()
@@ -56,4 +58,5 @@
projectile_type = /obj/projectile/bullet/foam_dart/riot
icon_state = "foamdart_riot"
base_icon_state = "foamdart_riot"
tip_color = "red"
custom_materials = list(/datum/material/iron = HALF_SHEET_MATERIAL_AMOUNT* 1.125)

View File

@@ -76,7 +76,7 @@
/obj/item/ammo_box/magazine/smgm45
name = "SMG magazine (.45)"
icon_state = "c20r45-24"
icon_state = "c20r45"
base_icon_state = "c20r45"
ammo_type = /obj/item/ammo_casing/c45
caliber = CALIBER_45

View File

@@ -29,17 +29,30 @@
/obj/item/ammo_box/magazine/toy/smgm45
name = "donksoft SMG magazine"
icon_state = "c20r45-toy"
base_icon_state = "c20r45"
base_icon_state = "c20r45-toy"
caliber = CALIBER_FOAM
ammo_type = /obj/item/ammo_casing/foam_dart
max_ammo = 20
/obj/item/ammo_box/magazine/toy/smgm45/update_icon_state()
. = ..()
icon_state = "[base_icon_state]-[round(ammo_count(), 2)]"
icon_state = "[base_icon_state]-base"
/obj/item/ammo_box/magazine/toy/smgm45/update_overlays()
. = ..()
if(!LAZYLEN(stored_ammo))
return
for(var/i in 1 to stored_ammo.len)
var/round_number = round(i, 2) //i meant the number of the round in the magazine, but i guess it's a round number too lol.
if(round_number == i) //only count odd numbers.
continue
var/obj/item/ammo_casing/foam_dart/boolet = stored_ammo[i]
. += "c20r45-foam-[boolet.tip_color]-[round_number]"
/obj/item/ammo_box/magazine/toy/smgm45/riot
icon_state = "c20r45-riot"
base_icon_state = "c20r45-riot"
ammo_type = /obj/item/ammo_casing/foam_dart/riot
/obj/item/ammo_box/magazine/toy/m762