diff --git a/Source/CombatExtended/CombatExtended/Comps/CompFragments.cs b/Source/CombatExtended/CombatExtended/Comps/CompFragments.cs index 33ca0df9f7..ed78056562 100644 --- a/Source/CombatExtended/CombatExtended/Comps/CompFragments.cs +++ b/Source/CombatExtended/CombatExtended/Comps/CompFragments.cs @@ -30,6 +30,10 @@ static CompFragments() public static IEnumerator FragRoutine(Vector3 pos, Map map, float height, Thing instigator, ThingDefCountClass frag, float fragSpeedFactor, float fragShadowChance, FloatRange fragAngleRange, FloatRange fragXZAngleRange, float minCollisionDistance = 0f, bool canTargetSelf = true) { + if (height < 0.001f) + { + height = 0.001f; + } var cell = pos.ToIntVec3(); var exactOrigin = new Vector2(pos.x, pos.z); diff --git a/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs b/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs index 1a6955e647..6b7e6dbbec 100644 --- a/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs +++ b/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs @@ -198,7 +198,8 @@ public override Vector3 DrawPos { get { - return ExactPosition + new Vector3(0, 0, ExactPosition.y - shotHeight); + var sh = Mathf.Max(0f, (ExactPosition.y) * 0.84f); + return new Vector3(ExactPosition.x, def.Altitude, ExactPosition.z + sh); } } @@ -1224,8 +1225,8 @@ public override void DrawAt(Vector3 drawLoc, bool flip = false) { //TODO : EXPERIMENTAL Add edifice height var shadowPos = new Vector3(ExactPosition.x, - 0, - ExactPosition.z); + def.Altitude - 0.001f, + ExactPosition.z - Mathf.Max(0f, ExactPosition.y)); //EXPERIMENTAL: + (new CollisionVertical(ExactPosition.ToIntVec3().GetEdifice(Map))).Max); //TODO : Vary ShadowMat plane