Merge pull request #3826 from Ikarrus/obscuredstrip

Strip Menu now obscures items based on flags_inv
This commit is contained in:
Alex
2014-06-05 21:43:52 +01:00
3 changed files with 108 additions and 72 deletions
+1
View File
@@ -12,3 +12,4 @@ var/timezoneOffset = 0 // The difference betwen midnight (of the host computer)
// However it'd be ok to use for accessing attack logs and such too, which are even laggier.
var/fileaccess_timer = 0
var/TAB = "    "
@@ -6,28 +6,8 @@
usr << "<span class='notice'>Something is there but you can't see it.</span>"
return
var/skipgloves = 0
var/skipsuitstorage = 0
var/skipjumpsuit = 0
var/skipshoes = 0
var/skipmask = 0
var/skipears = 0
var/skipeyes = 0
var/list/obscured = check_obscured_slots()
var/skipface = 0
//exosuits and helmets obscure our view and stuff.
if(wear_suit)
skipgloves = wear_suit.flags_inv & HIDEGLOVES
skipsuitstorage = wear_suit.flags_inv & HIDESUITSTORAGE
skipjumpsuit = wear_suit.flags_inv & HIDEJUMPSUIT
skipshoes = wear_suit.flags_inv & HIDESHOES
if(head)
skipmask = head.flags_inv & HIDEMASK
skipeyes = head.flags_inv & HIDEEYES
skipears = head.flags_inv & HIDEEARS
skipface = head.flags_inv & HIDEFACE
if(wear_mask)
skipface |= wear_mask.flags_inv & HIDEFACE
@@ -40,7 +20,7 @@
var/msg = "<span class='info'>*---------*\nThis is "
if( skipjumpsuit && skipface ) //big suits/masks/helmets make it hard to tell their gender
if( slot_w_uniform in obscured && skipface ) //big suits/masks/helmets make it hard to tell their gender
t_He = "They"
t_his = "their"
t_him = "them"
@@ -62,7 +42,7 @@
msg += "<EM>[src.name]</EM>!\n"
//uniform
if(w_uniform && !skipjumpsuit)
if(w_uniform && !(slot_w_uniform in obscured))
//Ties
var/tie_msg
if(istype(w_uniform,/obj/item/clothing/under))
@@ -90,7 +70,7 @@
msg += "[t_He] [t_is] wearing \icon[wear_suit] \a [wear_suit].\n"
//suit/armour storage
if(s_store && !skipsuitstorage)
if(s_store)
if(s_store.blood_DNA)
msg += "<span class='warning'>[t_He] [t_is] carrying \icon[s_store] [s_store.gender==PLURAL?"some":"a"] blood-stained [s_store.name] on [t_his] [wear_suit.name]!</span>\n"
else
@@ -118,7 +98,7 @@
msg += "[t_He] [t_is] holding \icon[r_hand] \a [r_hand] in [t_his] right hand.\n"
//gloves
if(gloves && !skipgloves)
if(gloves && !(slot_gloves in obscured))
if(gloves.blood_DNA)
msg += "<span class='warning'>[t_He] [t_has] \icon[gloves] [gloves.gender==PLURAL?"some":"a"] blood-stained [gloves.name] on [t_his] hands!</span>\n"
else
@@ -143,28 +123,28 @@
msg += "[t_He] [t_has] \icon[belt] \a [belt] about [t_his] waist.\n"
//shoes
if(shoes && !skipshoes)
if(shoes && !(slot_shoes in obscured))
if(shoes.blood_DNA)
msg += "<span class='warning'>[t_He] [t_is] wearing \icon[shoes] [shoes.gender==PLURAL?"some":"a"] blood-stained [shoes.name] on [t_his] feet!</span>\n"
else
msg += "[t_He] [t_is] wearing \icon[shoes] \a [shoes] on [t_his] feet.\n"
//mask
if(wear_mask && !skipmask)
if(wear_mask && !(slot_wear_mask in obscured))
if(wear_mask.blood_DNA)
msg += "<span class='warning'>[t_He] [t_has] \icon[wear_mask] [wear_mask.gender==PLURAL?"some":"a"] blood-stained [wear_mask.name] on [t_his] face!</span>\n"
else
msg += "[t_He] [t_has] \icon[wear_mask] \a [wear_mask] on [t_his] face.\n"
//eyes
if(glasses && !skipeyes)
if(glasses && !(slot_glasses in obscured))
if(glasses.blood_DNA)
msg += "<span class='warning'>[t_He] [t_has] \icon[glasses] [glasses.gender==PLURAL?"some":"a"] blood-stained [glasses] covering [t_his] eyes!</span>\n"
else
msg += "[t_He] [t_has] \icon[glasses] \a [glasses] covering [t_his] eyes.\n"
//ears
if(ears && !skipears)
if(ears && !(slot_ears in obscured))
msg += "[t_He] [t_has] \icon[ears] \a [ears] on [t_his] ears.\n"
//ID
+98 -43
View File
@@ -292,54 +292,81 @@
/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/dat = {"
<HR>
<B><FONT size=3>[name]</FONT></B>
<HR>
<BR><B>Mask:</B> <A href='?src=\ref[src];item=[slot_wear_mask]'> [(wear_mask && !(wear_mask.flags&ABSTRACT)) ? wear_mask : "Nothing"]</A>
<BR><B>Left Hand:</B> <A href='?src=\ref[src];item=[slot_l_hand]'> [(l_hand && !(l_hand.flags&ABSTRACT)) ? l_hand : "Nothing"]</A>
<BR><B>Right Hand:</B> <A href='?src=\ref[src];item=[slot_r_hand]'> [(r_hand && !(r_hand.flags&ABSTRACT)) ? r_hand : "Nothing"]</A>
<BR><B>Gloves:</B> <A href='?src=\ref[src];item=[slot_gloves]'> [(gloves && !(gloves.flags&ABSTRACT)) ? gloves : "Nothing"]</A>
<BR><B>Eyes:</B> <A href='?src=\ref[src];item=[slot_glasses]'> [(glasses && !(glasses.flags&ABSTRACT)) ? glasses : "Nothing"]</A>
<BR><B>Ears:</B> <A href='?src=\ref[src];item=[slot_ears]'> [(ears && !(ears.flags&ABSTRACT)) ? ears : "Nothing"]</A>
<BR><B>Head:</B> <A href='?src=\ref[src];item=[slot_head]'> [(head && !(head.flags&ABSTRACT)) ? head : "Nothing"]</A>
<BR><B>Shoes:</B> <A href='?src=\ref[src];item=[slot_shoes]'> [(shoes && !(shoes.flags&ABSTRACT)) ? shoes : "Nothing"]</A>"}
<B>Left Hand:</B> <A href='?src=\ref[src];item=[slot_l_hand]'> [(l_hand && !(l_hand.flags&ABSTRACT)) ? l_hand : "<font color=grey>Empty</font>"]</A><BR>
<B>Right Hand:</B> <A href='?src=\ref[src];item=[slot_r_hand]'> [(r_hand && !(r_hand.flags&ABSTRACT)) ? r_hand : "<font color=grey>Empty</font>"]</A><BR>
"}
dat += "<BR><B>Uniform:</B> <A href='?src=\ref[src];item=[slot_w_uniform]'> [(w_uniform && !(w_uniform.flags&ABSTRACT)) ? w_uniform : "Nothing"]</A>"
if(w_uniform)
dat += "<BR><B>Belt:</B> <A href='?src=\ref[src];item=[slot_belt]'> [(belt && !(belt.flags&ABSTRACT)) ? belt : "Nothing"]</A>"
if(has_breathable_mask && istype(belt, /obj/item/weapon/tank))
dat += "<BR><A href='?src=\ref[src];internal=[slot_belt]'>[internal ? "Disable Internals" : "Set Internals"]</A>"
dat += "<BR><B>Exosuit:</B> <A href='?src=\ref[src];item=[slot_wear_suit]'> [(wear_suit && !(wear_suit.flags&ABSTRACT)) ? wear_suit : "Nothing"]</A>"
if(wear_suit)
dat += "<BR><B>Suit Storage:</B> <A href='?src=\ref[src];item=[slot_s_store]'>[(s_store && !(s_store.flags&ABSTRACT)) ? s_store : "Nothing"]</A>"
if(has_breathable_mask && istype(wear_suit, /obj/item/weapon/tank))
dat += "<BR><A href='?src=\ref[src];internal=[slot_s_store]'>[internal ? "Disable Internals" : "Set Internals"]</A>"
dat += "<BR><B>Back:</B> <A href='?src=\ref[src];item=[slot_back]'> [(back && !(back.flags&ABSTRACT)) ? back : "Nothing"]</A>"
dat += "<BR><B>Back:</B> <A href='?src=\ref[src];item=[slot_back]'> [(back && !(back.flags&ABSTRACT)) ? back : "<font color=grey>Empty</font>"]</A>"
if(has_breathable_mask && istype(back, /obj/item/weapon/tank))
dat += "<BR><A href='?src=\ref[src];internal=[slot_back]'>[internal ? "Disable Internals" : "Set Internals"]</A>"
dat += "<BR>[TAB]&#8627;<A href='?src=\ref[src];internal=[slot_back]'>[internal ? "Disable Internals" : "Set Internals"]</A>"
if(w_uniform) //we checked already, but a different place.
dat += "<BR><B>ID:</B> <A href='?src=\ref[src];item=[slot_wear_id]'>[(wear_id && !(wear_id.flags&ABSTRACT)) ? wear_id : "Nothing"]</A>"
dat += "<BR>"
dat += "<BR><B>Head:</B> <A href='?src=\ref[src];item=[slot_head]'> [(head && !(head.flags&ABSTRACT)) ? head : "<font color=grey>Empty</font>"]</A>"
if(slot_wear_mask in obscured)
dat += "<BR><font color=grey><B>Mask:</B> Obscured by [head]</font>"
else
dat += "<BR><B>Mask:</B> <A href='?src=\ref[src];item=[slot_wear_mask]'> [(wear_mask && !(wear_mask.flags&ABSTRACT)) ? wear_mask : "<font color=grey>Empty</font>"]</A>"
if(slot_glasses in obscured)
dat += "<BR><font color=grey><B>Eyes:</B> Obscured by [head]</font>"
else
dat += "<BR><B>Eyes:</B> <A href='?src=\ref[src];item=[slot_glasses]'> [(glasses && !(glasses.flags&ABSTRACT)) ? glasses : "<font color=grey>Empty</font>"]</A>"
if(slot_ears in obscured)
dat += "<BR><font color=grey><B>Ears:</B> Obscured by [head]</font>"
else
dat += "<BR><B>Ears:</B> <A href='?src=\ref[src];item=[slot_ears]'> [(ears && !(ears.flags&ABSTRACT)) ? ears : "<font color=grey>Empty</font>"]</A>"
dat += "<BR>"
dat += "<BR><B>Exosuit:</B> <A href='?src=\ref[src];item=[slot_wear_suit]'> [(wear_suit && !(wear_suit.flags&ABSTRACT)) ? wear_suit : "<font color=grey>Empty</font>"]</A>"
if(wear_suit)
dat += "<BR>[TAB]&#8627;<B>Suit Storage:</B> <A href='?src=\ref[src];item=[slot_s_store]'>[(s_store && !(s_store.flags&ABSTRACT)) ? s_store : "<font color=grey>Empty</font>"]</A>"
if(has_breathable_mask && istype(wear_suit, /obj/item/weapon/tank))
dat += "<BR>[TAB][TAB]&#8627;<A href='?src=\ref[src];internal=[slot_s_store]'>[internal ? "Disable Internals" : "Set Internals"]</A>"
if(slot_shoes in obscured)
dat += "<BR><font color=grey><B>Shoes:</B> Obscured by [wear_suit]</font>"
else
dat += "<BR><B>Shoes:</B> <A href='?src=\ref[src];item=[slot_shoes]'> [(shoes && !(shoes.flags&ABSTRACT)) ? shoes : "<font color=grey>Empty</font>"]</A>"
if(slot_gloves in obscured)
dat += "<BR><font color=grey><B>Gloves:</B> Obscured by [wear_suit]</font>"
else
dat += "<BR><B>Gloves:</B> <A href='?src=\ref[src];item=[slot_gloves]'> [(gloves && !(gloves.flags&ABSTRACT)) ? gloves : "<font color=grey>Empty</font>"]</A>"
if(slot_w_uniform in obscured)
dat += "<BR><font color=grey><B>Uniform:</B> Obscured by [wear_suit]</font>"
else
dat += "<BR><B>Uniform:</B> <A href='?src=\ref[src];item=[slot_w_uniform]'> [(w_uniform && !(w_uniform.flags&ABSTRACT)) ? w_uniform : "<font color=grey>Empty</font>"]</A>"
if(w_uniform)
dat += "<BR>[TAB]&#8627;<B>Belt:</B> <A href='?src=\ref[src];item=[slot_belt]'> [(belt && !(belt.flags&ABSTRACT)) ? belt : "<font color=grey>Empty</font>"]</A>"
if(has_breathable_mask && istype(belt, /obj/item/weapon/tank))
dat += "<BR>[TAB][TAB]&#8627;<A href='?src=\ref[src];internal=[slot_belt]'>[internal ? "Disable Internals" : "Set Internals"]</A>"
dat += "<BR>[TAB]&#8627;<B>Pockets:</B> <A href='?src=\ref[src];pockets=left'>[(l_store && !(l_store.flags&ABSTRACT)) ? "Left (Full)" : "<font color=grey>Left (Empty)</font>"]</A>"
dat += " <A href='?src=\ref[src];pockets=right'>[(r_store && !(r_store.flags&ABSTRACT)) ? "Right (Full)" : "<font color=grey>Right (Empty)</font>"]</A>"
dat += "<BR>[TAB]&#8627;<B>ID:</B> <A href='?src=\ref[src];item=[slot_wear_id]'>[(wear_id && !(wear_id.flags&ABSTRACT)) ? wear_id : "<font color=grey>Empty</font>"]</A>"
dat += "<BR>"
if(handcuffed)
dat += "<BR><A href='?src=\ref[src];item=[slot_handcuffed]'>Handcuffed</A>"
dat += "<BR><B>Handcuffed:</B> <A href='?src=\ref[src];item=[slot_handcuffed]'>Remove</A>"
if(legcuffed)
dat += "<BR><A href='?src=\ref[src];item=[slot_legcuffed]'>Legcuffed</A>"
if(w_uniform)
dat += "<BR><BR><A href='?src=\ref[src];pockets=left'>Left Pocket ([(l_store && !(l_store.flags&ABSTRACT)) ? "Full" : "Empty"])</A>"
dat += " - <A href='?src=\ref[src];pockets=right'>Right Pocket ([(r_store && !(r_store.flags&ABSTRACT)) ? "Full" : "Empty"])</A>"
dat += "<BR><B>Legcuffed:</B> <A href='?src=\ref[src];item=[slot_legcuffed]'>Remove</A>"
dat += {"
<BR>
<BR><A href='?src=\ref[user];mach_close=mob\ref[src]'>Close</A>
"}
user << browse(dat, "window=mob\ref[src];size=340x480")
onclose(user, "mob\ref[src]")
var/datum/browser/popup = new(user, "mob\ref[src]", "[src]", 340, 500)
popup.set_content(dat)
popup.open()
// called when something steps onto a human
// this could be made more general, but for now just handle mulebot
@@ -358,11 +385,14 @@
/mob/living/carbon/human/Topic(href, href_list)
..()
//strip panel
if(!usr.stat && usr.canmove && !usr.restrained() && in_range(src, usr))
if(href_list["pockets"])
if(canUseTopic(src))
if(href_list["item"])
var/slot = text2num(href_list["item"])
if(slot in check_obscured_slots())
usr << "<span class='warning'>You can't reach that. Something is covering it.</span>"
return
if(href_list["pockets"])
var/pocket_side = href_list["pockets"]
var/pocket_id = (pocket_side == "right" ? slot_r_store : slot_l_store)
var/obj/item/pocket_item = (pocket_id == slot_r_store ? src.r_store : src.l_store)
@@ -390,13 +420,14 @@
// Update strip window
if(usr.machine == src && in_range(src, usr))
show_inv(usr)
else
// Display a warning if the user mocks up
src << "<span class='warning'>You feel your [pocket_side] pocket being fumbled with!</span>"
..()
return
if(href_list["criminal"])
if(istype(usr, /mob/living/carbon/human))
var/mob/living/carbon/human/H = usr
@@ -461,4 +492,28 @@
. = 0
if(!. && error_msg && user)
// Might need re-wording.
user << "<span class='alert'>There is no exposed flesh or thin material [above_neck(target_zone) ? "on their head" : "on their body"].</span>"
user << "<span class='alert'>There is no exposed flesh or thin material [above_neck(target_zone) ? "on their head" : "on their body"].</span>"
/mob/living/carbon/human/proc/check_obscured_slots()
var/list/obscured = list()
if(wear_suit)
if(wear_suit.flags_inv & HIDEGLOVES)
obscured |= slot_gloves
if(wear_suit.flags_inv & HIDEJUMPSUIT)
obscured |= 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(obscured.len > 0)
return obscured
else
return null