public override void Update(float deltaTime, Camera cam) { base.Update(deltaTime, cam); if (!Enabled) { return; } if (!IsRemotePlayer && AIController is EnemyAIController enemyAi) { enemyAi.PetBehavior?.Update(deltaTime); } if (IsDead || Vitality <= 0.0f || Stun > 0.0f || IsIncapacitated) { //don't enable simple physics on dead/incapacitated characters //the ragdoll controls the movement of incapacitated characters instead of the collider, //but in simple physics mode the ragdoll would get disabled, causing the character to not move at all AnimController.SimplePhysicsEnabled = false; return; } if (!IsRemotePlayer && !(AIController is HumanAIController)) { float characterDistSqr = GetDistanceSqrToClosestPlayer(); if (characterDistSqr > MathUtils.Pow2(Params.DisableDistance * 0.5f)) { AnimController.SimplePhysicsEnabled = true; } else if (characterDistSqr < MathUtils.Pow2(Params.DisableDistance * 0.5f * 0.9f)) { AnimController.SimplePhysicsEnabled = false; } } if (GameMain.NetworkMember != null && !GameMain.NetworkMember.IsServer) { return; } if (Controlled == this) { return; } if (!IsRemotelyControlled && aiController != null && aiController.Enabled) { aiController.Update(deltaTime); } }