- items can be equipped/unequipped by double clicking
- items inside the respawn shuttle - using the teleport method when moving a character into or out from a sub - removing dropped items from the respawn shuttle when respawning
This commit is contained in:
@@ -586,18 +586,18 @@ namespace Barotrauma
|
||||
|
||||
if (Gap.FindAdjacent(currentHull.ConnectedGaps, findPos, 150.0f) != null) return;
|
||||
|
||||
Teleport(ConvertUnits.ToSimUnits(currentHull.Submarine.Position), currentHull.Submarine.Velocity, true);
|
||||
Teleport(ConvertUnits.ToSimUnits(currentHull.Submarine.Position), currentHull.Submarine.Velocity);
|
||||
}
|
||||
//out -> in
|
||||
else if (currentHull == null && newHull.Submarine != null)
|
||||
{
|
||||
Teleport(-ConvertUnits.ToSimUnits(newHull.Submarine.Position), -newHull.Submarine.Velocity, false);
|
||||
Teleport(-ConvertUnits.ToSimUnits(newHull.Submarine.Position), -newHull.Submarine.Velocity);
|
||||
}
|
||||
//from one sub to another
|
||||
else if (newHull != null && currentHull != null && newHull.Submarine != currentHull.Submarine)
|
||||
{
|
||||
Teleport(ConvertUnits.ToSimUnits(currentHull.Submarine.Position - newHull.Submarine.Position),
|
||||
Vector2.Zero, false);
|
||||
Vector2.Zero);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -608,7 +608,7 @@ namespace Barotrauma
|
||||
UpdateCollisionCategories();
|
||||
}
|
||||
|
||||
private void Teleport(Vector2 moveAmount, Vector2 velocityChange, bool inToOut)
|
||||
public void Teleport(Vector2 moveAmount, Vector2 velocityChange)
|
||||
{
|
||||
foreach (Limb limb in Limbs)
|
||||
{
|
||||
|
||||
@@ -1782,6 +1782,11 @@ namespace Barotrauma
|
||||
pos.X = message.ReadFloat();
|
||||
pos.Y = message.ReadFloat();
|
||||
|
||||
if (inSub != (Submarine != null))
|
||||
{
|
||||
AnimController.Teleport(pos - SimPosition, Vector2.Zero);
|
||||
}
|
||||
|
||||
if (inSub)
|
||||
{
|
||||
//AnimController.FindHull(ConvertUnits.ToDisplayUnits(pos) - Submarine.Loaded.WorldPosition);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
@@ -81,7 +82,7 @@ namespace Barotrauma
|
||||
default:
|
||||
SlotPositions[i] = new Vector2(
|
||||
spacing * 2 + rectWidth + (spacing + rectWidth) * ((i - 6)%5),
|
||||
GameMain.GraphicsHeight - (spacing + rectHeight) * ((i>10) ? 2 : 1));
|
||||
GameMain.GraphicsHeight - (spacing + rectHeight) * ((i>10) ? 1 : 2));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -143,7 +144,7 @@ namespace Barotrauma
|
||||
/// </summary>
|
||||
public override bool TryPutItem(Item item, List<InvSlotType> allowedSlots = null, bool createNetworkEvent = true)
|
||||
{
|
||||
if (allowedSlots == null) return false;
|
||||
if (allowedSlots == null || ! allowedSlots.Any()) return false;
|
||||
|
||||
//try to place the item in LimBlot.Any slot if that's allowed
|
||||
if (allowedSlots.Contains(InvSlotType.Any))
|
||||
@@ -303,6 +304,19 @@ namespace Barotrauma
|
||||
{
|
||||
character.SelectedCharacter.Inventory.TryPutItem(doubleClickedItem, doubleClickedItem.AllowedSlots, true);
|
||||
}
|
||||
else //doubleclicked and no other inventory is selected
|
||||
{
|
||||
//not equipped -> attempt to equip
|
||||
if (IsInLimbSlot(doubleClickedItem, InvSlotType.Any))
|
||||
{
|
||||
TryPutItem(doubleClickedItem, doubleClickedItem.AllowedSlots.FindAll(i => i != InvSlotType.Any), true);
|
||||
}
|
||||
//equipped -> attempt to unequip
|
||||
else if (doubleClickedItem.AllowedSlots.Contains(InvSlotType.Any))
|
||||
{
|
||||
TryPutItem(doubleClickedItem, new List<InvSlotType>() { InvSlotType.Any }, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -314,6 +314,16 @@ namespace Barotrauma.Networking
|
||||
shuttleTransportTimer = maxTransportTime;
|
||||
shuttleReturnTimer = maxTransportTime;
|
||||
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
if (item.Submarine != respawnShuttle) continue;
|
||||
|
||||
if (item.body != null && item.body.Enabled && item.ParentInventory == null)
|
||||
{
|
||||
Item.Remover.QueueItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Structure wall in Structure.WallList)
|
||||
{
|
||||
if (wall.Submarine != respawnShuttle) continue;
|
||||
@@ -397,7 +407,7 @@ namespace Barotrauma.Networking
|
||||
var divingSuit = new Item(divingSuitPrefab, pos, respawnShuttle);
|
||||
var oxyTank = new Item(oxyPrefab, pos, respawnShuttle);
|
||||
|
||||
oxyTank.Combine(divingSuit);
|
||||
divingSuit.Combine(oxyTank);
|
||||
|
||||
spawnedItems.Add(divingSuit);
|
||||
spawnedItems.Add(oxyTank);
|
||||
|
||||
Reference in New Issue
Block a user