Change int to UInt32 for grabLimb networking
Fixed IsRagdolled state networking
This commit is contained in:
@@ -29,7 +29,7 @@ namespace Barotrauma
|
||||
break;
|
||||
case NetEntityEvent.Type.Control:
|
||||
msg.WriteRangedInteger(0, 3, 3);
|
||||
msg.Write((int)AnimController.GrabLimb);
|
||||
msg.Write((UInt16)AnimController.GrabLimb);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -95,7 +95,7 @@ namespace Barotrauma
|
||||
bool crouching = msg.ReadBoolean();
|
||||
keys[(int)InputType.Crouch].Held = crouching;
|
||||
keys[(int)InputType.Crouch].SetState(false, crouching);
|
||||
AnimController.GrabLimb = (LimbType)msg.ReadInt32();
|
||||
AnimController.GrabLimb = (LimbType)msg.ReadUInt16();
|
||||
}
|
||||
|
||||
bool hasAttackLimb = msg.ReadBoolean();
|
||||
@@ -371,6 +371,9 @@ namespace Barotrauma
|
||||
SetStun(0.0f, true, true);
|
||||
}
|
||||
|
||||
bool ragdolled = msg.ReadBoolean();
|
||||
IsRagdolled = ragdolled;
|
||||
|
||||
bool huskInfected = msg.ReadBoolean();
|
||||
if (huskInfected)
|
||||
{
|
||||
|
||||
@@ -1468,15 +1468,17 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
|
||||
//Do ragdoll shenanigans before Stun because it's still technically a stun, innit? Less network updates for us!
|
||||
if (IsForceRagdolled)
|
||||
IsRagdolled = IsForceRagdolled;
|
||||
else if (!IsRagdolled || AnimController.Collider.LinearVelocity.Length() < 1f) //Keep us ragdolled if we were forced or we're too speedy to unragdoll
|
||||
else if (!IsRagdolled || (GameMain.Server != null && AnimController.Collider.LinearVelocity.Length() < 1f)) //Keep us ragdolled if we were forced or we're too speedy to unragdoll
|
||||
IsRagdolled = IsKeyDown(InputType.Ragdoll); //Handle this here instead of Control because we can stop being ragdolled ourselves
|
||||
|
||||
if (IsRagdolled)
|
||||
{
|
||||
if (AnimController is HumanoidAnimController) ((HumanoidAnimController)AnimController).Crouching = false;
|
||||
|
||||
if(GameMain.Server != null)
|
||||
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
||||
AnimController.ResetPullJoints();
|
||||
selectedConstruction = null;
|
||||
return;
|
||||
|
||||
@@ -357,7 +357,7 @@ namespace Barotrauma
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
AnimController.GrabLimb = (LimbType)msg.ReadInt32();
|
||||
AnimController.GrabLimb = (LimbType)msg.ReadUInt16();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -438,7 +438,7 @@ namespace Barotrauma
|
||||
if (AnimController is HumanoidAnimController)
|
||||
{
|
||||
tempBuffer.Write(((HumanoidAnimController)AnimController).Crouching);
|
||||
tempBuffer.Write((int)AnimController.GrabLimb);
|
||||
tempBuffer.Write((UInt16)AnimController.GrabLimb);
|
||||
}
|
||||
|
||||
bool hasAttackLimb = AnimController.Limbs.Any(l => l != null && l.attack != null);
|
||||
@@ -536,6 +536,8 @@ namespace Barotrauma
|
||||
msg.WriteRangedSingle(MathHelper.Clamp(Stun, 0.0f, MaxStun), 0.0f, MaxStun, 8);
|
||||
}
|
||||
|
||||
msg.Write(IsRagdolled);
|
||||
|
||||
msg.Write(HuskInfectionState > 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user