Sending NetTime at the start of a combined networkevent instead of individual networkevents, syncing itemcomponents for spectators, AICharacter importantentityupdates are sent again, misc bugfixes, some new heads

This commit is contained in:
Regalis
2015-11-20 17:12:33 +02:00
parent 8ec7fd44ff
commit cddf4f1bde
37 changed files with 269 additions and 130 deletions
+4 -8
View File
@@ -112,9 +112,7 @@ namespace Barotrauma
return true;
case NetworkEventType.EntityUpdate:
if (AnimController.RefLimb.SimPosition.Length() > NetConfig.CharacterIgnoreDistance) return false;
message.Write((float)NetTime.Now);
message.Write(AnimController.TargetDir == Direction.Right);
message.WriteRangedSingle(MathHelper.Clamp(AnimController.TargetMovement.X, -1.0f, 1.0f), -1.0f, 1.0f, 8);
message.WriteRangedSingle(MathHelper.Clamp(AnimController.TargetMovement.X, -1.0f, 1.0f), -1.0f, 1.0f, 8);
@@ -127,8 +125,8 @@ namespace Barotrauma
return true;
}
public override void ReadNetworkData(NetworkEventType type, NetIncomingMessage message, out object data)
public override void ReadNetworkData(NetworkEventType type, NetIncomingMessage message, float sendingTime, out object data)
{
data = null;
Enabled = true;
@@ -182,11 +180,9 @@ namespace Barotrauma
aiController.ReadNetworkData(message);
return;
case NetworkEventType.EntityUpdate:
float sendingTime = 0.0f;
Vector2 targetMovement = Vector2.Zero;
bool targetDir = false;
sendingTime = message.ReadFloat();
if (sendingTime <= LastNetworkUpdate) return;
Vector2 pos = Vector2.Zero, vel = Vector2.Zero;