public override void Impact() { if (Payload != null) { if (Payload.projectile.explosionDelay == 0) { this.Explode(); return; } this.landed = true; this.ticksToDetonation = Payload.projectile.explosionDelay; GenExplosion.NotifyNearbyPawnsOfDangerousExplosive(this, Payload.projectile.damageDef, this.launcher.Faction); } else if (this.def.skyfaller.CausesExplosion) { // Log.Message("CausesExplosion"); GenExplosion.DoExplosion(base.Position, base.Map, this.def.skyfaller.explosionRadius, this.def.skyfaller.explosionDamage, null, GenMath.RoundRandom((float)this.def.skyfaller.explosionDamage.defaultDamage * this.def.skyfaller.explosionDamageFactor), -1f, null, null, null, null, null, 0f, 1, false, null, 0f, 1, 0f, false, null, (!this.def.skyfaller.damageSpawnedThings) ? this.innerContainer.ToList <Thing>() : null); } // this.SpawnThings(); this.innerContainer.ClearAndDestroyContents(DestroyMode.Vanish); CellRect cellRect = this.OccupiedRect(); for (int i = 0; i < cellRect.Area * this.def.skyfaller.motesPerCell; i++) { AdeptusFleckMaker.ThrowDustPuff(cellRect.RandomVector3, base.Map, 2f); } if (this.def.skyfaller.MakesShrapnel) { SkyfallerShrapnelUtility.MakeShrapnel(base.Position, base.Map, this.shrapnelDirection, this.def.skyfaller.shrapnelDistanceFactor, this.def.skyfaller.metalShrapnelCountRange.RandomInRange, this.def.skyfaller.rubbleShrapnelCountRange.RandomInRange, true); } if (this.def.skyfaller.cameraShake > 0f && base.Map == Find.CurrentMap) { Find.CameraDriver.shaker.DoShake(this.def.skyfaller.cameraShake); } if (this.def.skyfaller.impactSound != null) { this.def.skyfaller.impactSound.PlayOneShot(SoundInfo.InMap(new TargetInfo(base.Position, base.Map, false), MaintenanceType.None)); } this.Destroy(DestroyMode.Vanish); }
public override void Tick() { if (Payload == null) { Log.Warning("Tried to spawn Artillery Strike with no Payload"); this.Destroy(); return; } if (this.ticksToDetonation > 0) { this.ticksToDetonation--; if (this.ticksToDetonation <= 0) { this.Explode(); } } this.innerContainer.ThingOwnerTick(true); if (this.SpawnTimedMotes) { CellRect cellRect = this.OccupiedRect(); for (int i = 0; i < cellRect.Area * this.def.skyfaller.motesPerCell; i++) { AdeptusFleckMaker.ThrowDustPuff(cellRect.RandomVector3, base.Map, 2f); } } if (this.def.skyfaller.reversed) { this.ticksToImpact++; if (!this.anticipationSoundPlayed && this.def.skyfaller.anticipationSound != null && this.ticksToImpact > this.def.skyfaller.anticipationSoundTicks) { this.anticipationSoundPlayed = true; this.def.skyfaller.anticipationSound.PlayOneShot(new TargetInfo(base.Position, base.Map, false)); } if (this.ticksToImpact == 220) { this.LeaveMap(); return; } if (this.ticksToImpact > 220) { Log.Error("ticksToImpact > LeaveMapAfterTicks. Was there an exception? Destroying skyfaller."); this.Destroy(DestroyMode.Vanish); return; } } else { this.ticksToImpact--; if (this.ticksToImpact == 15) { this.HitRoof(); } if (!this.anticipationSoundPlayed && this.def.skyfaller.anticipationSound != null && this.ticksToImpact < this.def.skyfaller.anticipationSoundTicks) { this.anticipationSoundPlayed = true; this.def.skyfaller.anticipationSound.PlayOneShot(new TargetInfo(base.Position, base.Map, false)); } if (this.ticksToImpact <= 0 && this.ticksToDetonation <= 0) { this.Impact(); return; } if (this.ticksToImpact < 0 && Payload.projectile.explosionDelay == 0) { Log.Error("ticksToImpact < 0. Was there an exception? Destroying skyfaller."); this.Destroy(DestroyMode.Vanish); } } }