diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index f19d68e35c5..f56c21038e1 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -64,6 +64,7 @@ icon_state = "brutepack" origin_tech = list(TECH_BIO = 1) heal_brute = 4 + icon_has_variants = TRUE /obj/item/stack/medical/bruise_pack/attack(mob/living/carbon/M as mob, mob/user as mob) if(..()) @@ -126,6 +127,7 @@ icon_state = "ointment" heal_burn = 4 origin_tech = list(TECH_BIO = 1) + icon_has_variants = TRUE /obj/item/stack/medical/ointment/attack(mob/living/carbon/M as mob, mob/user as mob) if(..()) diff --git a/code/game/objects/items/stacks/sheets/glass.dm b/code/game/objects/items/stacks/sheets/glass.dm index 8d82ffc8d1e..d2f47ecd31a 100644 --- a/code/game/objects/items/stacks/sheets/glass.dm +++ b/code/game/objects/items/stacks/sheets/glass.dm @@ -18,6 +18,7 @@ var/is_reinforced = 0 var/list/construction_options = list("One Direction", "Full Window") default_type = "glass" + icon_has_variants = TRUE /obj/item/stack/material/glass/attack_self(mob/user as mob) construct_window(user) @@ -144,6 +145,7 @@ icon_state = "sheet-phoronglass" created_window = /obj/structure/window/phoronbasic default_type = "phoron glass" + icon_has_variants = FALSE /obj/item/stack/material/glass/phoronglass/attackby(obj/item/W, mob/user) ..() @@ -172,3 +174,4 @@ default_type = "reinforced phoron glass" created_window = /obj/structure/window/phoronreinforced is_reinforced = 1 + icon_has_variants = FALSE diff --git a/code/game/objects/items/stacks/sheets/leather.dm b/code/game/objects/items/stacks/sheets/leather.dm index 79dd5f20fd2..3e4cfb62efa 100644 --- a/code/game/objects/items/stacks/sheets/leather.dm +++ b/code/game/objects/items/stacks/sheets/leather.dm @@ -4,6 +4,7 @@ singular_name = "hide piece" icon_state = "sheet-hide" default_type = "hide" + icon_has_variants = TRUE /obj/item/stack/material/animalhide/human name = "human skin" @@ -17,6 +18,7 @@ singular_name = "corgi hide piece" icon_state = "sheet-corgi" default_type = "corgi hide" + icon_has_variants = FALSE /obj/item/stack/material/animalhide/cat name = "cat hide" @@ -24,6 +26,7 @@ icon_state = "sheet-cat" singular_name = "cat hide piece" default_type = "cat hide" + icon_has_variants = FALSE /obj/item/stack/material/animalhide/monkey name = "monkey hide" @@ -31,6 +34,7 @@ singular_name = "monkey hide piece" icon_state = "sheet-monkey" default_type = "monkey hide" + icon_has_variants = FALSE /obj/item/stack/material/animalhide/lizard name = "lizard skin" @@ -38,6 +42,7 @@ singular_name = "lizard skin piece" icon_state = "sheet-lizard" default_type = "lizard hide" + icon_has_variants = FALSE /obj/item/stack/material/animalhide/xeno name = "alien hide" @@ -45,6 +50,7 @@ singular_name = "alien hide piece" icon_state = "sheet-xeno" default_type = "alien hide" + icon_has_variants = FALSE //don't see anywhere else to put these, maybe together they could be used to make the xenos suit? /obj/item/stack/material/xenochitin @@ -79,6 +85,7 @@ icon_state = "sheet-wetleather" var/wetness = 30 //Reduced when exposed to high temperautres var/drying_threshold_temperature = 500 //Kelvin to start drying + icon_has_variants = TRUE //Step one - dehairing. /obj/item/stack/material/animalhide/attackby(obj/item/weapon/W as obj, mob/user as mob) diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index ff38d4385fb..97f2f7ea7bf 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -21,14 +21,19 @@ var/uses_charge = 0 var/list/charge_costs = null var/list/datum/matter_synth/synths = null + var/icon_has_variants = FALSE -/obj/item/stack/New(var/loc, var/amount=null) - ..() +/obj/item/stack/Initialize(mapload, amount) + . = ..() if (!stacktype) stacktype = type if (amount) src.amount = amount - return + + if (icon_has_variants && !item_state) + item_state = icon_state + + update_icon() /obj/item/stack/Destroy() if(uses_charge) @@ -37,6 +42,17 @@ usr << browse(null, "window=stack") return ..() +/obj/item/stack/update_icon() + if (!icon_has_variants) + return ..() + + if (amount <= (max_amount * (1/3))) + icon_state = initial(icon_state) + else if (amount <= (max_amount * (2/3))) + icon_state = "[initial(icon_state)]_2" + else + icon_state = "[initial(icon_state)]_3" + /obj/item/stack/examine(mob/user) if(..(user, 1)) if(!uses_charge) diff --git a/code/modules/materials/material_sheets.dm b/code/modules/materials/material_sheets.dm index a4379cf871c..b095ed9dbb6 100644 --- a/code/modules/materials/material_sheets.dm +++ b/code/modules/materials/material_sheets.dm @@ -12,8 +12,8 @@ var/perunit var/apply_colour //temp pending icon rewrite -/obj/item/stack/material/New() - ..() +/obj/item/stack/material/Initialize() + . = ..() pixel_x = rand(0,4)-4 pixel_y = rand(0,4)-4 @@ -22,7 +22,7 @@ material = get_material_by_name("[default_type]") if(!material) qdel(src) - return 0 + return recipes = material.get_recipes() stacktype = material.stack_type @@ -38,7 +38,6 @@ matter = material.get_matter() update_strings() - return 1 /obj/item/stack/material/get_material() return material @@ -118,6 +117,7 @@ name = "plastic" icon_state = "sheet-plastic" default_type = "plastic" + icon_has_variants = TRUE /obj/item/stack/material/gold name = "gold" @@ -158,12 +158,14 @@ name = DEFAULT_WALL_MATERIAL icon_state = "sheet-metal" default_type = DEFAULT_WALL_MATERIAL + icon_has_variants = TRUE /obj/item/stack/material/plasteel name = "plasteel" icon_state = "sheet-plasteel" item_state = "sheet-metal" default_type = "plasteel" + icon_has_variants = TRUE /obj/item/stack/material/wood name = "wooden plank" @@ -174,6 +176,7 @@ name = "cloth" icon_state = "sheet-cloth" default_type = "cloth" + icon_has_variants = TRUE /obj/item/stack/material/cardboard name = "cardboard" @@ -185,11 +188,13 @@ desc = "The by-product of mob grinding." icon_state = "sheet-leather" default_type = "leather" + icon_has_variants = TRUE /obj/item/stack/material/glass name = "glass" icon_state = "sheet-glass" default_type = "glass" + icon_has_variants = TRUE /obj/item/stack/material/glass/reinforced name = "reinforced glass" @@ -202,10 +207,12 @@ singular_name = "borosilicate glass sheet" icon_state = "sheet-phoronglass" default_type = "borosilicate glass" + icon_has_variants = FALSE /obj/item/stack/material/glass/phoronrglass name = "reinforced borosilicate glass" desc = "This sheet is special platinum-glass alloy designed to withstand large temperatures. It is reinforced with few rods." singular_name = "reinforced borosilicate glass sheet" icon_state = "sheet-phoronrglass" - default_type = "reinforced borosilicate glass" + default_type = "reinforced borosilicate glass" + icon_has_variants = FALSE diff --git a/html/changelogs/lohikar-stack-icons.yml b/html/changelogs/lohikar-stack-icons.yml new file mode 100644 index 00000000000..9dffeef6112 --- /dev/null +++ b/html/changelogs/lohikar-stack-icons.yml @@ -0,0 +1,4 @@ +author: Lohikar +delete-after: True +changes: + - imageadd: "Some stacks' icons will now reflect how full said stack is." diff --git a/icons/obj/items.dmi b/icons/obj/items.dmi index 926fcc29e0f..e79ae67ae70 100644 Binary files a/icons/obj/items.dmi and b/icons/obj/items.dmi differ