public static void Postfix(Pawn pawn, ref bool __result) { // Also check that the pawn isn't standing on a tile that doesn't allow for crouching if (__result && !TerrainDefExtension.Get(pawn.Map.terrainGrid.TerrainAt(pawn.Position)).allowCrouching) { __result = false; } }
public static void Postfix(Thing thing, ref FloatRange heightRange, ref float shotHeight) { if (thing != null && thing.Map != null) { var terrainCoverEff = TerrainDefExtension.Get(thing.Map.terrainGrid.TerrainAt(thing.Position)).coverEffectiveness; float finalAdj = Mathf.Min(heightRange.max, terrainCoverEff); heightRange.max -= finalAdj; shotHeight -= finalAdj; } }