- The server doesn't disable client-controlled AI characters that are far from all other players.

- Clients aren't allowed to flip swimming FishAnimControllers unless the server says so (occasionally caused creatures to flip around constantly because the clients ignore the 1-second "flipping cooldown").
- Moved Character.ReadStatus to the client project.
This commit is contained in:
Joonas Rikkonen
2017-09-21 17:44:52 +03:00
parent f291a22976
commit dd86b5745a
4 changed files with 101 additions and 103 deletions
@@ -299,5 +299,81 @@ namespace Barotrauma
return character;
}
private void ReadStatus(NetBuffer msg)
{
bool isDead = msg.ReadBoolean();
if (isDead)
{
causeOfDeath = (CauseOfDeath)msg.ReadByte();
byte severedLimbCount = msg.ReadByte();
if (!IsDead)
{
if (causeOfDeath == CauseOfDeath.Pressure)
{
Implode(true);
}
else
{
Kill(causeOfDeath, true);
}
}
for (int i = 0; i < severedLimbCount; i++)
{
int severedJointIndex = msg.ReadByte();
AnimController.SeverLimbJoint(AnimController.LimbJoints[severedJointIndex]);
}
}
else
{
this.isDead = false;
health = msg.ReadRangedSingle(minHealth, maxHealth, 8);
bool lowOxygen = msg.ReadBoolean();
if (lowOxygen)
{
Oxygen = msg.ReadRangedSingle(-100.0f, 100.0f, 8);
}
else
{
Oxygen = 100.0f;
}
bool isBleeding = msg.ReadBoolean();
if (isBleeding)
{
bleeding = msg.ReadRangedSingle(0.0f, 5.0f, 8);
}
else
{
bleeding = 0.0f;
}
bool stunned = msg.ReadBoolean();
if (stunned)
{
float newStunTimer = msg.ReadRangedSingle(0.0f, 60.0f, 8);
SetStun(newStunTimer, true, true);
}
else
{
SetStun(0.0f, true, true);
}
bool huskInfected = msg.ReadBoolean();
if (huskInfected)
{
HuskInfectionState = Math.Max(HuskInfectionState, 0.01f);
}
else
{
HuskInfectionState = 0.0f;
}
}
}
}
}