Fixed AICharacters not playing sounds in mp

This commit is contained in:
Joonas Rikkonen
2017-11-24 17:49:52 +02:00
parent 1c09f757a2
commit e79ad3dceb
@@ -28,8 +28,10 @@ namespace Barotrauma
{ {
base.Update(deltaTime, cam); base.Update(deltaTime, cam);
if (!Enabled || IsRemotePlayer) return; if (!Enabled) return;
if (!IsRemotePlayer)
{
float dist = Vector2.DistanceSquared(cam.WorldViewCenter, WorldPosition); float dist = Vector2.DistanceSquared(cam.WorldViewCenter, WorldPosition);
if (dist > 8000.0f * 8000.0f) if (dist > 8000.0f * 8000.0f)
{ {
@@ -39,22 +41,25 @@ namespace Barotrauma
{ {
AnimController.SimplePhysicsEnabled = false; AnimController.SimplePhysicsEnabled = false;
} }
}
if (IsDead || Health <= 0.0f || IsUnconscious || Stun > 0.0f) return; if (IsDead || Health <= 0.0f || IsUnconscious || Stun > 0.0f) return;
if (Controlled == this || !aiController.Enabled) return; if (Controlled == this || !aiController.Enabled) return;
SoundUpdate(deltaTime); SoundUpdate(deltaTime);
if (!IsRemotePlayer)
{
aiController.Update(deltaTime); aiController.Update(deltaTime);
} }
}
partial void SoundUpdate(float deltaTime); partial void SoundUpdate(float deltaTime);
public override void AddDamage(CauseOfDeath causeOfDeath, float amount, IDamageable attacker) public override void AddDamage(CauseOfDeath causeOfDeath, float amount, IDamageable attacker)
{ {
base.AddDamage(causeOfDeath, amount, attacker); base.AddDamage(causeOfDeath, amount, attacker);
if (attacker!=null) aiController.OnAttacked(attacker, amount); if (attacker != null) aiController.OnAttacked(attacker, amount);
} }
public override AttackResult AddDamage(IDamageable attacker, Vector2 worldPosition, Attack attack, float deltaTime, bool playSound = false) public override AttackResult AddDamage(IDamageable attacker, Vector2 worldPosition, Attack attack, float deltaTime, bool playSound = false)