Skip to content

Commit

Permalink
Neckties can be worn below suits and accessories (#83131) (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
siliconOpossum authored May 24, 2024
1 parent aa5a0f6 commit e165d63
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 20 deletions.
40 changes: 22 additions & 18 deletions code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -693,39 +693,41 @@ GLOBAL_LIST_INIT(human_heights_to_offsets, list(
/// Total number of layers for mob overlays
/// KEEP THIS UP-TO-DATE OR SHIT WILL BREAK
/// Also consider updating layers_to_offset
#define TOTAL_LAYERS 34
#define TOTAL_LAYERS 35
/// Mutations layer - Tk headglows, cold resistance glow, etc
#define MUTATIONS_LAYER 34
#define MUTATIONS_LAYER 35
/// Mutantrace features (tail when looking south) that must appear behind the body parts
#define BODY_BEHIND_LAYER 33
#define BODY_BEHIND_LAYER 34
/// Layer for bodyparts that should appear behind every other bodypart - Mostly, legs when facing WEST or EAST
#define BODYPARTS_LOW_LAYER 32
#define BODYPARTS_LOW_LAYER 33
/// Layer for most bodyparts, appears above BODYPARTS_LOW_LAYER and below BODYPARTS_HIGH_LAYER
#define BODYPARTS_LAYER 31
#define BODYPARTS_LAYER 32
/// Mutantrace features (snout, body markings) that must appear above the body parts
#define BODY_ADJ_LAYER 30
#define BODY_ADJ_LAYER 31
/// Underwear, undershirts, socks, eyes, lips(makeup)
#define BODY_LAYER 29
#define BODY_LAYER 30
/// Mutations that should appear above body, body_adj and bodyparts layer (e.g. laser eyes)
#define FRONT_MUTATIONS_LAYER 28
#define FRONT_MUTATIONS_LAYER 29
/// Damage indicators (cuts and burns)
#define DAMAGE_LAYER 27
#define DAMAGE_LAYER 28
/// Jumpsuit clothing layer
#define UNIFORM_LAYER 26
#define UNIFORM_LAYER 27
/// ID card layer
#define ID_LAYER 25
#define ID_LAYER 26
/// ID card layer (might be deprecated)
#define ID_CARD_LAYER 24
#define ID_CARD_LAYER 25
/// Layer for bodyparts that should appear above every other bodypart - Currently only used for hands
#define BODYPARTS_HIGH_LAYER 23
#define BODYPARTS_HIGH_LAYER 24
/// Gloves layer
#define GLOVES_LAYER 22
#define GLOVES_LAYER 23
/// Shoes layer
#define SHOES_LAYER 21
#define SHOES_LAYER 22
/// Layer for masks that are worn below ears and eyes (like Balaclavas) (layers below hair, use flagsinv=HIDEHAIR as needed)
#define LOW_FACEMASK_LAYER 20
#define LOW_FACEMASK_LAYER 21
/// Ears layer (Spessmen have ears? Wow)
#define EARS_LAYER 19
#define EARS_LAYER 20
/// Layer for neck apperal that should appear below the suit slot (like neckties)
#define LOW_NECK_LAYER 19
/// Suit layer (armor, coats, etc.)
#define SUIT_LAYER 18
/// Glasses layer
Expand All @@ -734,7 +736,7 @@ GLOBAL_LIST_INIT(human_heights_to_offsets, list(
#define BELT_LAYER 16 //Possible make this an overlay of somethign required to wear a belt?
/// Suit storage layer (tucking a gun or baton underneath your armor)
#define SUIT_STORE_LAYER 15
/// Neck layer (for wearing ties and bedsheets)
/// Neck layer (for wearing capes and bedsheets)
#define NECK_LAYER 14
/// Back layer (for backpacks and equipment on your back)
#define BACK_LAYER 13
Expand Down Expand Up @@ -781,7 +783,9 @@ GLOBAL_LIST_INIT(layers_to_offset, list(
"[BELT_LAYER]" = LOWER_BODY,
// Everything below looks fine with or without a filter, so we can skip it and just offset
// (In practice they'd be fine if they got a filter but we can optimize a bit by not.)
"[NECK_LAYER]" = UPPER_BODY,
"[GLASSES_LAYER]" = UPPER_BODY,
"[LOW_NECK_LAYER]" = UPPER_BODY,
"[ABOVE_BODY_FRONT_GLASSES_LAYER]" = UPPER_BODY, // currently unused
"[ABOVE_BODY_FRONT_HEAD_LAYER]" = UPPER_BODY, // only used for head stuff
"[GLOVES_LAYER]" = LOWER_BODY,
Expand Down
22 changes: 22 additions & 0 deletions code/modules/clothing/neck/_neck.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
icon = 'icons/obj/clothing/neck.dmi'
icon_state = "tie_greyscale_tied"
inhand_icon_state = "" //no inhands
alternate_worn_layer = LOW_NECK_LAYER // So that it renders below suit jackets, MODsuits, etc
w_class = WEIGHT_CLASS_SMALL
custom_price = PAYCHECK_CREW
greyscale_config = /datum/greyscale_config/ties
Expand All @@ -70,6 +71,7 @@

/obj/item/clothing/neck/tie/examine(mob/user)
. = ..()
. += span_notice("The tie can be worn above or below your suit. Alt-Right-click to toggle.")
if(clip_on)
. += span_notice("Looking closely, you can see that it's actually a cleverly disguised clip-on.")
else if(!is_tied)
Expand Down Expand Up @@ -106,6 +108,14 @@
update_appearance(UPDATE_ICON)
user.update_clothing(ITEM_SLOT_NECK)

/obj/item/clothing/neck/tie/alt_click_secondary(mob/user)
. = ..()
if(!user.can_perform_action(src, NEED_DEXTERITY))
return
alternate_worn_layer = alternate_worn_layer == initial(alternate_worn_layer) ? NONE : initial(alternate_worn_layer)
user.update_clothing(ITEM_SLOT_NECK)
balloon_alert(user, "wearing [alternate_worn_layer == initial(alternate_worn_layer) ? "below" : "above"] suits")

/obj/item/clothing/neck/tie/update_icon()
. = ..()
if(clip_on)
Expand All @@ -124,6 +134,7 @@

/obj/item/clothing/neck/tie/add_context(atom/source, list/context, obj/item/held_item, mob/user)
. = ..()
context[SCREENTIP_CONTEXT_ALT_RMB] = "Wear [alternate_worn_layer == initial(alternate_worn_layer) ? "above" : "below"] suit"
if(clip_on)
return
if(is_tied)
Expand All @@ -132,6 +143,17 @@
context[SCREENTIP_CONTEXT_ALT_LMB] = "Tie"
return CONTEXTUAL_SCREENTIP_SET

/obj/item/clothing/neck/tie/worn_overlays(mutable_appearance/standing, isinhands)
. = ..()
var/mob/living/carbon/human/wearer = loc
if(!ishuman(wearer) || !wearer.w_uniform)
return
var/obj/item/clothing/under/undershirt = wearer.w_uniform
if(!istype(undershirt) || !LAZYLEN(undershirt.attached_accessories))
return
if(alternate_worn_layer)
. += undershirt.accessory_overlay

/obj/item/clothing/neck/tie/blue
name = "blue tie"
icon_state = "tie_greyscale_untied"
Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/under/_under.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
//make the sensor mode favor higher levels, except coords.
sensor_mode = pick(SENSOR_VITALS, SENSOR_VITALS, SENSOR_VITALS, SENSOR_LIVING, SENSOR_LIVING, SENSOR_COORDS, SENSOR_COORDS, SENSOR_OFF)
register_context()
AddElement(/datum/element/update_icon_updates_onmob, flags = ITEM_SLOT_ICLOTHING|ITEM_SLOT_OCLOTHING, body = TRUE)
AddElement(/datum/element/update_icon_updates_onmob, flags = ITEM_SLOT_ICLOTHING|ITEM_SLOT_OCLOTHING|ITEM_SLOT_NECK, body = TRUE)

/obj/item/clothing/under/add_context(atom/source, list/context, obj/item/held_item, mob/living/user)
. = NONE
Expand Down
3 changes: 2 additions & 1 deletion code/modules/clothing/under/accessories/_accessories.dm
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,12 @@
SIGNAL_HANDLER

accessory_dropped(source, user)
user.update_clothing(ITEM_SLOT_ICLOTHING|ITEM_SLOT_OCLOTHING)
user.update_clothing(ITEM_SLOT_ICLOTHING|ITEM_SLOT_OCLOTHING|ITEM_SLOT_NECK)

/// Called when the uniform this accessory is pinned to is equipped in a valid slot
/obj/item/clothing/accessory/proc/accessory_equipped(obj/item/clothing/under/clothes, mob/living/user)
equipped(user, user.get_slot_by_item(clothes)) // so we get any actions, item_flags get set, etc
user.update_clothing(ITEM_SLOT_OCLOTHING|ITEM_SLOT_NECK)
return

/// Called when the uniform this accessory is pinned to is dropped
Expand Down

0 comments on commit e165d63

Please sign in to comment.