Dockingport power wire is connected to a free wire slot instead of the last slot, submarines above the top of the level (i.e. respawn shuttle) aren't shown on sonar, underwater scooter for each respawned player

This commit is contained in:
Regalis
2016-08-13 21:35:52 +03:00
parent fbe6c91d67
commit 0602bb6154
9 changed files with 34 additions and 15 deletions
+1 -1
View File
@@ -168,7 +168,7 @@ namespace Launcher2
displayModeDD.SelectItem(settings.WindowMode); displayModeDD.SelectItem(settings.WindowMode);
displayModeDD.OnSelected = (guiComponent) => { settings.WindowMode = (WindowMode)guiComponent.UserData; return true; }; displayModeDD.OnSelected = (guiComponent, userData) => { settings.WindowMode = (WindowMode)guiComponent.UserData; return true; };
//var fullScreenTick = new GUITickBox(new Rectangle(x,y+150,20,20), "Fullscreen", Alignment.TopLeft, guiRoot); //var fullScreenTick = new GUITickBox(new Rectangle(x,y+150,20,20), "Fullscreen", Alignment.TopLeft, guiRoot);
//fullScreenTick.OnSelected = ToggleFullScreen; //fullScreenTick.OnSelected = ToggleFullScreen;
@@ -252,9 +252,10 @@ namespace Barotrauma.Items.Components
wire.RemoveConnection(item); wire.RemoveConnection(item);
wire.RemoveConnection(dockingTarget.item); wire.RemoveConnection(dockingTarget.item);
powerConnection.AddLink(4, wire);
powerConnection.TryAddLink(wire);
wire.Connect(powerConnection, false); wire.Connect(powerConnection, false);
recipient.AddLink(4, wire); recipient.TryAddLink(wire);
wire.Connect(recipient, false); wire.Connect(recipient, false);
} }
@@ -282,6 +282,7 @@ namespace Barotrauma.Items.Components
foreach (Submarine sub in Submarine.Loaded) foreach (Submarine sub in Submarine.Loaded)
{ {
if (item.Submarine == sub || sub.DockedTo.Contains(item.Submarine)) continue; if (item.Submarine == sub || sub.DockedTo.Contains(item.Submarine)) continue;
if (sub.WorldPosition.Y > Level.Loaded.Size.Y) continue;
DrawMarker(spriteBatch, sub.Name, sub.WorldPosition - item.WorldPosition, displayScale, center, (rect.Width * 0.45f)); DrawMarker(spriteBatch, sub.Name, sub.WorldPosition - item.WorldPosition, displayScale, center, (rect.Width * 0.45f));
} }
@@ -140,10 +140,21 @@ namespace Barotrauma.Items.Components
return -1; return -1;
} }
public void TryAddLink(Wire wire)
{
for (int i = 0; i < MaxLinked; i++)
{
if (Wires[i] == null)
{
Wires[i] = wire;
UpdateRecipients();
return;
}
}
}
public void AddLink(int index, Wire wire) public void AddLink(int index, Wire wire)
{ {
//linked[index] = connectedItem;
//recipient[index] = otherConnection;
Wires[index] = wire; Wires[index] = wire;
UpdateRecipients(); UpdateRecipients();
} }
@@ -459,6 +470,7 @@ namespace Barotrauma.Items.Components
{ {
if (wireId == null) return; if (wireId == null) return;
for (int i = 0; i < MaxLinked; i++) for (int i = 0; i < MaxLinked; i++)
{ {
if (wireId[i] == 0) continue; if (wireId[i] == 0) continue;
@@ -186,7 +186,9 @@ namespace Barotrauma
Vector2.Zero, Vector2.Zero,
SpriteEffects.None, 0.0f); SpriteEffects.None, 0.0f);
GUI.DrawRectangle(spriteBatch, new Rectangle((int)(MathUtils.Round(pos.X, 512.0f)), (int)-GameMain.GameScreen.Cam.WorldView.Y, width, (int)(GameMain.GameScreen.Cam.WorldView.Y - level.Size.Y)), Color.Black, true ); GUI.DrawRectangle(spriteBatch,
new Rectangle((int)(MathUtils.Round(pos.X, 512.0f)), (int)-GameMain.GameScreen.Cam.WorldView.Y, width, (int)(GameMain.GameScreen.Cam.WorldView.Y - level.Size.Y)+10),
Color.Black, true );
//background.DrawTiled(spriteBatch, //background.DrawTiled(spriteBatch,
// (backgroundPos.Y < 0) ? new Vector2(0.0f, -backgroundPos.Y) : Vector2.Zero, // (backgroundPos.Y < 0) ? new Vector2(0.0f, -backgroundPos.Y) : Vector2.Zero,
@@ -182,7 +182,7 @@ namespace Barotrauma.Networking
private void UpdateTransporting(float deltaTime) private void UpdateTransporting(float deltaTime)
{ {
//shuttleTransportTimer -= deltaTime; shuttleTransportTimer -= deltaTime;
if (shuttleReturnTimer + deltaTime > 15.0f && shuttleReturnTimer <= 15.0f && if (shuttleReturnTimer + deltaTime > 15.0f && shuttleReturnTimer <= 15.0f &&
networkMember.Character != null && networkMember.Character != null &&
@@ -401,7 +401,8 @@ namespace Barotrauma.Networking
var waypoints = WayPoint.SelectCrewSpawnPoints(characterInfos, respawnShuttle); var waypoints = WayPoint.SelectCrewSpawnPoints(characterInfos, respawnShuttle);
ItemPrefab divingSuitPrefab = ItemPrefab.list.Find(ip => ip.Name == "Diving Suit") as ItemPrefab; ItemPrefab divingSuitPrefab = ItemPrefab.list.Find(ip => ip.Name == "Diving Suit") as ItemPrefab;
ItemPrefab oxyPrefab = ItemPrefab.list.Find(ip => ip.Name == "Oxygen Tank") as ItemPrefab; ItemPrefab oxyPrefab = ItemPrefab.list.Find(ip => ip.Name == "Oxygen Tank") as ItemPrefab;
ItemPrefab scooterPrefab = ItemPrefab.list.Find(ip => ip.Name == "Underwater Scooter") as ItemPrefab;
var cargoSp = WayPoint.WayPointList.Find(wp => wp.Submarine == respawnShuttle && wp.SpawnType == SpawnType.Cargo); var cargoSp = WayPoint.WayPointList.Find(wp => wp.Submarine == respawnShuttle && wp.SpawnType == SpawnType.Cargo);
@@ -428,25 +429,25 @@ namespace Barotrauma.Networking
{ {
Vector2 pos = cargoSp == null ? character.Position : cargoSp.Position; Vector2 pos = cargoSp == null ? character.Position : cargoSp.Position;
var divingSuit = new Item(divingSuitPrefab, pos, respawnShuttle); var divingSuit = new Item(divingSuitPrefab, pos, respawnShuttle);
var oxyTank = new Item(oxyPrefab, pos, respawnShuttle); var oxyTank = new Item(oxyPrefab, pos, respawnShuttle);
var scooter = new Item(scooterPrefab, pos, respawnShuttle);
divingSuit.Combine(oxyTank); divingSuit.Combine(oxyTank);
spawnedItems.Add(divingSuit); spawnedItems.Add(divingSuit);
spawnedItems.Add(oxyTank); spawnedItems.Add(oxyTank);
spawnedItems.Add(scooter);
Item.Spawner.AddToSpawnedList(divingSuit); Item.Spawner.AddToSpawnedList(divingSuit);
Item.Spawner.AddToSpawnedList(oxyTank); Item.Spawner.AddToSpawnedList(oxyTank);
Item.Spawner.AddToSpawnedList(scooter);
} }
character.GiveJobItems(waypoints[i]); character.GiveJobItems(waypoints[i]);
GameMain.GameSession.CrewManager.characters.Add(character); GameMain.GameSession.CrewManager.characters.Add(character);
} }
server.SendRespawnManagerMsg(spawnedCharacters, spawnedItems); server.SendRespawnManagerMsg(spawnedCharacters, spawnedItems);
} }
@@ -465,6 +465,7 @@ namespace Barotrauma
{ {
var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "Shuttle", GUI.Style, Alignment.Left, Alignment.CenterY | Alignment.Right, textBlock, false, GUI.SmallFont); var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "Shuttle", GUI.Style, Alignment.Left, Alignment.CenterY | Alignment.Right, textBlock, false, GUI.SmallFont);
shuttleText.TextColor = textBlock.TextColor * 0.8f; shuttleText.TextColor = textBlock.TextColor * 0.8f;
shuttleText.ToolTip = textBlock.ToolTip;
} }
} }
@@ -112,6 +112,7 @@ namespace Barotrauma
var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "Shuttle", GUI.Style, Alignment.Left, Alignment.CenterY | Alignment.Right, textBlock, false, GUI.SmallFont); var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "Shuttle", GUI.Style, Alignment.Left, Alignment.CenterY | Alignment.Right, textBlock, false, GUI.SmallFont);
shuttleText.TextColor = textBlock.TextColor * 0.8f; shuttleText.TextColor = textBlock.TextColor * 0.8f;
shuttleText.ToolTip = textBlock.ToolTip;
} }
} }
if (Submarine.SavedSubmarines.Count > 0) subList.Select(Submarine.SavedSubmarines[0]); if (Submarine.SavedSubmarines.Count > 0) subList.Select(Submarine.SavedSubmarines[0]);
+1 -1
View File
@@ -687,11 +687,11 @@ namespace Barotrauma
} }
} }
if (sub.HasTag(SubmarineTag.Shuttle)) if (sub.HasTag(SubmarineTag.Shuttle))
{ {
var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "Shuttle", GUI.Style, Alignment.Left, Alignment.CenterY | Alignment.Right, subTextBlock, false, GUI.SmallFont); var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "Shuttle", GUI.Style, Alignment.Left, Alignment.CenterY | Alignment.Right, subTextBlock, false, GUI.SmallFont);
shuttleText.TextColor = subTextBlock.TextColor * 0.8f; shuttleText.TextColor = subTextBlock.TextColor * 0.8f;
shuttleText.ToolTip = subTextBlock.ToolTip;
} }
} }