Character freezing + Misc fixes

This commit is contained in:
juanjp600
2016-09-21 16:46:12 -03:00
parent 3314c8501c
commit edab86f730
9 changed files with 70 additions and 9 deletions

View File

@@ -62,6 +62,7 @@ namespace Barotrauma
public override void UpdateAnim(float deltaTime)
{
if (character.IsDead) return;
if (Frozen) return;
Vector2 colliderPos = GetLimb(LimbType.Torso).SimPosition;

View File

@@ -19,6 +19,10 @@ namespace Barotrauma
protected Hull currentHull;
public Limb[] Limbs;
private bool isFrozen = false;
public bool Frozen = false;
private Dictionary<LimbType, Limb> limbDictionary;
public RevoluteJoint[] limbJoints;
@@ -320,7 +324,7 @@ namespace Barotrauma
public void AddLimb(Limb limb)
{
limb.body.FarseerBody.OnCollision += OnLimbCollision;
Array.Resize(ref Limbs, Limbs.Length + 1);
Limbs[Limbs.Length-1] = limb;
@@ -684,6 +688,27 @@ namespace Barotrauma
{
if (!character.Enabled) return;
if (Frozen)
{
if (!isFrozen)
{
foreach (Limb l in Limbs)
{
l.body.PhysEnabled = false;
}
isFrozen = true;
}
return;
}
if (isFrozen)
{
for (int i=0;i < Limbs.Length;i++)
{
Limbs[i].body.PhysEnabled = true;
}
isFrozen = false;
}
UpdateNetPlayerPosition();
Vector2 flowForce = Vector2.Zero;

View File

@@ -27,7 +27,7 @@ namespace Barotrauma
get { return netStateID; }
}
List<char> memInput = new List<char>();
List<byte> memInput = new List<byte>();
List<float> memMouseX = new List<float>();
List<float> memMouseY = new List<float>();
@@ -1142,7 +1142,14 @@ namespace Barotrauma
if (isDead) return;
if (networkUpdateSent)
if (this != Character.Controlled)
{
if (GameMain.Server != null)
{
}
}
/*if (networkUpdateSent)
{
foreach (Key key in keys)
{
@@ -1151,7 +1158,7 @@ namespace Barotrauma
}
networkUpdateSent = false;
}
}*/
DisableImpactDamageTimer -= deltaTime;