Merge branch 'master' into new-netcode
Conflicts: Subsurface/Source/Characters/Animation/Ragdoll.cs
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
<Pickable holdpos="30,-15" handle1="0,1" slots="RightHand,LeftHand,Any">
|
<Pickable holdpos="30,-15" handle1="0,1" slots="RightHand,LeftHand,Any">
|
||||||
<StatusEffect type="OnFire" target="This" Condition="-100.0" sound="Content/Items/Reactor/explosion.ogg" disabledeltatime="true">
|
<StatusEffect type="OnFire" target="This" Condition="-100.0" sound="Content/Items/Reactor/explosion.ogg" disabledeltatime="true">
|
||||||
<Explosion range="500.0" structuredamage="100" damage="200" stun="5" force="3.0"/>
|
<Explosion range="250.0" structuredamage="10" damage="20" stun="5" force="3.0"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
</Pickable>
|
</Pickable>
|
||||||
</Item>
|
</Item>
|
||||||
|
|||||||
@@ -118,7 +118,7 @@
|
|||||||
|
|
||||||
<Holdable slots="RightHand,Any" holdpos="30,-15" handle1="0,5" handle2="0,-5">
|
<Holdable slots="RightHand,Any" holdpos="30,-15" handle1="0,5" handle2="0,-5">
|
||||||
<StatusEffect type="OnFire" target="This" Condition="-100.0" sound="Content/Items/Reactor/explosion.ogg" disabledeltatime="true">
|
<StatusEffect type="OnFire" target="This" Condition="-100.0" sound="Content/Items/Reactor/explosion.ogg" disabledeltatime="true">
|
||||||
<Explosion range="500.0" structuredamage="100" damage="200" stun="5" force="3.0"/>
|
<Explosion range="250.0" structuredamage="15" damage="25" stun="5" force="3.0"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
</Holdable>
|
</Holdable>
|
||||||
</Item>
|
</Item>
|
||||||
|
|||||||
@@ -159,18 +159,21 @@
|
|||||||
</smoke>
|
</smoke>
|
||||||
|
|
||||||
<explosionfire
|
<explosionfire
|
||||||
startsizemin="1.0,1.0" startsizemax="1.5,1.5"
|
startsizemin="0.25,0.15" startsizemax="0.5,0.25"
|
||||||
sizechangemin="0.5,0.5" sizechangemax="0.6,0.6"
|
sizechangemin="0.2,0.2" sizechangemax="0.3,0.3"
|
||||||
startrotationmin ="0.0" startrotationmax="360"
|
startrotationmin ="-50.0" startrotationmax="50"
|
||||||
startcolor="1.0, 1.0, 1.0" startalpha="1.0"
|
startcolor="1.0, 1.0, 1.0" startalpha="1.0"
|
||||||
colorchange="-0.6, -0.6, -0.6, -0.5"
|
colorchange="-0.6, -0.6, -0.6, -0.5"
|
||||||
lifetime="5.0"
|
lifetime="5.0"
|
||||||
growtime ="0.05"
|
growtime ="0.05"
|
||||||
drawtarget="air"
|
drawtarget="air"
|
||||||
collideswithwalls="true"
|
collideswithwalls="true"
|
||||||
|
collisionradius="100"
|
||||||
blendstate="additive"
|
blendstate="additive"
|
||||||
velocitychange="0.0, 0.5">
|
velocitychange="0.0, 1.0"
|
||||||
<sprite texture="Content/Particles/explosion.png" sourcerect="0,0,128,128"/>
|
animduration="1.2"
|
||||||
|
loopanim="false">
|
||||||
|
<animatedsprite texture="Content/Particles/FlameRoundParticleSheet.png" sourcerect="0,0,2048,2048" columns="10" rows="5" origin="0.5,0.8"/>
|
||||||
</explosionfire>
|
</explosionfire>
|
||||||
|
|
||||||
<weld
|
<weld
|
||||||
|
|||||||
@@ -856,12 +856,19 @@ namespace Barotrauma
|
|||||||
|
|
||||||
headInWater = false;
|
headInWater = false;
|
||||||
|
|
||||||
float waterSurface = ConvertUnits.ToSimUnits(currentHull.Surface);
|
inWater = false;
|
||||||
|
if (inWater = currentHull.Volume > currentHull.FullVolume * 0.95f)
|
||||||
float floorY = GetFloorY();
|
{
|
||||||
|
inWater = true;
|
||||||
inWater = currentHull.Volume > currentHull.FullVolume * 0.95f ||
|
}
|
||||||
(waterSurface - floorY > HeadPosition * 0.95f && Collider.SimPosition.Y < waterSurface);
|
else
|
||||||
|
{
|
||||||
|
float waterSurface = ConvertUnits.ToSimUnits(currentHull.Surface);
|
||||||
|
if (Collider.SimPosition.Y < waterSurface && waterSurface - GetFloorY() > HeadPosition * 0.95f)
|
||||||
|
{
|
||||||
|
inWater = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flowForce.LengthSquared() > 0.001f)
|
if (flowForce.LengthSquared() > 0.001f)
|
||||||
@@ -1069,15 +1076,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
float tfloorY = rayStart.Y + (rayEnd.Y - rayStart.Y) * closestFraction;
|
float tfloorY = rayStart.Y + (rayEnd.Y - rayStart.Y) * closestFraction;
|
||||||
float targetY = tfloorY + Collider.height * 0.5f + Collider.radius + colliderHeightFromFloor;
|
float targetY = tfloorY + Collider.height * 0.5f + Collider.radius + colliderHeightFromFloor;
|
||||||
|
|
||||||
float waterSurface = ConvertUnits.ToSimUnits(currentHull.Surface);
|
|
||||||
|
|
||||||
float floorY = GetFloorY();
|
|
||||||
|
|
||||||
if (currentHull.Volume > currentHull.FullVolume * 0.95f ||
|
|
||||||
(waterSurface - floorY > HeadPosition * 0.95f && Collider.SimPosition.Y < waterSurface))
|
|
||||||
inWater = true;
|
|
||||||
|
|
||||||
if (Math.Abs(Collider.SimPosition.Y - targetY) > 0.01f && Collider.SimPosition.Y<targetY && !forceImmediate)
|
if (Math.Abs(Collider.SimPosition.Y - targetY) > 0.01f && Collider.SimPosition.Y<targetY && !forceImmediate)
|
||||||
{
|
{
|
||||||
Vector2 newSpeed = Collider.LinearVelocity;
|
Vector2 newSpeed = Collider.LinearVelocity;
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ namespace Barotrauma
|
|||||||
get { return text; }
|
get { return text; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
if (Text == value) return;
|
||||||
|
|
||||||
text = value;
|
text = value;
|
||||||
wrappedText = value;
|
wrappedText = value;
|
||||||
SetTextPos();
|
SetTextPos();
|
||||||
@@ -68,8 +70,12 @@ namespace Barotrauma
|
|||||||
child.Rect = new Rectangle(child.Rect.X + value.X - rect.X, child.Rect.Y + value.Y - rect.Y, child.Rect.Width, child.Rect.Height);
|
child.Rect = new Rectangle(child.Rect.X + value.X - rect.X, child.Rect.Y + value.Y - rect.Y, child.Rect.Width, child.Rect.Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (value.Width != rect.Width || value.Height != rect.Height)
|
||||||
|
{
|
||||||
|
SetTextPos();
|
||||||
|
}
|
||||||
|
|
||||||
rect = value;
|
rect = value;
|
||||||
SetTextPos();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Barotrauma.Lights;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
using FarseerPhysics;
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
@@ -14,7 +15,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public float CameraShake;
|
public float CameraShake;
|
||||||
|
|
||||||
private bool sparks, shockwave, flames;
|
private bool sparks, shockwave, flames, smoke;
|
||||||
|
|
||||||
public Explosion(XElement element)
|
public Explosion(XElement element)
|
||||||
{
|
{
|
||||||
@@ -24,7 +25,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
sparks = ToolBox.GetAttributeBool(element, "sparks", true);
|
sparks = ToolBox.GetAttributeBool(element, "sparks", true);
|
||||||
shockwave = ToolBox.GetAttributeBool(element, "shockwave", true);
|
shockwave = ToolBox.GetAttributeBool(element, "shockwave", true);
|
||||||
flames = ToolBox.GetAttributeBool(element, "flames", true);
|
flames = ToolBox.GetAttributeBool(element, "flames", true);
|
||||||
|
smoke = ToolBox.GetAttributeBool(element, "smoke", true);
|
||||||
|
|
||||||
CameraShake = ToolBox.GetAttributeFloat(element, "camerashake", attack.Range*0.1f);
|
CameraShake = ToolBox.GetAttributeFloat(element, "camerashake", attack.Range*0.1f);
|
||||||
}
|
}
|
||||||
@@ -52,8 +54,13 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
if (flames)
|
if (flames)
|
||||||
{
|
{
|
||||||
GameMain.ParticleManager.CreateParticle("explosionfire", worldPosition + Rand.Vector(50f),
|
GameMain.ParticleManager.CreateParticle("explosionfire", ClampParticlePos(worldPosition + Rand.Vector(50f), hull),
|
||||||
Rand.Vector(Rand.Range(50f, 100.0f)), 0.0f, hull);
|
Rand.Vector(Rand.Range(50.0f, 100.0f)), 0.0f, hull);
|
||||||
|
}
|
||||||
|
if (smoke)
|
||||||
|
{
|
||||||
|
GameMain.ParticleManager.CreateParticle("smoke", ClampParticlePos(worldPosition + Rand.Vector(50f), hull),
|
||||||
|
Rand.Vector(Rand.Range(1.0f, 10.0f)), 0.0f, hull);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,9 +96,19 @@ namespace Barotrauma
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Vector2 ClampParticlePos(Vector2 particlePos, Hull hull)
|
||||||
|
{
|
||||||
|
if (hull == null) return particlePos;
|
||||||
|
|
||||||
|
return new Vector2(
|
||||||
|
MathHelper.Clamp(particlePos.X, hull.WorldRect.X, hull.WorldRect.Right),
|
||||||
|
MathHelper.Clamp(particlePos.Y, hull.WorldRect.Y - hull.WorldRect.Height, hull.WorldRect.Y));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private IEnumerable<object> DimLight(LightSource light)
|
private IEnumerable<object> DimLight(LightSource light)
|
||||||
{
|
{
|
||||||
float currBrightness= 1.0f;
|
float currBrightness = 1.0f;
|
||||||
float startRange = light.Range;
|
float startRange = light.Range;
|
||||||
|
|
||||||
while (light.Color.A > 0.0f)
|
while (light.Color.A > 0.0f)
|
||||||
@@ -99,13 +116,13 @@ namespace Barotrauma
|
|||||||
light.Color = new Color(light.Color.R, light.Color.G, light.Color.B, currBrightness);
|
light.Color = new Color(light.Color.R, light.Color.G, light.Color.B, currBrightness);
|
||||||
light.Range = startRange * currBrightness;
|
light.Range = startRange * currBrightness;
|
||||||
|
|
||||||
currBrightness -= CoroutineManager.DeltaTime*10.0f;
|
currBrightness -= CoroutineManager.DeltaTime * 20.0f;
|
||||||
|
|
||||||
yield return CoroutineStatus.Running;
|
yield return CoroutineStatus.Running;
|
||||||
}
|
}
|
||||||
|
|
||||||
light.Remove();
|
light.Remove();
|
||||||
|
|
||||||
yield return CoroutineStatus.Success;
|
yield return CoroutineStatus.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,6 +132,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
foreach (Character c in Character.CharacterList)
|
foreach (Character c in Character.CharacterList)
|
||||||
{
|
{
|
||||||
|
Vector2 explosionPos = worldPosition;
|
||||||
|
if (c.Submarine != null) explosionPos -= c.Submarine.Position;
|
||||||
|
|
||||||
|
explosionPos = ConvertUnits.ToSimUnits(explosionPos);
|
||||||
|
|
||||||
foreach (Limb limb in c.AnimController.Limbs)
|
foreach (Limb limb in c.AnimController.Limbs)
|
||||||
{
|
{
|
||||||
float dist = Vector2.Distance(limb.WorldPosition, worldPosition);
|
float dist = Vector2.Distance(limb.WorldPosition, worldPosition);
|
||||||
@@ -128,6 +150,9 @@ namespace Barotrauma
|
|||||||
|
|
||||||
float distFactor = 1.0f - dist / range;
|
float distFactor = 1.0f - dist / range;
|
||||||
|
|
||||||
|
//solid obstacles between the explosion and the limb reduce the effect of the explosion by 90%
|
||||||
|
if (Submarine.CheckVisibility(limb.SimPosition, explosionPos) != null) distFactor *= 0.1f;
|
||||||
|
|
||||||
c.AddDamage(limb.WorldPosition, DamageType.None,
|
c.AddDamage(limb.WorldPosition, DamageType.None,
|
||||||
damage / c.AnimController.Limbs.Length * distFactor, 0.0f, stun * distFactor, false);
|
damage / c.AnimController.Limbs.Length * distFactor, 0.0f, stun * distFactor, false);
|
||||||
|
|
||||||
|
|||||||
@@ -68,10 +68,10 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (!isNetworkMessage && GameMain.Client != null) return;
|
if (!isNetworkMessage && GameMain.Client != null) return;
|
||||||
|
|
||||||
if (fireSoundBasic==null)
|
if (fireSoundBasic == null)
|
||||||
{
|
{
|
||||||
fireSoundBasic = Sound.Load("Content/Sounds/fire.ogg");
|
fireSoundBasic = Sound.Load("Content/Sounds/fire.ogg", false);
|
||||||
fireSoundLarge = Sound.Load("Content/Sounds/firelarge.ogg");
|
fireSoundLarge = Sound.Load("Content/Sounds/firelarge.ogg", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
hull.AddFireSource(this);
|
hull.AddFireSource(this);
|
||||||
@@ -80,13 +80,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
this.position = worldPosition - new Vector2(-5.0f, 5.0f) - Submarine.Position;
|
this.position = worldPosition - new Vector2(-5.0f, 5.0f) - Submarine.Position;
|
||||||
|
|
||||||
|
|
||||||
lightSource = new LightSource(this.position, 50.0f, new Color(1.0f, 0.9f, 0.7f), hull == null ? null : hull.Submarine);
|
lightSource = new LightSource(this.position, 50.0f, new Color(1.0f, 0.9f, 0.7f), hull == null ? null : hull.Submarine);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//this.position.Y = hull.Rect.Y - hull.Rect.Height;
|
|
||||||
|
|
||||||
size = new Vector2(10.0f, 10.0f);
|
size = new Vector2(10.0f, 10.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -358,12 +353,12 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
lightSource.Remove();
|
lightSource.Remove();
|
||||||
|
|
||||||
if (basicSoundIndex > -1)
|
if (basicSoundIndex > 0)
|
||||||
{
|
{
|
||||||
Sounds.SoundManager.Stop(basicSoundIndex);
|
Sounds.SoundManager.Stop(basicSoundIndex);
|
||||||
basicSoundIndex = -1;
|
basicSoundIndex = -1;
|
||||||
}
|
}
|
||||||
if (largeSoundIndex > -1)
|
if (largeSoundIndex > 0)
|
||||||
{
|
{
|
||||||
Sounds.SoundManager.Stop(largeSoundIndex);
|
Sounds.SoundManager.Stop(largeSoundIndex);
|
||||||
largeSoundIndex = -1;
|
largeSoundIndex = -1;
|
||||||
|
|||||||
@@ -352,7 +352,19 @@ namespace Barotrauma.Lights
|
|||||||
points.AddRange(boundaryCorners);
|
points.AddRange(boundaryCorners);
|
||||||
|
|
||||||
var compareCCW = new CompareSegmentPointCW(drawPos);
|
var compareCCW = new CompareSegmentPointCW(drawPos);
|
||||||
points.Sort(compareCCW);
|
try
|
||||||
|
{
|
||||||
|
points.Sort(compareCCW);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder("Constructing light volumes failed! Light pos: "+drawPos+", Hull verts:\n");
|
||||||
|
foreach (SegmentPoint sp in points)
|
||||||
|
{
|
||||||
|
sb.AppendLine(sp.Pos.ToString());
|
||||||
|
}
|
||||||
|
DebugConsole.ThrowError(sb.ToString(), e);
|
||||||
|
}
|
||||||
|
|
||||||
List<Vector2> output = new List<Vector2>();
|
List<Vector2> output = new List<Vector2>();
|
||||||
|
|
||||||
|
|||||||
@@ -242,7 +242,11 @@ namespace Barotrauma
|
|||||||
SoundManager.ClearAlSource(AlBufferId);
|
SoundManager.ClearAlSource(AlBufferId);
|
||||||
ALHelper.Check();
|
ALHelper.Check();
|
||||||
|
|
||||||
if (oggSound != null) oggSound.Dispose();
|
if (oggSound != null)
|
||||||
|
{
|
||||||
|
oggSound.Dispose();
|
||||||
|
oggSound = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ namespace Barotrauma.Sounds
|
|||||||
|
|
||||||
public static int Play(Sound sound, Vector2 position, float volume = 1.0f, float lowPassGain = 0.0f, bool loop=false)
|
public static int Play(Sound sound, Vector2 position, float volume = 1.0f, float lowPassGain = 0.0f, bool loop=false)
|
||||||
{
|
{
|
||||||
if (Disabled) return -1;
|
if (Disabled || sound.AlBufferId == -1) return -1;
|
||||||
|
|
||||||
for (int i = 1; i < DefaultSourceCount; i++)
|
for (int i = 1; i < DefaultSourceCount; i++)
|
||||||
{
|
{
|
||||||
//find a source that's free to use (not playing or paused)
|
//find a source that's free to use (not playing or paused)
|
||||||
|
|||||||
@@ -512,6 +512,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public static int Compare(Vector2 a, Vector2 b, Vector2 center)
|
public static int Compare(Vector2 a, Vector2 b, Vector2 center)
|
||||||
{
|
{
|
||||||
|
if (a == b) return 0;
|
||||||
if (a.X - center.X >= 0 && b.X - center.X < 0) return -1;
|
if (a.X - center.X >= 0 && b.X - center.X < 0) return -1;
|
||||||
if (a.X - center.X < 0 && b.X - center.X >= 0) return 1;
|
if (a.X - center.X < 0 && b.X - center.X >= 0) return 1;
|
||||||
if (a.X - center.X == 0 && b.X - center.X == 0)
|
if (a.X - center.X == 0 && b.X - center.X == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user