private static void EffectProjectileExtension(Projectile __instance, Vector3 vector, Thing hitThing) { EffectProjectileExtension effects = __instance.def.GetModExtension <EffectProjectileExtension>(); if (effects != null) { // effects.ThrowMote(vector, __instance.Map, __instance.def.projectile.damageDef.explosionCellMote, effects.explosionMoteSize, __instance.def.projectile.damageDef.explosionColorCenter, __instance.def.projectile.damageDef.soundExplosion, ThingDef.Named(effects.ImpactMoteDef) ?? null, effects.ImpactMoteSizeRange?.RandomInRange ?? effects.ImpactMoteSize, ThingDef.Named(effects.ImpactGlowMoteDef) ?? null, effects.ImpactGlowMoteSizeRange?.RandomInRange ?? effects.ImpactGlowMoteSize, hitThing); effects.ThrowMote(vector, __instance.Map, __instance.def.projectile.damageDef.explosionCellMote, __instance.def.projectile.damageDef.explosionColorCenter, __instance.def.projectile.damageDef.soundExplosion, effects, hitThing); } }
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); } }