1using Microsoft.Xna.Framework;
2using Microsoft.Xna.Framework.Graphics;
4using System.Collections.Generic;
30 internal int instanceIndex;
37 public virtual bool Autoload(ref
string name) {
77 copy.instanceIndex = instanceIndex;
93 public virtual bool PreAI(Projectile projectile) {
101 public virtual void AI(Projectile projectile) {
108 public virtual void PostAI(Projectile projectile) {
128 public virtual bool TileCollideStyle(Projectile projectile, ref
int width, ref
int height, ref
bool fallThrough) {
138 public virtual bool OnTileCollide(Projectile projectile, Vector2 oldVelocity) {
148 public virtual bool PreKill(Projectile projectile,
int timeLeft) {
157 public virtual void Kill(Projectile projectile,
int timeLeft) {
173 public virtual void CutTiles(Projectile projectile) {
208 public virtual bool?
CanHitNPC(Projectile projectile, NPC target) {
221 public virtual void ModifyHitNPC(Projectile projectile, NPC target, ref
int damage, ref
float knockback, ref
bool crit, ref
int hitDirection) {
232 public virtual void OnHitNPC(Projectile projectile, NPC target,
int damage,
float knockback,
bool crit) {
241 public virtual bool CanHitPvp(Projectile projectile, Player target) {
252 public virtual void ModifyHitPvp(Projectile projectile, Player target, ref
int damage, ref
bool crit) {
262 public virtual void OnHitPvp(Projectile projectile, Player target,
int damage,
bool crit) {
271 public virtual bool CanHitPlayer(Projectile projectile, Player target) {
282 public virtual void ModifyHitPlayer(Projectile projectile, Player target, ref
int damage, ref
bool crit) {
292 public virtual void OnHitPlayer(Projectile projectile, Player target,
int damage,
bool crit) {
302 public virtual bool?
Colliding(Projectile projectile, Rectangle projHitbox, Rectangle targetHitbox) {
312 public virtual Color?
GetAlpha(Projectile projectile, Color lightColor) {
322 public virtual bool PreDrawExtras(Projectile projectile, SpriteBatch spriteBatch) {
333 public virtual bool PreDraw(Projectile projectile, SpriteBatch spriteBatch, Color lightColor) {
343 public virtual void PostDraw(Projectile projectile, SpriteBatch spriteBatch, Color lightColor) {
355 public virtual void DrawBehind(Projectile projectile,
int index, List<int> drawCacheProjsBehindNPCsAndTiles, List<int> drawCacheProjsBehindNPCs, List<int> drawCacheProjsBehindProjectiles, List<int> drawCacheProjsOverWiresUI) {
375 public virtual void UseGrapple(Player player, ref
int type) {
381 public virtual void NumGrappleHooks(Projectile projectile, Player player, ref
int numHooks) {
393 public virtual void GrapplePullSpeed(Projectile projectile, Player player, ref
float speed) {
399 public virtual void GrappleTargetPoint(Projectile projectile, Player player, ref
float grappleX, ref
float grappleY) {
This class allows you to modify and use hooks for all projectiles, including vanilla projectiles....
virtual void OnHitPvp(Projectile projectile, Player target, int damage, bool crit)
Allows you to create special effects when a projectile hits an opponent player.
virtual ? bool CanUseGrapple(int type, Player player)
Whether or not a grappling hook that shoots this type of projectile can be used by the given player....
virtual bool InstancePerEntity
Whether to create a new GlobalProjectile instance for every Projectile that exists....
virtual bool Autoload(ref string name)
Allows you to automatically load a GlobalProjectile instead of using Mod.AddGlobalProjectile....
virtual void GrapplePullSpeed(Projectile projectile, Player player, ref float speed)
The speed at which the grapple pulls the player after hitting something. Defaults to 11,...
virtual void Kill(Projectile projectile, int timeLeft)
Allows you to control what happens when a projectile is killed (for example, creating dust or making ...
virtual bool CloneNewInstances
Whether instances of this GlobalProjectile are created through Clone or constructor (by default imple...
virtual bool PreDraw(Projectile projectile, SpriteBatch spriteBatch, Color lightColor)
Allows you to draw things behind a projectile, or to modify the way the projectile is drawn....
virtual void ModifyHitPlayer(Projectile projectile, Player target, ref int damage, ref bool crit)
Allows you to modify the damage, etc., that a hostile projectile does to a player.
virtual bool PreAI(Projectile projectile)
Allows you to determine how any projectile behaves. Return false to stop the vanilla AI and the AI ho...
virtual void OnHitPlayer(Projectile projectile, Player target, int damage, bool crit)
Allows you to create special effects when a hostile projectile hits a player.
virtual ? bool CanCutTiles(Projectile projectile)
Return true or false to specify if the projectile can cut tiles, like vines. Return null for vanilla ...
virtual void PostDraw(Projectile projectile, SpriteBatch spriteBatch, Color lightColor)
Allows you to draw things in front of a projectile. This method is called even if PreDraw returns fal...
virtual bool CanHitPlayer(Projectile projectile, Player target)
Allows you to determine whether a hostile projectile can hit the given player. Return false to block ...
virtual bool OnTileCollide(Projectile projectile, Vector2 oldVelocity)
Allows you to determine what happens when a projectile collides with a tile. OldVelocity is the veloc...
virtual void PostAI(Projectile projectile)
Allows you to determine how any projectile behaves. This will be called regardless of what PreAI retu...
Mod mod
The mod to which this GlobalProjectile belongs.
virtual void OnHitNPC(Projectile projectile, NPC target, int damage, float knockback, bool crit)
Allows you to create special effects when a projectile hits an NPC (for example, inflicting debuffs)....
virtual void CutTiles(Projectile projectile)
Code ran when the projectile cuts tiles. Only runs if CanCutTiles() returns true. Useful when program...
virtual void ModifyHitNPC(Projectile projectile, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
Allows you to modify the damage, knockback, etc., that a projectile does to an NPC....
virtual ? bool CanHitNPC(Projectile projectile, NPC target)
Allows you to determine whether a projectile can hit the given NPC. Return true to allow hitting the ...
virtual ? Color GetAlpha(Projectile projectile, Color lightColor)
Allows you to determine the color and transparency in which a projectile is drawn....
virtual void ModifyDamageHitbox(Projectile projectile, ref Rectangle hitbox)
Allows you to change the hitbox used by a projectile for damaging players and NPCs.
virtual bool ShouldUpdatePosition(Projectile projectile)
Whether or not the given projectile should update its position based on factors such as its velocity,...
virtual bool CanHitPvp(Projectile projectile, Player target)
Allows you to determine whether a projectile can hit the given opponent player. Return false to block...
virtual GlobalProjectile Clone()
Returns a clone of this GlobalProjectile. By default this will return a memberwise clone; you will wa...
virtual void UseGrapple(Player player, ref int type)
This code is called whenever the player uses a grappling hook that shoots this type of projectile....
virtual bool CanDamage(Projectile projectile)
Whether or not the given projectile is capable of killing tiles (such as grass) and damaging NPCs/pla...
virtual void NumGrappleHooks(Projectile projectile, Player player, ref int numHooks)
How many of this type of grappling hook the given player can latch onto blocks before the hooks start...
virtual bool MinionContactDamage(Projectile projectile)
Whether or not a minion can damage NPCs by touching them. Returns false by default....
virtual ? bool Colliding(Projectile projectile, Rectangle projHitbox, Rectangle targetHitbox)
Allows you to use custom collision detection between a projectile and a player or NPC that the projec...
virtual void ModifyHitPvp(Projectile projectile, Player target, ref int damage, ref bool crit)
Allows you to modify the damage, etc., that a projectile does to an opponent player.
GlobalProjectile Instance(Projectile projectile)
virtual void GrappleTargetPoint(Projectile projectile, Player player, ref float grappleX, ref float grappleY)
The location that the grappling hook pulls the player to. Defaults to the center of the hook projecti...
virtual GlobalProjectile NewInstance(Projectile projectile)
Create a new instance of this GlobalProjectile for a Projectile instance. Called at the end of Projec...
virtual bool PreKill(Projectile projectile, int timeLeft)
Allows you to determine whether the vanilla code for Kill and the Kill hook will be called....
virtual void DrawBehind(Projectile projectile, int index, List< int > drawCacheProjsBehindNPCsAndTiles, List< int > drawCacheProjsBehindNPCs, List< int > drawCacheProjsBehindProjectiles, List< int > drawCacheProjsOverWiresUI)
When used in conjunction with "projectile.hide = true", allows you to specify that this projectile sh...
string Name
The name of this GlobalProjectile instance.
virtual ? bool SingleGrappleHook(int type, Player player)
Whether or not a grappling hook can only have one hook per player in the world at a time....
virtual void AI(Projectile projectile)
Allows you to determine how any projectile behaves. This will only be called if PreAI returns true.
virtual bool TileCollideStyle(Projectile projectile, ref int width, ref int height, ref bool fallThrough)
Allows you to determine how a projectile interacts with tiles. Width and height determine the project...
virtual void GrappleRetreatSpeed(Projectile projectile, Player player, ref float speed)
The speed at which the grapple retreats back to the player after not hitting anything....
virtual bool PreDrawExtras(Projectile projectile, SpriteBatch spriteBatch)
Allows you to draw things behind a projectile. Returns false to stop the game from drawing extras tex...
virtual void SetDefaults(Projectile projectile)
Allows you to set the properties of any and every projectile that gets created.
Mod is an abstract class that you will override. It serves as a central place from which the mod's co...
bool Autoload
Whether or not this mod will autoload content by default. Autoloading content means you do not need t...