mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
Hidden identity fixes (#28233)
* Hidden identity fixes * The tests * Sets gender on test
This commit is contained in:
@@ -165,6 +165,18 @@
|
|||||||
// datum/mind/mind: the mind that just got transferred.
|
// datum/mind/mind: the mind that just got transferred.
|
||||||
/lazy_event/after_mind_transfer
|
/lazy_event/after_mind_transfer
|
||||||
|
|
||||||
|
// Called when mob equips an item
|
||||||
|
// Arguments:
|
||||||
|
// atom/item: the item
|
||||||
|
// slot: the slot
|
||||||
|
/lazy_event/on_equipped
|
||||||
|
|
||||||
|
// Called when mob unequippes an item
|
||||||
|
// Arguments:
|
||||||
|
// atom/item: the item
|
||||||
|
/lazy_event/on_unequipped
|
||||||
|
|
||||||
|
|
||||||
/datum
|
/datum
|
||||||
/// Associative list of type path -> list(),
|
/// Associative list of type path -> list(),
|
||||||
/// where the type path is a descendant of /event_type.
|
/// where the type path is a descendant of /event_type.
|
||||||
|
|||||||
@@ -291,7 +291,8 @@
|
|||||||
|
|
||||||
//W.dropped(src)
|
//W.dropped(src)
|
||||||
//update_icons() // Redundant as u_equip will handle updating the specific overlay
|
//update_icons() // Redundant as u_equip will handle updating the specific overlay
|
||||||
return 1
|
lazy_invoke_event(/lazy_event/on_unequipped, list(W))
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
// Drops all and only equipped items, including items in hand
|
// Drops all and only equipped items, including items in hand
|
||||||
|
|||||||
@@ -2,36 +2,22 @@
|
|||||||
#define JITTER_HIGH 300
|
#define JITTER_HIGH 300
|
||||||
|
|
||||||
/mob/living/carbon/human/examine(mob/user)
|
/mob/living/carbon/human/examine(mob/user)
|
||||||
|
var/msg = get_examine_text(user)
|
||||||
|
to_chat(user, msg)
|
||||||
|
if(istype(user))
|
||||||
|
user.heard(src)
|
||||||
|
|
||||||
|
/mob/living/carbon/human/proc/get_examine_text(mob/user)
|
||||||
var/list/obscured = check_obscured_slots()
|
var/list/obscured = check_obscured_slots()
|
||||||
var/skipgloves = 0
|
|
||||||
//var/skipsuitstorage = 0
|
|
||||||
var/skipjumpsuit = 0
|
|
||||||
var/skipshoes = 0
|
|
||||||
var/skipmask = 0
|
|
||||||
var/skipface = 0
|
var/skipface = 0
|
||||||
|
|
||||||
/*
|
var/is_gender_visible = 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//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)
|
if(wear_mask)
|
||||||
skipface |= check_hidden_head_flags(HIDEFACE)
|
skipface |= check_hidden_head_flags(HIDEFACE)
|
||||||
|
|
||||||
|
if(wear_mask?.is_hidden_identity() || head?.is_hidden_identity())
|
||||||
|
is_gender_visible = 0
|
||||||
|
|
||||||
// crappy hacks because you can't do \his[src] etc. I'm sorry this proc is so unreadable, blame the text macros :<
|
// crappy hacks because you can't do \his[src] etc. I'm sorry this proc is so unreadable, blame the text macros :<
|
||||||
var/t_He = "It" //capitalised for use at the start of each line.
|
var/t_He = "It" //capitalised for use at the start of each line.
|
||||||
@@ -44,7 +30,7 @@
|
|||||||
|
|
||||||
var/msg = "<span class='info'>*---------*\nThis is "
|
var/msg = "<span class='info'>*---------*\nThis is "
|
||||||
|
|
||||||
if((slot_w_uniform in obscured) && skipface)
|
if((slot_w_uniform in obscured) && !is_gender_visible)
|
||||||
t_He = "They"
|
t_He = "They"
|
||||||
t_his = "their"
|
t_his = "their"
|
||||||
t_him = "them"
|
t_him = "them"
|
||||||
@@ -366,47 +352,47 @@
|
|||||||
var/display_chest = 0
|
var/display_chest = 0
|
||||||
var/display_shoes = 0
|
var/display_shoes = 0
|
||||||
var/display_gloves = 0
|
var/display_gloves = 0
|
||||||
if(wound_flavor_text["head"] && (is_destroyed["head"] || (!skipmask && !(wear_mask && istype(wear_mask, /obj/item/clothing/mask/gas)))))
|
if(wound_flavor_text["head"] && (is_destroyed["head"] || !(wear_mask && istype(wear_mask, /obj/item/clothing/mask/gas))))
|
||||||
msg += wound_flavor_text["head"]
|
msg += wound_flavor_text["head"]
|
||||||
else if(is_bleeding["head"])
|
else if(is_bleeding["head"])
|
||||||
msg += "<span class='warning'>[src] has blood running down [t_his] face!</span>\n"
|
msg += "<span class='warning'>[src] has blood running down [t_his] face!</span>\n"
|
||||||
if(wound_flavor_text["chest"] && !w_uniform && !skipjumpsuit) //No need. A missing chest gibs you.
|
if(wound_flavor_text["chest"] && !w_uniform) //No need. A missing chest gibs you.
|
||||||
msg += wound_flavor_text["chest"]
|
msg += wound_flavor_text["chest"]
|
||||||
else if(is_bleeding["chest"])
|
else if(is_bleeding["chest"])
|
||||||
display_chest = 1
|
display_chest = 1
|
||||||
if(wound_flavor_text["left arm"] && (is_destroyed["left arm"] || (!w_uniform && !skipjumpsuit)))
|
if(wound_flavor_text["left arm"] && (is_destroyed["left arm"] || !w_uniform))
|
||||||
msg += wound_flavor_text["left arm"]
|
msg += wound_flavor_text["left arm"]
|
||||||
else if(is_bleeding["left arm"])
|
else if(is_bleeding["left arm"])
|
||||||
display_chest = 1
|
display_chest = 1
|
||||||
if(wound_flavor_text["left hand"] && (is_destroyed["left hand"] || (!gloves && !skipgloves)))
|
if(wound_flavor_text["left hand"] && (is_destroyed["left hand"] || !gloves))
|
||||||
msg += wound_flavor_text["left hand"]
|
msg += wound_flavor_text["left hand"]
|
||||||
else if(is_bleeding["left hand"])
|
else if(is_bleeding["left hand"])
|
||||||
display_gloves = 1
|
display_gloves = 1
|
||||||
if(wound_flavor_text["right arm"] && (is_destroyed["right arm"] || (!w_uniform && !skipjumpsuit)))
|
if(wound_flavor_text["right arm"] && (is_destroyed["right arm"] || !w_uniform))
|
||||||
msg += wound_flavor_text["right arm"]
|
msg += wound_flavor_text["right arm"]
|
||||||
else if(is_bleeding["right arm"])
|
else if(is_bleeding["right arm"])
|
||||||
display_chest = 1
|
display_chest = 1
|
||||||
if(wound_flavor_text["right hand"] && (is_destroyed["right hand"] || (!gloves && !skipgloves)))
|
if(wound_flavor_text["right hand"] && (is_destroyed["right hand"] || !gloves))
|
||||||
msg += wound_flavor_text["right hand"]
|
msg += wound_flavor_text["right hand"]
|
||||||
else if(is_bleeding["right hand"])
|
else if(is_bleeding["right hand"])
|
||||||
display_gloves = 1
|
display_gloves = 1
|
||||||
if(wound_flavor_text["groin"] && (is_destroyed["groin"] || (!w_uniform && !skipjumpsuit)))
|
if(wound_flavor_text["groin"] && (is_destroyed["groin"] || !w_uniform))
|
||||||
msg += wound_flavor_text["groin"]
|
msg += wound_flavor_text["groin"]
|
||||||
else if(is_bleeding["groin"])
|
else if(is_bleeding["groin"])
|
||||||
display_chest = 1
|
display_chest = 1
|
||||||
if(wound_flavor_text["left leg"] && (is_destroyed["left leg"] || (!w_uniform && !skipjumpsuit)))
|
if(wound_flavor_text["left leg"] && (is_destroyed["left leg"] || !w_uniform))
|
||||||
msg += wound_flavor_text["left leg"]
|
msg += wound_flavor_text["left leg"]
|
||||||
else if(is_bleeding["left leg"])
|
else if(is_bleeding["left leg"])
|
||||||
display_chest = 1
|
display_chest = 1
|
||||||
if(wound_flavor_text["left foot"]&& (is_destroyed["left foot"] || (!shoes && !skipshoes)))
|
if(wound_flavor_text["left foot"] && (is_destroyed["left foot"] || !shoes))
|
||||||
msg += wound_flavor_text["left foot"]
|
msg += wound_flavor_text["left foot"]
|
||||||
else if(is_bleeding["left foot"])
|
else if(is_bleeding["left foot"])
|
||||||
display_shoes = 1
|
display_shoes = 1
|
||||||
if(wound_flavor_text["right leg"] && (is_destroyed["right leg"] || (!w_uniform && !skipjumpsuit)))
|
if(wound_flavor_text["right leg"] && (is_destroyed["right leg"] || !w_uniform))
|
||||||
msg += wound_flavor_text["right leg"]
|
msg += wound_flavor_text["right leg"]
|
||||||
else if(is_bleeding["right leg"])
|
else if(is_bleeding["right leg"])
|
||||||
display_chest = 1
|
display_chest = 1
|
||||||
if(wound_flavor_text["right foot"]&& (is_destroyed["right foot"] || (!shoes && !skipshoes)))
|
if(wound_flavor_text["right foot"]&& (is_destroyed["right foot"] || !shoes))
|
||||||
msg += wound_flavor_text["right foot"]
|
msg += wound_flavor_text["right foot"]
|
||||||
else if(is_bleeding["right foot"])
|
else if(is_bleeding["right foot"])
|
||||||
display_shoes = 1
|
display_shoes = 1
|
||||||
@@ -471,9 +457,7 @@
|
|||||||
|
|
||||||
msg += "*---------*</span>"
|
msg += "*---------*</span>"
|
||||||
|
|
||||||
to_chat(user, msg)
|
return msg
|
||||||
if(istype(user))
|
|
||||||
user.heard(src)
|
|
||||||
|
|
||||||
#undef JITTER_MEDIUM
|
#undef JITTER_MEDIUM
|
||||||
#undef JITTER_HIGH
|
#undef JITTER_HIGH
|
||||||
|
|||||||
@@ -230,6 +230,12 @@
|
|||||||
|
|
||||||
update_mutantrace()
|
update_mutantrace()
|
||||||
|
|
||||||
|
lazy_register_event(/lazy_event/on_equipped, src, .proc/update_name)
|
||||||
|
lazy_register_event(/lazy_event/on_unequipped, src, .proc/update_name)
|
||||||
|
|
||||||
|
/mob/living/carbon/human/proc/update_name()
|
||||||
|
name = get_visible_name()
|
||||||
|
|
||||||
/mob/living/carbon/human/player_panel_controls()
|
/mob/living/carbon/human/player_panel_controls()
|
||||||
var/html=""
|
var/html=""
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@
|
|||||||
ignore_slot = (equipped == wear_mask) ? MOUTH : 0
|
ignore_slot = (equipped == wear_mask) ? MOUTH : 0
|
||||||
if(!equipped)
|
if(!equipped)
|
||||||
continue
|
continue
|
||||||
else if(is_slot_hidden(equipped.body_parts_covered,(hidden_flags),ignore_slot,equipped.body_parts_visible_override))
|
else if(is_slot_hidden(equipped.body_parts_covered, hidden_flags, ignore_slot, equipped.body_parts_visible_override))
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -499,6 +499,7 @@
|
|||||||
W.equipped(src, slot)
|
W.equipped(src, slot)
|
||||||
if(client)
|
if(client)
|
||||||
client.screen |= W
|
client.screen |= W
|
||||||
|
lazy_invoke_event(/lazy_event/on_equipped, list(W, slot))
|
||||||
|
|
||||||
/mob/living/carbon/human/get_multitool(var/active_only=0)
|
/mob/living/carbon/human/get_multitool(var/active_only=0)
|
||||||
if(istype(get_active_hand(),/obj/item/device/multitool))
|
if(istype(get_active_hand(),/obj/item/device/multitool))
|
||||||
|
|||||||
@@ -176,7 +176,6 @@ var/global/list/organ_damage_overlays = list(
|
|||||||
handle_regular_status_updates() //Optimized a bit
|
handle_regular_status_updates() //Optimized a bit
|
||||||
update_canmove()
|
update_canmove()
|
||||||
//Update our name based on whether our face is obscured/disfigured
|
//Update our name based on whether our face is obscured/disfigured
|
||||||
name = get_visible_name()
|
|
||||||
handle_regular_hud_updates()
|
handle_regular_hud_updates()
|
||||||
pulse = handle_pulse()
|
pulse = handle_pulse()
|
||||||
for(var/obj/item/weapon/grab/G in src)
|
for(var/obj/item/weapon/grab/G in src)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "borer.dm"
|
#include "borer.dm"
|
||||||
#include "circuitboards.dm"
|
#include "circuitboards.dm"
|
||||||
#include "dna_and_disabilities.dm"
|
#include "dna_and_disabilities.dm"
|
||||||
|
#include "examine.dm"
|
||||||
#include "hexadecimal.dm"
|
#include "hexadecimal.dm"
|
||||||
#include "highscores.dm"
|
#include "highscores.dm"
|
||||||
#include "icons.dm"
|
#include "icons.dm"
|
||||||
|
|||||||
38
code/modules/unit_tests/examine.dm
Normal file
38
code/modules/unit_tests/examine.dm
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
// Tests masks/hardsuits not properly hiding gender
|
||||||
|
|
||||||
|
// To hide the gender the carbon has to be covering his body AND his face
|
||||||
|
|
||||||
|
/datum/unit_test/examine/start()
|
||||||
|
|
||||||
|
/datum/unit_test/examine/hidden_identity/start()
|
||||||
|
var/mob/living/carbon/human/test_subject = new()
|
||||||
|
var/name = "Barack Obama"
|
||||||
|
test_subject.real_name = name
|
||||||
|
test_subject.name = name
|
||||||
|
test_subject.gender = MALE
|
||||||
|
|
||||||
|
assert_eq(test_subject.name, "Barack Obama")
|
||||||
|
test_subject.equip_to_appropriate_slot(new /obj/item/clothing/mask/balaclava, TRUE)
|
||||||
|
assert_eq(test_subject.name, "Unknown")
|
||||||
|
// naked body or simple jumpsuit is not enough to hide your gender
|
||||||
|
assert_pronoun(test_subject.get_examine_text(test_subject), "He")
|
||||||
|
|
||||||
|
test_subject.equip_to_appropriate_slot(new /obj/item/clothing/suit/space/rig/medical, TRUE)
|
||||||
|
assert_eq(test_subject.name, "Unknown")
|
||||||
|
assert_pronoun(test_subject.get_examine_text(test_subject), "They")
|
||||||
|
|
||||||
|
test_subject.drop_from_inventory(test_subject.wear_mask)
|
||||||
|
assert_eq(test_subject.name, "Barack Obama")
|
||||||
|
assert_pronoun(test_subject.get_examine_text(test_subject), "He")
|
||||||
|
|
||||||
|
test_subject.equip_to_slot(new /obj/item/clothing/mask/cigarette, slot_wear_mask)
|
||||||
|
assert_eq(test_subject.name, "Barack Obama")
|
||||||
|
assert_pronoun(test_subject.get_examine_text(test_subject), "He")
|
||||||
|
|
||||||
|
/datum/unit_test/examine/hidden_identity/proc/assert_pronoun(examine_text, expected_pronoun)
|
||||||
|
var/list/lines = splittext(examine_text, "\n")
|
||||||
|
|
||||||
|
for(var/i = 3; i < length(lines) - 2; i++)
|
||||||
|
var/list/words = splittext(lines[i], " ")
|
||||||
|
var/pronoun = words[1]
|
||||||
|
assert_eq(pronoun, expected_pronoun)
|
||||||
Reference in New Issue
Block a user