diff --git a/code/modules/asset_cache/asset_list_items.dm b/code/modules/asset_cache/asset_list_items.dm index e35974bc6276..0b27cf268a12 100644 --- a/code/modules/asset_cache/asset_list_items.dm +++ b/code/modules/asset_cache/asset_list_items.dm @@ -378,9 +378,16 @@ InsertAll("", icon_file) for(var/obj/item/weapon/gun/current_gun as anything in subtypesof(/obj/item/weapon/gun)) - var/icon_state = initial(current_gun.base_gun_icon) + if(isnull(initial(current_gun.icon_state))) + continue + if(initial(current_gun.flags_gun_features) & GUN_UNUSUAL_DESIGN) + continue // These don't have a way to inspect weapon stats + var/obj/item/weapon/gun/temp_gun = new current_gun + var/icon_state = temp_gun.base_gun_icon // base_gun_icon is set in Initialize generally + qdel(temp_gun) if(icon_state && isnull(sprites[icon_state])) - stack_trace("[current_gun] does not have a valid lineart icon state, icon=[icon_file], icon_state=[json_encode(icon_state)](\ref[icon_state])") + // upgrade this to a stack_trace once all guns have a lineart and we want to lint against that + log_debug("[current_gun] does not have a valid lineart icon state, icon=[icon_file], icon_state=[json_encode(icon_state)]") ..() diff --git a/code/modules/autowiki/pages/guns.dm b/code/modules/autowiki/pages/guns.dm index ad675c51a409..7f63602d56f0 100644 --- a/code/modules/autowiki/pages/guns.dm +++ b/code/modules/autowiki/pages/guns.dm @@ -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() @@ -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 = "" diff --git a/code/modules/projectiles/guns/pistols.dm b/code/modules/projectiles/guns/pistols.dm index c17ca5bca739..5794e861a63c 100644 --- a/code/modules/projectiles/guns/pistols.dm +++ b/code/modules/projectiles/guns/pistols.dm @@ -236,7 +236,6 @@ icon = 'icons/obj/items/weapons/guns/guns_by_faction/colony.dmi' icon_state = "c_deagle" item_state = "c_deagle" - base_gun_icon = "c_deagle" current_mag = /obj/item/ammo_magazine/pistol/heavy/super/highimpact black_market_value = 100 @@ -257,7 +256,6 @@ desc = "A Desert Eagle anodized in gold and adorned with rosewood grips. The living definition of ostentatious, it's flashy, unwieldy, tremendously heavy, and kicks like a mule. But as a symbol of power, there's nothing like it." icon_state = "g_deagle" item_state = "g_deagle" - base_gun_icon = "g_deagle" //------------------------------------------------------- //NP92 pistol @@ -588,7 +586,7 @@ name = "\improper 88 Mod 4 combat pistol" desc = "Standard issue USCM firearm. Also found in the hands of Weyland-Yutani PMC teams. Fires 9mm armor shredding rounds and is capable of 3-round burst." icon = 'icons/obj/items/weapons/guns/guns_by_faction/uscm.dmi' - icon_state = "88m4" + icon_state = "_88m4" // to comply with css standards item_state = "88m4" fire_sound = "88m4" firesound_volume = 20 diff --git a/code/modules/unit_tests/spritesheets.dm b/code/modules/unit_tests/spritesheets.dm index c7c16c6535e8..142d3f958821 100644 --- a/code/modules/unit_tests/spritesheets.dm +++ b/code/modules/unit_tests/spritesheets.dm @@ -2,6 +2,7 @@ /datum/unit_test/spritesheets /datum/unit_test/spritesheets/Run() + var/regex/valid_css_class = new(@"^([\l_][\w\-]|[\l_\-][\l_])") for(var/datum/asset/spritesheet/sheet as anything in subtypesof(/datum/asset/spritesheet)) if(!initial(sheet.name)) //Ignore abstract types continue @@ -9,3 +10,6 @@ for(var/sprite_name in sheet.sprites) if(!sprite_name) TEST_FAIL("Spritesheet [sheet.type] has a nameless icon state.") + if(!valid_css_class.Find(sprite_name)) + // https://www.w3.org/TR/CSS2/syndata.html#value-def-identifier + TEST_FAIL("Spritesheet [sheet.type] has a icon state that doesn't comply with css standards: '[sprite_name]'.") diff --git a/icons/obj/items/weapons/guns/guns_by_faction/uscm.dmi b/icons/obj/items/weapons/guns/guns_by_faction/uscm.dmi index 4ecb121a7feb..1f0b98967a25 100644 Binary files a/icons/obj/items/weapons/guns/guns_by_faction/uscm.dmi and b/icons/obj/items/weapons/guns/guns_by_faction/uscm.dmi differ diff --git a/icons/obj/items/weapons/guns/lineart.dmi b/icons/obj/items/weapons/guns/lineart.dmi index 212b3988fc02..6c1dae5bd5c1 100644 Binary files a/icons/obj/items/weapons/guns/lineart.dmi and b/icons/obj/items/weapons/guns/lineart.dmi differ