diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 401601949fe..f569fe910e2 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -24,8 +24,10 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/e ///Icon file for mob worn overlays. var/icon/worn_icon - ///icon state for mob worn overlays, if null the normal icon_state will be used. + ///Icon state for mob worn overlays, if null the normal icon_state will be used. var/worn_icon_state + ///Icon state for the belt overlay, if null the normal icon_state will be used. + var/belt_icon_state ///Forced mob worn layer instead of the standard preferred ssize. var/alternate_worn_layer ///The config type to use for greyscaled worn sprites. Both this and greyscale_colors must be assigned to work. @@ -34,6 +36,8 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/e var/greyscale_config_inhand_left ///The config type to use for greyscaled right inhand sprites. Both this and greyscale_colors must be assigned to work. var/greyscale_config_inhand_right + ///The config type to use for greyscaled belt overlays. Both this and greyscale_colors must be assigned to work. + var/greyscale_config_belt /* !!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!! @@ -713,8 +717,12 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/e return SEND_SIGNAL(loc, COMSIG_TRY_STORAGE_TAKE, src, newLoc, TRUE) return FALSE -/obj/item/proc/get_belt_overlay() //Returns the icon used for overlaying the object on a belt - return mutable_appearance('icons/obj/clothing/belt_overlays.dmi', icon_state) +/// Returns the icon used for overlaying the object on a belt +/obj/item/proc/get_belt_overlay() + var/icon_state_to_use = belt_icon_state || icon_state + if(greyscale_config_belt && greyscale_colors) + return mutable_appearance(SSgreyscale.GetColoredIconByType(greyscale_config_belt, greyscale_colors), icon_state_to_use) + return mutable_appearance('icons/obj/clothing/belt_overlays.dmi', icon_state_to_use) /obj/item/proc/update_slot_icon() if(!ismob(loc)) diff --git a/code/game/objects/items/tools/screwdriver.dm b/code/game/objects/items/tools/screwdriver.dm index 4c20a46e7fe..721befbd6f4 100644 --- a/code/game/objects/items/tools/screwdriver.dm +++ b/code/game/objects/items/tools/screwdriver.dm @@ -5,6 +5,7 @@ icon_state = "screwdriver_map" inhand_icon_state = "screwdriver" worn_icon_state = "screwdriver" + belt_icon_state = "screwdriver" lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi' flags_1 = CONDUCT_1 @@ -28,6 +29,7 @@ greyscale_config = /datum/greyscale_config/screwdriver greyscale_config_inhand_left = /datum/greyscale_config/screwdriver_inhand_left greyscale_config_inhand_right = /datum/greyscale_config/screwdriver_inhand_right + greyscale_config_belt = /datum/greyscale_config/screwdriver_belt /// If the item should be assigned a random color var/random_color = TRUE /// List of possible random colors @@ -40,8 +42,6 @@ "cyan" = "#18a2d5", "yellow" = "#ffa500" ) - /// Colored belt appearance for adding it as a belt overlay - var/mutable_appearance/colored_belt_appearance /obj/item/screwdriver/suicide_act(mob/user) user.visible_message("[user] is stabbing [src] into [user.p_their()] [pick("temple", "heart")]! It looks like [user.p_theyre()] trying to commit suicide!") @@ -51,16 +51,9 @@ if(random_color) var/our_color = pick(screwdriver_colors) set_greyscale(colors=list(screwdriver_colors[our_color])) - colored_belt_appearance = mutable_appearance(SSgreyscale.GetColoredIconByType(/datum/greyscale_config/screwdriver_belt, greyscale_colors)) . = ..() AddElement(/datum/element/eyestab) -/obj/item/screwdriver/get_belt_overlay() - if(random_color) - return colored_belt_appearance - else - return mutable_appearance('icons/obj/clothing/belt_overlays.dmi', icon_state) - /obj/item/screwdriver/abductor name = "alien screwdriver" desc = "An ultrasonic screwdriver." diff --git a/code/modules/unit_tests/greyscale_config.dm b/code/modules/unit_tests/greyscale_config.dm index d35b53fcda4..ff7272c3fa7 100644 --- a/code/modules/unit_tests/greyscale_config.dm +++ b/code/modules/unit_tests/greyscale_config.dm @@ -17,3 +17,8 @@ var/worn_icon_state = initial(item_path.worn_icon_state) || initial(item_path.icon_state) if(worn && !worn.icon_states[worn_icon_state]) Fail("[worn.DebugName()] is missing a sprite for the worn overlay for [item_path]. Expected icon state: '[worn_icon_state]'") + + var/datum/greyscale_config/belt = SSgreyscale.configurations["[initial(item_path.greyscale_config_belt)]"] + var/belt_icon_state = initial(item_path.belt_icon_state) || initial(item_path.icon_state) + if(belt && !belt.icon_states[belt_icon_state]) + Fail("[belt.DebugName()] is missing a sprite for the belt overlay for [item_path]. Expected icon state: '[belt_icon_state]'")