diff --git a/Source/CombatExtended/CombatExtended/CollisionVertical.cs b/Source/CombatExtended/CombatExtended/CollisionVertical.cs index 0f624f6424..285e09afda 100755 --- a/Source/CombatExtended/CombatExtended/CollisionVertical.cs +++ b/Source/CombatExtended/CombatExtended/CollisionVertical.cs @@ -84,10 +84,9 @@ private static void CalculateHeightRange(Thing thing, out FloatRange heightRange if (pawn.Flying) { - heightAdjust += 0.5f * pawn.flight.PositionOffsetFactor; + heightAdjust += 1; } - // Humanlikes in combat crouch to reduce their profile if (pawn.IsCrouching()) { diff --git a/Source/CombatExtended/CombatExtended/LightingTracker.cs b/Source/CombatExtended/CombatExtended/LightingTracker.cs index 86126bf934..fe89f64b54 100755 --- a/Source/CombatExtended/CombatExtended/LightingTracker.cs +++ b/Source/CombatExtended/CombatExtended/LightingTracker.cs @@ -259,16 +259,12 @@ public float HighestCoverAt(IntVec3 position) float coverHeight = coverGridCache[CellToIndex(position)]; if (coverHeight == -1) { - Thing cover = position.GetFirstPawn(map) ?? position.GetCover(map); - if (cover == null) - { - coverHeight = 0; - } - else - { - Bounds bounds = CE_Utility.GetBoundsFor(cover); - coverHeight = bounds.size.y; - } + // separate pawnHeight and coverHeight and keep the higher instead of pawn height XOR cover height. + Thing pawn = position.GetFirstPawn(map); + Thing coverThing = position.GetCover(map); + float pawnHeight = pawn == null ? 0f : CE_Utility.GetBoundsFor(pawn).max.y; + float coverHeightFromThing = coverThing == null ? 0f : CE_Utility.GetBoundsFor(coverThing).max.y; + coverHeight = Mathf.Max(pawnHeight, coverHeightFromThing); coverGridCache[CellToIndex(position)] = coverHeight; } return coverHeight;