From d90f3e1395438165e9bade2780299cb2b64b177d Mon Sep 17 00:00:00 2001 From: CMDR-Bill-Doors Date: Thu, 22 Aug 2024 18:42:18 +0100 Subject: [PATCH 1/4] Update ProjectileCE.cs --- .../CombatExtended/Projectiles/ProjectileCE.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs b/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs index ee3cd03a43..551b29dbd0 100644 --- a/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs +++ b/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs @@ -106,6 +106,7 @@ public virtual float DamageAmount public bool canTargetSelf; public bool castShadow = true; public bool logMisses = true; + protected bool ignoreRoof; public GlobalTargetInfo globalTargetInfo = GlobalTargetInfo.Invalid; public GlobalTargetInfo globalSourceInfo = GlobalTargetInfo.Invalid; @@ -348,6 +349,7 @@ public override void ExposeData() Scribe_Values.Look(ref logMisses, "logMisses", true); Scribe_Values.Look(ref castShadow, "castShadow", true); Scribe_Values.Look(ref lerpPosition, "lerpPosition", true); + Scribe_Values.Look(ref ignoreRoof, "ignoreRoof", true); //To fix landed grenades sl problem Scribe_Values.Look(ref exactPosition, "exactPosition"); @@ -551,6 +553,10 @@ public virtual void Launch(Thing launcher, Vector2 origin, float shotAngle, floa this.lerpPosition = props.lerpPosition; this.GravityFactor = props.Gravity; } + if (shotHeight >= CollisionVertical.WallCollisionHeight && launcher.Position.Roofed(launcher.Map)) + { + ignoreRoof = true; + } Launch(launcher, origin, equipment); } @@ -867,7 +873,7 @@ protected bool CheckCellForCollision(IntVec3 cell) protected virtual bool TryCollideWithRoof(IntVec3 cell) { - if (!cell.Roofed(Map)) + if (!cell.Roofed(Map) || ignoreRoof) { return false; } From 6254c8d5272d5e43dfbcca3a1b1aedb5432ed512 Mon Sep 17 00:00:00 2001 From: CMDR-Bill-Doors Date: Thu, 22 Aug 2024 18:52:25 +0100 Subject: [PATCH 2/4] not fly overhead --- .../CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs b/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs index 551b29dbd0..d3688f6109 100644 --- a/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs +++ b/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs @@ -553,7 +553,7 @@ public virtual void Launch(Thing launcher, Vector2 origin, float shotAngle, floa this.lerpPosition = props.lerpPosition; this.GravityFactor = props.Gravity; } - if (shotHeight >= CollisionVertical.WallCollisionHeight && launcher.Position.Roofed(launcher.Map)) + if (shotHeight >= CollisionVertical.WallCollisionHeight && launcher.Position.Roofed(launcher.Map) && !def.projectile.flyOverhead) { ignoreRoof = true; } From e76c8f5d825a8a263d5a057a170e378d6fe62b91 Mon Sep 17 00:00:00 2001 From: CMDR-Bill-Doors Date: Thu, 22 Aug 2024 18:58:31 +0100 Subject: [PATCH 3/4] Update ProjectileCE.cs --- .../CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs b/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs index d3688f6109..527b98cb34 100644 --- a/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs +++ b/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs @@ -553,7 +553,7 @@ public virtual void Launch(Thing launcher, Vector2 origin, float shotAngle, floa this.lerpPosition = props.lerpPosition; this.GravityFactor = props.Gravity; } - if (shotHeight >= CollisionVertical.WallCollisionHeight && launcher.Position.Roofed(launcher.Map) && !def.projectile.flyOverhead) + if (shotHeight >= CollisionVertical.WallCollisionHeight && Position.Roofed(launcher.Map) && !def.projectile.flyOverhead) { ignoreRoof = true; } From 85e18c5cccfa86e933ede130268c60bb370f49d6 Mon Sep 17 00:00:00 2001 From: CMDR-Bill-Doors Date: Thu, 22 Aug 2024 19:05:55 +0100 Subject: [PATCH 4/4] fly overhead fix --- .../CombatExtended/Projectiles/ProjectileCE.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs b/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs index 527b98cb34..5cdf7846d6 100644 --- a/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs +++ b/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs @@ -553,7 +553,7 @@ public virtual void Launch(Thing launcher, Vector2 origin, float shotAngle, floa this.lerpPosition = props.lerpPosition; this.GravityFactor = props.Gravity; } - if (shotHeight >= CollisionVertical.WallCollisionHeight && Position.Roofed(launcher.Map) && !def.projectile.flyOverhead) + if (shotHeight >= CollisionVertical.WallCollisionHeight && Position.Roofed(launcher.Map)) { ignoreRoof = true; } @@ -1200,6 +1200,11 @@ public override void Tick() { DangerTracker?.Notify_BulletAt(Position, def.projectile.damageAmountBase * dangerFactor); } + //If a flyoverhead ignore roof projectile is descending, enable roof check. + if (ignoreRoof && def.projectile.flyOverhead && shotAngle < 0) + { + ignoreRoof = false; + } } ///