diff --git a/Subsurface/Source/Characters/AICharacter.cs b/Subsurface/Source/Characters/AICharacter.cs index e97c1efb8..6e0dddc60 100644 --- a/Subsurface/Source/Characters/AICharacter.cs +++ b/Subsurface/Source/Characters/AICharacter.cs @@ -34,8 +34,18 @@ namespace Barotrauma public override void Update(Camera cam, float deltaTime) { base.Update(cam, deltaTime); + + float dist = Vector2.Distance(cam.WorldViewCenter, WorldPosition); + if (dist > 8000.0f) + { + AnimController.SimplePhysicsEnabled = true; + } + else if (dist < 7000.0f) + { + AnimController.SimplePhysicsEnabled = false; + } - if (isDead) return; + if (isDead || health <= 0.0f) return; if (Controlled == this) return; @@ -92,6 +102,9 @@ namespace Barotrauma message.WriteRangedSingle(MathHelper.Clamp(AnimController.StunTimer, 0.0f, 60.0f), 0.0f, 60.0f, 8); message.Write((byte)((health / maxHealth) * 255.0f)); + Bleeding = MathHelper.Clamp(Bleeding, 0.0f, 5.0f); + message.WriteRangedSingle(Bleeding, 0.0f, 5.0f, 8); + aiController.FillNetworkData(message); return true; case NetworkEventType.EntityUpdate: @@ -160,18 +173,23 @@ namespace Barotrauma } //} - float newStunTimer = 0.0f, newHealth = 0.0f; + float newStunTimer = 0.0f, newHealth = 0.0f, newBleeding = 0.0f; try { newStunTimer = message.ReadRangedSingle(0.0f, 60.0f, 8); newHealth = (message.ReadByte() / 255.0f) * maxHealth; + + + newBleeding = message.ReadRangedSingle(0.0f, 5.0f, 8); } catch { return; } AnimController.StunTimer = newStunTimer; health = newHealth; + Bleeding = newBleeding; + aiController.ReadNetworkData(message); return; case NetworkEventType.EntityUpdate: diff --git a/Subsurface/Source/Characters/Animation/Ragdoll.cs b/Subsurface/Source/Characters/Animation/Ragdoll.cs index a23baf77a..217bce765 100644 --- a/Subsurface/Source/Characters/Animation/Ragdoll.cs +++ b/Subsurface/Source/Characters/Animation/Ragdoll.cs @@ -393,13 +393,13 @@ namespace Barotrauma if (impact > 0.8f && l.HitSound != null && l.soundTimer <= 0.0f) l.HitSound.Play(volume, impact * 100.0f, l.WorldPosition); if (impact > l.impactTolerance) - { + { if (!character.IsNetworkPlayer) { character.AddDamage(CauseOfDeath.Damage, impact - l.impactTolerance * 0.1f); - } - strongestImpact = Math.Max(strongestImpact, impact - l.impactTolerance); + strongestImpact = Math.Max(strongestImpact, impact - l.impactTolerance); + } SoundPlayer.PlayDamageSound(DamageSoundType.LimbBlunt, strongestImpact, l.body); @@ -824,8 +824,10 @@ namespace Barotrauma //if (character is AICharacter) SetRotation(refLimb.body.TargetRotation); - //foreach (Limb limb in Limbs) - //{ + foreach (Limb limb in Limbs) + { + limb.body.LinearVelocity = Vector2.Zero; + limb.body.AngularVelocity = Vector2.Zero; // if (limb.body.TargetPosition == Vector2.Zero) // { // limb.body.SetTransform(limb.body.SimPosition + diff, limb.body.Rotation); @@ -837,7 +839,7 @@ namespace Barotrauma // limb.body.SetTransform(limb.body.TargetPosition, limb.body.TargetRotation); // limb.body.TargetPosition = Vector2.Zero; - //} + } } } diff --git a/Subsurface/Source/Characters/Character.cs b/Subsurface/Source/Characters/Character.cs index e2f8851ae..0ab519ce5 100644 --- a/Subsurface/Source/Characters/Character.cs +++ b/Subsurface/Source/Characters/Character.cs @@ -873,7 +873,7 @@ namespace Barotrauma { foreach (Character c in CharacterList) { - if (c.isDead || !c.Enabled) continue; + if (c.isDead || c.health <= 0.0f || !c.Enabled) continue; c.AnimController.UpdateAnim(deltaTime); } } @@ -897,16 +897,6 @@ namespace Barotrauma obstructVisionAmount = Math.Max(obstructVisionAmount - deltaTime, 0.0f); - float dist = Vector2.Distance(cam.WorldViewCenter, WorldPosition); - if (dist > 8000.0f) - { - AnimController.SimplePhysicsEnabled = true; - } - else if (dist < 7000.0f) - { - AnimController.SimplePhysicsEnabled = false; - } - if (isDead) return; if (!(AnimController is FishAnimController)) diff --git a/Subsurface/Source/Events/MonsterEvent.cs b/Subsurface/Source/Events/MonsterEvent.cs index 259f2555d..3f2d316b6 100644 --- a/Subsurface/Source/Events/MonsterEvent.cs +++ b/Subsurface/Source/Events/MonsterEvent.cs @@ -42,8 +42,8 @@ namespace Barotrauma position.Y -= Level.Loaded.Size.Y; } - position.X += Rand.Range(-0.5f, 0.5f); - position.Y += Rand.Range(-0.5f, 0.5f); + position.X += Rand.Range(-0.5f, 0.5f, false); + position.Y += Rand.Range(-0.5f, 0.5f, false); monsters[i] = Character.Create(characterFile, position); } } diff --git a/Subsurface/Source/Map/WayPoint.cs b/Subsurface/Source/Map/WayPoint.cs index 716676b6f..e84e0548f 100644 --- a/Subsurface/Source/Map/WayPoint.cs +++ b/Subsurface/Source/Map/WayPoint.cs @@ -617,7 +617,7 @@ namespace Barotrauma if (!wayPoints.Any()) return null; - return wayPoints[Rand.Int(wayPoints.Count())]; + return wayPoints[Rand.Int(wayPoints.Count(), false)]; } public static WayPoint[] SelectCrewSpawnPoints(List crew) diff --git a/Subsurface/Source/Networking/GameClient.cs b/Subsurface/Source/Networking/GameClient.cs index d9bb13689..8b149cc8d 100644 --- a/Subsurface/Source/Networking/GameClient.cs +++ b/Subsurface/Source/Networking/GameClient.cs @@ -30,6 +30,10 @@ namespace Barotrauma.Networking public GameClient(string newName) { + GameMain.DebugDraw = false; + Hull.EditFire = false; + Hull.EditWater = false; + name = newName; characterInfo = new CharacterInfo(Character.HumanConfigFile, name); diff --git a/Subsurface/Source/Networking/NetConfig.cs b/Subsurface/Source/Networking/NetConfig.cs index 7ca0c7c49..9e1940093 100644 --- a/Subsurface/Source/Networking/NetConfig.cs +++ b/Subsurface/Source/Networking/NetConfig.cs @@ -16,7 +16,7 @@ namespace Barotrauma.Networking //if a Character is further than this from the sub, the server will ignore it //(in sim units) - public const float CharacterIgnoreDistance = 100.0f; + public const float CharacterIgnoreDistance = 300.0f; //if a ragdoll is further than this from the correct position, teleport it there //(in sim units) @@ -32,7 +32,7 @@ namespace Barotrauma.Networking public const float IdSendInterval = 0.2f; public const float RerequestInterval = 0.2f; - public const int ReliableMessageBufferSize = 100; + public const int ReliableMessageBufferSize = 500; public const int ResendAttempts = 10; } } diff --git a/Subsurface/Source/Screens/NetLobbyScreen.cs b/Subsurface/Source/Screens/NetLobbyScreen.cs index d88d71533..d6725fac3 100644 --- a/Subsurface/Source/Screens/NetLobbyScreen.cs +++ b/Subsurface/Source/Screens/NetLobbyScreen.cs @@ -884,10 +884,7 @@ namespace Barotrauma public bool TrySelectSub(string subName, string md5Hash) { - - subName = subName.ToLower(); - - Submarine sub = Submarine.SavedSubmarines.Find(m => m.Name.ToLower() == subName); + Submarine sub = Submarine.SavedSubmarines.Find(m => m.Name == subName); if (sub == null) { new GUIMessageBox("Submarine not found!","The submarine ''" + subName + "'' has been selected by the server. Matching file not found in your map folder."); diff --git a/Subsurface_Solution.v12.suo b/Subsurface_Solution.v12.suo index 14d9dde82..522cba962 100644 Binary files a/Subsurface_Solution.v12.suo and b/Subsurface_Solution.v12.suo differ