Merge remote-tracking branch 'barotrauma/master' into new-netcode
# Conflicts: # Subsurface/Properties/AssemblyInfo.cs # Subsurface/Source/Characters/AI/EnemyAIController.cs # Subsurface/Source/Characters/AICharacter.cs # Subsurface/Source/Characters/Character.cs # Subsurface/Source/Items/Components/Signal/Connection.cs # Subsurface/Source/Items/Item.cs # Subsurface/Source/Map/Structure.cs # Subsurface/Source/Networking/GameClient.cs # Subsurface/Source/Networking/GameServer.cs # Subsurface/Source/Screens/NetLobbyScreen.cs
This commit is contained in:
@@ -117,8 +117,6 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
foreach (FabricableItem fi in fabricableItems)
|
||||
{
|
||||
Color color = ((itemList.CountChildren % 2) == 0) ? Color.Transparent : Color.Black * 0.3f;
|
||||
|
||||
GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 50), Color.Transparent, null, itemList)
|
||||
{
|
||||
UserData = fi,
|
||||
@@ -429,7 +427,7 @@ namespace Barotrauma.Items.Components
|
||||
ItemContainer container = item.GetComponent<ItemContainer>();
|
||||
foreach (Tuple<ItemPrefab, int> ip in fabricableItem.RequiredItems)
|
||||
{
|
||||
if (Array.FindAll(container.Inventory.Items, it => it != null && it.Prefab == ip.Item1).Count() < ip.Item2) return false;
|
||||
if (Array.FindAll(container.Inventory.Items, it => it != null && it.Prefab == ip.Item1).Length < ip.Item2) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -433,13 +433,12 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
IsActive = true;
|
||||
|
||||
int width = GuiFrame.Rect.Width, height = GuiFrame.Rect.Height;
|
||||
int x = GuiFrame.Rect.X;
|
||||
int y = GuiFrame.Rect.Y;
|
||||
|
||||
GuiFrame.Draw(spriteBatch);
|
||||
|
||||
float xOffset = (graphTimer / (float)updateGraphInterval);
|
||||
float xOffset = graphTimer / updateGraphInterval;
|
||||
|
||||
//GUI.DrawRectangle(spriteBatch, new Rectangle(x, y, width, height), Color.Black, true);
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
levelEndTickBox = new GUITickBox(
|
||||
new Rectangle(5, 90, 15, 15),
|
||||
GameMain.GameSession == null ? "" : ToolBox.LimitString(GameMain.GameSession.StartLocation.Name, 20),
|
||||
GameMain.GameSession == null ? "" : ToolBox.LimitString(GameMain.GameSession.EndLocation.Name, 20),
|
||||
Alignment.TopLeft, GUI.SmallFont, GuiFrame);
|
||||
levelEndTickBox.Enabled = false;
|
||||
levelEndTickBox.OnSelected = SelectDestination;
|
||||
|
||||
@@ -108,9 +108,7 @@ namespace Barotrauma.Items.Components
|
||||
connectedList.Add(this);
|
||||
|
||||
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
|
||||
|
||||
List<Connection> alreadyChecked = new List<Connection>();
|
||||
|
||||
|
||||
List<Connection> connections = item.Connections;
|
||||
if (connections == null) return;
|
||||
|
||||
@@ -151,8 +149,6 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
fullPower += powerContainer.CurrPowerOutput;
|
||||
}
|
||||
|
||||
alreadyChecked.Add(recipient);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
List<Body>ropeList = PathManager.EvenlyDistributeShapesAlongPath(GameMain.World, ropePath, shape, BodyType.Dynamic, (int)(length/sectionLength));
|
||||
|
||||
ropeBodies = new PhysicsBody[ropeList.Count()];
|
||||
ropeBodies = new PhysicsBody[ropeList.Count];
|
||||
for (int i = 0; i<ropeBodies.Length; i++)
|
||||
{
|
||||
ropeList[i].Mass = 0.01f;
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
private static Texture2D panelTexture;
|
||||
private static Sprite connector;
|
||||
private static Sprite wireCorner, wireVertical, wireHorizontal;
|
||||
private static Sprite wireVertical;
|
||||
|
||||
//how many wires can be linked to a single connector
|
||||
public const int MaxLinked = 5;
|
||||
@@ -67,9 +67,7 @@ namespace Barotrauma.Items.Components
|
||||
connector = new Sprite(panelTexture, new Rectangle(470, 102, 19,43), Vector2.Zero, 0.0f);
|
||||
connector.Origin = new Vector2(9.5f, 10.0f);
|
||||
|
||||
wireCorner = new Sprite(panelTexture, new Rectangle(448, 0, 64, 64), new Vector2(-32.0f, -32.0f), 0.0f);
|
||||
wireVertical = new Sprite(panelTexture, new Rectangle(408, 1, 11, 102), Vector2.Zero, 0.0f);
|
||||
wireHorizontal = new Sprite(panelTexture, new Rectangle(496, 64, 16, 16), new Vector2(-8.0f, -8.0f), 0.0f);
|
||||
}
|
||||
|
||||
this.item = item;
|
||||
@@ -242,9 +240,7 @@ namespace Barotrauma.Items.Components
|
||||
Vector2 leftWirePos = new Vector2(x+5, y + 30);
|
||||
|
||||
int wireInterval = (height - 20) / Math.Max(totalWireCount,1);
|
||||
|
||||
float rightWireX = x + width;
|
||||
float leftWireX = x;
|
||||
|
||||
foreach (Connection c in panel.Connections)
|
||||
{
|
||||
//if dragging a wire, let the Inventory know so that the wire can be
|
||||
@@ -284,6 +280,18 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
if (draggingConnected != null)
|
||||
{
|
||||
DrawWire(spriteBatch, draggingConnected, draggingConnected.Item, PlayerInput.MousePosition, new Vector2(x + width / 2, y + height), mouseInRect, false);
|
||||
|
||||
if (!PlayerInput.LeftButtonHeld())
|
||||
{
|
||||
panel.Item.NewComponentEvent(panel, true, true);
|
||||
//draggingConnected.Drop(Character);
|
||||
draggingConnected = null;
|
||||
}
|
||||
}
|
||||
|
||||
//if the Character using the panel has a wire item equipped
|
||||
//and the wire hasn't been connected yet, draw it on the panel
|
||||
if (equippedWire!=null)
|
||||
|
||||
@@ -211,10 +211,11 @@ namespace Barotrauma.Items.Components
|
||||
if (connections[0] != null && connections[0].Item.Submarine != null) sub = connections[0].Item.Submarine;
|
||||
if (connections[1] != null && connections[1].Item.Submarine != null) sub = connections[1].Item.Submarine;
|
||||
|
||||
if (item.Submarine != null && item.Submarine != sub)
|
||||
if (item.Submarine != sub)
|
||||
{
|
||||
ClearConnections();
|
||||
Nodes.Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
newNodePos = RoundNode(item.Position, item.CurrentHull) - sub.HiddenSubPosition;
|
||||
@@ -480,8 +481,8 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
if (Nodes == null || Nodes.Count == 0) return componentElement;
|
||||
|
||||
string[] nodeCoords = new string[Nodes.Count() * 2];
|
||||
for (int i = 0; i < Nodes.Count(); i++)
|
||||
string[] nodeCoords = new string[Nodes.Count * 2];
|
||||
for (int i = 0; i < Nodes.Count; i++)
|
||||
{
|
||||
nodeCoords[i * 2] = Nodes[i].X.ToString(CultureInfo.InvariantCulture);
|
||||
nodeCoords[i * 2 + 1] = Nodes[i].Y.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Barotrauma.Items.Components
|
||||
this.item = item;
|
||||
|
||||
var sprites = element.Elements().Where(x => x.Name.ToString() == "sprite").ToList();
|
||||
int spriteCount = sprites.Count();
|
||||
int spriteCount = sprites.Count;
|
||||
wearableSprites = new WearableSprite[spriteCount];
|
||||
limbType = new LimbType[spriteCount];
|
||||
limb = new Limb[spriteCount];
|
||||
@@ -171,19 +171,10 @@ namespace Barotrauma.Items.Components
|
||||
base.Update(deltaTime, cam);
|
||||
|
||||
item.SetTransform(picker.SimPosition, 0.0f);
|
||||
|
||||
Item[] containedItems = item.ContainedItems;
|
||||
|
||||
|
||||
ApplyStatusEffects(ActionType.OnWearing, deltaTime, picker);
|
||||
|
||||
PlaySound(ActionType.OnWearing, picker.WorldPosition);
|
||||
|
||||
//if (containedItems == null) return;
|
||||
//for (int j = 0; j < containedItems.Length; j++)
|
||||
//{
|
||||
// if (containedItems[j] == null) continue;
|
||||
// containedItems[j].ApplyStatusEffects(ActionType.OnWearing, deltaTime, picker);
|
||||
//}
|
||||
}
|
||||
|
||||
protected override void RemoveComponentSpecific()
|
||||
|
||||
Reference in New Issue
Block a user