Husk infections, manually attacking when controlling a creature

This commit is contained in:
Regalis
2016-08-26 20:52:44 +03:00
parent 3d2d06d2e5
commit e2885a912d
19 changed files with 586 additions and 84 deletions
+16 -1
View File
@@ -49,7 +49,7 @@ namespace Barotrauma
if (isDead || health <= 0.0f) return;
if (Controlled == this) return;
if (Controlled == this || !aiController.Enabled) return;
if (soundTimer > 0)
{
@@ -117,6 +117,12 @@ namespace Barotrauma
aiController.FillNetworkData(message);
return true;
case NetworkEventType.EntityUpdate:
message.Write(Controlled == this);
if (Controlled == this)
{
return base.FillNetworkData(type, message, data);
}
message.Write(AnimController.Dir > 0.0f);
message.WriteRangedSingle(MathHelper.Clamp(AnimController.TargetMovement.X, -1.0f, 1.0f), -1.0f, 1.0f, 4);
@@ -215,6 +221,15 @@ namespace Barotrauma
case NetworkEventType.EntityUpdate:
if (sendingTime <= LastNetworkUpdate) return false;
bool playerControlled = message.ReadBoolean();
if (playerControlled)
{
aiController.Enabled = false;
return base.ReadNetworkData(type, message, sendingTime, out data);
}
aiController.Enabled = true;
Vector2 targetMovement = Vector2.Zero, pos = Vector2.Zero;
bool targetDir = false,inSub = false;