From 519f675cbfa0bf3eb17fe8262aec3c5533a2ea02 Mon Sep 17 00:00:00 2001 From: Logan Perkins Date: Fri, 5 Apr 2024 20:46:08 -0700 Subject: [PATCH 1/3] Use a 40 degree projection for projectile drawing --- .../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 1a6955e647..02abd03382 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,7 +1225,11 @@ public override void DrawAt(Vector3 drawLoc, bool flip = false) { //TODO : EXPERIMENTAL Add edifice height var shadowPos = new Vector3(ExactPosition.x, +<<<<<<< HEAD 0, +======= + def.Altitude - 0.001f, +>>>>>>> d452ab850 (Use a 40 degree projection for projectile drawing) ExactPosition.z); //EXPERIMENTAL: + (new CollisionVertical(ExactPosition.ToIntVec3().GetEdifice(Map))).Max); From 9bdd63293ba35a8d8991152ff87581697d4a878e Mon Sep 17 00:00:00 2001 From: Logan Perkins Date: Fri, 5 Apr 2024 14:39:25 -0700 Subject: [PATCH 2/3] Draw shadow immediately below projectile, use z-offset to emulate height --- .../CombatExtended/Projectiles/ProjectileCE.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs b/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs index 02abd03382..6b7e6dbbec 100644 --- a/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs +++ b/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs @@ -1225,12 +1225,8 @@ public override void DrawAt(Vector3 drawLoc, bool flip = false) { //TODO : EXPERIMENTAL Add edifice height var shadowPos = new Vector3(ExactPosition.x, -<<<<<<< HEAD - 0, -======= def.Altitude - 0.001f, ->>>>>>> d452ab850 (Use a 40 degree projection for projectile drawing) - ExactPosition.z); + ExactPosition.z - Mathf.Max(0f, ExactPosition.y)); //EXPERIMENTAL: + (new CollisionVertical(ExactPosition.ToIntVec3().GetEdifice(Map))).Max); //TODO : Vary ShadowMat plane From 43a24b559edcfc298b23a050121712019deaecec Mon Sep 17 00:00:00 2001 From: Logan Perkins Date: Fri, 5 Apr 2024 03:35:07 -0700 Subject: [PATCH 3/3] Force fragments to spawn at ground level or higher --- Source/CombatExtended/CombatExtended/Comps/CompFragments.cs | 4 ++++ 1 file changed, 4 insertions(+) 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);