mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 05:00:55 +01:00
[MIRROR] Converted check_obscured_slots() output to bitfield instead of list (#586)
* Converted check_obscured_slots() output to bitfield instead of list (#53241) * Converted check_obscured_slots() output to bitfield instead of list Co-authored-by: Donkie <daniel.cf.hultgren@gmail.com>
This commit is contained in:
@@ -357,7 +357,7 @@
|
||||
|
||||
|
||||
/mob/living/carbon/proc/check_obscured_slots(transparent_protection)
|
||||
var/list/obscured = list()
|
||||
var/obscured = NONE
|
||||
var/hidden_slots = NONE
|
||||
|
||||
for(var/obj/item/I in get_equipped_items())
|
||||
|
||||
@@ -189,14 +189,14 @@
|
||||
<HR>
|
||||
<BR><B>Head:</B> <A href='?src=[REF(src)];item=[ITEM_SLOT_HEAD]'>[(head && !(head.item_flags & ABSTRACT)) ? head : "Nothing"]</A>"}
|
||||
|
||||
var/list/obscured = check_obscured_slots()
|
||||
var/obscured = check_obscured_slots()
|
||||
|
||||
if(ITEM_SLOT_NECK in obscured)
|
||||
if(obscured & ITEM_SLOT_NECK)
|
||||
dat += "<BR><B>Neck:</B> Obscured"
|
||||
else
|
||||
dat += "<BR><B>Neck:</B> <A href='?src=[REF(src)];item=[ITEM_SLOT_NECK]'>[(wear_neck && !(wear_neck.item_flags & ABSTRACT)) ? (wear_neck) : "Nothing"]</A>"
|
||||
|
||||
if(ITEM_SLOT_MASK in obscured)
|
||||
if(obscured & ITEM_SLOT_MASK)
|
||||
dat += "<BR><B>Mask:</B> Obscured"
|
||||
else
|
||||
dat += "<BR><B>Mask:</B> <A href='?src=[REF(src)];item=[ITEM_SLOT_MASK]'>[(wear_mask && !(wear_mask.item_flags & ABSTRACT)) ? wear_mask : "Nothing"]</a>"
|
||||
@@ -1152,30 +1152,30 @@
|
||||
. = TRUE
|
||||
|
||||
// Check and wash stuff that can be covered
|
||||
var/list/obscured = check_obscured_slots()
|
||||
var/obscured = check_obscured_slots()
|
||||
|
||||
// If the eyes are covered by anything but glasses, that thing will be covering any potential glasses as well.
|
||||
if(glasses && is_eyes_covered(FALSE, TRUE, TRUE) && glasses.wash(clean_types))
|
||||
update_inv_glasses()
|
||||
. = TRUE
|
||||
|
||||
if(wear_mask && !(ITEM_SLOT_MASK in obscured) && wear_mask.wash(clean_types))
|
||||
if(wear_mask && !(obscured & ITEM_SLOT_MASK) && wear_mask.wash(clean_types))
|
||||
update_inv_wear_mask()
|
||||
. = TRUE
|
||||
|
||||
if(ears && !(ITEM_SLOT_EARS in obscured) && ears.wash(clean_types))
|
||||
if(ears && !(obscured & ITEM_SLOT_EARS) && ears.wash(clean_types))
|
||||
update_inv_ears()
|
||||
. = TRUE
|
||||
|
||||
if(wear_neck && !(ITEM_SLOT_NECK in obscured) && wear_neck.wash(clean_types))
|
||||
if(wear_neck && !(obscured & ITEM_SLOT_NECK) && wear_neck.wash(clean_types))
|
||||
update_inv_neck()
|
||||
. = TRUE
|
||||
|
||||
if(shoes && !(ITEM_SLOT_FEET in obscured) && shoes.wash(clean_types))
|
||||
if(shoes && !(obscured & ITEM_SLOT_FEET) && shoes.wash(clean_types))
|
||||
update_inv_shoes()
|
||||
. = TRUE
|
||||
|
||||
if(gloves && !(ITEM_SLOT_GLOVES in obscured) && gloves.wash(clean_types))
|
||||
if(gloves && !(obscured & ITEM_SLOT_GLOVES) && gloves.wash(clean_types))
|
||||
update_inv_gloves()
|
||||
. = TRUE
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
inv.update_icon()
|
||||
|
||||
if(wear_mask)
|
||||
if(!(ITEM_SLOT_MASK in check_obscured_slots()))
|
||||
if(!(check_obscured_slots() & ITEM_SLOT_MASK))
|
||||
overlays_standing[FACEMASK_LAYER] = wear_mask.build_worn_icon(default_layer = FACEMASK_LAYER, default_icon_file = 'icons/mob/clothing/mask.dmi')
|
||||
update_hud_wear_mask(wear_mask)
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
inv.update_icon()
|
||||
|
||||
if(wear_neck)
|
||||
if(!(ITEM_SLOT_NECK in check_obscured_slots()))
|
||||
if(!(check_obscured_slots() & ITEM_SLOT_NECK))
|
||||
overlays_standing[NECK_LAYER] = wear_neck.build_worn_icon(default_layer = NECK_LAYER, default_icon_file = 'icons/mob/clothing/neck.dmi')
|
||||
update_hud_neck(wear_neck)
|
||||
|
||||
|
||||
@@ -7,15 +7,15 @@
|
||||
var/t_is = p_are()
|
||||
|
||||
. = list("<span class='info'>*---------*\nThis is [icon2html(src, user)] \a <EM>[src]</EM>!")
|
||||
var/list/obscured = check_obscured_slots()
|
||||
var/obscured = check_obscured_slots()
|
||||
|
||||
if (handcuffed)
|
||||
. += "<span class='warning'>[t_He] [t_is] [icon2html(handcuffed, user)] handcuffed!</span>"
|
||||
if (head)
|
||||
. += "[t_He] [t_is] wearing [head.get_examine_string(user)] on [t_his] head. "
|
||||
if(wear_mask && !(ITEM_SLOT_MASK in obscured))
|
||||
if(wear_mask && !(obscured & ITEM_SLOT_MASK))
|
||||
. += "[t_He] [t_is] wearing [wear_mask.get_examine_string(user)] on [t_his] face."
|
||||
if(wear_neck && !(ITEM_SLOT_NECK in obscured))
|
||||
if(wear_neck && !(obscured & ITEM_SLOT_NECK))
|
||||
. += "[t_He] [t_is] wearing [wear_neck.get_examine_string(user)] around [t_his] neck."
|
||||
|
||||
for(var/obj/item/I in held_items)
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
|
||||
. = list("<span class='info'>*---------*\nThis is <EM>[!obscure_name ? name : "Unknown"]</EM>!")
|
||||
|
||||
var/list/obscured = check_obscured_slots()
|
||||
var/obscured = check_obscured_slots()
|
||||
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
|
||||
|
||||
//uniform
|
||||
if(w_uniform && !(ITEM_SLOT_ICLOTHING in obscured))
|
||||
if(w_uniform && !(obscured & ITEM_SLOT_ICLOTHING))
|
||||
//accessory
|
||||
var/accessory_msg
|
||||
if(istype(w_uniform, /obj/item/clothing/under))
|
||||
@@ -35,7 +35,7 @@
|
||||
if(wear_suit)
|
||||
. += "[t_He] [t_is] wearing [wear_suit.get_examine_string(user)]."
|
||||
//suit/armor storage
|
||||
if(s_store && !(ITEM_SLOT_SUITSTORE in obscured))
|
||||
if(s_store && !(obscured & ITEM_SLOT_SUITSTORE))
|
||||
. += "[t_He] [t_is] carrying [s_store.get_examine_string(user)] on [t_his] [wear_suit.name]."
|
||||
//back
|
||||
if(back)
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
var/datum/component/forensics/FR = GetComponent(/datum/component/forensics)
|
||||
//gloves
|
||||
if(gloves && !(ITEM_SLOT_GLOVES in obscured))
|
||||
if(gloves && !(obscured & ITEM_SLOT_GLOVES))
|
||||
. += "[t_He] [t_has] [gloves.get_examine_string(user)] on [t_his] hands."
|
||||
else if(FR && length(FR.blood_DNA))
|
||||
if(num_hands)
|
||||
@@ -68,25 +68,25 @@
|
||||
. += "[t_He] [t_has] [belt.get_examine_string(user)] about [t_his] waist."
|
||||
|
||||
//shoes
|
||||
if(shoes && !(ITEM_SLOT_FEET in obscured))
|
||||
if(shoes && !(obscured & ITEM_SLOT_FEET))
|
||||
. += "[t_He] [t_is] wearing [shoes.get_examine_string(user)] on [t_his] feet."
|
||||
|
||||
//mask
|
||||
if(wear_mask && !(ITEM_SLOT_MASK in obscured))
|
||||
if(wear_mask && !(obscured & ITEM_SLOT_MASK))
|
||||
. += "[t_He] [t_has] [wear_mask.get_examine_string(user)] on [t_his] face."
|
||||
|
||||
if(wear_neck && !(ITEM_SLOT_NECK in obscured))
|
||||
if(wear_neck && !(obscured & ITEM_SLOT_NECK))
|
||||
. += "[t_He] [t_is] wearing [wear_neck.get_examine_string(user)] around [t_his] neck."
|
||||
|
||||
//eyes
|
||||
if(!(ITEM_SLOT_EYES in obscured))
|
||||
if(!(obscured & ITEM_SLOT_EYES))
|
||||
if(glasses)
|
||||
. += "[t_He] [t_has] [glasses.get_examine_string(user)] covering [t_his] eyes."
|
||||
else if(eye_color == BLOODCULT_EYE && iscultist(src) && HAS_TRAIT(src, CULT_EYES))
|
||||
. += "<span class='warning'><B>[t_His] eyes are glowing an unnatural red!</B></span>"
|
||||
|
||||
//ears
|
||||
if(ears && !(ITEM_SLOT_EARS in obscured))
|
||||
if(ears && !(obscured & ITEM_SLOT_EARS))
|
||||
. += "[t_He] [t_has] [ears.get_examine_string(user)] on [t_his] ears."
|
||||
|
||||
//ID
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
/mob/living/carbon/human/show_inv(mob/user)
|
||||
user.set_machine(src)
|
||||
var/has_breathable_mask = istype(wear_mask, /obj/item/clothing/mask)
|
||||
var/list/obscured = check_obscured_slots()
|
||||
var/obscured = check_obscured_slots()
|
||||
var/list/dat = list()
|
||||
|
||||
dat += "<table>"
|
||||
@@ -124,22 +124,22 @@
|
||||
|
||||
dat += "<tr><td><B>Head:</B></td><td><A href='?src=[REF(src)];item=[ITEM_SLOT_HEAD]'>[(head && !(head.item_flags & ABSTRACT)) ? head : "<font color=grey>Empty</font>"]</A></td></tr>"
|
||||
|
||||
if(ITEM_SLOT_MASK in obscured)
|
||||
if(obscured & ITEM_SLOT_MASK)
|
||||
dat += "<tr><td><font color=grey><B>Mask:</B></font></td><td><font color=grey>Obscured</font></td></tr>"
|
||||
else
|
||||
dat += "<tr><td><B>Mask:</B></td><td><A href='?src=[REF(src)];item=[ITEM_SLOT_MASK]'>[(wear_mask && !(wear_mask.item_flags & ABSTRACT)) ? wear_mask : "<font color=grey>Empty</font>"]</A></td></tr>"
|
||||
|
||||
if(ITEM_SLOT_NECK in obscured)
|
||||
if(obscured & ITEM_SLOT_NECK)
|
||||
dat += "<tr><td><font color=grey><B>Neck:</B></font></td><td><font color=grey>Obscured</font></td></tr>"
|
||||
else
|
||||
dat += "<tr><td><B>Neck:</B></td><td><A href='?src=[REF(src)];item=[ITEM_SLOT_NECK]'>[(wear_neck && !(wear_neck.item_flags & ABSTRACT)) ? wear_neck : "<font color=grey>Empty</font>"]</A></td></tr>"
|
||||
|
||||
if(ITEM_SLOT_EYES in obscured)
|
||||
if(obscured & ITEM_SLOT_EYES)
|
||||
dat += "<tr><td><font color=grey><B>Eyes:</B></font></td><td><font color=grey>Obscured</font></td></tr>"
|
||||
else
|
||||
dat += "<tr><td><B>Eyes:</B></td><td><A href='?src=[REF(src)];item=[ITEM_SLOT_EYES]'>[(glasses && !(glasses.item_flags & ABSTRACT)) ? glasses : "<font color=grey>Empty</font>"]</A></td></tr>"
|
||||
|
||||
if(ITEM_SLOT_EARS in obscured)
|
||||
if(obscured & ITEM_SLOT_EARS)
|
||||
dat += "<tr><td><font color=grey><B>Ears:</B></font></td><td><font color=grey>Obscured</font></td></tr>"
|
||||
else
|
||||
dat += "<tr><td><B>Ears:</B></td><td><A href='?src=[REF(src)];item=[ITEM_SLOT_EARS]'>[(ears && !(ears.item_flags & ABSTRACT)) ? ears : "<font color=grey>Empty</font>"]</A></td></tr>"
|
||||
@@ -148,7 +148,7 @@
|
||||
|
||||
dat += "<tr><td><B>Exosuit:</B></td><td><A href='?src=[REF(src)];item=[ITEM_SLOT_OCLOTHING]'>[(wear_suit && !(wear_suit.item_flags & ABSTRACT)) ? wear_suit : "<font color=grey>Empty</font>"]</A></td></tr>"
|
||||
if(wear_suit)
|
||||
if(ITEM_SLOT_SUITSTORE in obscured)
|
||||
if(obscured & ITEM_SLOT_SUITSTORE)
|
||||
dat += "<tr><td><font color=grey> ↳<B>Suit Storage:</B></font></td></tr>"
|
||||
else
|
||||
dat += "<tr><td> ↳<B>Suit Storage:</B></td><td><A href='?src=[REF(src)];item=[ITEM_SLOT_SUITSTORE]'>[(s_store && !(s_store.item_flags & ABSTRACT)) ? s_store : "<font color=grey>Empty</font>"]</A>"
|
||||
@@ -158,7 +158,7 @@
|
||||
else
|
||||
dat += "<tr><td><font color=grey> ↳<B>Suit Storage:</B></font></td></tr>"
|
||||
|
||||
if(ITEM_SLOT_FEET in obscured)
|
||||
if(obscured & ITEM_SLOT_FEET)
|
||||
dat += "<tr><td><font color=grey><B>Shoes:</B></font></td><td><font color=grey>Obscured</font></td></tr>"
|
||||
else
|
||||
dat += "<tr><td><B>Shoes:</B></td><td><A href='?src=[REF(src)];item=[ITEM_SLOT_FEET]'>[(shoes && !(shoes.item_flags & ABSTRACT)) ? shoes : "<font color=grey>Empty</font>"]</A>"
|
||||
@@ -166,12 +166,12 @@
|
||||
dat += " <A href='?src=[REF(src)];shoes=[ITEM_SLOT_FEET]'>[shoes.tied ? "Untie shoes" : "Knot shoes"]</A>"
|
||||
|
||||
dat += "</td></tr>"
|
||||
if(ITEM_SLOT_GLOVES in obscured)
|
||||
if(obscured & ITEM_SLOT_GLOVES)
|
||||
dat += "<tr><td><font color=grey><B>Gloves:</B></font></td><td><font color=grey>Obscured</font></td></tr>"
|
||||
else
|
||||
dat += "<tr><td><B>Gloves:</B></td><td><A href='?src=[REF(src)];item=[ITEM_SLOT_GLOVES]'>[(gloves && !(gloves.item_flags & ABSTRACT)) ? gloves : "<font color=grey>Empty</font>"]</A></td></tr>"
|
||||
|
||||
if(ITEM_SLOT_ICLOTHING in obscured)
|
||||
if(obscured & ITEM_SLOT_ICLOTHING)
|
||||
dat += "<tr><td><font color=grey><B>Uniform:</B></font></td><td><font color=grey>Obscured</font></td></tr>"
|
||||
else
|
||||
dat += "<tr><td><B>Uniform:</B></td><td><A href='?src=[REF(src)];item=[ITEM_SLOT_ICLOTHING]'>[(w_uniform && !(w_uniform.item_flags & ABSTRACT)) ? w_uniform : "<font color=grey>Empty</font>"]</A>"
|
||||
@@ -182,7 +182,7 @@
|
||||
dat += "</td></tr>"
|
||||
|
||||
var/obj/item/bodypart/O = get_bodypart(BODY_ZONE_CHEST)
|
||||
if((w_uniform == null && !(dna && dna.species.nojumpsuit) && !(O && O.status == BODYPART_ROBOTIC)) || (ITEM_SLOT_ICLOTHING in obscured))
|
||||
if((w_uniform == null && !(dna && dna.species.nojumpsuit) && !(O && O.status == BODYPART_ROBOTIC)) || (obscured & ITEM_SLOT_ICLOTHING))
|
||||
dat += "<tr><td><font color=grey> ↳<B>Pockets:</B></font></td></tr>"
|
||||
dat += "<tr><td><font color=grey> ↳<B>ID:</B></font></td></tr>"
|
||||
dat += "<tr><td><font color=grey> ↳<B>Belt:</B></font></td></tr>"
|
||||
@@ -231,7 +231,7 @@
|
||||
|
||||
if(href_list["item"]) //canUseTopic check for this is handled by mob/Topic()
|
||||
var/slot = text2num(href_list["item"])
|
||||
if(slot in check_obscured_slots(TRUE))
|
||||
if(check_obscured_slots(TRUE) & slot)
|
||||
to_chat(usr, "<span class='warning'>You can't reach that! Something is covering it.</span>")
|
||||
return
|
||||
|
||||
@@ -727,8 +727,8 @@
|
||||
* Returns false if we couldn't wash our hands due to them being obscured, otherwise true
|
||||
*/
|
||||
/mob/living/carbon/human/proc/wash_hands(clean_types)
|
||||
var/list/obscured = check_obscured_slots()
|
||||
if(ITEM_SLOT_GLOVES in obscured)
|
||||
var/obscured = check_obscured_slots()
|
||||
if(obscured & ITEM_SLOT_GLOVES)
|
||||
return FALSE
|
||||
|
||||
if(gloves)
|
||||
@@ -762,8 +762,8 @@
|
||||
update_inv_glasses()
|
||||
. = TRUE
|
||||
|
||||
var/list/obscured = check_obscured_slots()
|
||||
if(wear_mask && !(ITEM_SLOT_MASK in obscured) && wear_mask.wash(clean_types))
|
||||
var/obscured = check_obscured_slots()
|
||||
if(wear_mask && !(obscured & ITEM_SLOT_MASK) && wear_mask.wash(clean_types))
|
||||
update_inv_wear_mask()
|
||||
. = TRUE
|
||||
|
||||
@@ -783,9 +783,9 @@
|
||||
. = TRUE
|
||||
|
||||
// Check and wash stuff that can be covered
|
||||
var/list/obscured = check_obscured_slots()
|
||||
var/obscured = check_obscured_slots()
|
||||
|
||||
if(w_uniform && !(ITEM_SLOT_ICLOTHING in obscured) && w_uniform.wash(clean_types))
|
||||
if(w_uniform && !(obscured & ITEM_SLOT_ICLOTHING) && w_uniform.wash(clean_types))
|
||||
update_inv_w_uniform()
|
||||
. = TRUE
|
||||
|
||||
@@ -793,7 +793,7 @@
|
||||
. = TRUE
|
||||
|
||||
// Wash hands if exposed
|
||||
if(!gloves && (clean_types & CLEAN_TYPE_BLOOD) && blood_in_hands > 0 && !(ITEM_SLOT_GLOVES in obscured))
|
||||
if(!gloves && (clean_types & CLEAN_TYPE_BLOOD) && blood_in_hands > 0 && !(obscured & ITEM_SLOT_GLOVES))
|
||||
blood_in_hands = 0
|
||||
update_inv_gloves()
|
||||
. = TRUE
|
||||
|
||||
@@ -1749,29 +1749,29 @@ 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(TRUE)
|
||||
var/obscured = H.check_obscured_slots(TRUE)
|
||||
//HEAD//
|
||||
|
||||
if(H.glasses && !(ITEM_SLOT_EYES in obscured))
|
||||
if(H.glasses && !(obscured & ITEM_SLOT_EYES))
|
||||
burning_items += H.glasses
|
||||
if(H.wear_mask && !(ITEM_SLOT_MASK in obscured))
|
||||
if(H.wear_mask && !(obscured & ITEM_SLOT_MASK))
|
||||
burning_items += H.wear_mask
|
||||
if(H.wear_neck && !(ITEM_SLOT_NECK in obscured))
|
||||
if(H.wear_neck && !(obscured & ITEM_SLOT_NECK))
|
||||
burning_items += H.wear_neck
|
||||
if(H.ears && !(ITEM_SLOT_EARS in obscured))
|
||||
if(H.ears && !(obscured & ITEM_SLOT_EARS))
|
||||
burning_items += H.ears
|
||||
if(H.head)
|
||||
burning_items += H.head
|
||||
|
||||
//CHEST//
|
||||
if(H.w_uniform && !(ITEM_SLOT_ICLOTHING in obscured))
|
||||
if(H.w_uniform && !(obscured & ITEM_SLOT_ICLOTHING))
|
||||
burning_items += H.w_uniform
|
||||
if(H.wear_suit)
|
||||
burning_items += H.wear_suit
|
||||
|
||||
//ARMS & HANDS//
|
||||
var/obj/item/clothing/arm_clothes = null
|
||||
if(H.gloves && !(ITEM_SLOT_GLOVES in obscured))
|
||||
if(H.gloves && !(obscured & ITEM_SLOT_GLOVES))
|
||||
arm_clothes = H.gloves
|
||||
else if(H.wear_suit && ((H.wear_suit.body_parts_covered & HANDS) || (H.wear_suit.body_parts_covered & ARMS)))
|
||||
arm_clothes = H.wear_suit
|
||||
@@ -1782,7 +1782,7 @@ GLOBAL_LIST_EMPTY(roundstart_races)
|
||||
|
||||
//LEGS & FEET//
|
||||
var/obj/item/clothing/leg_clothes = null
|
||||
if(H.shoes && !(ITEM_SLOT_FEET in obscured))
|
||||
if(H.shoes && !(obscured & ITEM_SLOT_FEET))
|
||||
leg_clothes = H.shoes
|
||||
else if(H.wear_suit && ((H.wear_suit.body_parts_covered & FEET) || (H.wear_suit.body_parts_covered & LEGS)))
|
||||
leg_clothes = H.wear_suit
|
||||
|
||||
@@ -140,10 +140,10 @@
|
||||
//the fire tries to damage the exposed clothes and items
|
||||
var/list/burning_items = list()
|
||||
//HEAD//
|
||||
var/list/obscured = check_obscured_slots(TRUE)
|
||||
if(wear_mask && !(ITEM_SLOT_MASK in obscured))
|
||||
var/obscured = check_obscured_slots(TRUE)
|
||||
if(wear_mask && !(obscured & ITEM_SLOT_MASK))
|
||||
burning_items += wear_mask
|
||||
if(wear_neck && !(ITEM_SLOT_NECK in obscured))
|
||||
if(wear_neck && !(obscured & ITEM_SLOT_NECK))
|
||||
burning_items += wear_neck
|
||||
if(head)
|
||||
burning_items += head
|
||||
|
||||
Reference in New Issue
Block a user