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); } }
public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol) { Map currentMap = Find.CurrentMap; GenDraw.DrawFieldEdges(Building_NaniteFactory.ResourceCellsAround(center, currentMap)); }