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:
Alex Noir
2017-12-14 22:57:42 +03:00
parent 58e98977df
commit 760452170e
10 changed files with 42 additions and 27 deletions

View File

@@ -39,7 +39,7 @@ namespace Barotrauma
case 3:
case 4:
SlotPositions[i] = new Vector2(
spacing * 2 + rectWidth + (spacing + rectWidth) * (i - 2),
spacing * 2 + rectWidth + (spacing + rectWidth) * (i - 1),
GameMain.GraphicsHeight - (spacing + rectHeight) * 3);
useOnSelfButton[i - 3] = new GUIButton(
@@ -52,16 +52,24 @@ namespace Barotrauma
break;
//face
case 5:
SlotPositions[i] = new Vector2(
spacing * 2 + rectWidth + (spacing + rectWidth) * (i - 5),
GameMain.GraphicsHeight - (spacing + rectHeight) * 3);
break;
//id card
case 6:
SlotPositions[i] = new Vector2(
spacing * 2 + rectWidth + (spacing + rectWidth) * (i - 5),
GameMain.GraphicsHeight - (spacing + rectHeight) * 3);
break;
default:
SlotPositions[i] = new Vector2(
spacing * 2 + rectWidth + (spacing + rectWidth) * ((i - 6) % 5),
GameMain.GraphicsHeight - (spacing + rectHeight) * ((i > 10) ? 2 : 1));
spacing * 2 + rectWidth + (spacing + rectWidth) * ((i - 7) % 5),
GameMain.GraphicsHeight - (spacing + rectHeight) * ((i > 11) ? 2 : 1));
break;
}
}
@@ -247,6 +255,13 @@ namespace Barotrauma
new Vector2(15.0f, 16.0f), Vector2.One,
SpriteEffects.None, 0.1f);
}
else if (i == 6)
{
spriteBatch.Draw(icons, new Vector2(slotRect.Center.X, slotRect.Center.Y),
new Rectangle(62, 36, 22, 18), Color.White * 0.7f, 0.0f,
new Vector2(11.0f, 9.0f), Vector2.One,
SpriteEffects.None, 0.1f);
}
}
base.Draw(spriteBatch);

View File

@@ -68,7 +68,7 @@
<Body radius="6" height="22" density="5"/>
<Holdable handle1="0,0" slots="RightHand,Any"/>
<Holdable handle1="0,0" slots="Any,RightHand,LeftHand"/>
</Item>
<Item
@@ -86,7 +86,7 @@
<Body radius="6" height="22" density="5"/>
<Holdable handle1="0,0" slots="RightHand,Any"/>
<Holdable handle1="0,0" slots="Any,RightHand,LeftHand"/>
</Item>

View File

@@ -116,7 +116,7 @@
<Body width="12" height="33" density="5"/>
<Holdable slots="RightHand,Any" holdpos="30,-15" handle1="0,5" handle2="0,-5">
<Holdable slots="Any,RightHand,LeftHand" holdpos="30,-15" handle1="0,5" handle2="0,-5">
<StatusEffect type="OnFire" target="This" Condition="-100.0" disabledeltatime="true">
<sound file="Content/Items/Reactor/explosion.ogg"/>
<Explosion range="250.0" structuredamage="15" damage="25" stun="5" force="3.0"/>

View File

@@ -10,8 +10,5 @@
<Body width="16" height="16" density="20"/>
<Pickable/>
</Item>
<Pickable slots="Card,Any"/>
</Item>

View File

@@ -8,7 +8,7 @@
<Skill name="Medical" level="10,30"/>
</Skills>
<Items>
<Item name="ID Card"/>
<Item name="ID Card" equip="true"/>
<Item name="Captain's Cap" equip="true"/>
<Item name="Captain's Jacket" equip="true"/>
<Item name="Captain's Trousers" equip="true"/>
@@ -30,7 +30,7 @@
<Skill name="Medical" level="10,20"/>
</Skills>
<Items>
<Item name="ID Card"/>
<Item name="ID Card" equip="true"/>
<Item name="Wrench"/>
<Item name="Screwdriver"/>
<Item name="Orange Jumpsuit" equip="true"/>
@@ -48,7 +48,7 @@
<Skill name="Medical" level="10,20"/>
</Skills>
<Items>
<Item name="ID Card"/>
<Item name="ID Card" equip="true"/>
<Item name="Wrench"/>
<Item name="Screwdriver"/>
<Item name="Blue Jumpsuit" equip="true"/>
@@ -66,7 +66,7 @@
<Skill name="Electrical Engineering" level="10,20"/>
</Skills>
<Items>
<Item name="ID Card"/>
<Item name="ID Card" equip="true"/>
<Item name="Stun Baton"/>
<Item name="Battery Cell"/>
<Item name="Handcuffs"/>
@@ -86,7 +86,7 @@
<Skill name="Medical" level="60,70"/>
</Skills>
<Items>
<Item name="ID Card"/>
<Item name="ID Card" equip="true"/>
<Item name="Doctor's Coat" equip="true"/>
<Item name="Doctor's Trousers" equip="true"/>
<Item name="Health Scanner HUD"/>
@@ -105,7 +105,7 @@
<Skill name="Medical" level="10,20"/>
</Skills>
<Items>
<Item name="ID Card"/>
<Item name="ID Card" equip="true"/>
<Item name="Wrench"/>
<Item name="Screwdriver"/>
<Item name="Headset" equip="true">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -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
{

View File

@@ -130,6 +130,7 @@ namespace Barotrauma
{
item.AddTag(s);
}
item.Description = "This belongs to " + character.Name + ", the " + Name + ".";
}
if (parentItem != null) parentItem.Combine(item);

View File

@@ -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};

View File

@@ -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)
{