Skip to content

Commit

Permalink
Standardizes greyscale belt overlays (tgstation#59362)
Browse files Browse the repository at this point in the history
  • Loading branch information
ninjanomnom authored May 30, 2021
1 parent 5092171 commit 9e0ddfb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
14 changes: 11 additions & 3 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 !!!!!!!!!!!!!!
Expand Down Expand Up @@ -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))
Expand Down
11 changes: 2 additions & 9 deletions code/game/objects/items/tools/screwdriver.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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("<span class='suicide'>[user] is stabbing [src] into [user.p_their()] [pick("temple", "heart")]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
Expand All @@ -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."
Expand Down
5 changes: 5 additions & 0 deletions code/modules/unit_tests/greyscale_config.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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]'")

0 comments on commit 9e0ddfb

Please sign in to comment.