Skip to content

Commit

Permalink
Skip null icon_states for autowiki guns
Browse files Browse the repository at this point in the history
  • Loading branch information
Drulikar committed Feb 16, 2024
1 parent 60b77a2 commit a552fd5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions code/modules/autowiki/pages/guns.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@

var/list/gun_to_ammo = list()

for(var/obj/item/ammo_magazine/typepath as anything in subtypesof(/obj/item/ammo_magazine) - subtypesof(/obj/item/ammo_magazine/internal))
for(var/obj/item/ammo_magazine/typepath as anything in subtypesof(/obj/item/ammo_magazine) - typesof(/obj/item/ammo_magazine/internal))
if(isnull(initial(typepath.icon_state)))
continue // Skip mags with no icon_state (e.g. base types)
LAZYADD(gun_to_ammo[initial(typepath.gun_type)], typepath)

for(var/typepath in sort_list(subtypesof(/obj/item/weapon/gun), GLOBAL_PROC_REF(cmp_typepaths_asc)))
var/obj/item/weapon/gun/generating_gun = new typepath()
var/obj/item/weapon/gun/generating_gun = typepath
if(isnull(initial(generating_gun.icon_state)))
continue // Skip guns with no icon_state (e.g. base types)

generating_gun = new typepath()
var/filename = SANITIZE_FILENAME(escape_value(format_text(generating_gun.name)))

var/list/gun_data = generating_gun.ui_data()

var/list/valid_mag_types = list()
Expand Down Expand Up @@ -70,6 +74,8 @@

var/list/attachments_by_slot = list()
for(var/obj/item/attachable/attachment_typepath as anything in generating_gun.attachable_allowed)
if(isnull(initial(attachment_typepath.icon_state)))
continue // Skip attachments with no icon_state (e.g. base types)
LAZYADD(attachments_by_slot[capitalize(initial(attachment_typepath.slot))], attachment_typepath)

var/attachments = ""
Expand Down

0 comments on commit a552fd5

Please sign in to comment.