Wrist Slot (Wear watches with gloves!) (#10951)

This commit is contained in:
Wowzewow (Wezzy)
2021-02-01 11:12:37 +01:00
committed by GitHub
parent a9e6e0db73
commit f88fdd706d
64 changed files with 684 additions and 468 deletions
+3 -7
View File
@@ -84,7 +84,8 @@ var/list/slot_equipment_priority = list( \
slot_s_store,\
slot_tie,\
slot_l_store,\
slot_r_store\
slot_r_store,\
slot_wrists\
)
//Checks if a given slot can be accessed at this time, either to equip or unequip I
@@ -272,7 +273,7 @@ var/list/slot_equipment_priority = list( \
/mob/proc/get_inventory_slot(obj/item/I)
var/slot = 0
for(var/s in slot_back to slot_tie) //kind of worries me
for(var/s in slot_first to slot_last) //kind of worries me
if(get_equipped_item(s) == I)
slot = s
break
@@ -397,11 +398,6 @@ var/list/slot_equipment_priority = list( \
if((istype(src.loc, /turf/space)) || (src.lastarea.has_gravity() == 0))
src.inertia_dir = get_dir(target, src)
step(src, inertia_dir)
/*
if(istype(src.loc, /turf/space) || (src.flags & NOGRAV)) //they're in space, move em one space in the opposite direction
src.inertia_dir = get_dir(target, src)
step(src, inertia_dir)
*/
if(istype(item,/obj/item))
var/obj/item/W = item
W.randpixel_xy()
@@ -27,6 +27,7 @@
var/skipmask = skipitems & HIDEMASK
var/skipeyes = skipitems & HIDEEYES
var/skipears = skipitems & HIDEEARS
var/skipwrists = skipitems & HIDEWRISTS
var/list/msg = list("<span class='info'>*---------*\nThis is ")
@@ -53,7 +54,7 @@
for(var/accessory in U.accessories)
if(istype(accessory, /obj/item/clothing/accessory/holster)) //so you can't see what kind of gun a holster is holding from afar
accessory_descs += "\a [accessory]"
else
else
accessory_descs += "<a href='?src=\ref[src];lookitem_desc_only=\ref[accessory]'>\a [accessory]</a>"
tie_msg += " [lowertext(english_list(accessory_descs))]"
@@ -194,6 +195,10 @@
var/id_name = wear_id
msg += "[get_pronoun("He")] [get_pronoun("is")] wearing [icon2html(wear_id, user)] <a href='?src=\ref[src];lookitem_desc_only=\ref[wear_id]'>\a [id_name]</a>.\n"
//wrists
if(wrists && !skipwrists)
msg += "[get_pronoun("He")] [get_pronoun("is")] wearing [icon2html(wrists, user)] <a href='?src=\ref[src];lookitem_desc_only=\ref[wear_id]'>\a [wrists]</a> on [get_pronoun("his")] [wrists.gender==PLURAL?"wrists":"wrist"].\n"
//Jitters
if(is_jittery)
if(jitteriness >= 300)
@@ -67,6 +67,7 @@
var/obj/item/r_store = null
var/obj/item/l_store = null
var/obj/item/s_store = null
var/obj/item/wrists = null
var/used_skillpoints = 0
var/skill_specialization = null
@@ -82,6 +82,8 @@ This saves us from having to call add_fingerprint() any time something is put in
return 1
if(slot_in_belt)
return 1
if(slot_wrists)
return has_organ(BP_L_ARM) || has_organ(BP_R_ARM)
/mob/living/carbon/human/u_equip(obj/W as obj)
if(!W) return 0
@@ -111,6 +113,9 @@ This saves us from having to call add_fingerprint() any time something is put in
else if (W == gloves)
gloves = null
update_inv_gloves()
else if (W == wrists)
wrists = null
update_inv_wrists()
else if (W == glasses)
glasses = null
update_inv_glasses()
@@ -258,6 +263,10 @@ This saves us from having to call add_fingerprint() any time something is put in
src.gloves = W
W.equipped(src, slot)
update_inv_gloves(redraw_mob)
if(slot_wrists)
src.wrists = W
W.equipped(src, slot)
update_inv_wrists(redraw_mob)
if(slot_head)
src.head = W
if(head.flags_inv & (BLOCKHAIR|BLOCKHEADHAIR|HIDEMASK))
@@ -306,7 +315,7 @@ This saves us from having to call add_fingerprint() any time something is put in
var/obj/item/clothing/under/uniform = src.w_uniform
uniform.attackby(W,src)
else
to_chat(src, "<span class='danger'>You are trying to eqip this item to an unsupported inventory slot. If possible, please write a ticket with steps to reproduce. Slot was: [slot]</span>")
to_chat(src, "<span class='danger'>You are trying to equip this item to an unsupported inventory slot. If possible, please write a ticket with steps to reproduce. Slot was: [slot]</span>")
return
if((W == src.l_hand) && (slot != slot_l_hand))
@@ -335,7 +344,7 @@ This saves us from having to call add_fingerprint() any time something is put in
if(slot_glasses)
covering = src.head
check_flags = EYES
if(slot_gloves, slot_w_uniform)
if(slot_gloves, slot_wrists, slot_w_uniform)
covering = src.wear_suit
if(slot_l_ear, slot_r_ear)
covering = src.head
@@ -367,6 +376,7 @@ This saves us from having to call add_fingerprint() any time something is put in
if(slot_s_store) return s_store
if(slot_l_ear) return l_ear
if(slot_r_ear) return r_ear
if(slot_wrists) return wrists
return ..()
/mob/living/carbon/human/get_equipped_items(var/include_carried = 0)
@@ -384,6 +394,7 @@ This saves us from having to call add_fingerprint() any time something is put in
if(wear_mask) items += wear_mask
if(wear_suit) items += wear_suit
if(w_uniform) items += w_uniform
if(wrists) items += wrists
if(include_carried)
if(l_hand) items += l_hand
@@ -20,21 +20,22 @@
// to be drawn for the mob. This is fairly delicate, try to avoid messing with it
// unless you know exactly what it does.
var/list/gear = list(
"i_clothing" = list("loc" = ui_iclothing, "name" = "Uniform", "slot" = slot_w_uniform, "state" = "center", "toggle" = 1),
"o_clothing" = list("loc" = ui_oclothing, "name" = "Suit", "slot" = slot_wear_suit, "state" = "suit", "toggle" = 1),
"mask" = list("loc" = ui_mask, "name" = "Mask", "slot" = slot_wear_mask, "state" = "mask", "toggle" = 1),
"gloves" = list("loc" = ui_gloves, "name" = "Gloves", "slot" = slot_gloves, "state" = "gloves", "toggle" = 1),
"eyes" = list("loc" = ui_glasses, "name" = "Glasses", "slot" = slot_glasses, "state" = "glasses","toggle" = 1),
"l_ear" = list("loc" = ui_l_ear, "name" = "Left Ear", "slot" = slot_l_ear, "state" = "ears", "toggle" = 1),
"r_ear" = list("loc" = ui_r_ear, "name" = "Right Ear", "slot" = slot_r_ear, "state" = "ears", "toggle" = 1),
"head" = list("loc" = ui_head, "name" = "Hat", "slot" = slot_head, "state" = "hair", "toggle" = 1),
"shoes" = list("loc" = ui_shoes, "name" = "Shoes", "slot" = slot_shoes, "state" = "shoes", "toggle" = 1),
"suit storage" = list("loc" = ui_sstore1, "name" = "Suit Storage", "slot" = slot_s_store, "state" = "suitstore"),
"back" = list("loc" = ui_back, "name" = "Back", "slot" = slot_back, "state" = "back"),
"id" = list("loc" = ui_id, "name" = "ID", "slot" = slot_wear_id, "state" = "id"),
"storage1" = list("loc" = ui_storage1, "name" = "Left Pocket", "slot" = slot_l_store, "state" = "pocket"),
"storage2" = list("loc" = ui_storage2, "name" = "Right Pocket", "slot" = slot_r_store, "state" = "pocket"),
"belt" = list("loc" = ui_belt, "name" = "Belt", "slot" = slot_belt, "state" = "belt")
"i_clothing" = list("loc" = ui_iclothing, "name" = "uniform", "slot" = slot_w_uniform, "state" = "center", "toggle" = 1),
"o_clothing" = list("loc" = ui_oclothing, "name" = "suit", "slot" = slot_wear_suit, "state" = "suit", "toggle" = 1),
"mask" = list("loc" = ui_mask, "name" = "mask", "slot" = slot_wear_mask, "state" = "mask", "toggle" = 1),
"gloves" = list("loc" = ui_gloves, "name" = "gloves", "slot" = slot_gloves, "state" = "gloves", "toggle" = 1),
"eyes" = list("loc" = ui_glasses, "name" = "glasses", "slot" = slot_glasses, "state" = "glasses","toggle" = 1),
"l_ear" = list("loc" = ui_l_ear, "name" = "left ear", "slot" = slot_l_ear, "state" = "l_ear", "toggle" = 1),
"r_ear" = list("loc" = ui_r_ear, "name" = "right ear", "slot" = slot_r_ear, "state" = "r_ear", "toggle" = 1),
"head" = list("loc" = ui_head, "name" = "hat", "slot" = slot_head, "state" = "hair", "toggle" = 1),
"shoes" = list("loc" = ui_shoes, "name" = "shoes", "slot" = slot_shoes, "state" = "shoes", "toggle" = 1),
"wrists" = list("loc" = ui_wrists, "name" = "wrists", "slot" = slot_wrists, "state" = "wrists", "toggle" = 1),
"suit storage" = list("loc" = ui_sstore1, "name" = "suit storage", "slot" = slot_s_store, "state" = "suitstore"),
"back" = list("loc" = ui_back, "name" = "back", "slot" = slot_back, "state" = "back"),
"id" = list("loc" = ui_id, "name" = "id", "slot" = slot_wear_id, "state" = "id"),
"storage1" = list("loc" = ui_storage1, "name" = "left pocket", "slot" = slot_l_store, "state" = "pocket"),
"storage2" = list("loc" = ui_storage2, "name" = "right pocket", "slot" = slot_r_store, "state" = "pocket"),
"belt" = list("loc" = ui_belt, "name" = "belt", "slot" = slot_belt, "state" = "belt")
)
/datum/hud_data/New()
@@ -53,7 +54,6 @@
if(slot_w_uniform in equip_slots)
equip_slots |= slot_tie
if(slot_belt in equip_slots)
equip_slots |= slot_in_belt
@@ -63,25 +63,25 @@
has_hydration = FALSE
has_internals = FALSE
gear = list(
"i_clothing" = list("loc" = ui_iclothing, "name" = "Uniform", "slot" = slot_w_uniform, "state" = "center", "toggle" = 1),
"o_clothing" = list("loc" = ui_shoes, "name" = "Suit", "slot" = slot_wear_suit, "state" = "suit", "toggle" = 1),
"l_ear" = list("loc" = ui_glasses, "name" = "Left Ear", "slot" = slot_l_ear, "state" = "ears", "toggle" = 1),
"r_ear" = list("loc" = ui_l_ear, "name" = "Right Ear", "slot" = slot_r_ear, "state" = "ears", "toggle" = 1),
"head" = list("loc" = ui_mask, "name" = "Hat", "slot" = slot_head, "state" = "hair", "toggle" = 1),
"suit storage" = list("loc" = ui_sstore1, "name" = "Suit Storage", "slot" = slot_s_store, "state" = "suitstore"),
"back" = list("loc" = ui_back, "name" = "Back", "slot" = slot_back, "state" = "back"),
"id" = list("loc" = ui_id, "name" = "ID", "slot" = slot_wear_id, "state" = "id"),
"storage1" = list("loc" = ui_storage1, "name" = "Left Pocket", "slot" = slot_l_store, "state" = "pocket"),
"storage2" = list("loc" = ui_storage2, "name" = "Right Pocket", "slot" = slot_r_store, "state" = "pocket"),
"belt" = list("loc" = ui_belt, "name" = "Belt", "slot" = slot_belt, "state" = "belt"),
"mask" = list("loc" = ui_oclothing, "name" = "Mask", "slot" = slot_wear_mask, "state" = "mask", "toggle" = 1),
"eyes" = list("loc" = ui_gloves, "name" = "Glasses", "slot" = slot_glasses, "state" = "glasses","toggle" = 1)
"i_clothing" = list("loc" = ui_iclothing, "name" = "uniform", "slot" = slot_w_uniform, "state" = "center", "toggle" = 1),
"o_clothing" = list("loc" = ui_shoes, "name" = "suit", "slot" = slot_wear_suit, "state" = "suit", "toggle" = 1),
"l_ear" = list("loc" = ui_glasses, "name" = "left ear", "slot" = slot_l_ear, "state" = "l_ear", "toggle" = 1),
"r_ear" = list("loc" = ui_l_ear, "name" = "right ear", "slot" = slot_r_ear, "state" = "r_ear", "toggle" = 1),
"head" = list("loc" = ui_mask, "name" = "hat", "slot" = slot_head, "state" = "hair", "toggle" = 1),
"suit storage" = list("loc" = ui_sstore1, "name" = "suit storage", "slot" = slot_s_store, "state" = "suitstore"),
"back" = list("loc" = ui_back, "name" = "back", "slot" = slot_back, "state" = "back"),
"id" = list("loc" = ui_id, "name" = "id", "slot" = slot_wear_id, "state" = "id"),
"storage1" = list("loc" = ui_storage1, "name" = "left Pocket", "slot" = slot_l_store, "state" = "pocket"),
"storage2" = list("loc" = ui_storage2, "name" = "right Pocket", "slot" = slot_r_store, "state" = "pocket"),
"belt" = list("loc" = ui_belt, "name" = "belt", "slot" = slot_belt, "state" = "belt"),
"mask" = list("loc" = ui_oclothing, "name" = "mask", "slot" = slot_wear_mask, "state" = "mask", "toggle" = 1),
"eyes" = list("loc" = ui_gloves, "name" = "glasses", "slot" = slot_glasses, "state" = "glasses","toggle" = 1)
)
/datum/hud_data/monkey
gear = list(
"mask" = list("loc" = ui_shoes, "name" = "Mask", "slot" = slot_wear_mask, "state" = "mask", "toggle" = 1),
"back" = list("loc" = ui_sstore1, "name" = "Back", "slot" = slot_back, "state" = "back")
"mask" = list("loc" = ui_shoes, "name" = "mask", "slot" = slot_wear_mask, "state" = "mask", "toggle" = 1),
"back" = list("loc" = ui_sstore1, "name" = "back", "slot" = slot_back, "state" = "back")
)
@@ -92,4 +92,4 @@
/datum/hud_data/construct
has_hydration = FALSE
has_nutrition = FALSE
has_nutrition = FALSE
@@ -113,8 +113,9 @@ There are several things that need to be remembered:
#define LEGCUFF_LAYER 26
#define L_HAND_LAYER 27
#define R_HAND_LAYER 28
#define FIRE_LAYER 29 //If you're on fire
#define TOTAL_LAYERS 29
#define WRISTS_LAYER 29
#define FIRE_LAYER 30 //If you're on fire
#define TOTAL_LAYERS 30
//////////////////////////////////
#define UNDERSCORE_OR_NULL(target) "[target ? "[target]_" : ""]"
@@ -517,6 +518,7 @@ There are several things that need to be remembered:
update_fire(FALSE)
update_surgery(FALSE)
update_underwear(FALSE)
update_inv_wrists(FALSE)
UpdateDamageIcon()
update_icon()
//Hud Stuff
@@ -1253,6 +1255,58 @@ There are several things that need to be remembered:
if(update_icons)
update_icon()
/mob/living/carbon/human/update_inv_l_hand(var/update_icons=1)
if (QDELING(src))
return
overlays_raw[L_HAND_LAYER] = null
if(l_hand)
l_hand.screen_loc = ui_lhand //TODO
//determine icon state to use
var/t_state = l_hand.item_state || l_hand.icon_state
var/image/result_layer
if(l_hand.contained_sprite)
l_hand.auto_adapt_species(src)
t_state = "[UNDERSCORE_OR_NULL(l_hand.icon_species_tag)][l_hand.item_state][WORN_LHAND]"
result_layer = image(l_hand.icon_override || l_hand.icon, t_state)
if(l_hand.color)
result_layer.color = l_hand.color
result_layer.appearance_flags = RESET_ALPHA
overlays_raw[L_HAND_LAYER] = result_layer
else
if(l_hand.item_state_slots && l_hand.item_state_slots[slot_l_hand_str])
t_state = l_hand.item_state_slots[slot_l_hand_str]
//determine icon to use
var/icon/t_icon
if(l_hand.item_icons && (slot_l_hand_str in l_hand.item_icons))
t_icon = l_hand.item_icons[slot_l_hand_str]
else if(l_hand.icon_override)
t_state += WORN_LHAND
t_icon = l_hand.icon_override
else
t_icon = INV_L_HAND_DEF_ICON
result_layer = image(t_icon, t_state)
if(l_hand.color)
result_layer.color = l_hand.color
var/image/worn_overlays = l_hand.worn_overlays(t_icon)
if(worn_overlays)
result_layer.overlays.Add(worn_overlays)
result_layer.appearance_flags = RESET_ALPHA
overlays_raw[L_HAND_LAYER] = result_layer
if(update_icons)
update_icon()
/mob/living/carbon/human/update_inv_r_hand(var/update_icons=1)
if (QDELING(src))
return
@@ -1305,54 +1359,54 @@ There are several things that need to be remembered:
if(update_icons)
update_icon()
/mob/living/carbon/human/update_inv_l_hand(var/update_icons=1)
/mob/living/carbon/human/update_inv_wrists(var/update_icons=1)
if (QDELING(src))
return
overlays_raw[L_HAND_LAYER] = null
if(l_hand)
l_hand.screen_loc = ui_lhand //TODO
overlays_raw[WRISTS_LAYER] = null
if(check_draw_wrists())
wrists.screen_loc = ui_lhand //TODO
//determine icon state to use
var/t_state = l_hand.item_state || l_hand.icon_state
var/t_state = wrists.item_state || wrists.icon_state
var/image/result_layer
if(l_hand.contained_sprite)
l_hand.auto_adapt_species(src)
t_state = "[UNDERSCORE_OR_NULL(l_hand.icon_species_tag)][l_hand.item_state][WORN_LHAND]"
if(wrists.contained_sprite)
wrists.auto_adapt_species(src)
t_state = "[UNDERSCORE_OR_NULL(wrists.icon_species_tag)][wrists.item_state][WORN_WRISTS]"
result_layer = image(l_hand.icon_override || l_hand.icon, t_state)
result_layer = image(wrists.icon_override || wrists.icon, t_state)
if(l_hand.color)
result_layer.color = l_hand.color
if(wrists.color)
result_layer.color = wrists.color
result_layer.appearance_flags = RESET_ALPHA
overlays_raw[L_HAND_LAYER] = result_layer
overlays_raw[WRISTS_LAYER] = result_layer
else
if(l_hand.item_state_slots && l_hand.item_state_slots[slot_l_hand_str])
t_state = l_hand.item_state_slots[slot_l_hand_str]
if(wrists.item_state_slots && wrists.item_state_slots[slot_wrists_str])
t_state = wrists.item_state_slots[slot_wrists_str]
//determine icon to use
var/icon/t_icon
if(l_hand.item_icons && (slot_l_hand_str in l_hand.item_icons))
t_icon = l_hand.item_icons[slot_l_hand_str]
else if(l_hand.icon_override)
t_state += WORN_LHAND
t_icon = l_hand.icon_override
if(wrists.item_icons && (slot_wrists_str in wrists.item_icons))
t_icon = wrists.item_icons[slot_wrists_str]
else if(wrists.icon_override)
t_state += WORN_WRISTS
t_icon = wrists.icon_override
else
t_icon = INV_L_HAND_DEF_ICON
t_icon = INV_WRISTS_DEF_ICON
result_layer = image(t_icon, t_state)
if(l_hand.color)
result_layer.color = l_hand.color
if(wrists.color)
result_layer.color = wrists.color
var/image/worn_overlays = l_hand.worn_overlays(t_icon)
var/image/worn_overlays = wrists.worn_overlays(t_icon)
if(worn_overlays)
result_layer.overlays.Add(worn_overlays)
result_layer.appearance_flags = RESET_ALPHA
overlays_raw[L_HAND_LAYER] = result_layer
overlays_raw[WRISTS_LAYER] = result_layer
if(update_icons)
update_icon()
@@ -1519,65 +1573,74 @@ There are several things that need to be remembered:
//These functions check if an item should be drawn, or if its covered up by something else
/mob/living/carbon/human/proc/check_draw_gloves()
if (!gloves)
return 0
return FALSE
else if (gloves.flags_inv & ALWAYSDRAW)
return 1
return TRUE
else if (wear_suit && (wear_suit.flags_inv & HIDEGLOVES))
return 0
return FALSE
else
return 1
return TRUE
/mob/living/carbon/human/proc/check_draw_ears()
if (!l_ear && !r_ear)
return 0
return FALSE
else if ((l_ear && (l_ear.flags_inv & ALWAYSDRAW)) || (r_ear && (r_ear.flags_inv & ALWAYSDRAW)))
return 1
return TRUE
else if( (head && (head.flags_inv & (HIDEEARS))) || (wear_mask && (wear_mask.flags_inv & (HIDEEARS))))
return 0
return FALSE
else
return 1
return TRUE
/mob/living/carbon/human/proc/check_draw_glasses()
if (!glasses)
return 0
return FALSE
else if (glasses.flags_inv & ALWAYSDRAW)
return 1
return TRUE
else if( (head && (head.flags_inv & (HIDEEYES))) || (wear_mask && (wear_mask.flags_inv & (HIDEEYES))))
return 0
return FALSE
else
return 1
return TRUE
/mob/living/carbon/human/proc/check_draw_mask()
if (!wear_mask)
return 0
return FALSE
else if (wear_mask.flags_inv & ALWAYSDRAW)
return 1
return TRUE
else if( head && (head.flags_inv & HIDEEYES))
return 0
return FALSE
else
return 1
return TRUE
/mob/living/carbon/human/proc/check_draw_shoes()
if (!shoes)
return 0
return FALSE
else if (shoes.flags_inv & ALWAYSDRAW)
return 1
return TRUE
else if(wear_suit && (wear_suit.flags_inv & HIDESHOES))
return 0
return FALSE
else
return 1
return TRUE
/mob/living/carbon/human/proc/check_draw_underclothing()
if (!w_uniform)
return 0
return FALSE
else if (w_uniform.flags_inv & ALWAYSDRAW)
return 1
return TRUE
else if(wear_suit && (wear_suit.flags_inv & HIDEJUMPSUIT))
return 0
return FALSE
else
return 1
return TRUE
/mob/living/carbon/human/proc/check_draw_wrists()
if (!wrists)
return FALSE
else if (wrists.flags_inv & ALWAYSDRAW)
return TRUE
else if (wrists && (wrists.flags_inv & HIDEWRISTS))
return FALSE
else
return TRUE
//Human Overlays Indexes/////////
#undef MUTATIONS_LAYER
@@ -1605,6 +1668,7 @@ There are several things that need to be remembered:
#undef LEGCUFF_LAYER
#undef L_HAND_LAYER
#undef R_HAND_LAYER
#undef WRISTS_LAYER
#undef FIRE_LAYER
#undef TOTAL_LAYERS
+3 -2
View File
@@ -754,6 +754,8 @@ proc/is_blind(A)
return slot_l_ear
else if (H.shoes == src)
return slot_shoes
else if (H.wrists == src)
return slot_wrists
else
return null//We failed to find the slot
@@ -1187,6 +1189,5 @@ proc/is_blind(A)
/mob/proc/remove_deaf()
sdisabilities &= ~DEAF
/mob/proc/get_antag_datum(var/antag_role)
return
return
+3
View File
@@ -64,5 +64,8 @@
/mob/proc/update_inv_r_ear()
return
/mob/proc/update_inv_wrists()
return
/mob/proc/update_targeted()
return