public static void ThrowMuzzleFlash(IntVec3 cell, Map map, ThingDef moteDef, float scale, Verb verb) { if (verb.EquipmentSource != null) { if (verb.verbProps.range > 1.48f) { ThingDef mote = moteDef; Vector3 origin = verb.CasterIsPawn ? verb.CasterPawn.Drawer.DrawPos : verb.Caster.DrawPos; CompEquippable equippable = verb.EquipmentSource.TryGetComp <CompEquippable>(); float aimAngle = (verb.CurrentTarget.CenterVector3 - origin).AngleFlat(); if (Oversized) { OversizedWeapon(verb.EquipmentSource, aimAngle, verb, ref origin); } if (verb.EquipmentSource.def.HasModExtension <BarrelOffsetExtension>()) { BarrelOffsetExtension ext = verb.EquipmentSource.def.GetModExtension <BarrelOffsetExtension>(); EffectProjectileExtension ext2 = verb.GetProjectile().HasModExtension <EffectProjectileExtension>() ? verb.GetProjectile().GetModExtension <EffectProjectileExtension>() : null; float offset = ext.barrellength; origin += (verb.CurrentTarget.CenterVector3 - origin).normalized * (verb.EquipmentSource.def.graphic.drawSize.magnitude * (offset)); if (ext2 != null && ext2.muzzleFlare) { ThingDef muzzleFlaremote = DefDatabase <ThingDef> .GetNamed(!ext2.muzzleSmokeDef.NullOrEmpty()?ext2.muzzleFlareDef : "Mote_SparkFlash"); MoteMaker.MakeStaticMote(origin, map, muzzleFlaremote, ext2.muzzleFlareSize); } else if (ext.muzzleFlare) { ThingDef muzzleFlaremote = DefDatabase <ThingDef> .GetNamed(!ext.muzzleSmokeDef.NullOrEmpty()?ext.muzzleFlareDef : "Mote_SparkFlash"); MoteMaker.MakeStaticMote(origin, map, muzzleFlaremote, ext.muzzleFlareSize); } if (ext2 != null && ext2.muzzleSmoke) { string muzzleSmokemote = !ext2.muzzleSmokeDef.NullOrEmpty() ? ext2.muzzleSmokeDef : "OG_Mote_SmokeTrail"; TrailThrower.ThrowSmoke(origin, ext2.muzzleSmokeSize, map, muzzleSmokemote); } else if (ext.muzzleSmoke) { string muzzleSmokemote = !ext.muzzleSmokeDef.NullOrEmpty() ? ext.muzzleSmokeDef : "OG_Mote_SmokeTrail"; TrailThrower.ThrowSmoke(origin, ext.muzzleSmokeSize, map, muzzleSmokemote); } } MoteMaker.MakeStaticMote(origin, map, mote, scale); return; } } { MoteMaker.MakeStaticMote(cell.ToVector3Shifted(), map, moteDef, scale); } }
public override void Tick() { base.Tick(); if (landed) { return; } LastPos = ExactPosition; ticksToImpact--; if (!ExactPosition.InBounds(Map)) { Position = LastPos.ToIntVec3(); Destroy(); return; } if (CheckForCollisionBetween()) { return; } Position = ExactPosition.ToIntVec3(); if (ticksToImpact == 60 && Find.TickManager.CurTimeSpeed == TimeSpeed.Normal && def.projectile.soundImpactAnticipate != null) { def.projectile.soundImpactAnticipate.PlayOneShot(this); } //TODO : It appears that the final steps in the arc (past ticksToImpact == 0) don't CheckForCollisionBetween. if (ticksToImpact <= 0) { ImpactSomething(); return; } if (ambientSustainer != null) { ambientSustainer.Maintain(); } if (def.HasModExtension <TrailerProjectileExtension>()) { var trailer = def.GetModExtension <TrailerProjectileExtension>(); if (trailer != null) { if (ticksToImpact % trailer.trailerMoteInterval == 0) { for (int i = 0; i < trailer.motesThrown; i++) { TrailThrower.ThrowSmoke(DrawPos, trailer.trailMoteSize, Map, trailer.trailMoteDef); } } } } }
public void Tick() { this.lifeTime--; Vector3 pos = this.targetCell.ToVector3() + Velocity(-Angle) * Mathf.Lerp(StartZ, 0f, 1f - (float)this.lifeTime / (float)this.maxLifeTime); pos.z += 1.25f; pos.y = AltitudeLayer.MetaOverlays.AltitudeFor(); if (ordnance.HasModExtension <TrailerProjectileExtension>()) { for (int i = 0; i < ordnance.modExtensions.Count; i++) { TrailerProjectileExtension trailer = ordnance.modExtensions[i] as TrailerProjectileExtension; if (trailer != null) { if (lifeTime % trailer.trailerMoteInterval == 0) { for (int ii = 0; ii < trailer.motesThrown; ii++) { // Trail1Thrower.ThrowSmokeTrail(__instance.Position.ToVector3Shifted(), trailer.trailMoteSize, __instance.Map, trailer.trailMoteDef); // TrailThrower.ThrowSmokeTrail(__instance.DrawPos, trailer.trailMoteSize * DistanceCoveredFraction(___origin, ___destination, ___ticksToImpact, __instance.def.projectile.SpeedTilesPerTick), __instance.Map, trailer.trailMoteDef, __instance); Color?DC = null; if (trailer.useGraphicColor) { DC = ordnance.graphicData.color; } else if (trailer.useGraphicColorTwo) { DC = ordnance.graphicData.colorTwo; } TrailThrower.ThrowSprayTrail(pos, map, pos, this.targetCell.ToVector3(), trailer.trailMoteDef, trailer.trailMoteSize * Scale, 240, ordnance.projectile.SpeedTilesPerTick, DC); } } } } } /* * AdeptusMoteMaker.ThrowLightningBolt(pos, map); * AdeptusMoteMaker.ThrowEMPLightningGlow(pos, map, 1.25f); */ }
public static void Postfix(Projectile __instance, int ___ticksToImpact) { if (__instance != null) { if (__instance.def.HasModExtension <TrailerProjectileExtension>()) { TrailerProjectileExtension trailer = __instance.def.GetModExtension <TrailerProjectileExtension>(); if (trailer != null) { if (___ticksToImpact % trailer.trailerMoteInterval == 0) { for (int i = 0; i < trailer.motesThrown; i++) { // TrailThrower.ThrowSmokeTrail(__instance.Position.ToVector3Shifted(), trailer.trailMoteSize, __instance.Map, trailer.trailMoteDef); TrailThrower.ThrowSmoke(__instance.DrawPos, trailer.trailMoteSize, __instance.Map, trailer.trailMoteDef); } } } } } }
public static void Postfix(ProjectileCE __instance, int ___ticksToImpact, IntVec3 ___originInt, Vector3 ___destinationInt) { if (__instance != null) { if (__instance.def.HasModExtension <TrailerProjectileExtension>() && __instance.Map != null) { for (int i = 0; i < __instance.def.modExtensions.Count; i++) { TrailerProjectileExtension trailer = __instance.def.modExtensions[i] as TrailerProjectileExtension; if (trailer != null) { if (___ticksToImpact % trailer.trailerMoteInterval == 0) { for (int ii = 0; ii < trailer.motesThrown; ii++) { // Trail1Thrower.ThrowSmokeTrail(__instance.Position.ToVector3Shifted(), trailer.trailMoteSize, __instance.Map, trailer.trailMoteDef); // TrailThrower.ThrowSmokeTrail(__instance.DrawPos, trailer.trailMoteSize * DistanceCoveredFraction(___origin, ___destination, ___ticksToImpact, __instance.def.projectile.SpeedTilesPerTick), __instance.Map, trailer.trailMoteDef, __instance); Color?DC = null; if (trailer.useGraphicColor) { DC = __instance.DrawColor; } else if (trailer.useGraphicColorTwo) { DC = __instance.DrawColorTwo; } TrailThrower.ThrowSprayTrail(__instance.ExactPosition, __instance.Map, ___originInt.ToVector3Shifted(), ___destinationInt, trailer.trailMoteDef, trailer.trailMoteSize, 240, __instance.def.projectile.SpeedTilesPerTick, DC); } } } } } } }