Some null checks, clients log initial lobby update, minor lighting optimization

This commit is contained in:
Joonas Rikkonen
2017-07-04 22:32:14 +03:00
parent 59997b94ab
commit e431cc775f
4 changed files with 8 additions and 11 deletions

View File

@@ -19,7 +19,7 @@ namespace Barotrauma
Vector2 pos = Character.WorldPosition;
pos.Y = -pos.Y;
if (selectedAiTarget != null)
if (selectedAiTarget?.Entity != null)
{
GUI.DrawLine(spriteBatch, pos, new Vector2(selectedAiTarget.WorldPosition.X, -selectedAiTarget.WorldPosition.Y), Color.Red);
@@ -31,13 +31,6 @@ namespace Barotrauma
GUI.Font.DrawString(spriteBatch, targetValue.ToString(), pos - Vector2.UnitY * 20.0f, Color.Red);
}
if (selectedAiTarget != null)
{
GUI.DrawLine(spriteBatch,
new Vector2(Character.DrawPosition.X, -Character.DrawPosition.Y),
new Vector2(selectedAiTarget.WorldPosition.X, -selectedAiTarget.WorldPosition.Y), Color.Red);
}
GUI.Font.DrawString(spriteBatch, targetValue.ToString(), pos - Vector2.UnitY * 80.0f, Color.Red);
GUI.Font.DrawString(spriteBatch, "updatetargets: " + updateTargetsTimer, pos - Vector2.UnitY * 100.0f, Color.Red);

View File

@@ -413,7 +413,7 @@ namespace Barotrauma.Lights
if (intersection != null)
{
float dist = Vector2.Distance((Vector2)intersection, rayStart);
float dist = Vector2.DistanceSquared((Vector2)intersection, rayStart);
if (closestIntersection == null || dist < closestDist)
{
closestDist = dist;

View File

@@ -818,7 +818,11 @@ namespace Barotrauma.Networking
if (inc.ReadBoolean())
{
ReadInitialUpdate(inc, !NetIdUtils.IdMoreRecent(updateID,GameMain.NetLobbyScreen.LastUpdateID));
if (GameSettings.VerboseLogging)
{
DebugConsole.NewMessage("Received initial lobby update, ID: " + updateID + ", last ID: " + GameMain.NetLobbyScreen.LastUpdateID, Color.Gray);
}
ReadInitialUpdate(inc, !NetIdUtils.IdMoreRecent(updateID, GameMain.NetLobbyScreen.LastUpdateID));
}
string selectSubName = inc.ReadString();

View File

@@ -213,7 +213,7 @@ namespace Barotrauma
return;
}
if (attachToWalls && Character.Submarine == null)
if (attachToWalls && Character.Submarine == null && Level.Loaded != null)
{
raycastTimer -= deltaTime;
//check if there are any walls nearby the character could attach to