Terraria.ModLoader.GlobalProjectile

This class allows you to modify and use hooks for all projectiles, including vanilla projectiles. Create an instance of an overriding class then call Mod.AddGlobalProjectile to use this.

Methods

Autoload(System.String@)()
Allows you to automatically load a GlobalProjectile instead of using Mod.AddGlobalProjectile. Return true to allow autoloading; by default returns the mod's autoload property. Name is initialized to the overriding class name. Use this method to either force or stop an autoload or to control the internal name.
NewInstance(Terraria.Projectile)()
Create a new instance of this GlobalProjectile for a Projectile instance. Called at the end of Projectile.SetDefaults. If CloneNewInstances is true, just calls Clone() Otherwise calls the default constructor and copies fields
SetDefaults(Terraria.Projectile)()
Allows you to set the properties of any and every projectile that gets created.
PreAI(Terraria.Projectile)()
Allows you to determine how any projectile behaves. Return false to stop the vanilla AI and the AI hook from being run. Returns true by default.
AI(Terraria.Projectile)()
Allows you to determine how any projectile behaves. This will only be called if PreAI returns true.
PostAI(Terraria.Projectile)()
Allows you to determine how any projectile behaves. This will be called regardless of what PreAI returns.
ShouldUpdatePosition(Terraria.Projectile)()
Whether or not the given projectile should update its position based on factors such as its velocity, whether it is in liquid, etc. Return false to make its velocity have no effect on its position. Returns true by default.
TileCollideStyle(Terraria.Projectile,System.Int32@,System.Int32@,System.Boolean@)()
Allows you to determine how a projectile interacts with tiles. Width and height determine the projectile's hitbox for tile collision, and default to -1. Leave them as -1 to use the projectile's real size. Fallthrough determines whether the projectile can fall through platforms, etc., and defaults to true.
OnTileCollide(Terraria.Projectile,Microsoft.Xna.Framework.Vector2)()
Allows you to determine what happens when a projectile collides with a tile. OldVelocity is the velocity before tile collision. The velocity that takes tile collision into account can be found with projectile.velocity. Return true to allow the vanilla tile collision code to take place (which normally kills the projectile). Returns true by default.
PreKill(Terraria.Projectile,System.Int32)()
Allows you to determine whether the vanilla code for Kill and the Kill hook will be called. Return false to stop them from being called. Returns true by default. Note that this does not stop the projectile from dying.
Kill(Terraria.Projectile,System.Int32)()
Allows you to control what happens when a projectile is killed (for example, creating dust or making sounds).
CanCutTiles(Terraria.Projectile)()
Return true or false to specify if the projectile can cut tiles, like vines. Return null for vanilla decision.
CutTiles(Terraria.Projectile)()
Code ran when the projectile cuts tiles. Only runs if CanCutTiles() returns true. Useful when programming lasers and such.
CanDamage(Terraria.Projectile)()
Whether or not the given projectile is capable of killing tiles (such as grass) and damaging NPCs/players. Return false to prevent it from doing any sort of damage. Returns true by default.
MinionContactDamage(Terraria.Projectile)()
Whether or not a minion can damage NPCs by touching them. Returns false by default. Note that this will only be used if the projectile is considered a pet.
ModifyDamageHitbox(Terraria.Projectile,Microsoft.Xna.Framework.Rectangle@)()
Allows you to change the hitbox used by a projectile for damaging players and NPCs.
CanHitNPC(Terraria.Projectile,Terraria.NPC)()
Allows you to determine whether a projectile can hit the given NPC. Return true to allow hitting the target, return false to block the projectile from hitting the target, and return null to use the vanilla code for whether the target can be hit. Returns null by default.
ModifyHitNPC(Terraria.Projectile,Terraria.NPC,System.Int32@,System.Single@,System.Boolean@,System.Int32@)()
Allows you to modify the damage, knockback, etc., that a projectile does to an NPC.
OnHitNPC(Terraria.Projectile,Terraria.NPC,System.Int32,System.Single,System.Boolean)()
Allows you to create special effects when a projectile hits an NPC (for example, inflicting debuffs).
CanHitPvp(Terraria.Projectile,Terraria.Player)()
Allows you to determine whether a projectile can hit the given opponent player. Return false to block the projectile from hitting the target. Returns true by default.
ModifyHitPvp(Terraria.Projectile,Terraria.Player,System.Int32@,System.Boolean@)()
Allows you to modify the damage, etc., that a projectile does to an opponent player.
OnHitPvp(Terraria.Projectile,Terraria.Player,System.Int32,System.Boolean)()
Allows you to create special effects when a projectile hits an opponent player.
CanHitPlayer(Terraria.Projectile,Terraria.Player)()
Allows you to determine whether a hostile projectile can hit the given player. Return false to block the projectile from hitting the target. Returns true by default.
ModifyHitPlayer(Terraria.Projectile,Terraria.Player,System.Int32@,System.Boolean@)()
Allows you to modify the damage, etc., that a hostile projectile does to a player.
OnHitPlayer(Terraria.Projectile,Terraria.Player,System.Int32,System.Boolean)()
Allows you to create special effects when a hostile projectile hits a player.
Colliding(Terraria.Projectile,Microsoft.Xna.Framework.Rectangle,Microsoft.Xna.Framework.Rectangle)()
Allows you to use custom collision detection between a projectile and a player or NPC that the projectile can damage. Useful for things like diagonal lasers, projectiles that leave a trail behind them, etc.
GetAlpha(Terraria.Projectile,Microsoft.Xna.Framework.Color)()
Allows you to determine the color and transparency in which a projectile is drawn. Return null to use the default color (normally light and buff color). Returns null by default.
PreDrawExtras(Terraria.Projectile,Microsoft.Xna.Framework.Graphics.SpriteBatch)()
Allows you to draw things behind a projectile. Returns false to stop the game from drawing extras textures related to the projectile (for example, the chains for grappling hooks), useful if you're manually drawing the extras. Returns true by default.
PreDraw(Terraria.Projectile,Microsoft.Xna.Framework.Graphics.SpriteBatch,Microsoft.Xna.Framework.Color)()
Allows you to draw things behind a projectile, or to modify the way the projectile is drawn. Return false to stop the game from drawing the projectile (useful if you're manually drawing the projectile). Returns true by default.
PostDraw(Terraria.Projectile,Microsoft.Xna.Framework.Graphics.SpriteBatch,Microsoft.Xna.Framework.Color)()
Allows you to draw things in front of a projectile. This method is called even if PreDraw returns false.
DrawBehind(Terraria.Projectile,System.Int32,System.Collections.Generic.List{System.Int32},System.Collections.Generic.List{System.Int32},System.Collections.Generic.List{System.Int32},System.Collections.Generic.List{System.Int32})()
When used in conjunction with "projectile.hide = true", allows you to specify that this projectile should be drawn behind certain elements. Add the index to one and only one of the lists. For example, the Nebula Arcanum projectile draws behind NPCs and tiles.
CanUseGrapple(System.Int32,Terraria.Player)()
Whether or not a grappling hook that shoots this type of projectile can be used by the given player. Return null to use the default code (whether or not the player is in the middle of firing the grappling hook). Returns null by default.
SingleGrappleHook(System.Int32,Terraria.Player)()
Whether or not a grappling hook can only have one hook per player in the world at a time. Return null to use the vanilla code. Returns null by default.
UseGrapple(Terraria.Player,System.Int32@)()
This code is called whenever the player uses a grappling hook that shoots this type of projectile. Use it to change what kind of hook is fired (for example, the Dual Hook does this), to kill old hook projectiles, etc.
NumGrappleHooks(Terraria.Projectile,Terraria.Player,System.Int32@)()
How many of this type of grappling hook the given player can latch onto blocks before the hooks start disappearing. Change the numHooks parameter to determine this; by default it will be 3.
GrappleRetreatSpeed(Terraria.Projectile,Terraria.Player,System.Single@)()
The speed at which the grapple retreats back to the player after not hitting anything. Defaults to 11, but vanilla hooks go up to 24.
GrapplePullSpeed(Terraria.Projectile,Terraria.Player,System.Single@)()
The speed at which the grapple pulls the player after hitting something. Defaults to 11, but the Bat Hook uses 16.