Fixes item obscuring issues

This commit is contained in:
ShizCalev
2018-11-15 18:57:48 -05:00
parent 9eb695006e
commit c1e3deeb34
6 changed files with 85 additions and 88 deletions
+1
View File
@@ -87,6 +87,7 @@
//Bit flags for the flags_inv variable, which determine when a piece of clothing hides another. IE a helmet hiding glasses.
//Make sure to update check_obscured_slots() if you add more.
#define HIDEGLOVES (1<<0)
#define HIDESUITSTORAGE (1<<1)
#define HIDEJUMPSUIT (1<<2) //these first four are only used in exterior suits
+32 -36
View File
@@ -349,56 +349,52 @@
check_heat(M)
for(var/obj/item/I in M.held_items)
wash_obj(I)
if(M.back)
if(wash_obj(M.back))
M.update_inv_back(0)
if(M.back && wash_obj(M.back))
M.update_inv_back(0)
var/list/obscured = M.check_obscured_slots()
if(M.head && wash_obj(M.head))
M.update_inv_head()
if(M.glasses && !(SLOT_GLASSES in obscured) && wash_obj(M.glasses))
M.update_inv_glasses()
if(M.wear_mask && !(SLOT_WEAR_MASK in obscured) && wash_obj(M.wear_mask))
M.update_inv_wear_mask()
if(M.ears && !(HIDEEARS in obscured) && wash_obj(M.ears))
M.update_inv_ears()
if(M.wear_neck && !(SLOT_NECK in obscured) && wash_obj(M.wear_neck))
M.update_inv_neck()
if(M.shoes && !(HIDESHOES in obscured) && wash_obj(M.shoes))
M.update_inv_shoes()
var/washgloves = FALSE
if(M.gloves && !(HIDEGLOVES in obscured))
washgloves = TRUE
if(ishuman(M))
var/mob/living/carbon/human/H = M
var/washgloves = TRUE
var/washshoes = TRUE
var/washmask = TRUE
var/washears = TRUE
var/washglasses = TRUE
if(H.wear_suit)
washgloves = !(H.wear_suit.flags_inv & HIDEGLOVES)
washshoes = !(H.wear_suit.flags_inv & HIDESHOES)
if(H.head)
washmask = !(H.head.flags_inv & HIDEMASK)
washglasses = !(H.head.flags_inv & HIDEEYES)
washears = !(H.head.flags_inv & HIDEEARS)
if(H.wear_mask)
if (washears)
washears = !(H.wear_mask.flags_inv & HIDEEARS)
if (washglasses)
washglasses = !(H.wear_mask.flags_inv & HIDEEYES)
if(H.head && wash_obj(H.head))
H.update_inv_head()
if(H.wear_suit && wash_obj(H.wear_suit))
H.update_inv_wear_suit()
else if(H.w_uniform && wash_obj(H.w_uniform))
H.update_inv_w_uniform()
if(washgloves)
SEND_SIGNAL(H, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD)
if(H.shoes && washshoes && wash_obj(H.shoes))
H.update_inv_shoes()
if(H.wear_mask && washmask && wash_obj(H.wear_mask))
H.update_inv_wear_mask()
else
if(!H.is_mouth_covered())
H.lip_style = null
H.update_body()
if(H.glasses && washglasses && wash_obj(H.glasses))
H.update_inv_glasses()
if(H.ears && washears && wash_obj(H.ears))
H.update_inv_ears()
if(H.belt && wash_obj(H.belt))
H.update_inv_belt()
else
if(M.wear_mask && wash_obj(M.wear_mask))
M.update_inv_wear_mask(0)
SEND_SIGNAL(M, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD)
else
SEND_SIGNAL(L, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD)
+22 -1
View File
@@ -243,6 +243,27 @@
"<span class='userdanger'>[usr] [internal ? "opens" : "closes"] the valve on [src]'s [ITEM.name].</span>")
/mob/living/carbon/proc/check_obscured_slots()
var/list/obscured = list()
if(head)
if(head.flags_inv & HIDENECK)
obscured |= SLOT_NECK
if(head.flags_inv & HIDEMASK)
obscured |= SLOT_WEAR_MASK
if(head.flags_inv & HIDEEYES)
obscured |= SLOT_GLASSES
if(head.flags_inv & HIDEEARS)
obscured |= SLOT_EARS
if(wear_mask)
if(wear_mask.flags_inv & HIDEEYES)
obscured |= SLOT_GLASSES
if(wear_mask.flags_inv & HIDEEARS)
obscured |= SLOT_EARS
return obscured
/mob/living/carbon/fall(forced)
loc.handle_fall(src, forced)//it's loc so it doesn't call the mob's handle_fall which does nothing
@@ -895,7 +916,7 @@
for(var/X in internal_organs)
var/obj/item/organ/I = X
I.Insert(src)
/mob/living/carbon/proc/update_disabled_bodyparts()
for(var/B in bodyparts)
var/obj/item/bodypart/BP = B
+7 -23
View File
@@ -508,33 +508,17 @@
// Might need re-wording.
to_chat(user, "<span class='alert'>There is no exposed flesh or thin material [above_neck(target_zone) ? "on [p_their()] head" : "on [p_their()] body"].</span>")
/mob/living/carbon/human/proc/check_obscured_slots()
var/list/obscured = list()
/mob/living/carbon/human/check_obscured_slots()
. = ..()
if(wear_suit)
if(wear_suit.flags_inv & HIDENECK)
. |= SLOT_NECK
if(wear_suit.flags_inv & HIDEGLOVES)
obscured |= SLOT_GLOVES
. |= SLOT_GLOVES
if(wear_suit.flags_inv & HIDEJUMPSUIT)
obscured |= SLOT_W_UNIFORM
. |= SLOT_W_UNIFORM
if(wear_suit.flags_inv & HIDESHOES)
obscured |= SLOT_SHOES
if(head)
if(head.flags_inv & HIDEMASK)
obscured |= SLOT_WEAR_MASK
if(head.flags_inv & HIDEEYES)
obscured |= SLOT_GLASSES
if(head.flags_inv & HIDEEARS)
obscured |= SLOT_EARS
if(wear_mask)
if(wear_mask.flags_inv & HIDEEYES)
obscured |= SLOT_GLASSES
if(obscured.len)
return obscured
else
return null
. |= SLOT_SHOES
/mob/living/carbon/human/assess_threat(judgement_criteria, lasercolor = "", datum/callback/weaponcheck=null)
if(judgement_criteria & JUDGE_EMAGGED)
+22 -27
View File
@@ -1546,50 +1546,45 @@ GLOBAL_LIST_EMPTY(roundstart_races)
if(H.on_fire)
//the fire tries to damage the exposed clothes and items
var/list/burning_items = list()
var/list/obscured = H.check_obscured_slots()
//HEAD//
var/obj/item/clothing/head_clothes = null
if(H.glasses)
head_clothes = H.glasses
if(H.wear_mask)
head_clothes = H.wear_mask
if(H.wear_neck)
head_clothes = H.wear_neck
if(H.head)
head_clothes = H.head
if(head_clothes)
burning_items += head_clothes
else if(H.ears)
if(H.glasses && !(SLOT_GLASSES in obscured))
burning_items += H.glasses
if(H.wear_mask && !(SLOT_WEAR_MASK in obscured))
burning_items += H.wear_mask
if(H.wear_neck && !(SLOT_NECK in obscured))
burning_items += H.wear_neck
if(H.ears && !(SLOT_EARS in obscured))
burning_items += H.ears
if(H.head)
burning_items += H.head
//CHEST//
var/obj/item/clothing/chest_clothes = null
if(H.w_uniform)
chest_clothes = H.w_uniform
if(H.w_uniform && !(SLOT_W_UNIFORM in obscured))
burning_items += H.w_uniform
if(H.wear_suit)
chest_clothes = H.wear_suit
if(chest_clothes)
burning_items += chest_clothes
burning_items += H.wear_suit
//ARMS & HANDS//
var/obj/item/clothing/arm_clothes = null
if(H.gloves)
if(H.gloves && !(SLOT_GLOVES in obscured))
arm_clothes = H.gloves
if(H.w_uniform && ((H.w_uniform.body_parts_covered & HANDS) || (H.w_uniform.body_parts_covered & ARMS)))
arm_clothes = H.w_uniform
if(H.wear_suit && ((H.wear_suit.body_parts_covered & HANDS) || (H.wear_suit.body_parts_covered & ARMS)))
else if(H.wear_suit && ((H.wear_suit.body_parts_covered & HANDS) || (H.wear_suit.body_parts_covered & ARMS)))
arm_clothes = H.wear_suit
else if(H.w_uniform && ((H.w_uniform.body_parts_covered & HANDS) || (H.w_uniform.body_parts_covered & ARMS)))
arm_clothes = H.w_uniform
if(arm_clothes)
burning_items |= arm_clothes
//LEGS & FEET//
var/obj/item/clothing/leg_clothes = null
if(H.shoes)
if(H.shoes && !(SLOT_SHOES in obscured))
leg_clothes = H.shoes
if(H.w_uniform && ((H.w_uniform.body_parts_covered & FEET) || (H.w_uniform.body_parts_covered & LEGS)))
leg_clothes = H.w_uniform
if(H.wear_suit && ((H.wear_suit.body_parts_covered & FEET) || (H.wear_suit.body_parts_covered & LEGS)))
else if(H.wear_suit && ((H.wear_suit.body_parts_covered & FEET) || (H.wear_suit.body_parts_covered & LEGS)))
leg_clothes = H.wear_suit
else if(H.w_uniform && ((H.w_uniform.body_parts_covered & FEET) || (H.w_uniform.body_parts_covered & LEGS)))
leg_clothes = H.w_uniform
if(leg_clothes)
burning_items |= leg_clothes
@@ -136,7 +136,7 @@
inv.update_icon()
if(wear_neck)
if(!(head && (head.flags_inv & HIDENECK)))
if(!(SLOT_NECK in check_obscured_slots()))
overlays_standing[NECK_LAYER] = wear_neck.build_worn_icon(state = wear_neck.icon_state, default_layer = NECK_LAYER, default_icon_file = 'icons/mob/neck.dmi')
update_hud_neck(wear_neck)