public void CalculateCurvePoints(Vector3 start, Vector3 end, float variance)
        {
            int     variancePoints = 20;
            Vector3 initialVector  = SPT_Utility.GetVector(start, end);

            initialVector.y = 0;
            float initialAngle = (initialVector).ToAngleFlat(); //Quaternion.AngleAxis(90, Vector3.up) *
            float curveAngle   = 0;

            if (Rand.Chance(.5f))
            {
                curveAngle = variance;
            }
            else
            {
                curveAngle = (-1) * variance;
            }
            //calculate extra distance bolt travels around the ellipse
            float a = .5f * Vector3.Distance(start, end);
            float b = a * Mathf.Sin(.5f * Mathf.Deg2Rad * variance);
            float p = .5f * Mathf.PI * (3 * (a + b) - (Mathf.Sqrt((3 * a + b) * (a + 3 * b))));

            float incrementalDistance = p / variancePoints;
            float incrementalAngle    = (curveAngle / variancePoints) * 2;

            this.curvePoints.Add(this.trueOrigin);
            for (int i = 1; i < variancePoints; i++)
            {
                this.curvePoints.Add(this.curvePoints[i - 1] + ((Quaternion.AngleAxis(curveAngle, Vector3.up) * initialVector) * incrementalDistance)); //(Quaternion.AngleAxis(curveAngle, Vector3.up) *
                curveAngle -= incrementalAngle;
            }
        }
        protected virtual void Impact(Thing hitThing)
        {
            if (this.impactRadius > 0)
            {
                if (this.isExplosive)
                {
                    GenExplosion.DoExplosion(this.ExactPosition.ToIntVec3(), this.Map, this.impactRadius, this.impactDamageType, this.launcher as Pawn, this.explosionDamage, -1, this.impactDamageType.soundExplosion, def, null, null, null, 0f, 1, false, null, 0f, 0, 0.0f, true);
                }
                else
                {
                    this.impactCells = GenRadial.RadialCellsAround(this.Position, this.impactRadius, true).ToList();
                }
            }

            //From nanite to bench // not null
            //This.Launcher WHEN RETURNING HOME = Bench
            //This.LAUNCHER when being sent to job = NF

            Building_NaniteFactory factory       = this.launcher as Building_NaniteFactory; // NULL // THING
            Building_NaniteFactory returnFactory = hitThing as Building_NaniteFactory;


            Log.Message("1");
            if (!factory.DestroyedOrNull())
            {
                Log.Message("2");
                if (dispersalMethod == NaniteDispersal.Spray && !hitThing.DestroyedOrNull() && hitThing.Spawned)
                {
                    Log.Message("3");
                    this.sprayVec             = SPT_Utility.GetVector(this.curvePoints[this.curvePoints.Count - 1], hitThing.DrawPos);
                    this.impacted             = true;
                    this.ticksFollowingImpact = 35;
                    if (naniteAction == NaniteActions.Repair)
                    {
                        factory.RepairJobs.Add(hitThing);
                    }
                    else if (naniteAction == NaniteActions.Construct)
                    {
                        Frame constructFrame = hitThing as Frame;
                        factory.ConstructJobs.Add(constructFrame);
                    }
                    else if (naniteAction == NaniteActions.Deconstruct)
                    {
                        factory.DeconstructJobs.Add(hitThing);
                    }
                }
                else if (dispersalMethod == NaniteDispersal.ExplosionMist && !hitThing.DestroyedOrNull() && hitThing.Spawned)
                {
                    this.sprayVec             = SPT_Utility.GetVector(this.curvePoints[this.curvePoints.Count - 1], hitThing.DrawPos);
                    this.impacted             = true;
                    this.ticksFollowingImpact = 15;
                    if (naniteAction == NaniteActions.Repair)
                    {
                        factory.RepairJobs.Add(hitThing);
                    }
                    else if (naniteAction == NaniteActions.Construct)
                    {
                        Frame constructFrame = hitThing as Frame;
                        factory.ConstructJobs.Add(constructFrame);
                    }
                    else if (naniteAction == NaniteActions.Deconstruct)
                    {
                        factory.DeconstructJobs.Add(hitThing);
                    }
                }

                else
                {
                    Log.Message("5");

                    this.Destroy(DestroyMode.Vanish);
                }
            }
            else if (!returnFactory.DestroyedOrNull() && returnFactory.def == SPT_DefOf.SPT_NaniteFactory)
            {
                //if (naniteAction == NaniteActions.Return)
                //{
                returnFactory.nanitesTraveling = false;
                this.Destroy(DestroyMode.Vanish);
                //}
            }
            else
            {
                //FIRE FIRE FIRE
                this.Destroy(DestroyMode.Vanish);
            }
        }