Cleanup (removing unused variables & other redundancies, rethrowing exceptions instead of wrapping them in a new exception instance)
This commit is contained in:
@@ -31,8 +31,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private float raycastTimer;
|
private float raycastTimer;
|
||||||
|
|
||||||
private Vector2 prevPosition;
|
|
||||||
|
|
||||||
//a timer for attacks such as biting that last for a specific amount of time
|
//a timer for attacks such as biting that last for a specific amount of time
|
||||||
//the duration is determined by the attackDuration of the attacking limb
|
//the duration is determined by the attackDuration of the attacking limb
|
||||||
private float attackTimer;
|
private float attackTimer;
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ namespace Barotrauma
|
|||||||
/// makes the character act according to the objective, or according to any subobjectives that
|
/// makes the character act according to the objective, or according to any subobjectives that
|
||||||
/// need to be completed before this one
|
/// need to be completed before this one
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="character">the character who's trying to achieve the objective</param>
|
|
||||||
public void TryComplete(float deltaTime)
|
public void TryComplete(float deltaTime)
|
||||||
{
|
{
|
||||||
subObjectives.RemoveAll(s => s.IsCompleted() || !s.CanBeCompleted);
|
subObjectives.RemoveAll(s => s.IsCompleted() || !s.CanBeCompleted);
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
class AICharacter : Character
|
class AICharacter : Character
|
||||||
{
|
{
|
||||||
const float AttackBackPriority = 1.0f;
|
|
||||||
|
|
||||||
private AIController aiController;
|
private AIController aiController;
|
||||||
|
|
||||||
public override AIController AIController
|
public override AIController AIController
|
||||||
|
|||||||
@@ -857,7 +857,7 @@ namespace Barotrauma
|
|||||||
headInWater = false;
|
headInWater = false;
|
||||||
|
|
||||||
inWater = false;
|
inWater = false;
|
||||||
if (inWater = currentHull.Volume > currentHull.FullVolume * 0.95f)
|
if (currentHull.Volume > currentHull.FullVolume * 0.95f)
|
||||||
{
|
{
|
||||||
inWater = true;
|
inWater = true;
|
||||||
}
|
}
|
||||||
@@ -1435,8 +1435,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public Vector2 GetColliderBottom()
|
public Vector2 GetColliderBottom()
|
||||||
{
|
{
|
||||||
float halfHeight = Collider.height * 0.5f + Collider.radius;
|
|
||||||
|
|
||||||
float offset = 0.0f;
|
float offset = 0.0f;
|
||||||
|
|
||||||
if (!character.IsUnconscious && !character.IsDead && character.Stun <= 0.0f)
|
if (!character.IsUnconscious && !character.IsDead && character.Stun <= 0.0f)
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Item> SpawnItems = new List<Item>();
|
|
||||||
|
|
||||||
private bool enabled = true;
|
private bool enabled = true;
|
||||||
public bool Enabled
|
public bool Enabled
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ namespace Barotrauma
|
|||||||
public InputNetFlags states; //keys pressed/other boolean states at this step
|
public InputNetFlags states; //keys pressed/other boolean states at this step
|
||||||
public UInt16 intAim; //aim angle, represented as an unsigned short where 0=0º, 65535=just a bit under 360º
|
public UInt16 intAim; //aim angle, represented as an unsigned short where 0=0º, 65535=just a bit under 360º
|
||||||
public UInt16 interact; //id of the entity being interacted with
|
public UInt16 interact; //id of the entity being interacted with
|
||||||
public AnimController.Animation? animation;
|
|
||||||
|
|
||||||
public UInt16 networkUpdateID;
|
public UInt16 networkUpdateID;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,8 +132,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
character.SpawnItems.Add(item);
|
|
||||||
|
|
||||||
if (parentItem != null) parentItem.Combine(item);
|
if (parentItem != null) parentItem.Combine(item);
|
||||||
|
|
||||||
foreach (XElement childItemElement in itemElement.Elements())
|
foreach (XElement childItemElement in itemElement.Elements())
|
||||||
@@ -142,7 +140,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual XElement Save(XElement parentElement)
|
public XElement Save(XElement parentElement)
|
||||||
{
|
{
|
||||||
XElement jobElement = new XElement("job");
|
XElement jobElement = new XElement("job");
|
||||||
|
|
||||||
|
|||||||
@@ -49,12 +49,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public readonly bool ignoreCollisions;
|
public readonly bool ignoreCollisions;
|
||||||
|
|
||||||
//private readonly float maxHealth;
|
|
||||||
//private float damage;
|
|
||||||
//private float bleeding;
|
|
||||||
|
|
||||||
public readonly float impactTolerance;
|
|
||||||
|
|
||||||
private float damage, burnt;
|
private float damage, burnt;
|
||||||
|
|
||||||
private readonly Vector2 armorSector;
|
private readonly Vector2 armorSector;
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else if (spawnInventory != null)
|
else if (spawnInventory != null)
|
||||||
{
|
{
|
||||||
Item.Spawner.AddToSpawnQueue(itemPrefab, (Inventory)spawnInventory);
|
Item.Spawner.AddToSpawnQueue(itemPrefab, spawnInventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ namespace Barotrauma
|
|||||||
face.LoadGlyph(face.GetCharIndex(baseChar), LoadFlags.Default, LoadTarget.Normal);
|
face.LoadGlyph(face.GetCharIndex(baseChar), LoadFlags.Default, LoadTarget.Normal);
|
||||||
baseHeight = face.Glyph.Metrics.Height.ToInt32();
|
baseHeight = face.Glyph.Metrics.Height.ToInt32();
|
||||||
//lineHeight = baseHeight;
|
//lineHeight = baseHeight;
|
||||||
for (int i = 0; i < charRanges.Count(); i += 2)
|
for (int i = 0; i < charRanges.Length; i += 2)
|
||||||
{
|
{
|
||||||
uint start = charRanges[i];
|
uint start = charRanges[i];
|
||||||
uint end = charRanges[i + 1];
|
uint end = charRanges[i + 1];
|
||||||
@@ -139,7 +139,7 @@ namespace Barotrauma
|
|||||||
face.Glyph.RenderGlyph(RenderMode.Normal);
|
face.Glyph.RenderGlyph(RenderMode.Normal);
|
||||||
byte[] bitmap = face.Glyph.Bitmap.BufferData;
|
byte[] bitmap = face.Glyph.Bitmap.BufferData;
|
||||||
int glyphWidth = face.Glyph.Bitmap.Width;
|
int glyphWidth = face.Glyph.Bitmap.Width;
|
||||||
int glyphHeight = bitmap.Count() / glyphWidth;
|
int glyphHeight = bitmap.Length / glyphWidth;
|
||||||
|
|
||||||
//if (glyphHeight>lineHeight) lineHeight=glyphHeight;
|
//if (glyphHeight>lineHeight) lineHeight=glyphHeight;
|
||||||
|
|
||||||
|
|||||||
@@ -60,8 +60,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public readonly Dictionary<GUIComponent.ComponentState, List<UISprite>> Sprites;
|
public readonly Dictionary<GUIComponent.ComponentState, List<UISprite>> Sprites;
|
||||||
|
|
||||||
public readonly bool TileSprites;
|
|
||||||
|
|
||||||
public Dictionary<string, GUIComponentStyle> ChildStyles;
|
public Dictionary<string, GUIComponentStyle> ChildStyles;
|
||||||
|
|
||||||
public GUIComponentStyle(XElement element)
|
public GUIComponentStyle(XElement element)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace Barotrauma
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
DebugConsole.NewMessage("Error in AddToGUIUPdateList! GUIComponent runtime type: "+this.GetType().ToString()+"; children count: "+children.Count.ToString(),Color.Red);
|
DebugConsole.NewMessage("Error in AddToGUIUPdateList! GUIComponent runtime type: "+this.GetType().ToString()+"; children count: "+children.Count.ToString(),Color.Red);
|
||||||
throw e;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -427,7 +427,7 @@ namespace Barotrauma
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
DebugConsole.NewMessage("Error in Update! GUIComponent runtime type: " + this.GetType().ToString() + "; children count: " + children.Count.ToString(), Color.Red);
|
DebugConsole.NewMessage("Error in Update! GUIComponent runtime type: " + this.GetType().ToString() + "; children count: " + children.Count.ToString(), Color.Red);
|
||||||
throw e;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ namespace Barotrauma
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
DebugConsole.NewMessage("Error in AddToGUIUpdateList! GUIComponent runtime type: " + this.GetType().ToString() + "; children count: " + children.Count.ToString(), Color.Red);
|
DebugConsole.NewMessage("Error in AddToGUIUpdateList! GUIComponent runtime type: " + this.GetType().ToString() + "; children count: " + children.Count.ToString(), Color.Red);
|
||||||
throw e;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scrollBarEnabled && !scrollBarHidden) scrollBar.AddToGUIUpdateList();
|
if (scrollBarEnabled && !scrollBarHidden) scrollBar.AddToGUIUpdateList();
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace Barotrauma
|
|||||||
Rand.Range(cargoRoom.Rect.X + 20, cargoRoom.Rect.Right - 20),
|
Rand.Range(cargoRoom.Rect.X + 20, cargoRoom.Rect.Right - 20),
|
||||||
cargoRoom.Rect.Y - cargoRoom.Rect.Height + prefab.Size.Y/2);
|
cargoRoom.Rect.Y - cargoRoom.Rect.Height + prefab.Size.Y/2);
|
||||||
|
|
||||||
new Item(prefab as ItemPrefab, position, wp.Submarine);
|
new Item(prefab, position, wp.Submarine);
|
||||||
}
|
}
|
||||||
|
|
||||||
purchasedItems.Clear();
|
purchasedItems.Clear();
|
||||||
|
|||||||
@@ -161,9 +161,9 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void StartShift(string levelSeed, bool loadSecondSub = false)
|
public void StartShift(string levelSeed, bool loadSecondSub = false)
|
||||||
{
|
{
|
||||||
Level level = Level.CreateRandom(levelSeed);
|
Level randomLevel = Level.CreateRandom(levelSeed);
|
||||||
|
|
||||||
StartShift(level,true,loadSecondSub);
|
StartShift(randomLevel, true, loadSecondSub);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartShift(Level level, bool reloadSub = true, bool loadSecondSub = false)
|
public void StartShift(Level level, bool reloadSub = true, bool loadSecondSub = false)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
public List<CharacterInfo> availableCharacters;
|
public List<CharacterInfo> availableCharacters;
|
||||||
|
|
||||||
const int MaxAvailableCharacters = 10;
|
public const int MaxAvailableCharacters = 10;
|
||||||
|
|
||||||
public HireManager()
|
public HireManager()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -714,7 +714,6 @@ namespace Barotrauma.Items.Components
|
|||||||
if (gap != null)
|
if (gap != null)
|
||||||
{
|
{
|
||||||
gap.Remove();
|
gap.Remove();
|
||||||
gap.linkedTo.Remove(hull);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,6 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
private bool isStuck;
|
private bool isStuck;
|
||||||
|
|
||||||
private float lastReceivedMessage;
|
|
||||||
|
|
||||||
private bool? predictedState;
|
private bool? predictedState;
|
||||||
private float resetPredictionTimer;
|
private float resetPredictionTimer;
|
||||||
|
|
||||||
|
|||||||
@@ -95,8 +95,6 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
if (userPos != Vector2.Zero)
|
if (userPos != Vector2.Zero)
|
||||||
{
|
{
|
||||||
float torsoX = character.Position.X;
|
|
||||||
|
|
||||||
Vector2 diff = (item.WorldPosition + userPos) - character.WorldPosition;
|
Vector2 diff = (item.WorldPosition + userPos) - character.WorldPosition;
|
||||||
|
|
||||||
if (character.AnimController.InWater)
|
if (character.AnimController.InWater)
|
||||||
|
|||||||
@@ -149,8 +149,6 @@ namespace Barotrauma.Items.Components
|
|||||||
if (radarBlips[i].FadeTimer <= 0.0f) radarBlips.RemoveAt(i);
|
if (radarBlips[i].FadeTimer <= 0.0f) radarBlips.RemoveAt(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
float radius = (GuiFrame.Rect.Height / 2 - 30);
|
|
||||||
|
|
||||||
if (IsActive)
|
if (IsActive)
|
||||||
{
|
{
|
||||||
float pingRadius = displayRadius * pingState;
|
float pingRadius = displayRadius * pingState;
|
||||||
|
|||||||
@@ -263,12 +263,6 @@ namespace Barotrauma
|
|||||||
get { return prefab.ConfigFile; }
|
get { return prefab.ConfigFile; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Removed
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
private set;
|
|
||||||
}
|
|
||||||
|
|
||||||
//which type of inventory slots (head, torso, any, etc) the item can be placed in
|
//which type of inventory slots (head, torso, any, etc) the item can be placed in
|
||||||
public List<InvSlotType> AllowedSlots
|
public List<InvSlotType> AllowedSlots
|
||||||
{
|
{
|
||||||
@@ -279,15 +273,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Capacity
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
ItemContainer c = GetComponent<ItemContainer>();
|
|
||||||
return (c == null) ? 0 : c.Capacity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Connection> Connections
|
public List<Connection> Connections
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -570,11 +555,11 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (parentInventory.Owner is Character)
|
if (parentInventory.Owner is Character)
|
||||||
{
|
{
|
||||||
CurrentHull = (parentInventory.Owner as Character).AnimController.CurrentHull;
|
CurrentHull = ((Character)parentInventory.Owner).AnimController.CurrentHull;
|
||||||
}
|
}
|
||||||
else if (parentInventory.Owner is Item)
|
else if (parentInventory.Owner is Item)
|
||||||
{
|
{
|
||||||
CurrentHull = (parentInventory.Owner as Item).CurrentHull;
|
CurrentHull = ((Item)parentInventory.Owner).CurrentHull;
|
||||||
}
|
}
|
||||||
|
|
||||||
Submarine = parentInventory.Owner.Submarine;
|
Submarine = parentInventory.Owner.Submarine;
|
||||||
@@ -2307,8 +2292,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
base.ShallowRemove();
|
base.ShallowRemove();
|
||||||
|
|
||||||
Removed = true;
|
|
||||||
|
|
||||||
foreach (ItemComponent ic in components)
|
foreach (ItemComponent ic in components)
|
||||||
{
|
{
|
||||||
ic.ShallowRemove();
|
ic.ShallowRemove();
|
||||||
@@ -2326,8 +2309,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
base.Remove();
|
base.Remove();
|
||||||
|
|
||||||
Removed = true;
|
|
||||||
|
|
||||||
if (parentInventory != null)
|
if (parentInventory != null)
|
||||||
{
|
{
|
||||||
parentInventory.RemoveItem(this);
|
parentInventory.RemoveItem(this);
|
||||||
|
|||||||
@@ -1,13 +1,8 @@
|
|||||||
using FarseerPhysics.Common;
|
using Microsoft.Xna.Framework;
|
||||||
using FarseerPhysics.Common.PolygonManipulation;
|
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Voronoi2;
|
using Voronoi2;
|
||||||
|
|
||||||
namespace Barotrauma.RuinGeneration
|
namespace Barotrauma.RuinGeneration
|
||||||
|
|||||||
@@ -239,15 +239,15 @@ namespace Barotrauma.Lights
|
|||||||
|
|
||||||
private void CalculateDimensions()
|
private void CalculateDimensions()
|
||||||
{
|
{
|
||||||
float? minX = null, minY = null, maxX = null, maxY = null;
|
float minX = vertices[0].Pos.X, minY = vertices[0].Pos.Y, maxX = vertices[0].Pos.X, maxY = vertices[0].Pos.Y;
|
||||||
|
|
||||||
for (int i = 0; i < vertices.Length; i++)
|
for (int i = 1; i < vertices.Length; i++)
|
||||||
{
|
{
|
||||||
if (minX == null || vertices[i].Pos.X < minX) minX = vertices[i].Pos.X;
|
if (vertices[i].Pos.X < minX) minX = vertices[i].Pos.X;
|
||||||
if (minY == null || vertices[i].Pos.Y < minY) minY = vertices[i].Pos.Y;
|
if (vertices[i].Pos.Y < minY) minY = vertices[i].Pos.Y;
|
||||||
|
|
||||||
if (maxX == null || vertices[i].Pos.X > maxX) maxX = vertices[i].Pos.X;
|
if (vertices[i].Pos.X > maxX) maxX = vertices[i].Pos.X;
|
||||||
if (maxY == null || vertices[i].Pos.Y > minY) maxY = vertices[i].Pos.Y;
|
if (vertices[i].Pos.Y > minY) maxY = vertices[i].Pos.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
boundingBox = new Rectangle((int)minX, (int)minY, (int)(maxX - minX), (int)(maxY - minY));
|
boundingBox = new Rectangle((int)minX, (int)minY, (int)(maxX - minX), (int)(maxY - minY));
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ namespace Barotrauma.Lights
|
|||||||
|
|
||||||
private Texture2D visionCircle;
|
private Texture2D visionCircle;
|
||||||
|
|
||||||
private Dictionary<Hull, Color> hullAmbientLights = new Dictionary<Hull, Color>();
|
private Dictionary<Hull, Color> hullAmbientLights;
|
||||||
private Dictionary<Hull, Color> smoothedHullAmbientLights = new Dictionary<Hull, Color>();
|
private Dictionary<Hull, Color> smoothedHullAmbientLights;
|
||||||
|
|
||||||
private float ambientLightUpdateTimer;
|
private float ambientLightUpdateTimer;
|
||||||
|
|
||||||
@@ -134,9 +134,6 @@ namespace Barotrauma.Lights
|
|||||||
{
|
{
|
||||||
if (!LightingEnabled) return;
|
if (!LightingEnabled) return;
|
||||||
|
|
||||||
Matrix shadowTransform = cam.ShaderTransform
|
|
||||||
* Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
|
|
||||||
|
|
||||||
graphics.SetRenderTarget(lightMap);
|
graphics.SetRenderTarget(lightMap);
|
||||||
|
|
||||||
Rectangle viewRect = cam.WorldView;
|
Rectangle viewRect = cam.WorldView;
|
||||||
@@ -338,19 +335,11 @@ namespace Barotrauma.Lights
|
|||||||
return hullAmbientLight;
|
return hullAmbientLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ClearAlphaToOne(GraphicsDevice graphics, SpriteBatch spriteBatch)
|
|
||||||
{
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, CustomBlendStates.WriteToAlpha);
|
|
||||||
spriteBatch.Draw(alphaClearTexture, new Rectangle(0, 0,graphics.Viewport.Width, graphics.Viewport.Height), Color.White);
|
|
||||||
spriteBatch.End();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DrawLightMap(SpriteBatch spriteBatch, Effect effect)
|
public void DrawLightMap(SpriteBatch spriteBatch, Effect effect)
|
||||||
{
|
{
|
||||||
if (!LightingEnabled) return;
|
if (!LightingEnabled) return;
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, CustomBlendStates.Multiplicative, null, null, null, effect);
|
spriteBatch.Begin(SpriteSortMode.Deferred, CustomBlendStates.Multiplicative, null, null, null, effect);
|
||||||
//effect.CurrentTechnique.Passes[0].Apply();
|
|
||||||
spriteBatch.Draw(lightMap, Vector2.Zero, Color.White);
|
spriteBatch.Draw(lightMap, Vector2.Zero, Color.White);
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace Barotrauma
|
|||||||
if (type.HasHireableCharacters)
|
if (type.HasHireableCharacters)
|
||||||
{
|
{
|
||||||
hireManager = new HireManager();
|
hireManager = new HireManager();
|
||||||
hireManager.GenerateCharacters(this, 10);
|
hireManager.GenerateCharacters(this, HireManager.MaxAvailableCharacters);
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections = new List<LocationConnection>();
|
Connections = new List<LocationConnection>();
|
||||||
@@ -62,9 +62,9 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private string RandomName(LocationType type)
|
private string RandomName(LocationType type)
|
||||||
{
|
{
|
||||||
string name = ToolBox.GetRandomLine("Content/Map/locationNames.txt");
|
string randomName = ToolBox.GetRandomLine("Content/Map/locationNames.txt");
|
||||||
int nameFormatIndex = Rand.Int(type.NameFormats.Count, false);
|
int nameFormatIndex = Rand.Int(type.NameFormats.Count, false);
|
||||||
return type.NameFormats[nameFormatIndex].Replace("[name]", name);
|
return type.NameFormats[nameFormatIndex].Replace("[name]", randomName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -363,8 +363,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Dictionary<string, float> timeElapsed = new Dictionary<string, float>();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Call Update() on every object in Entity.list
|
/// Call Update() on every object in Entity.list
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -872,7 +872,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime)
|
public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < sections.Count(); i++)
|
for (int i = 0; i < sections.Length; i++)
|
||||||
{
|
{
|
||||||
float damage = msg.ReadRangedSingle(0.0f, 1.0f, 8) * Health;
|
float damage = msg.ReadRangedSingle(0.0f, 1.0f, 8) * Health;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Barotrauma.Items.Components;
|
using Lidgren.Network;
|
||||||
using Lidgren.Network;
|
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|||||||
@@ -28,11 +28,9 @@ namespace Barotrauma.Networking
|
|||||||
public Character Character;
|
public Character Character;
|
||||||
public CharacterInfo characterInfo;
|
public CharacterInfo characterInfo;
|
||||||
public NetConnection Connection { get; set; }
|
public NetConnection Connection { get; set; }
|
||||||
public string version;
|
|
||||||
public bool inGame;
|
public bool inGame;
|
||||||
public UInt16 lastRecvGeneralUpdate = 0;
|
public UInt16 lastRecvGeneralUpdate = 0;
|
||||||
|
|
||||||
public bool hasLobbyData = false;
|
|
||||||
public UInt16 lastSentChatMsgID = 0; //last msg this client said
|
public UInt16 lastSentChatMsgID = 0; //last msg this client said
|
||||||
public UInt16 lastRecvChatMsgID = 0; //last msg this client knows about
|
public UInt16 lastRecvChatMsgID = 0; //last msg this client knows about
|
||||||
|
|
||||||
|
|||||||
@@ -1095,7 +1095,6 @@ namespace Barotrauma.Networking
|
|||||||
{
|
{
|
||||||
var transfer = fileReceiver.ActiveTransfers[i];
|
var transfer = fileReceiver.ActiveTransfers[i];
|
||||||
|
|
||||||
GameMain.NetLobbyScreen.SubList.children.Find(c => c is GUITextBlock && ((GUITextBlock)c).Text == transfer.FileName);
|
|
||||||
GUI.DrawString(spriteBatch,
|
GUI.DrawString(spriteBatch,
|
||||||
pos,
|
pos,
|
||||||
ToolBox.LimitString("Downloading " + transfer.FileName, GUI.SmallFont, 200),
|
ToolBox.LimitString("Downloading " + transfer.FileName, GUI.SmallFont, 200),
|
||||||
@@ -1221,9 +1220,6 @@ namespace Barotrauma.Networking
|
|||||||
if (votedClient == null) return false;
|
if (votedClient == null) return false;
|
||||||
|
|
||||||
votedClient.AddKickVote(new Client(name, ID));
|
votedClient.AddKickVote(new Client(name, ID));
|
||||||
|
|
||||||
if (votedClient == null) return false;
|
|
||||||
|
|
||||||
Vote(VoteType.Kick, votedClient);
|
Vote(VoteType.Kick, votedClient);
|
||||||
|
|
||||||
button.Enabled = false;
|
button.Enabled = false;
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ using System.Xml.Linq;
|
|||||||
|
|
||||||
namespace Barotrauma.Networking
|
namespace Barotrauma.Networking
|
||||||
{
|
{
|
||||||
enum SelectionMode : int
|
enum SelectionMode
|
||||||
{
|
{
|
||||||
Manual = 0, Random = 1, Vote = 2
|
Manual = 0, Random = 1, Vote = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
enum YesNoMaybe : int
|
enum YesNoMaybe
|
||||||
{
|
{
|
||||||
No = 0, Maybe = 1, Yes = 2
|
No = 0, Maybe = 1, Yes = 2
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ namespace Barotrauma.Networking
|
|||||||
//kick everyone that hasn't received it yet, this is way too old
|
//kick everyone that hasn't received it yet, this is way too old
|
||||||
List<Client> toKick = inGameClients.FindAll(c => NetIdUtils.IdMoreRecent((UInt16)(lastSentToAll + 1), c.lastRecvEntityEventID));
|
List<Client> toKick = inGameClients.FindAll(c => NetIdUtils.IdMoreRecent((UInt16)(lastSentToAll + 1), c.lastRecvEntityEventID));
|
||||||
|
|
||||||
if (toKick != null) toKick.ForEach(c => server.DisconnectClient(c, "", "You have been disconnected because of excessive desync"));
|
toKick.ForEach(c => server.DisconnectClient(c, "", "You have been disconnected because of excessive desync"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (events.Count > 0)
|
if (events.Count > 0)
|
||||||
@@ -164,12 +164,12 @@ namespace Barotrauma.Networking
|
|||||||
//the client is waiting for an event that we don't have anymore
|
//the client is waiting for an event that we don't have anymore
|
||||||
//(the ID they're expecting is smaller than the ID of the first event in our list)
|
//(the ID they're expecting is smaller than the ID of the first event in our list)
|
||||||
List<Client> toKick = inGameClients.FindAll(c => NetIdUtils.IdMoreRecent(events[0].ID, (UInt16)(c.lastRecvEntityEventID+1)));
|
List<Client> toKick = inGameClients.FindAll(c => NetIdUtils.IdMoreRecent(events[0].ID, (UInt16)(c.lastRecvEntityEventID+1)));
|
||||||
if (toKick != null) toKick.ForEach(c => server.DisconnectClient(c, "", "You have been disconnected because of excessive desync"));
|
toKick.ForEach(c => server.DisconnectClient(c, "", "You have been disconnected because of excessive desync"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var timedOutClients = clients.FindAll(c => c.inGame && c.NeedsMidRoundSync && Timing.TotalTime > c.MidRoundSyncTimeOut);
|
var timedOutClients = clients.FindAll(c => c.inGame && c.NeedsMidRoundSync && Timing.TotalTime > c.MidRoundSyncTimeOut);
|
||||||
if (timedOutClients != null) timedOutClients.ForEach(c => GameMain.Server.DisconnectClient(c, "", "You have been disconnected because syncing your client with the server took too long."));
|
timedOutClients.ForEach(c => GameMain.Server.DisconnectClient(c, "", "You have been disconnected because syncing your client with the server took too long."));
|
||||||
|
|
||||||
bufferedEvents.RemoveAll(b => b.IsProcessed);
|
bufferedEvents.RemoveAll(b => b.IsProcessed);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -393,11 +393,7 @@ namespace Barotrauma.Networking
|
|||||||
var server = networkMember as GameServer;
|
var server = networkMember as GameServer;
|
||||||
if (server == null) return;
|
if (server == null) return;
|
||||||
|
|
||||||
List<Item> spawnedItems = new List<Item>();
|
|
||||||
List<Character> spawnedCharacters = new List<Character>();
|
|
||||||
|
|
||||||
var clients = GetClientsToRespawn();
|
var clients = GetClientsToRespawn();
|
||||||
|
|
||||||
foreach (Client c in clients)
|
foreach (Client c in clients)
|
||||||
{
|
{
|
||||||
if (c.characterInfo == null) c.characterInfo = new CharacterInfo(Character.HumanConfigFile, c.name);
|
if (c.characterInfo == null) c.characterInfo = new CharacterInfo(Character.HumanConfigFile, c.name);
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ namespace Barotrauma
|
|||||||
private Vector2 drawPosition;
|
private Vector2 drawPosition;
|
||||||
private float drawRotation;
|
private float drawRotation;
|
||||||
|
|
||||||
private float lastNetworkUpdateTime;
|
|
||||||
public Vector2 LastSentPosition
|
public Vector2 LastSentPosition
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ namespace Barotrauma
|
|||||||
/// Allows the game to run logic such as updating the world,
|
/// Allows the game to run logic such as updating the world,
|
||||||
/// checking for collisions, gathering input, and playing audio.
|
/// checking for collisions, gathering input, and playing audio.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="gameTime">Provides a snapshot of timing values.</param>
|
|
||||||
public override void Update(double deltaTime)
|
public override void Update(double deltaTime)
|
||||||
{
|
{
|
||||||
cam.MoveCamera((float)deltaTime);
|
cam.MoveCamera((float)deltaTime);
|
||||||
@@ -113,7 +112,6 @@ namespace Barotrauma
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is called when the game should draw itself.
|
/// This is called when the game should draw itself.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="gameTime">Provides a snapshot of timing values.</param>
|
|
||||||
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
|
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
//cam.UpdateTransform();
|
//cam.UpdateTransform();
|
||||||
|
|||||||
@@ -960,7 +960,6 @@ namespace Barotrauma
|
|||||||
/// Allows the game to run logic such as updating the world,
|
/// Allows the game to run logic such as updating the world,
|
||||||
/// checking for collisions, gathering input, and playing audio.
|
/// checking for collisions, gathering input, and playing audio.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="gameTime">Provides a snapshot of timing values.</param>
|
|
||||||
public override void Update(double deltaTime)
|
public override void Update(double deltaTime)
|
||||||
{
|
{
|
||||||
if (tutorial != null) tutorial.Update((float)deltaTime);
|
if (tutorial != null) tutorial.Update((float)deltaTime);
|
||||||
@@ -1085,7 +1084,6 @@ namespace Barotrauma
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is called when the game should draw itself.
|
/// This is called when the game should draw itself.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="gameTime">Provides a snapshot of timing values.</param>
|
|
||||||
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
|
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
cam.UpdateTransform();
|
cam.UpdateTransform();
|
||||||
|
|||||||
@@ -110,7 +110,6 @@ namespace Barotrauma
|
|||||||
/// Allows the game to run logic such as updating the world,
|
/// Allows the game to run logic such as updating the world,
|
||||||
/// checking for collisions, gathering input, and playing audio.
|
/// checking for collisions, gathering input, and playing audio.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="gameTime">Provides a snapshot of timing values.</param>
|
|
||||||
public override void Update(double deltaTime)
|
public override void Update(double deltaTime)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -1120,10 +1120,9 @@ namespace Barotrauma
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
GameModePreset modePreset = obj as GameModePreset;
|
GameModePreset modePreset = obj as GameModePreset;
|
||||||
missionTypeBlock.Visible = modePreset.Name == "Mission";
|
|
||||||
|
|
||||||
if (modePreset == null) return false;
|
if (modePreset == null) return false;
|
||||||
|
|
||||||
|
missionTypeBlock.Visible = modePreset.Name == "Mission";
|
||||||
lastUpdateID++;
|
lastUpdateID++;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace Barotrauma.Sounds
|
|||||||
catch (DllNotFoundException e)
|
catch (DllNotFoundException e)
|
||||||
{
|
{
|
||||||
Program.CrashMessageBox("OpenAL32.dll not found");
|
Program.CrashMessageBox("OpenAL32.dll not found");
|
||||||
throw e;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0 ; i < DefaultSourceCount; i++)
|
for (int i = 0 ; i < DefaultSourceCount; i++)
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
string tempPath = Path.Combine(SaveFolder, "temp");
|
string tempPath = Path.Combine(SaveFolder, "temp");
|
||||||
|
|
||||||
DirectoryInfo dir = new DirectoryInfo(tempPath);
|
|
||||||
|
|
||||||
Directory.CreateDirectory(tempPath);
|
Directory.CreateDirectory(tempPath);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user