More easily readable netstats (B/kB/MB instead of just B), scrollable netstats client list, possible to wear multiple items in same limb, handcuffs
This commit is contained in:
@@ -210,7 +210,7 @@ namespace Barotrauma
|
||||
return TryPutItem(item, new List<LimbSlot>() {placeToSlots}, createNetworkEvent);
|
||||
}
|
||||
|
||||
public void DrawOwn(SpriteBatch spriteBatch)
|
||||
public void DrawOwn(SpriteBatch spriteBatch, Vector2 offset)
|
||||
{
|
||||
string toolTip = "";
|
||||
Rectangle highlightedSlot = Rectangle.Empty;
|
||||
@@ -227,8 +227,8 @@ namespace Barotrauma
|
||||
|
||||
for (int i = 0; i < capacity; i++)
|
||||
{
|
||||
slotRect.X = (int)SlotPositions[i].X;
|
||||
slotRect.Y = (int)SlotPositions[i].Y;
|
||||
slotRect.X = (int)(SlotPositions[i].X + offset.X);
|
||||
slotRect.Y = (int)(SlotPositions[i].Y + offset.Y);
|
||||
|
||||
if (i==1) //head
|
||||
{
|
||||
@@ -248,8 +248,8 @@ namespace Barotrauma
|
||||
|
||||
for (int i = 0; i < capacity; i++)
|
||||
{
|
||||
slotRect.X = (int)SlotPositions[i].X;
|
||||
slotRect.Y = (int)SlotPositions[i].Y;
|
||||
slotRect.X = (int)(SlotPositions[i].X + offset.X);
|
||||
slotRect.Y = (int)(SlotPositions[i].Y + offset.Y);
|
||||
|
||||
bool multiSlot = false;
|
||||
//skip if the item is in multiple slots
|
||||
@@ -295,8 +295,8 @@ namespace Barotrauma
|
||||
//check if the item is in multiple slots
|
||||
if (Items[i] != null)
|
||||
{
|
||||
slotRect.X = (int)SlotPositions[i].X;
|
||||
slotRect.Y = (int)SlotPositions[i].Y;
|
||||
slotRect.X = (int)(SlotPositions[i].X + offset.X);
|
||||
slotRect.Y = (int)(SlotPositions[i].Y + offset.Y);
|
||||
slotRect.Width = 40;
|
||||
slotRect.Height = 40;
|
||||
|
||||
@@ -310,7 +310,7 @@ namespace Barotrauma
|
||||
{
|
||||
multiSlot = true;
|
||||
slotRect = Rectangle.Union(
|
||||
new Rectangle((int)SlotPositions[n].X, (int)SlotPositions[n].Y, rectWidth, rectHeight), slotRect);
|
||||
new Rectangle((int)(SlotPositions[n].X+offset.X), (int)(SlotPositions[n].Y+offset.Y), rectWidth, rectHeight), slotRect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
foreach (Limb limb in character.AnimController.Limbs)
|
||||
{
|
||||
if (limb.WearingItem==null || limb.WearingItem.Item != item) continue;
|
||||
if (limb.WearingItems.Find(w => w.WearableComponent.Item != this.item)==null) continue;
|
||||
|
||||
limb.body.ApplyForce(propulsion);
|
||||
}
|
||||
|
||||
@@ -12,8 +12,11 @@ namespace Barotrauma.Items.Components
|
||||
public bool HideLimb;
|
||||
public LimbType DepthLimb;
|
||||
|
||||
public WearableSprite(Sprite sprite, bool hideLimb, LimbType depthLimb = LimbType.None)
|
||||
public Wearable WearableComponent;
|
||||
|
||||
public WearableSprite(Wearable item, Sprite sprite, bool hideLimb, LimbType depthLimb = LimbType.None)
|
||||
{
|
||||
WearableComponent = item;
|
||||
Sprite = sprite;
|
||||
HideLimb = hideLimb;
|
||||
|
||||
@@ -85,7 +88,7 @@ namespace Barotrauma.Items.Components
|
||||
spritePath = Path.GetDirectoryName( item.Prefab.ConfigFile)+"/"+spritePath;
|
||||
|
||||
var sprite = new Sprite(subElement, "", spritePath);
|
||||
wearableSprites[i] = new WearableSprite(sprite, ToolBox.GetAttributeBool(subElement, "hidelimb", false),
|
||||
wearableSprites[i] = new WearableSprite(this, sprite, ToolBox.GetAttributeBool(subElement, "hidelimb", false),
|
||||
(LimbType)Enum.Parse(typeof(LimbType),
|
||||
ToolBox.GetAttributeString(subElement, "depthlimb", "None"), true));
|
||||
|
||||
@@ -105,10 +108,10 @@ namespace Barotrauma.Items.Components
|
||||
if (equipLimb == null) continue;
|
||||
|
||||
//something is already on the limb -> unequip it
|
||||
if (equipLimb.WearingItem != null && equipLimb.WearingItem != this)
|
||||
{
|
||||
equipLimb.WearingItem.Unequip(character);
|
||||
}
|
||||
//if (equipLimb.WearingItem != null && equipLimb.WearingItem != this)
|
||||
//{
|
||||
// equipLimb.WearingItem.Unequip(character);
|
||||
//}
|
||||
|
||||
//sprite[i].Depth = equipLimb.sprite.Depth - 0.001f;
|
||||
|
||||
@@ -117,8 +120,7 @@ namespace Barotrauma.Items.Components
|
||||
IsActive = true;
|
||||
|
||||
limb[i] = equipLimb;
|
||||
equipLimb.WearingItem = this;
|
||||
equipLimb.WearingItemSprite = wearableSprites[i];
|
||||
equipLimb.WearingItems.Add(wearableSprites[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,11 +142,20 @@ namespace Barotrauma.Items.Components
|
||||
Limb equipLimb = character.AnimController.GetLimb(limbType[i]);
|
||||
if (equipLimb == null) continue;
|
||||
|
||||
if (equipLimb.WearingItem != this) continue;
|
||||
//foreach (WearableSprite wearable in equipLimb.WearingItems)
|
||||
//{
|
||||
// if (wearable != wearableSprites[i]) continue;
|
||||
|
||||
// equipLimb.WearingItems.Remove(wearableSprites[i]);
|
||||
//}
|
||||
|
||||
equipLimb.WearingItems.RemoveAll(w=> w!=null && w==wearableSprites[i]);
|
||||
|
||||
//if (equipLimb.WearingItem != this) continue;
|
||||
|
||||
limb[i] = null;
|
||||
equipLimb.WearingItem = null;
|
||||
equipLimb.WearingItemSprite = null;
|
||||
//equipLimb.WearingItem = null;
|
||||
//equipLimb.WearingItemSprite = null;
|
||||
}
|
||||
|
||||
IsActive = false;
|
||||
|
||||
Reference in New Issue
Block a user