Skip to content

ProjectileExtension

juanosarg edited this page Jun 3, 2026 · 2 revisions

<- Back

ProjectileExtension is a def extension that adds new functionality for projectiles

      public int beamLifetimeTicks   = 30;
      public int beamSkyFadeInTicks  = 0;
      public int beakSkyHoldTikcs    = 25;
      public int beakSkyFadeOutTicks = 5;
      public float flashIntensity      = -1f;
      public FleckDef hitFleck;
      public EffecterDef attachedEffecter;
      public FleckDef attachedFleck;
      public float fleckScale = 1;
      public int fleckRefreshInterval = 10;

      /// A filth that will be spawned if the projectile misses without hitting anything (and isn't intercepted by, for example, shields)
      public ThingDef filthOnMiss;

      /// A chance that <see cref="filthOnMiss"/> will be spawned.
      public float filthOnMissChance;

      /// The amount of <see cref="filthOnMiss"/> to spawn.
      public IntRange filthOnMissCount;

      //This static collection is accessed by external mods, for example as a projectile blacklist in Alpha Armoury
      public bool excludeFromStaticCollection = false;

How do I use this code?

This Def Extension is added to the ThingDef of the projectile you want to add it to.

If you aren't sure if the ThingDef ALREADY has an extension (for example, if you think another mod will add their own), always use XPATH (xml patching) to add an extension, as there is already a PatchOperationAddModExtension to ensure they don't collide.

For example, the eyeblast in Vanilla Psycasts Expanded

<modExtensions>
	<li Class="VEF.Weapons.ProjectileExtension">
		<flashIntensity>100</flashIntensity>
		<hitFleck>VPE_EyeBlast</hitFleck>
	</li>
</modExtensions>

Clone this wiki locally