This commit is contained in:
Joonas Rikkonen
2017-12-26 20:04:47 +02:00
72 changed files with 2763 additions and 2535 deletions
@@ -78,7 +78,7 @@ namespace Barotrauma
}
//re-enable collider
if (!Collider.FarseerBody.Enabled)
if (!Collider.Enabled)
{
var lowestLimb = FindLowestLimb();
@@ -87,7 +87,7 @@ namespace Barotrauma
Math.Max(lowestLimb.SimPosition.Y + (Collider.radius + Collider.height / 2), Collider.SimPosition.Y)),
0.0f);
Collider.FarseerBody.Enabled = true;
Collider.Enabled = true;
}
ResetPullJoints();
@@ -105,7 +105,7 @@ namespace Barotrauma
//re-enable collider
if (!Collider.FarseerBody.Enabled)
if (!Collider.Enabled)
{
var lowestLimb = FindLowestLimb();
@@ -115,7 +115,7 @@ namespace Barotrauma
Collider.Rotation);
Collider.FarseerBody.ResetDynamics();
Collider.FarseerBody.Enabled = true;
Collider.Enabled = true;
}
if (swimming)
@@ -1469,5 +1469,12 @@ namespace Barotrauma
list.Remove(this);
}
public static void RemoveAll()
{
for (int i = list.Count - 1; i >= 0; i--)
{
list[i].Remove();
}
}
}
}
@@ -344,18 +344,18 @@ namespace Barotrauma
if (GameMain.Client != null) return;
float newHealth = MathHelper.Clamp(value, minHealth, maxHealth);
if (newHealth == health) return;
//if (newHealth == health) return;
health = newHealth;
if (GameMain.Server != null)
/*if (GameMain.Server != null)
{
if (Math.Abs(health - lastSentHealth) > (maxHealth - minHealth) / 255.0f || Math.Sign(health) != Math.Sign(lastSentHealth))
{
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
lastSentHealth = health;
}
}
}*/
}
}
@@ -373,12 +373,12 @@ namespace Barotrauma
if (GameMain.Client != null) return;
float newBleeding = MathHelper.Clamp(value, 0.0f, 5.0f);
if (newBleeding == bleeding) return;
//if (newBleeding == bleeding) return;
bleeding = newBleeding;
if (GameMain.Server != null)
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
/*if (GameMain.Server != null)
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });*/
}
}
@@ -1540,11 +1540,11 @@ namespace Barotrauma
if (stunTimer > 0.0f)
{
stunTimer -= deltaTime;
if (stunTimer < 0.0f && GameMain.Server != null)
/*if (stunTimer < 0.0f && GameMain.Server != null)
{
//stun ended -> notify clients
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
}
} */
}
//Skip health effects as critical health handles it differently
@@ -1574,8 +1574,8 @@ namespace Barotrauma
if (IsRagdolled)
{
if (AnimController is HumanoidAnimController) ((HumanoidAnimController)AnimController).Crouching = false;
if(GameMain.Server != null)
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
/*if(GameMain.Server != null)
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });*/
AnimController.ResetPullJoints();
selectedConstruction = null;
return;
@@ -1821,11 +1821,11 @@ namespace Barotrauma
if ((newStun <= stunTimer && !allowStunDecrease) || !MathUtils.IsValid(newStun)) return;
if (GameMain.Server != null &&
/*if (GameMain.Server != null &&
(Math.Sign(newStun) != Math.Sign(stunTimer) || Math.Abs(newStun - stunTimer) > 0.1f))
{
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
}
}*/
if (Math.Sign(newStun) != Math.Sign(stunTimer)) AnimController.ResetPullJoints();
@@ -1884,11 +1884,11 @@ namespace Barotrauma
return;
}
if (GameMain.NetworkMember != null)
/*if (GameMain.NetworkMember != null)
{
if (GameMain.Server != null)
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
}
}*/
AnimController.Frozen = false;
@@ -332,6 +332,7 @@ namespace Barotrauma
inventory.ServerRead(type, msg, c);
break;
case 1:
bool doingCPR = msg.ReadBoolean();
if (c.Character != this)
{
#if DEBUG
@@ -340,7 +341,6 @@ namespace Barotrauma
return;
}
bool doingCPR = msg.ReadBoolean();
AnimController.Anim = doingCPR ? AnimController.Animation.CPR : AnimController.Animation.None;
break;
case 2:
@@ -358,7 +358,15 @@ namespace Barotrauma
}
break;
case 3:
AnimController.GrabLimb = (LimbType)msg.ReadUInt16();
LimbType grabLimb = (LimbType)msg.ReadUInt16();
if (c.Character != this)
{
#if DEBUG
DebugConsole.Log("Received a character update message from a client who's not controlling the character");
#endif
return;
}
AnimController.GrabLimb = grabLimb;
break;
}
break;
@@ -384,10 +392,6 @@ namespace Barotrauma
Client owner = ((Client)extraData[1]);
msg.Write(owner == null ? (byte)0 : owner.ID);
break;
case NetEntityEvent.Type.Status:
msg.WriteRangedInteger(0, 2, 2);
WriteStatus(msg);
break;
}
msg.WritePadBits();
}
@@ -474,6 +478,8 @@ namespace Barotrauma
tempBuffer.Write(SimPosition.Y);
tempBuffer.Write(AnimController.Collider.Rotation);
WriteStatus(tempBuffer);
tempBuffer.WritePadBits();
msg.Write((byte)tempBuffer.LengthBytes);