1ec6577...e08c5e7

commit e08c5e722fdff38d408428d138919bb8ea90321b
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Tue Feb 5 11:13:25 2019 +0200

    Changed default radio chat keybind to T. OemTilde works as an apostrophe on some keyboard layouts, making it difficult to type in chat messages without deselecting the chatbox. Closes #1044

commit e0ca9ffebe06b3f711b28a3ccfd486d84c47f9b0
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Tue Feb 5 11:03:14 2019 +0200

    Fixed content package compatibility check. Closes #1059

commit f54bc180e8aef383cf9c893cd44c103840c066ac
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Tue Feb 5 10:48:03 2019 +0200

    Remove the spacing from the crew selection listbox and disable focusing from the background. An alternative fix for #1039.

commit d037815054ecc8269b0af3297700d2b98e1e5bc5
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Tue Feb 5 10:40:52 2019 +0200

    Enforce vsync during the splash screen. Should fix the crashes due to insufficient memory mentioned in #1060. Does not fix the issue on releasing the used video resources.

commit 90f1d8fe168356ba3c797c0c58fadea2aff57458
Author: ezjamsen <ezjames.fi@gmail.com>
Date:   Mon Feb 4 23:05:54 2019 +0200

    small updates to subs

commit 56dbdf6ea6e8e14035f943eb232eed7aa250f8f6
Author: ezjamsen <ezjames.fi@gmail.com>
Date:   Mon Feb 4 23:05:26 2019 +0200

    adjusted default deterioration values on prefabs

commit eaa4818cb63d52e1af519c8ca5c4f01f20143cb2
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Mon Feb 4 21:59:03 2019 +0200

    Fixed servers occasionally starting the round multiple times when automatically starting the game via autorestart or clients being ready. Happened because "initiatedStartGame" (which prevents starting the round again) was not set until the InitiateStartGame coroutine is run for the first time, causing the automatic restart logic to run one extra time. Closes #1056

commit afd83b6ef40333a95e5eeec400d5f981cbdb1889
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Mon Feb 4 21:36:35 2019 +0200

    Fixed some typos in affliction & mission descriptions. Closes #1057

commit feb97628582a9a22f0660a8ab2798f8e03fe8fc9
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Mon Feb 4 18:29:40 2019 +0200

    Fixes to Level.TryGetInterestingPosition. Should fix monsters spawning very close to the sub in some levels (see #1054).
    - Ignore outposts when determining which positions are far enough from the sub.
    - If no position far enough from the sub is found, use the furthest one instead of choosing randomly.

commit 62e5d7b229f334a5cf15cedf22e6795f18d637b9
Merge: 6ffc90da6 73f3dd060
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Mon Feb 4 18:03:44 2019 +0200

    Merge branch 'dev' of https://github.com/Regalis11/Barotrauma into dev

commit 6ffc90da69d9a5db146435054fdbb2cb18d855be
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Mon Feb 4 18:03:26 2019 +0200

    Allow to focus on the crew selection listbox to enable scrolling when the mouse cursor is not over a content element, but is inside the listbox. Another option would be to remove the spacing from the listbox. Fixes #1039.

commit 73f3dd060ef208199941cb74a72dcda6a7c15f41
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Mon Feb 4 18:00:57 2019 +0200

    Fixed compiler error in GameServer.ClientWriteIngame

commit 131263490c7093dd526a84757f4edd096a213a74
Merge: 637668488 9753e46a5
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Mon Feb 4 17:55:39 2019 +0200

    Merge branch 'dev' of https://github.com/Regalis11/Barotrauma into dev

commit 637668488b27954afa0a8485eeaa3b23cf9461c5
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Mon Feb 4 17:55:01 2019 +0200

    Changed character culling logic a bit. The characters need to be 22,000 units away from the players to be disabled, and won't be re-enabled until they're within 20,000 units. Using 20,000 as the threshold for both caused characters to be constantly toggled on/off when they're around the maximum distance, which caused ContactManager to constantly have to update contacts.

commit 9753e46a5694b7b3c2bd0c4c006e2c1856c6eddb
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Mon Feb 4 17:54:35 2019 +0200

    Add a debug command for adding more money in the compaign mode.

commit f8a7179d6f8cb7c834b91b942722b1ae05417316
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Mon Feb 4 17:53:03 2019 +0200

    Always disallow zooming when the cursor is over a gui element.

commit eefd956c50650be906acbd10662e24507e48cb83
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Mon Feb 4 17:47:18 2019 +0200

    Don't display outpost markers on the sonar (the ending and starting positions of the level are displayed, no need to show an additional marker on the "outpost submarine").

commit c7883bafc634e0ac2603bc96a87433da0c3481df
Author: ezjamsen <ezjames.fi@gmail.com>
Date:   Mon Feb 4 17:21:50 2019 +0200

    removed references to medical syringes
This commit is contained in:
Joonas Rikkonen
2019-03-18 21:12:02 +02:00
parent d4c8fd5649
commit 74086415fc
22 changed files with 135 additions and 44 deletions

View File

@@ -264,7 +264,7 @@ namespace Barotrauma
}
}
if (allowZoom)
if (allowZoom && GUI.MouseOn == null)
{
Vector2 mouseInWorld = ScreenToWorld(PlayerInput.MousePosition);
Vector2 diffViewCenter;

View File

@@ -201,8 +201,15 @@ namespace Barotrauma
#if !(LINUX || OSX)
private void DrawSplashScreen(SpriteBatch spriteBatch)
{
bool vsync = GameMain.Config.VSyncEnabled;
if (videoPlayer == null)
{
// Enforce the vsync so that the video player doesn't eat all the vram
if (!GameMain.Config.VSyncEnabled)
{
GameMain.Config.VSyncEnabled = true;
GameMain.Instance.ApplyGraphicsSettings();
}
videoPlayer = new VideoPlayer();
videoPlayer.Play(splashScreenVideo);
videoPlayer.Volume = GameMain.Config.SoundVolume;
@@ -218,6 +225,12 @@ namespace Barotrauma
splashScreenVideo.Dispose();
splashScreenVideo = null;
// If the vsync was enforced, restore the user preference
if (GameMain.Config.VSyncEnabled != vsync)
{
GameMain.Config.VSyncEnabled = vsync;
GameMain.Instance.ApplyGraphicsSettings();
}
}
else
{
@@ -232,7 +245,6 @@ namespace Barotrauma
videoPlayer.Stop();
}
}
}
}
#endif

View File

@@ -106,7 +106,7 @@ namespace Barotrauma
characterListBox = new GUIListBox(new RectTransform(new Point(100, (int)(crewArea.Rect.Height - scrollButtonSize.Y * 1.6f)), crewArea.RectTransform, Anchor.CenterLeft), false, Color.Transparent, null)
{
Spacing = (int)(3 * GUI.Scale),
//Spacing = (int)(3 * GUI.Scale),
ScrollBarEnabled = false,
ScrollBarVisible = false,
CanBeFocused = false

View File

@@ -455,14 +455,14 @@ namespace Barotrauma.Items.Components
foreach (Submarine sub in Submarine.Loaded)
{
if (!sub.OnSonar) continue;
if (!sub.ShowSonarMarker) { continue; }
if (UseTransducers ?
connectedTransducers.Any(t => sub == t.Transducer.Item.Submarine || sub.DockedTo.Contains(t.Transducer.Item.Submarine)) :
(sub == item.Submarine || sub.DockedTo.Contains(item.Submarine)))
{
continue;
}
if (sub.WorldPosition.Y > Level.Loaded.Size.Y) continue;
if (sub.WorldPosition.Y > Level.Loaded.Size.Y) { continue; }
DrawMarker(spriteBatch, sub.Name, sub.WorldPosition - transducerCenter, displayScale, center, (rect.Width * 0.45f));
}

View File

@@ -1173,6 +1173,15 @@ namespace Barotrauma.Networking
ConnectedClients.RemoveAt(i);
}
}
//remove clients that aren't present anymore
for (int i = ConnectedClients.Count - 1; i >= 0; i--)
{
if (!currentClients.Contains(ConnectedClients[i]))
{
GameMain.NetLobbyScreen.RemovePlayer(ConnectedClients[i].Name);
ConnectedClients.RemoveAt(i);
}
}
Voting.AllowSubVoting = allowSubVoting;
Voting.AllowModeVoting = allowModeVoting;

View File

@@ -237,6 +237,7 @@ namespace Barotrauma.Networking
public bool StartGameClicked(GUIButton button, object obj)
{
if (initiatedStartGame || gameStarted) { return false; }
return StartGame();
}
}

View File

@@ -417,7 +417,7 @@ namespace Barotrauma
GameMain.World.Step((float)deltaTime);
}
// Camera
Cam.MoveCamera((float)deltaTime, allowMove: false, allowZoom: GUI.MouseOn == null);
Cam.MoveCamera((float)deltaTime, allowMove: false);
bool movementInput = PlayerInput.KeyDown(InputType.Up) || PlayerInput.KeyDown(InputType.Down) || PlayerInput.KeyDown(InputType.Left) || PlayerInput.KeyDown(InputType.Right);
// 0.2f, because we want to allow the user to pan when the character is floating in the water without actively moving
if (!isFreezed && (character.AnimController.Collider.LinearVelocity.LengthSquared() > 0.2f || movementInput))

View File

@@ -474,7 +474,7 @@ namespace Barotrauma
pointerLightSource.Position = cam.ScreenToWorld(PlayerInput.MousePosition);
pointerLightSource.Enabled = cursorLightEnabled.Selected;
pointerLightSource.IsBackground = true;
cam.MoveCamera((float)deltaTime, allowZoom: GUI.MouseOn == null);
cam.MoveCamera((float)deltaTime);
cam.UpdateTransform();
Level.Loaded?.Update((float)deltaTime, cam);

View File

@@ -238,7 +238,7 @@ namespace Barotrauma
public override void Update(double deltaTime)
{
cam.MoveCamera((float)deltaTime, true, GUI.MouseOn == null);
cam.MoveCamera((float)deltaTime, true);
if (selectedPrefab != null)
{

View File

@@ -1937,7 +1937,7 @@ namespace Barotrauma
hullVolumeFrame.Visible = MapEntity.SelectedList.Any(s => s is Hull);
saveAssemblyFrame.Visible = MapEntity.SelectedList.Count > 0;
cam.MoveCamera((float)deltaTime, true, GUI.MouseOn == null);
cam.MoveCamera((float)deltaTime, true);
if (PlayerInput.MidButtonHeld())
{
Vector2 moveSpeed = PlayerInput.MouseSpeed * (float)deltaTime * 100.0f / cam.Zoom;

View File

@@ -1781,19 +1781,47 @@ namespace Barotrauma
if (GameMain.Server != null)
{
//disable AI characters that are far away from all clients and the host's character and not controlled by anyone
c.Enabled =
c == controlled ||
c.IsRemotePlayer ||
CharacterList.Any(c2 =>
c != c2 &&
(c2.IsRemotePlayer || c2 == GameMain.Server.Character) &&
Vector2.DistanceSquared(c2.WorldPosition, c.WorldPosition) < NetConfig.CharacterIgnoreDistanceSqr);
if (c == controlled || c.IsRemotePlayer)
{
c.Enabled = true;
}
else
{
float distSqr = float.MaxValue;
foreach (Character otherCharacter in CharacterList)
{
if (otherCharacter == c) { continue; }
if (!otherCharacter.IsRemotePlayer && otherCharacter != GameMain.NetworkMember.Character) { continue; }
distSqr = Math.Min(distSqr, Vector2.DistanceSquared(otherCharacter.WorldPosition, c.WorldPosition));
}
if (distSqr > NetConfig.DisableCharacterDistSqr)
{
c.Enabled = false;
}
else if (distSqr < NetConfig.EnableCharacterDistSqr)
{
c.Enabled = true;
}
}
}
else if (Submarine.MainSub != null)
{
//disable AI characters that are far away from the sub and the controlled character
c.Enabled = Vector2.DistanceSquared(Submarine.MainSub.WorldPosition, c.WorldPosition) < NetConfig.CharacterIgnoreDistanceSqr ||
(controlled != null && Vector2.DistanceSquared(controlled.WorldPosition, c.WorldPosition) < NetConfig.CharacterIgnoreDistanceSqr);
float distSqr = Vector2.DistanceSquared(Submarine.MainSub.WorldPosition, c.WorldPosition);
if (Controlled != null)
{
distSqr = Math.Min(distSqr, Vector2.DistanceSquared(controlled.WorldPosition, c.WorldPosition));
}
if (distSqr > NetConfig.DisableCharacterDistSqr)
{
c.Enabled = false;
}
else if ( distSqr < NetConfig.EnableCharacterDistSqr)
{
c.Enabled = true;
}
}
}
}

View File

@@ -195,9 +195,9 @@ namespace Barotrauma
return true;
}
//content package compatibility checks were added in 0.9
//0.9 is not compatible with older content packages
if (GameVersion < new Version(0, 9))
//content package compatibility checks were added in 0.8.9.1
//v0.8.9.1 is not compatible with older content packages
if (GameVersion < new Version(0, 8, 9, 1))
{
return false;
}

View File

@@ -2388,6 +2388,18 @@ namespace Barotrauma
character.ReloadHead(id, hairIndex, beardIndex, moustacheIndex, faceAttachmentIndex);
}
}));
commands.Add(new Command("money", "", args =>
{
if (args.Length == 0) { return; }
if (GameMain.GameSession.GameMode is CampaignMode campaign)
{
if (int.TryParse(args[0], out int money))
{
campaign.Money += money;
}
}
}, isCheat: true));
#endif
InitProjectSpecific();

View File

@@ -178,7 +178,7 @@ namespace Barotrauma
foreach (Submarine submarine in Submarine.Loaded)
{
//hide all subs from sonar to make sneak attacks possible
submarine.OnSonar = false;
submarine.ShowSonarMarker = false;
}
}

View File

@@ -25,8 +25,7 @@ namespace Barotrauma
public override void Start(Level level)
{
Vector2 spawnPos;
Level.Loaded.TryGetInterestingPosition(true, Level.PositionType.MainPath, Level.Loaded.Size.X * 0.3f, out spawnPos);
Level.Loaded.TryGetInterestingPosition(true, Level.PositionType.MainPath, Level.Loaded.Size.X * 0.3f, out Vector2 spawnPos);
monster = Character.Create(monsterFile, spawnPos, ToolBox.RandomSeed(8), null, GameMain.Client != null, true, false);
monster.Enabled = false;

View File

@@ -1360,27 +1360,51 @@ namespace Barotrauma
return false;
}
var matchingPositions = positionsOfInterest.FindAll(p => positionType.HasFlag(p.PositionType));
if (minDistFromSubs > 0.0f)
{
foreach (Submarine sub in Submarine.Loaded)
{
matchingPositions.RemoveAll(p => Vector2.DistanceSquared(p.Position.ToVector2(), sub.WorldPosition) < minDistFromSubs * minDistFromSubs);
}
}
if (!matchingPositions.Any())
List<InterestingPosition> suitablePositions = positionsOfInterest.FindAll(p => positionType.HasFlag(p.PositionType));
if (!suitablePositions.Any())
{
string errorMsg = "Could not find a suitable position of interest. (PositionType: " + positionType + ", minDistFromSubs: " + minDistFromSubs + ")\n" + Environment.StackTrace;
GameAnalyticsManager.AddErrorEventOnce("Level.TryGetInterestingPosition:PositionTypeNotFound", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
#if DEBUG
DebugConsole.ThrowError("Could not find a suitable position of interest. (PositionType: " + positionType + ", minDistFromSubs: " + minDistFromSubs + "\n" + Environment.StackTrace);
DebugConsole.ThrowError(errorMsg);
#endif
position = positionsOfInterest[Rand.Int(positionsOfInterest.Count, (useSyncedRand ? Rand.RandSync.Server : Rand.RandSync.Unsynced))].Position;
return false;
}
position = matchingPositions[Rand.Int(matchingPositions.Count, (useSyncedRand ? Rand.RandSync.Server : Rand.RandSync.Unsynced))].Position;
List<InterestingPosition> farEnoughPositions = new List<InterestingPosition>(suitablePositions);
if (minDistFromSubs > 0.0f)
{
foreach (Submarine sub in Submarine.Loaded)
{
if (sub.IsOutpost) { continue; }
farEnoughPositions.RemoveAll(p => Vector2.DistanceSquared(p.Position.ToVector2(), sub.WorldPosition) < minDistFromSubs * minDistFromSubs);
}
}
if (!farEnoughPositions.Any())
{
string errorMsg = "Could not find a position of interest far enough from the submarines. (PositionType: " + positionType + ", minDistFromSubs: " + minDistFromSubs + ")\n" + Environment.StackTrace;
GameAnalyticsManager.AddErrorEventOnce("Level.TryGetInterestingPosition:TooCloseToSubs", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
#if DEBUG
DebugConsole.ThrowError(errorMsg);
#endif
float maxDist = 0.0f;
position = suitablePositions.First().Position;
foreach (InterestingPosition pos in suitablePositions)
{
float dist = Submarine.Loaded.Sum(s =>
Submarine.MainSubs.Contains(s) ? Vector2.DistanceSquared(s.WorldPosition, pos.Position.ToVector2()) : 0.0f);
if (dist > maxDist)
{
position = pos.Position;
maxDist = dist;
}
}
return false;
}
position = farEnoughPositions[Rand.Int(farEnoughPositions.Count, (useSyncedRand ? Rand.RandSync.Server : Rand.RandSync.Unsynced))].Position;
return true;
}

View File

@@ -109,7 +109,7 @@ namespace Barotrauma
set { name = value; }
}
public bool OnSonar = true;
public bool ShowSonarMarker = true;
public string Description
{
@@ -388,6 +388,7 @@ namespace Barotrauma
public void MakeOutpost()
{
IsOutpost = true;
ShowSonarMarker = false;
PhysicsBody.FarseerBody.IsStatic = true;
foreach (MapEntity me in MapEntity.mapEntityList)

View File

@@ -1081,7 +1081,7 @@ namespace Barotrauma.Networking
if (!character.Enabled) continue;
if (c.Character != null &&
Vector2.DistanceSquared(character.WorldPosition, c.Character.WorldPosition) >=
NetConfig.CharacterIgnoreDistanceSqr)
NetConfig.DisableCharacterDistSqr)
{
continue;
}
@@ -1325,6 +1325,7 @@ namespace Barotrauma.Networking
return false;
}
initiatedStartGame = true;
CoroutineManager.StartCoroutine(InitiateStartGame(selectedSub, selectedShuttle, usingShuttle, selectedMode), "InitiateStartGame");
return true;

View File

@@ -9,10 +9,14 @@
public static string MasterServerUrl = GameMain.Config.MasterServerUrl;
//if a Character is further than this from the sub, the server will ignore it
//if a Character is further than this from the sub and the players, the server will disable it
//(in display units)
public const float CharacterIgnoreDistance = 20000.0f;
public const float CharacterIgnoreDistanceSqr = CharacterIgnoreDistance * CharacterIgnoreDistance;
public const float DisableCharacterDist = 22000.0f;
public const float DisableCharacterDistSqr = DisableCharacterDist * DisableCharacterDist;
//the character needs to get this close to be re-enabled
public const float EnableCharacterDist = 20000.0f;
public const float EnableCharacterDistSqr = EnableCharacterDist * EnableCharacterDist;
//how much the physics body of an item has to move until the server
//send a position update to clients (in sim units)

View File

@@ -34,7 +34,7 @@
Run="LeftShift"
Crouch="LeftControl"
Chat="Tab"
RadioChat="OemTilde"
RadioChat="T"
CrewOrders="C"
Ragdoll="Space"
Health="H"