diff --git a/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/DebugDraw/DebugDraw.cs b/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/DebugDraw/DebugDraw.cs index 0d12e5ba..f370d8e6 100644 --- a/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/DebugDraw/DebugDraw.cs +++ b/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/DebugDraw/DebugDraw.cs @@ -88,29 +88,33 @@ public static void AddLine(Vector3D origin, Vector3D destination, Color color, f public override void Draw() { - foreach (var key in QueuedPoints.Keys.ToList()) + try { - DrawPoint0(key, QueuedPoints[key].Item2); + foreach (var key in QueuedPoints.Keys.ToList()) + { + DrawPoint0(key, QueuedPoints[key].Item2); - if (DateTime.UtcNow.Ticks > QueuedPoints[key].Item1) - QueuedPoints.Remove(key); - } + if (DateTime.UtcNow.Ticks > QueuedPoints[key].Item1) + QueuedPoints.Remove(key); + } - foreach (var key in QueuedGridPoints.Keys.ToList()) - { - DrawGridPoint0(key, QueuedGridPoints[key].Item3, QueuedGridPoints[key].Item2); + foreach (var key in QueuedGridPoints.Keys.ToList()) + { + DrawGridPoint0(key, QueuedGridPoints[key].Item3, QueuedGridPoints[key].Item2); - if (DateTime.UtcNow.Ticks > QueuedGridPoints[key].Item1) - QueuedGridPoints.Remove(key); - } + if (DateTime.UtcNow.Ticks > QueuedGridPoints[key].Item1) + QueuedGridPoints.Remove(key); + } - foreach (var key in QueuedLinePoints.Keys.ToList()) - { - DrawLine0(key.Item1, key.Item2, QueuedLinePoints[key].Item2); + foreach (var key in QueuedLinePoints.Keys.ToList()) + { + DrawLine0(key.Item1, key.Item2, QueuedLinePoints[key].Item2); - if (DateTime.UtcNow.Ticks > QueuedLinePoints[key].Item1) - QueuedLinePoints.Remove(key); + if (DateTime.UtcNow.Ticks > QueuedLinePoints[key].Item1) + QueuedLinePoints.Remove(key); + } } + catch { } // Icky no error logging } private void DrawPoint0(Vector3D globalPos, Color color) diff --git a/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/HeartData.cs b/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/HeartData.cs index f6ef76f8..c6980fb4 100644 --- a/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/HeartData.cs +++ b/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/HeartData.cs @@ -24,7 +24,7 @@ internal class HeartData public ulong SteamId = 0; public List Players = new List(); public bool DegradedMode = false; - public int DegradedModeTicks = 30; + public int DegradedModeTicks = 20; public Action OnGridAdd = (a) => { }; public Action OnGridRemove = (a) => { }; public GuiBlockCategoryHelper OrreryBlockCategory = new GuiBlockCategoryHelper("[Orrery Combat Framework]", "OrreryBlockCategory"); diff --git a/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/ParallelProjectileThread.cs b/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/ParallelProjectileThread.cs index b1740fa5..b8cd5d67 100644 --- a/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/ParallelProjectileThread.cs +++ b/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/ParallelProjectileThread.cs @@ -1,4 +1,5 @@ -using Heart_Module.Data.Scripts.HeartModule.ExceptionHandler; +using Heart_Module.Data.Scripts.HeartModule.Debug; +using Heart_Module.Data.Scripts.HeartModule.ExceptionHandler; using ParallelTasks; using Sandbox.Game.Entities; using Sandbox.ModAPI; @@ -44,6 +45,9 @@ public void Update() MyAPIGateway.Utilities.ShowNotification("PPT Sim: " + Math.Round(1/60d/DeltaTick, 2), 1000/60); + foreach (var p in ProjectileManager.I.ActiveProjectiles.Values) + DebugDraw.AddLine(p.Position, p.NextMoveStep, VRageMath.Color.Red, 0); + if (thisTask.IsComplete) { // Update thread-safe buffer lists diff --git a/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/Projectile.cs b/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/Projectile.cs index 5f3ac6a9..8dc2f51f 100644 --- a/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/Projectile.cs +++ b/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/Projectile.cs @@ -1,4 +1,5 @@ -using Heart_Module.Data.Scripts.HeartModule.ErrorHandler; +using Heart_Module.Data.Scripts.HeartModule.Debug; +using Heart_Module.Data.Scripts.HeartModule.ErrorHandler; using Heart_Module.Data.Scripts.HeartModule.Projectiles.GuidanceHelpers; using Heart_Module.Data.Scripts.HeartModule.Projectiles.StandardClasses; using Sandbox.Game.Entities; @@ -309,19 +310,21 @@ private void PerformRaycastRecursive(double length) if (entities.Count == 0) return; - MyAPIGateway.Physics.CastRayParallel(ref Position, ref NextMoveStep, DefaultCollisionLayer, (hitInfo) => + MyAPIGateway.Physics.CastRayParallel(ref Position, ref NextMoveStep, 0, (hitInfo) => { if (RemainingImpacts <= 0 || hitInfo.HitEntity.EntityId == Firer) return; + DebugDraw.AddLine(hitInfo.Position, hitInfo.Position - hitInfo.Normal, VRageMath.Color.Blue, 2); + MaxBeamLength = (float) (hitInfo.Fraction * length); if (MyAPIGateway.Session.IsServer) { if (hitInfo.HitEntity is IMyCubeGrid) - DamageHandler.QueueEvent(new DamageEvent(hitInfo.HitEntity, DamageEvent.DamageEntType.Grid, this, hitInfo.Position, hitInfo.Normal, hitInfo.Position, hitInfo.Position - hitInfo.Normal)); + DamageHandler.QueueEvent(new DamageEvent(hitInfo.HitEntity, DamageEvent.DamageEntType.Grid, this, hitInfo.Position, hitInfo.Normal, hitInfo.Position + hitInfo.Normal, hitInfo.Position - hitInfo.Normal)); else if (hitInfo.HitEntity is IMyCharacter) - DamageHandler.QueueEvent(new DamageEvent(hitInfo.HitEntity, DamageEvent.DamageEntType.Character, this, hitInfo.Position, hitInfo.Normal, hitInfo.Position, hitInfo.Position - hitInfo.Normal)); + DamageHandler.QueueEvent(new DamageEvent(hitInfo.HitEntity, DamageEvent.DamageEntType.Character, this, hitInfo.Position, hitInfo.Normal, hitInfo.Position + hitInfo.Normal, hitInfo.Position - hitInfo.Normal)); } if (MyAPIGateway.Session.IsServer)