Turret rotation fix, CharacterInventory networking bugfixes, prevent limbs clipping with other colliders when mirroring, fixed mantis animations, better looking explosions, spark effect when overvoltage breaks an item

This commit is contained in:
Regalis
2015-09-04 21:56:39 +03:00
parent 2f08dcf3f9
commit 0cbcdd0b03
35 changed files with 393 additions and 262 deletions
@@ -26,7 +26,6 @@ namespace Subsurface
protected readonly Vector2 stepSize;
protected readonly float legTorque;
protected readonly Vector2 stepOffset;
public float StunTimer
{
@@ -46,8 +45,8 @@ namespace Subsurface
stepSize = ToolBox.GetAttributeVector2(element, "stepsize", Vector2.One);
stepSize = ConvertUnits.ToSimUnits(stepSize);
stepOffset = ToolBox.GetAttributeVector2(element, "stepoffset", Vector2.One);
stepOffset = ConvertUnits.ToSimUnits(stepOffset);
//stepOffset = ToolBox.GetAttributeVector2(element, "stepoffset", Vector2.One);
//stepOffset = ConvertUnits.ToSimUnits(stepOffset);
//impactTolerance = ToolBox.GetAttributeFloat(element, "impacttolerance", 10.0f);
@@ -69,22 +69,22 @@ namespace Subsurface
depth = MathHelper.Clamp(depth + velocity.Z * deltaTime, 0.0f, MaxDepth);
checkWallsTimer -= deltaTime;
if (checkWallsTimer<=0.0f)
if (checkWallsTimer<=0.0f && Level.Loaded!=null)
{
checkWallsTimer = CheckWallsInterval;
obstacleDiff = Vector2.Zero;
var cells = Level.Loaded.GetCells(position, 1);
if (cells.Count>0)
if (cells.Count > 0)
{
foreach (Voronoi2.VoronoiCell cell in cells)
{
obstacleDiff += cell.Center - position;
}
obstacleDiff = Vector2.Normalize(obstacleDiff)*prefab.Speed;
obstacleDiff = Vector2.Normalize(obstacleDiff) * prefab.Speed;
}
}
@@ -141,7 +141,9 @@ namespace Subsurface
if (velocity.X < 0.0f) rotation -= MathHelper.Pi;
}
Vector2 drawPos = position + Level.Loaded.Position;
Vector2 drawPos = position;
if (Level.Loaded != null) drawPos += Level.Loaded.Position;
if (depth > 0.0f)
{
+1 -1
View File
@@ -866,7 +866,7 @@ namespace Subsurface
for (int i = 0; i < sounds.Count(); i++)
{
if (soundStates[i] != state) continue;
if (n == selectedSound)
if (n == selectedSound && sounds[i]!=null)
{
sounds[i].Play(1.0f, 2000.0f,
AnimController.limbs[0].body.FarseerBody);
@@ -302,8 +302,8 @@ namespace Subsurface
RevoluteJoint refJoint = limbJoints[limb.RefJointIndex];
footPos.X = refJoint.WorldAnchorA.X;
}
footPos.X += stepOffset.X * Dir;
footPos.Y += stepOffset.Y;
footPos.X += limb.StepOffset.X * Dir;
footPos.Y += limb.StepOffset.Y;
if (limb.type == LimbType.LeftFoot)
{
@@ -373,7 +373,20 @@ namespace Subsurface
foreach (Limb l in limbs)
{
Vector2 newPos = new Vector2(midX - (l.SimPosition.X - midX), l.SimPosition.Y);
l.body.SetTransform(newPos, l.body.Rotation);
if (Submarine.CheckVisibility(l.SimPosition, newPos)!=null)
{
Vector2 diff = newPos - l.SimPosition;
l.body.SetTransform(
l.SimPosition + Submarine.LastPickedFraction * diff * 0.8f, l.body.Rotation);
}
else
{
l.body.SetTransform(newPos, l.body.Rotation);
}
}
}
@@ -786,7 +786,6 @@ namespace Subsurface
arm.body.SmoothRotate((ang2 - armAngle * Dir), 20.0f);
hand.body.SmoothRotate((ang2 + handAngle * Dir), 100.0f);
}
}
+10 -1
View File
@@ -32,6 +32,8 @@ namespace Subsurface
private readonly bool doesFlip;
protected readonly Vector2 stepOffset;
public Sprite sprite;
public bool inWater;
@@ -128,6 +130,11 @@ namespace Subsurface
get { return refJointIndex; }
}
public Vector2 StepOffset
{
get { return stepOffset; }
}
//public float Damage
//{
// get { return damage; }
@@ -205,9 +212,11 @@ namespace Subsurface
Vector2 jointPos = ToolBox.GetAttributeVector2(element, "pullpos", Vector2.Zero);
jointPos = ConvertUnits.ToSimUnits(jointPos);
stepOffset = ToolBox.GetAttributeVector2(element, "stepoffset", Vector2.Zero);
stepOffset = ConvertUnits.ToSimUnits(stepOffset);
refJointIndex = ToolBox.GetAttributeInt(element, "refjoint", -1);
pullJoint = new FixedMouseJoint(body.FarseerBody, jointPos);