Implements identity system! If your mask hides your face (e.g. oxygen mask, clown mask and diving suit), the game will either use the name of the ID card owner in your ID card slot or will give you a "?" name.

This only affects "DisplayName". The reason why I can't completely override the .Name for the client from server is due to how crew manifest and CharacterInfo classes are handled - it would require a major rework of many Character-related systems and interactions to truly make this "hack-proof".
Server hosts will have to stay on their toes I guess.
This commit is contained in:
Alex Noir
2017-12-16 19:52:25 +03:00
parent eb92242a8c
commit bd646fb23e
9 changed files with 74 additions and 12 deletions
@@ -298,15 +298,16 @@ namespace Barotrauma
if (info != null)
{
Vector2 namePos = new Vector2(pos.X, pos.Y - 110.0f - (5.0f / cam.Zoom)) - GUI.Font.MeasureString(Info.Name) * 0.5f / cam.Zoom;
string name = Info.DisplayName;
Vector2 namePos = new Vector2(pos.X, pos.Y - 110.0f - (5.0f / cam.Zoom)) - GUI.Font.MeasureString(name) * 0.5f / cam.Zoom;
Color nameColor = Color.White;
if (Character.Controlled != null && TeamID != Character.Controlled.TeamID)
{
nameColor = Color.Red;
}
GUI.Font.DrawString(spriteBatch, Info.Name, namePos + new Vector2(1.0f / cam.Zoom, 1.0f / cam.Zoom), Color.Black, 0.0f, Vector2.Zero, 1.0f / cam.Zoom, SpriteEffects.None, 0.001f);
GUI.Font.DrawString(spriteBatch, Info.Name, namePos, nameColor, 0.0f, Vector2.Zero, 1.0f / cam.Zoom, SpriteEffects.None, 0.0f);
GUI.Font.DrawString(spriteBatch, name, namePos + new Vector2(1.0f / cam.Zoom, 1.0f / cam.Zoom), Color.Black, 0.0f, Vector2.Zero, 1.0f / cam.Zoom, SpriteEffects.None, 0.001f);
GUI.Font.DrawString(spriteBatch, name, namePos, nameColor, 0.0f, Vector2.Zero, 1.0f / cam.Zoom, SpriteEffects.None, 0.0f);
if (GameMain.DebugDraw)
{
@@ -208,7 +208,7 @@ namespace Barotrauma
string focusName = character.FocusedCharacter.SpeciesName;
if (character.FocusedCharacter.Info != null)
{
focusName = character.FocusedCharacter.Info.Name;
focusName = character.FocusedCharacter.Info.DisplayName;
}
Vector2 textPos = startPos;
textPos -= new Vector2(GUI.Font.MeasureString(focusName).X / 2, 20);
@@ -296,9 +296,26 @@ namespace Barotrauma
}
else
{
toolTip = string.IsNullOrEmpty(Items[i].Description) ?
string description = Items[i].Description;
if (Items[i].Name == "ID Card")
{
string[] readTags = Items[i].Tags.Split(',');
string idName = null;
string idJob = null;
foreach (string tag in readTags)
{
string[] s = tag.Split(':');
if (s[0] == "name")
idName = s[1];
if (s[0] == "job")
idJob = s[1];
}
if (idName != null)
description = "This belongs to " + idName + (idJob != null ? ", the " + idJob + ".\n" : ".\n") + description;
}
toolTip = string.IsNullOrEmpty(description) ?
Items[i].Name :
Items[i].Name + '\n' + Items[i].Description;
Items[i].Name + '\n' + description;
}
DrawToolTip(spriteBatch, toolTip, slots[i].Rect);