- fixed level generation algorithm placing waypoints at unreachable positions
- changes to drowning/suffocation logic (oxygen-value drops/rises at a fixed rate depending on whether there's enough oxygen available, instead of effects "stacking")
This commit is contained in:
@@ -41,10 +41,10 @@
|
||||
<Wearable limbtype="Head" slots="Any,Head">
|
||||
<sprite texture="DivingMask.png" limb="Head" sourcerect="1,1,37,38"/>
|
||||
<StatusEffect type="OnWearing" target="Character" ObstructVision="true" setvalue="true" disabledeltatime="true"/>
|
||||
<StatusEffect type="OnWearing" target="Contained,Character" Oxygen="20.0" Condition="-0.5">
|
||||
<StatusEffect type="OnWearing" target="Contained,Character" OxygenAvailable="1000.0" Condition="-0.5">
|
||||
<RequiredItem type="Contained" name="Oxygen Tank"/>
|
||||
</StatusEffect>
|
||||
<StatusEffect type="OnWearing" target="Contained,Character" Oxygen="-30.0" Condition="-0.5">
|
||||
<StatusEffect type="OnWearing" target="Contained,Character" OxygenAvailable="-100.0" Oxygen="-20.0" Condition="-0.5">
|
||||
<RequiredItem type="Contained" name="Welding Fuel Tank"/>
|
||||
</StatusEffect>
|
||||
</Wearable>
|
||||
@@ -86,10 +86,13 @@
|
||||
<sprite texture="DivingSuit.png" limb="LeftLeg" sourcerect="17,47,21,51" origin="0.5,0.55" depth="0.02" hidelimb="true"/>
|
||||
|
||||
<StatusEffect type="OnWearing" target="Character" ObstructVision="true" PressureProtection="100.0" SpeedMultiplier="0.6" LowPassMultiplier="0.2" setvalue="true" disabledeltatime="true"/>
|
||||
<StatusEffect type="OnWearing" target="Contained,Character" Oxygen="30.0" Condition="-0.5">
|
||||
<StatusEffect type="OnWearing" target="Contained,Character" OxygenAvailable="1000.0" Condition="-0.5">
|
||||
<RequiredItem type="Contained" name="Oxygen Tank"/>
|
||||
</StatusEffect>
|
||||
<StatusEffect type="OnWearing" target="Character" Oxygen="-11.0"/>
|
||||
<StatusEffect type="OnWearing" target="Contained,Character" Oxygen="-20.0" Condition="-0.5">
|
||||
<RequiredItem type="Contained" name="Welding Fuel Tank"/>
|
||||
</StatusEffect>
|
||||
<StatusEffect type="OnWearing" target="Character" OxygenAvailable="-100.0"/>
|
||||
</Wearable>
|
||||
|
||||
<ItemContainer capacity="1" hideitems="true">
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace Barotrauma
|
||||
private Vector2 cursorPosition;
|
||||
|
||||
protected bool needsAir;
|
||||
protected float oxygen;
|
||||
protected float oxygen, oxygenAvailable;
|
||||
protected float drowningTime;
|
||||
|
||||
protected float health;
|
||||
@@ -251,6 +251,12 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public float OxygenAvailable
|
||||
{
|
||||
get { return oxygenAvailable; }
|
||||
set { oxygenAvailable = MathHelper.Clamp(value, 0.0f, 100.0f); }
|
||||
}
|
||||
|
||||
public float Stun
|
||||
{
|
||||
get { return AnimController.StunTimer; }
|
||||
@@ -416,6 +422,7 @@ namespace Barotrauma
|
||||
IsNetworkPlayer = isNetworkPlayer;
|
||||
|
||||
oxygen = 100.0f;
|
||||
oxygenAvailable = 100.0f;
|
||||
aiTarget = new AITarget(this);
|
||||
|
||||
lowPassMultiplier = 1.0f;
|
||||
@@ -1027,20 +1034,20 @@ namespace Barotrauma
|
||||
|
||||
if (needsAir)
|
||||
{
|
||||
if (AnimController.HeadInWater)
|
||||
{
|
||||
Oxygen -= deltaTime*100.0f / drowningTime;
|
||||
}
|
||||
else if (AnimController.CurrentHull != null)
|
||||
{
|
||||
float hullOxygen = AnimController.CurrentHull.OxygenPercentage;
|
||||
hullOxygen -= 30.0f;
|
||||
Oxygen += deltaTime * (oxygenAvailable < 30.0f ? -5.0f : 10.0f);
|
||||
|
||||
Oxygen += deltaTime * 100.0f * (hullOxygen / 500.0f);
|
||||
PressureProtection -= deltaTime*100.0f;
|
||||
|
||||
float hullAvailableOxygen = 0.0f;
|
||||
|
||||
if (!AnimController.HeadInWater && AnimController.CurrentHull != null)
|
||||
{
|
||||
hullAvailableOxygen = AnimController.CurrentHull.OxygenPercentage;
|
||||
|
||||
AnimController.CurrentHull.Oxygen -= Hull.OxygenConsumptionSpeed * deltaTime;
|
||||
}
|
||||
PressureProtection -= deltaTime*100.0f;
|
||||
|
||||
OxygenAvailable += Math.Sign(hullAvailableOxygen - oxygenAvailable) * deltaTime * 50.0f;
|
||||
}
|
||||
|
||||
Health -= bleeding * deltaTime;
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace Barotrauma
|
||||
|
||||
if (Screen.Selected == GameMain.EditMapScreen) return;
|
||||
|
||||
if (character.Oxygen < 50.0f && !character.IsDead)
|
||||
if (character.Oxygen < 80.0f && !character.IsDead)
|
||||
{
|
||||
Vector2 offset = Rand.Vector(noiseOverlay.size.X);
|
||||
offset.X = Math.Abs(offset.X);
|
||||
@@ -106,7 +106,7 @@ namespace Barotrauma
|
||||
|
||||
noiseOverlay.DrawTiled(spriteBatch, Vector2.Zero - offset, new Vector2(GameMain.GraphicsWidth, GameMain.GraphicsHeight) + offset,
|
||||
Vector2.Zero,
|
||||
Color.White * ((50.0f - character.Oxygen) / 50.0f));
|
||||
Color.White * Math.Min((80.0f - character.Oxygen) / 50.0f, 0.8f));
|
||||
}
|
||||
|
||||
if (damageOverlayTimer>0.0f)
|
||||
|
||||
@@ -200,22 +200,19 @@ namespace Barotrauma
|
||||
|
||||
float tunnelLength = Rand.Range(5000.0f, 10000.0f, false);
|
||||
|
||||
var tunnelNodes = MathUtils.GenerateJaggedLine(tunnelStartPos, tunnelStartPos + Rand.Vector(tunnelLength,false) + Vector2.UnitY*5000.0f, 3, 1000.0f);
|
||||
var tunnelNodes = MathUtils.GenerateJaggedLine(
|
||||
tunnelStartPos,
|
||||
new Vector2(tunnelStartPos.X, pathBorders.Bottom)+Rand.Vector(tunnelLength,false),
|
||||
4, 1000.0f);
|
||||
|
||||
List<Vector2> tunnel = new List<Vector2>();
|
||||
foreach (Vector2[] tunnelNode in tunnelNodes)
|
||||
{
|
||||
if (!pathBorders.Contains(tunnelNode[0])) break;
|
||||
if (!pathBorders.Contains(tunnelNode[0])) continue;
|
||||
tunnel.Add(tunnelNode[0]);
|
||||
}
|
||||
|
||||
if (tunnel.Any())
|
||||
{
|
||||
smallTunnels.Add(tunnel);
|
||||
positionsOfInterest.Add(new InterestingPosition(tunnel.Last(), false));
|
||||
|
||||
if (tunnel.Count() > 4) positionsOfInterest.Add(new InterestingPosition(tunnel[tunnel.Count()/2], false));
|
||||
}
|
||||
if (tunnel.Any()) smallTunnels.Add(tunnel);
|
||||
}
|
||||
|
||||
|
||||
@@ -229,9 +226,9 @@ namespace Barotrauma
|
||||
|
||||
if (smallTunnels.Any(t => t.Any(node => Vector2.Distance(node, site) < siteInterval)))
|
||||
{
|
||||
if (x < borders.Width - siteInterval) sites.Add(new Vector2(x, y) + Vector2.UnitX * siteInterval * 0.2f);
|
||||
if (y < borders.Height - siteInterval) sites.Add(new Vector2(x, y) + Vector2.UnitY * siteInterval * 0.2f);
|
||||
if (x < borders.Width - siteInterval && y < borders.Height - siteInterval) sites.Add(new Vector2(x, y) + Vector2.One * siteInterval * 0.2f);
|
||||
if (x < borders.Width - siteInterval) sites.Add(new Vector2(x, y) + Vector2.UnitX * siteInterval * 0.5f);
|
||||
if (y < borders.Height - siteInterval) sites.Add(new Vector2(x, y) + Vector2.UnitY * siteInterval * 0.5f);
|
||||
if (x < borders.Width - siteInterval && y < borders.Height - siteInterval) sites.Add(new Vector2(x, y) + Vector2.One * siteInterval * 0.5f);
|
||||
}
|
||||
|
||||
if (mirror) site.X = borders.Width - site.X;
|
||||
@@ -314,42 +311,22 @@ namespace Barotrauma
|
||||
{
|
||||
if (tunnel.Count<2) continue;
|
||||
|
||||
//find the cell which the path starts from
|
||||
int startCellIndex = FindCellIndex(tunnel[0]);
|
||||
if (startCellIndex < 0) continue;
|
||||
|
||||
//if it wasn't one of the cells in the main path, don't create a tunnel
|
||||
if (!pathCells.Contains(cells[startCellIndex])) continue;
|
||||
|
||||
var newPathCells = GeneratePath(tunnel, cells, pathBorders, 0.0f, 0.0f);
|
||||
|
||||
//for (int n = 0; n < newPathCells.Count; n += 5)
|
||||
//{
|
||||
// positionsOfInterest.Add(newPathCells[n].Center);
|
||||
//}
|
||||
positionsOfInterest.Add(new InterestingPosition(tunnel.Last(), false));
|
||||
|
||||
if (tunnel.Count() > 4) positionsOfInterest.Add(new InterestingPosition(tunnel[tunnel.Count() / 2], false));
|
||||
|
||||
pathCells.AddRange(newPathCells);
|
||||
}
|
||||
|
||||
////generate a couple of random paths
|
||||
//for (int i = 0; i <= Rand.Range(1,4,false); i++)
|
||||
//{
|
||||
// //pathBorders = new Rectangle(
|
||||
// //borders.X + siteInterval * 2, borders.Y - siteInterval * 2,
|
||||
// //borders.Right - siteInterval * 2, borders.Y + borders.Height - siteInterval * 2);
|
||||
|
||||
// Vector2 start = pathCells[Rand.Range(1, pathCells.Count - 2,false)].Center;
|
||||
|
||||
// float x = pathBorders.X + Rand.Range(0, pathBorders.Right - pathBorders.X, false);
|
||||
// float y = pathBorders.Y + Rand.Range(0,pathBorders.Bottom - pathBorders.Y, false);
|
||||
|
||||
// if (mirror) x = borders.Width - x;
|
||||
|
||||
// Vector2 end = new Vector2(x, y);
|
||||
|
||||
// var newPathCells = GeneratePath(new List<Vector2> { start, end }, cells, pathBorders, 0.0f, 0.8f, mirror);
|
||||
|
||||
// for (int n = 0; n < newPathCells.Count; n += 5)
|
||||
// {
|
||||
// positionsOfInterest.Add(newPathCells[n].Center);
|
||||
// }
|
||||
|
||||
// pathCells.AddRange(newPathCells);
|
||||
//}
|
||||
|
||||
Debug.WriteLine("path: " + sw2.ElapsedMilliseconds + " ms");
|
||||
sw2.Restart();
|
||||
|
||||
|
||||
@@ -152,6 +152,8 @@ namespace Voronoi2
|
||||
ge.point1 = vertices[i-1];
|
||||
ge.point2 = vertices[i];
|
||||
|
||||
System.Diagnostics.Debug.Assert(ge.point1 != ge.point2);
|
||||
|
||||
edges.Add(ge);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Barotrauma.Lights
|
||||
{
|
||||
lights = new List<LightSource>();
|
||||
|
||||
AmbientLight = new Color(80, 80, 80, 255);
|
||||
AmbientLight = new Color(60, 60, 60, 255);
|
||||
|
||||
visionCircle = Sprite.LoadTexture("Content/Lights/visioncircle.png");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user