![grappling hook terraria grappling hook terraria](https://i.ytimg.com/vi/rRH3-aFWZNc/maxresdefault.jpg)
This method is only called for the owner of the projectile, meaning that in multi-player, projectiles owned by a player call this method on that client, and projectiles owned by the server such as enemy projectiles call this method on the server. ModifyHitNPC ( NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)Īllows you to modify the damage, knockback, etc., that this projectile does to an NPC. If this projectile is a bobber, allows you to modify the origin of the fisihing line that's connecting to the fishing pole, as well as the fishing line's color. ModifyFishingLine (ref Vector2 lineOriginOffset, ref Color lineColor) ModifyDamageHitbox (ref Rectangle hitbox)Īllows you to change the hitbox used by this projectile for damaging players and NPCs.
![grappling hook terraria grappling hook terraria](https://static1.thegamerimages.com/wordpress/wp-content/uploads/2021/03/Terraria-Ranged-Build-6.jpg)
Note that this will only be used if this projectile is considered a pet. Whether or not this minion can damage NPCs by touching them. (As seen in ExampleJavelinProjectile) More. Called on all clients and the server in multiplayer, so be sure to use if (projectile.owner = Main.myPlayer) if you are spawning retrievable ammo. Also useful for creating retrievable ammo. More.Īllows you to control what happens when this projectile is killed (for example, creating dust or making sounds). Defaults to the center of the hook projectile. The location that the grappling hook pulls the player to. GrappleTargetPoint ( Player player, ref float grappleX, ref float grappleY) Defaults to 11, but vanilla hooks go up to 24. The speed at which the grapple retreats back to the player after not hitting anything. GrappleRetreatSpeed ( Player player, ref float speed) How far away this grappling hook can travel away from its player before it retracts. Defaults to 11, but the Bat Hook uses 16. The speed at which the grapple pulls the player after hitting something. GrapplePullSpeed ( Player player, ref float speed) Return null to use the default color (normally light and buff color). More.Īllows you to determine the color and transparency in which this projectile is drawn. For example, the Nebula Arcanum projectile draws behind NPCs and tiles. Add the index to one and only one of the lists. When used in conjunction with "projectile.hide = true", allows you to specify that this projectile should be drawn behind certain elements. More.ĭrawBehind (int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) More.Ĭode ran when the projectile cuts tiles. Useful for things like diagonal lasers, projectiles that leave a trail behind them, etc. More.Ĭolliding (Rectangle projHitbox, Rectangle targetHitbox)Īllows you to use custom collision detection between this projectile and a player or NPC that this projectile can damage. Only called if CloneNewInstances is set to true. By default this will return a memberwise clone you will want to override this if your ModProjectile contains object references. Allows you to decide which fields of your ModProjectile class are copied over when a new Projectile is created. Use it to change what kind of hook is fired (for example, the Dual Hook does this), to kill old hook projectiles, etc.
Grappling hook terraria code#
This code is called whenever the player uses a grappling hook that shoots this type of projectile. Return false to block this projectile from hitting the target. More.Īllows you to determine whether this projectile can hit the given opponent player. More.Īllows you to determine whether this hostile projectile can hit the given player. Return true to allow hitting the target, return false to block this projectile from hitting the target, and return null to use the vanilla code for whether the target can be hit. More.Īllows you to determine whether this projectile can hit the given NPC. Return null to let the projectile follow vanilla can-damage-anything rules. Return true if you want the projectile to do damage regardless of the default blacklist. Return false to prevent it from doing any sort of damage.
![grappling hook terraria grappling hook terraria](https://i.ytimg.com/vi/FoalUoLdI2Y/hqdefault.jpg)
Whether or not this projectile is capable of killing tiles (such as grass) and damaging NPCs/players. Return true or false to specify if the projectile can cut tiles, like vines. Override this if you do not want the properties to be set for you. More.Īutomatically sets certain static defaults. This will only be called if PreAI returns true. Inherits .Īllows you to determine how this projectile behaves. Create instances of ModProjectile (preferably overriding this class) to pass as parameters to Mod.AddProjectile. This class serves as a place for you to place all your properties and hooks for each projectile.