Implement ID card slot and ID card description that states the owner and his job in preparation for identity system
This commit is contained in:
@@ -591,7 +591,7 @@ namespace Barotrauma
|
||||
{
|
||||
AnimController = new HumanoidAnimController(this, doc.Root.Element("ragdoll"));
|
||||
AnimController.TargetDir = Direction.Right;
|
||||
inventory = new CharacterInventory(16, this);
|
||||
inventory = new CharacterInventory(17, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -130,6 +130,7 @@ namespace Barotrauma
|
||||
{
|
||||
item.AddTag(s);
|
||||
}
|
||||
item.Description = "This belongs to " + character.Name + ", the " + Name + ".";
|
||||
}
|
||||
|
||||
if (parentItem != null) parentItem.Combine(item);
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Barotrauma
|
||||
[Flags]
|
||||
public enum InvSlotType
|
||||
{
|
||||
None = 0, Any = 1, RightHand = 2, LeftHand = 4, Head = 8, Torso = 16, Legs = 32, Face=64
|
||||
None = 0, Any = 1, RightHand = 2, LeftHand = 4, Head = 8, Torso = 16, Legs = 32, Face=64, Card=128
|
||||
};
|
||||
|
||||
partial class CharacterInventory : Inventory
|
||||
@@ -18,7 +18,7 @@ namespace Barotrauma
|
||||
private Character character;
|
||||
|
||||
public static InvSlotType[] limbSlots = new InvSlotType[] {
|
||||
InvSlotType.Head, InvSlotType.Torso, InvSlotType.Legs, InvSlotType.LeftHand, InvSlotType.RightHand, InvSlotType.Face,
|
||||
InvSlotType.Head, InvSlotType.Torso, InvSlotType.Legs, InvSlotType.LeftHand, InvSlotType.RightHand, InvSlotType.Face, InvSlotType.Card,
|
||||
InvSlotType.Any, InvSlotType.Any, InvSlotType.Any, InvSlotType.Any, InvSlotType.Any,
|
||||
InvSlotType.Any, InvSlotType.Any, InvSlotType.Any, InvSlotType.Any, InvSlotType.Any};
|
||||
|
||||
|
||||
@@ -119,9 +119,11 @@ namespace Barotrauma
|
||||
get { return prefab.Name; }
|
||||
}
|
||||
|
||||
private string description;
|
||||
public string Description
|
||||
{
|
||||
get { return prefab.Description; }
|
||||
get { return description == null ? prefab.Description : description; }
|
||||
set { description = value; }
|
||||
}
|
||||
|
||||
public float ImpactTolerance
|
||||
@@ -1458,6 +1460,7 @@ namespace Barotrauma
|
||||
if (GameMain.Server == null) return;
|
||||
|
||||
msg.Write(Prefab.Name);
|
||||
msg.Write(Description);
|
||||
msg.Write(ID);
|
||||
|
||||
if (ParentInventory == null || ParentInventory.Owner == null)
|
||||
@@ -1476,7 +1479,8 @@ namespace Barotrauma
|
||||
msg.Write(index < 0 ? (byte)255 : (byte)index);
|
||||
}
|
||||
|
||||
if (Name == "ID Card") msg.Write(Tags);
|
||||
//TODO: See if tags are different from their prefab before sending 'em
|
||||
msg.Write(Tags);
|
||||
}
|
||||
|
||||
public static Item ReadSpawnData(NetBuffer msg, bool spawn = true)
|
||||
@@ -1484,6 +1488,7 @@ namespace Barotrauma
|
||||
if (GameMain.Server != null) return null;
|
||||
|
||||
string itemName = msg.ReadString();
|
||||
string itemDesc = msg.ReadString();
|
||||
ushort itemId = msg.ReadUInt16();
|
||||
|
||||
ushort inventoryId = msg.ReadUInt16();
|
||||
@@ -1507,11 +1512,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
string tags = "";
|
||||
if (itemName == "ID Card")
|
||||
{
|
||||
tags = msg.ReadString();
|
||||
}
|
||||
string tags = msg.ReadString();
|
||||
|
||||
if (!spawn) return null;
|
||||
|
||||
@@ -1541,6 +1542,7 @@ namespace Barotrauma
|
||||
|
||||
var item = new Item(itemPrefab, pos, sub);
|
||||
|
||||
item.Description = itemDesc;
|
||||
item.ID = itemId;
|
||||
if (sub != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user