TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ noDropItem

bool Terraria.Projectile.noDropItem

Set to true if you don't want this projectile to have a chance to recover the ammo item that shot this. For example, if you shoot the F:Terraria.ID.ProjectileID.WoodenArrowFriendly projectile, it will sometimes drop the F:Terraria.ID.ItemID.WoodenArrow item. If your weapon shoots multiple arrows for 1 ammo, you might want to consider setting this field to prevent infinite ammo glitches.
In M:Terraria.ModLoader.ModProjectile.OnKill(System.Int32), check this and F:Terraria.Projectile.owner to decide if the item should drop:

if (Projectile.owner == Main.myPlayer && !Projectile.noDropItem) See ExamplePaperAirplaneProjectile

for an example of this logic.
Set directly on the projectile instance returned from M:Terraria.Projectile.NewProjectile(Terraria.DataStructures.IEntitySource,System.Single,System.Single,System.Single,System.Single,System.Int32,System.Int32,System.Single,System.Int32,System.Single,System.Single,System.Single), not in M:Terraria.ModLoader.ModProjectile.SetDefaults. This ensures that the weapon spawning the projectile decides if the ammo item will spawn, which is more compatible.
Set automatically when shot from a weapon that counts as P:Terraria.ModLoader.DamageClass.Throwing and P:Terraria.Player.AnyThrownCostReduction is true.
Defaults to false.

Definition at line 124 of file Projectile.cs.

Referenced by Terraria.Projectile.SetDefaults().