tModLoader v0.11.8.9
A mod to make and play Terraria mods
|
A ModPlayer instance represents an extension of a Player instance. You can store fields in the ModPlayer classes, much like how the Player class abuses field usage, to keep track of mod-specific information on the player that a ModPlayer instance represents. It also contains hooks to insert your code into the Player class. More...
Public Member Functions | |
virtual void | AnglerQuestReward (float rareMultiplier, List< Item > rewardItems) |
Allows you to add to, change, or remove from the items the player earns when finishing an Angler quest. The rareMultiplier is a number between 0.15 and 1 inclusively; the lower it is the higher chance there should be for the player to earn rare items. More... | |
virtual bool | Autoload (ref string name) |
Allows you to automatically add a ModPlayer instead of using Mod.AddPlayer. Return true to allow autoloading; by default returns the mod's autoload property. Name is initialized to the overriding class name. Use this to either force or stop an autoload, or change the name that identifies this type of ModPlayer. More... | |
virtual bool | CanBeHitByNPC (NPC npc, ref int cooldownSlot) |
Allows you to determine whether the given NPC can hit this player. Return false to block this player from being hit by the NPC. Returns true by default. CooldownSlot determines which of the player's cooldown counters to use (-1, 0, or 1), and defaults to -1. More... | |
virtual bool | CanBeHitByProjectile (Projectile proj) |
Allows you to determine whether the given hostile projectile can hit this player. Return false to block this player from being hit. Returns true by default. More... | |
virtual bool | CanBuyItem (NPC vendor, Item[] shopInventory, Item item) |
Return false to prevent a transaction. Called before the transaction. More... | |
virtual ? bool | CanHitNPC (Item item, NPC target) |
Allows you to determine whether a player can hit the given NPC by swinging a melee weapon. Return true to allow hitting the target, return false to block this player from hitting the target, and return null to use the vanilla code for whether the target can be hit. Returns null by default. More... | |
virtual ? bool | CanHitNPCWithProj (Projectile proj, NPC target) |
Allows you to determine whether a projectile created by this player can hit the given NPC. 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. Returns null by default. More... | |
virtual bool | CanHitPvp (Item item, Player target) |
Allows you to determine whether a melee weapon swung by this player can hit the given opponent player. Return false to block this weapon from hitting the target. Returns true by default. More... | |
virtual bool | CanHitPvpWithProj (Projectile proj, Player target) |
Allows you to determine whether a projectile created by this player can hit the given opponent player. Return false to block the projectile from hitting the target. Returns true by default. More... | |
virtual bool | CanSellItem (NPC vendor, Item[] shopInventory, Item item) |
Return false to prevent a transaction. Called before the transaction. More... | |
virtual void | CatchFish (Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk) |
Allows you to change the item the player gains from catching a fish. The fishingRod and bait parameters refer to the said items in the player's inventory. The liquidType parameter is 0 if the player is fishing in water, 1 for lava, and 2 for honey. The poolSize parameter is the tile size of the pool the player is fishing in. The worldLayer parameter is 0 if the player is in the sky, 1 if the player is on the surface, 2 if the player is underground, 3 if the player is in the caverns, and 4 if the player is in the underworld. The questFish parameter is the item ID for the day's Angler quest. Modify the caughtType parameter to change the item the player catches. The junk parameter is whether the player catches junk; you can set this to true if you make the player catch a junk item, and is mostly used to pass information (has no effect on the game). More... | |
virtual void | clientClone (ModPlayer clientClone) |
Allows you to copy information about this player to the clientClone parameter. You should copy information that you intend to sync between server and client. This hook is called in the Player.clientClone method. See SendClientChanges for more info. More... | |
virtual bool | ConsumeAmmo (Item weapon, Item ammo) |
Whether or not ammo will be consumed upon usage. Return false to stop the ammo from being depleted. Returns true by default. If false is returned, the OnConsumeAmmo hook is never called. More... | |
virtual void | CopyCustomBiomesTo (Player other) |
In this hook, you should copy the custom biome variables from this player to the other player parameter. This hook is used to help with client/server syncing. More... | |
virtual bool | CustomBiomesMatch (Player other) |
Whether or not this player and the other player parameter have the same custom biome variables. This hook is used to help with client/server syncing. Returns true by default. More... | |
virtual void | DrawEffects (PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright) |
Allows you to create special effects when this player is drawn, such as creating dust, modifying the color the player is drawn in, etc. The fullBright parameter makes it so that the drawn player ignores the modified color and lighting. Note that the fullBright parameter only works if r, g, b, and/or a is not equal to 1. Make sure to add the indexes of any dusts you create to Main.playerDrawDust, and the indexes of any gore you create to Main.playerDrawGore. More... | |
virtual void | FrameEffects () |
Allows you to modify the armor and accessories that visually appear on the player. In addition, you can create special effects around this character, such as creating dust. More... | |
virtual void | GetDyeTraderReward (List< int > rewardPool) |
Allows you to modify what items are possible for the player to earn when giving a Strange Plant to the Dye Trader. More... | |
virtual void | GetFishingLevel (Item fishingRod, Item bait, ref int fishingLevel) |
Allows you to modify the player's fishing power. As an example of the type of stuff that should go here, the phase of the moon can influence fishing power. More... | |
virtual void | GetHealLife (Item item, bool quickHeal, ref int healValue) |
Allows you to temporarily modify the amount of life a life healing item will heal for, based on player buffs, accessories, etc. This is only called for items with a healLife value. More... | |
virtual void | GetHealMana (Item item, bool quickHeal, ref int healValue) |
Allows you to temporarily modify the amount of mana a mana healing item will heal for, based on player buffs, accessories, etc. This is only called for items with a healMana value. More... | |
virtual Texture2D | GetMapBackgroundImage () |
Allows you to change the background that displays when viewing the map. Return null if you do not want to change the background. Returns null by default. More... | |
virtual void | GetWeaponCrit (Item item, ref int crit) |
Allows you to temporarily modify a weapon's crit chance based on player buffs, etc. More... | |
virtual void | GetWeaponDamage (Item item, ref int damage) |
Allows you to temporarily modify a weapon's damage based on player buffs, etc. This is useful for creating new classes of damage, or for making subclasses of damage (for example, Shroomite armor set boosts). More... | |
virtual void | GetWeaponKnockback (Item item, ref float knockback) |
Allows you to temporarily modify a weapon's knockback based on player buffs, etc. This allows you to customize knockback beyond the Player class's limited fields. More... | |
virtual void | Hurt (bool pvp, bool quiet, double damage, int hitDirection, bool crit) |
Allows you to make anything happen right before damage is subtracted from the player's health. More... | |
virtual void | Initialize () |
Called whenever the player is loaded (on the player selection screen). This can be used to initialize data structures, etc. More... | |
virtual void | Kill (double damage, int hitDirection, bool pvp, PlayerDeathReason damageSource) |
Allows you to make anything happen when the player dies. More... | |
virtual void | Load (TagCompound tag) |
Allows you to load custom data you have saved for this player. More... | |
virtual void | LoadLegacy (BinaryReader reader) |
Allows you to load pre-v0.9 custom data you have saved for this player. More... | |
virtual void | MeleeEffects (Item item, Rectangle hitbox) |
Allows you to give this player's melee weapon special effects, such as creating light or dust. More... | |
virtual float | MeleeSpeedMultiplier (Item item) |
Allows you to multiply an item's regular melee speed. Returns 1f by default. Values greater than 1 increase the item speed. More... | |
virtual void | ModifyDrawHeadLayers (List< PlayerHeadLayer > layers) |
Allows you to modify the drawing of the player head on the minimap. This is done by removing from, adding to, or rearranging the list, by setting some of the layers' visible field to false, etc. More... | |
virtual void | ModifyDrawInfo (ref PlayerDrawInfo drawInfo) |
Allows you to modify the drawing parameters of the player before drawing begins. More... | |
virtual void | ModifyDrawLayers (List< PlayerLayer > layers) |
Allows you to modify the drawing of the player. This is done by removing from, adding to, or rearranging the list, by setting some of the layers' visible field to false, etc. More... | |
virtual void | ModifyHitByNPC (NPC npc, ref int damage, ref bool crit) |
Allows you to modify the damage, etc., that an NPC does to this player. More... | |
virtual void | ModifyHitByProjectile (Projectile proj, ref int damage, ref bool crit) |
Allows you to modify the damage, etc., that a hostile projectile does to this player. More... | |
virtual void | ModifyHitNPC (Item item, NPC target, ref int damage, ref float knockback, ref bool crit) |
Allows you to modify the damage, knockback, etc., that this player does to an NPC by swinging a melee weapon. More... | |
virtual void | ModifyHitNPCWithProj (Projectile proj, 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 created by this player does to an NPC. More... | |
virtual void | ModifyHitPvp (Item item, Player target, ref int damage, ref bool crit) |
Allows you to modify the damage, etc., that a melee weapon swung by this player does to an opponent player. More... | |
virtual void | ModifyHitPvpWithProj (Projectile proj, Player target, ref int damage, ref bool crit) |
Allows you to modify the damage, etc., that a projectile created by this player does to an opponent player. More... | |
virtual void | ModifyManaCost (Item item, ref float reduce, ref float mult) |
Allows you to temporarily modify the amount of mana an item will consume on use, based on player buffs, accessories, etc. This is only called for items with a mana value. More... | |
virtual bool | ModifyNurseHeal (NPC nurse, ref int health, ref bool removeDebuffs, ref string chatText) |
Called on the Client while the nurse chat is displayed. Return false to prevent the player from healing. If you return false, you need to set chatText so the user knows why they can't heal. More... | |
virtual void | ModifyNursePrice (NPC nurse, int health, bool removeDebuffs, ref int price) |
Called on the Client while the nurse chat is displayed and after ModifyNurseHeal. Allows custom pricing for Nurse services. See https://terraria.gamepedia.com/Nurse for the default pricing. More... | |
virtual void | ModifyScreenPosition () |
Use this hook to modify Main.screenPosition after weapon zoom and camera lerp have taken place. More... | |
virtual void | ModifyWeaponDamage (Item item, ref float add, ref float mult) |
Allows you to temporarily modify this weapon's damage based on player buffs, etc. This is useful for creating new classes of damage, or for making subclasses of damage (for example, Shroomite armor set boosts). More... | |
virtual void | ModifyWeaponDamage (Item item, ref float add, ref float mult, ref float flat) |
Allows you to temporarily modify this weapon's damage based on player buffs, etc. This is useful for creating new classes of damage, or for making subclasses of damage (for example, Shroomite armor set boosts). More... | |
virtual void | ModifyZoom (ref float zoom) |
Use this to modify the zoom factor for the player. The zoom correlates to the percentage of half the screen size the zoom can reach. A value of -1 passed in means no vanilla scope is in effect. A value of 1.0 means the scope can zoom half a screen width/height away, putting the player on the edge of the game screen. Vanilla values include .8, .6666, and .5. More... | |
virtual void | NaturalLifeRegen (ref float regen) |
Allows you to modify the power of the player's natural life regeneration. This can be done by multiplying the regen parameter by any number. For example, campfires multiply it by 1.1, while walking multiplies it by 0.5. More... | |
virtual void | OnConsumeAmmo (Item weapon, Item ammo) |
Allows you to make things happen when ammo is consumed. Called before the ammo stack is reduced. More... | |
virtual void | OnConsumeMana (Item item, int manaConsumed) |
Allows you to make stuff happen when a player consumes mana on use of an item. More... | |
virtual void | OnEnterWorld (Player player) |
Called on the LocalPlayer when that player enters the world. SP and Client. Only called on the player who is entering. A possible use is ensuring that UI elements are reset to the configuration specified in data saved to the ModPlayer. Can also be used for informational messages. More... | |
virtual void | OnHitAnything (float x, float y, Entity victim) |
This hook is called when a player damages anything, whether it be an NPC or another player, using anything, whether it be a melee weapon or a projectile. The x and y parameters are the coordinates of the victim parameter's center. More... | |
virtual void | OnHitByNPC (NPC npc, int damage, bool crit) |
Allows you to create special effects when an NPC hits this player (for example, inflicting debuffs). More... | |
virtual void | OnHitByProjectile (Projectile proj, int damage, bool crit) |
Allows you to create special effects when a hostile projectile hits this player. More... | |
virtual void | OnHitNPC (Item item, NPC target, int damage, float knockback, bool crit) |
Allows you to create special effects when this player hits an NPC by swinging a melee weapon (for example how the Pumpkin Sword creates pumpkin heads). More... | |
virtual void | OnHitNPCWithProj (Projectile proj, NPC target, int damage, float knockback, bool crit) |
Allows you to create special effects when a projectile created by this player hits an NPC (for example, inflicting debuffs). More... | |
virtual void | OnHitPvp (Item item, Player target, int damage, bool crit) |
Allows you to create special effects when this player's melee weapon hits an opponent player. More... | |
virtual void | OnHitPvpWithProj (Projectile proj, Player target, int damage, bool crit) |
Allows you to create special effects when a projectile created by this player hits an opponent player. More... | |
virtual void | OnMissingMana (Item item, int neededMana) |
Allows you to make stuff happen when a player doesn't have enough mana for the item they are trying to use. If the player has high enough mana after this hook runs, mana consumption will happen normally. Only runs once per item use. More... | |
virtual void | OnRespawn (Player player) |
Called when a player respawns in the world. More... | |
virtual void | PlayerConnect (Player player) |
Called on clients when a player connects. More... | |
virtual void | PlayerDisconnect (Player player) |
Called when a player disconnects. More... | |
virtual void | PostBuyItem (NPC vendor, Item[] shopInventory, Item item) |
Called whenever the player buys an item from an NPC. More... | |
virtual void | PostHurt (bool pvp, bool quiet, double damage, int hitDirection, bool crit) |
Allows you to make anything happen when the player takes damage. More... | |
virtual void | PostItemCheck () |
Allows you to do anything after the update code for the player's held item is run. Hooks for the middle of the held item update code have more specific names in ModItem and ModPlayer. More... | |
virtual void | PostNurseHeal (NPC nurse, int health, bool removeDebuffs, int price) |
Called on the Client after the player heals themselves with the Nurse NPC. More... | |
virtual void | PostSavePlayer () |
PreSavePlayer and PostSavePlayer wrap the vanilla player saving code (both are before the ModPlayer.Save). Useful for advanced situations where a save might be corrupted or rendered unusable by the values that normally would save. More... | |
virtual void | PostSellItem (NPC vendor, Item[] shopInventory, Item item) |
Called whenever the player sells an item to an NPC. More... | |
virtual void | PostUpdate () |
This is called at the very end of the Player.Update method. Final general update tasks can be placed here. More... | |
virtual void | PostUpdateBuffs () |
This is called right after all of this player's buffs update on the player. This can be used to modify the effects that the buff updates had on this player, and can also be used for general update tasks. More... | |
virtual void | PostUpdateEquips () |
This is called right after all of this player's equipment and armor sets update on the player, which is sometime after PostUpdateBuffs is called. This can be used to modify the effects that the equipment had on this player, and can also be used for general update tasks. More... | |
virtual void | PostUpdateMiscEffects () |
This is called after miscellaneous update code is called in Player.Update, which is sometime after PostUpdateEquips is called. This can be used for general update tasks. More... | |
virtual void | PostUpdateRunSpeeds () |
This is called after the player's horizontal speeds are modified, which is sometime after PostUpdateMiscEffects is called, and right before the player's horizontal position is updated. Use this to modify maxRunSpeed, accRunSpeed, runAcceleration, and similar variables before the player moves forwards/backwards. More... | |
virtual bool | PreHurt (bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) |
This hook is called before every time the player takes damage. The pvp parameter is whether the damage was from another player. The quiet parameter determines whether the damage will be communicated to the server. The damage, hitDirection, and crit parameters can be modified. Set the customDamage parameter to true if you want to use your own damage formula (this parameter will disable automatically subtracting the player's defense from the damage). Set the playSound parameter to false to disable the player's hurt sound, and the genGore parameter to false to disable the dust particles that spawn. (These are useful for creating your own sound or gore.) The deathText parameter can be modified to change the player's death message if the player dies. Return false to stop the player from taking damage. Returns true by default. More... | |
virtual bool | PreItemCheck () |
Allows you to do anything before the update code for the player's held item is run. Return false to stop the held item update code from being run (for example, if the player is frozen). Returns true by default. More... | |
virtual bool | PreKill (double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) |
This hook is called whenever the player is about to be killed after reaching 0 health. Set the playSound parameter to false to stop the death sound from playing. Set the genGore parameter to false to stop the gore and dust from being created. (These are useful for creating your own sound or gore.) Return false to stop the player from being killed. Only return false if you know what you are doing! Returns true by default. More... | |
virtual void | PreSaveCustomData () |
Currently never gets called, so this is useless. More... | |
virtual void | PreSavePlayer () |
PreSavePlayer and PostSavePlayer wrap the vanilla player saving code (both are before the ModPlayer.Save). Useful for advanced situations where a save might be corrupted or rendered unusable by the values that normally would save. More... | |
virtual void | PreUpdate () |
This is called at the beginning of every tick update for this player, after checking whether the player exists. More... | |
virtual void | PreUpdateBuffs () |
This is called sometime after SetControls is called, and right before all the buffs update on this player. This hook can be used to add buffs to the player based on the player's state (for example, the Campfire buff is added if the player is near a Campfire). More... | |
virtual void | PreUpdateMovement () |
This is called right before modifying the player's position based on velocity. Use this to make direct changes to the velocity. More... | |
virtual void | ProcessTriggers (TriggersSet triggersSet) |
Use this to check on hotkeys you have registered. While SetControls is set even while in text entry mode, this hook is only called during gameplay. More... | |
virtual void | ReceiveCustomBiomes (BinaryReader reader) |
Allows you to do things with the custom biome information you send between client and server. More... | |
virtual void | ResetEffects () |
This is where you reset any fields you add to your ModPlayer subclass to their default states. This is necessary in order to reset your fields if they are conditionally set by a tick update but the condition is no longer satisfied. More... | |
virtual TagCompound | Save () |
Allows you to save custom data for this player. Returns null by default. More... | |
virtual void | SendClientChanges (ModPlayer clientPlayer) |
Allows you to sync any information that has changed between the server and client. Here, you should check the information you have copied in the clientClone parameter; if they differ between this player and the clientPlayer parameter, then you should send that information using NetMessage.SendData or ModPacket.Send. More... | |
virtual void | SendCustomBiomes (BinaryWriter writer) |
Allows you to send custom biome information between client and server. More... | |
virtual void | SetControls () |
Use this to modify the control inputs that the player receives. For example, the Confused debuff swaps the values of player.controlLeft and player.controlRight. This is called sometime after PreUpdate is called. More... | |
virtual void | SetupStartInventory (IList< Item > items) |
virtual void | SetupStartInventory (IList< Item > items, bool mediumcoreDeath) |
Allows you to modify the inventory newly created players or killed mediumcore players will start with. To add items to the player's inventory, create a new Item, call its SetDefaults method for whatever ID you want, call its Prefix method with a parameter of -1 if you want to give it a random prefix, then add it to the items list parameter. More... | |
virtual bool | ShiftClickSlot (Item[] inventory, int context, int slot) |
Called whenever the player shift-clicks an item slot. This can be used to override default clicking behavior (ie. selling, trashing, moving items). More... | |
virtual bool | Shoot (Item item, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) |
This is called before this player's weapon creates a projectile. You can use it to create special effects, such as changing the speed, changing the initial position, and/or firing multiple projectiles. Return false to stop the game from shooting the default projectile (do this if you manually spawn your own projectile). Returns true by default. More... | |
virtual void | SyncPlayer (int toWho, int fromWho, bool newPlayer) |
Allows you to sync information about this player between server and client. The toWho and fromWho parameters correspond to the remoteClient/toClient and ignoreClient arguments, respectively, of NetMessage.SendData/ModPacket.Send. The newPlayer parameter is whether or not the player is joining the server (it is true on the joining client). More... | |
bool | TypeEquals (ModPlayer other) |
virtual void | UpdateAutopause () |
Allows you to modify the player's stats while the game is paused due to the autopause setting being on. This is called in single player only, some time before the player's tick update would happen when the game isn't paused. More... | |
virtual void | UpdateBadLifeRegen () |
Allows you to give the player a negative life regeneration based on its state (for example, the "On Fire!" debuff makes the player take damage-over-time). This is typically done by setting player.lifeRegen to 0 if it is positive, setting player.lifeRegenTime to 0, and subtracting a number from player.lifeRegen. The player will take damage at a rate of half the number you subtract per second. More... | |
virtual void | UpdateBiomes () |
Allows you to set biome variables in your ModPlayer class based on tile counts. More... | |
virtual void | UpdateBiomeVisuals () |
Allows you to create special visual effects in the area around the player. For example, the blood moon's red filter on the screen or the slime rain's falling slime in the background. You must create classes that override Terraria.Graphics.Shaders.ScreenShaderData or Terraria.Graphics.Effects.CustomSky, add them in your mod's Load hook, then call Player.ManageSpecialBiomeVisuals. See the ExampleMod if you do not have access to the source code. More... | |
virtual void | UpdateDead () |
Similar to UpdateDead, except this is only called when the player is dead. If this is called, then ResetEffects will not be called. More... | |
virtual void | UpdateEquips (ref bool wallSpeedBuff, ref bool tileSpeedBuff, ref bool tileRangeBuff) |
Called after Update Accessories. More... | |
virtual void | UpdateLifeRegen () |
Allows you to increase the player's life regeneration based on its state. This can be done by incrementing player.lifeRegen by a certain number. The player will recover life at a rate of half the number you add per second. You can also increment player.lifeRegenTime to increase the speed at which the player reaches its maximum natural life regeneration. More... | |
virtual void | UpdateVanityAccessories () |
This is called after VanillaUpdateVanityAccessory() in player.UpdateEquips() More... | |
virtual float | UseTimeMultiplier (Item item) |
Allows you to multiply an item's regular use time. Returns 1f by default. Values greater than 1 increase the item speed. More... | |
Properties | |
virtual bool | CloneNewInstances [get] |
Whether each player gets a ModPlayer by cloning the ModPlayer added to the Mod or by creating a new ModPlayer object with the same type as the ModPlayer added to the Mod. The accessor returns true by default. Return false if you want to assign fields through the constructor. More... | |
Mod | mod [get, set] |
The mod that added this type of ModPlayer. More... | |
string | Name [get, set] |
The name of this ModPlayer. Used for distinguishing between multiple ModPlayers added by a single Mod, in addition to the argument passed to Player.GetModPlayer. More... | |
Player | player [get, set] |
The Player instance that this ModPlayer instance is attached to. More... | |
A ModPlayer instance represents an extension of a Player instance. You can store fields in the ModPlayer classes, much like how the Player class abuses field usage, to keep track of mod-specific information on the player that a ModPlayer instance represents. It also contains hooks to insert your code into the Player class.
Definition at line 15 of file ModPlayer.cs.
|
virtual |
Allows you to add to, change, or remove from the items the player earns when finishing an Angler quest. The rareMultiplier is a number between 0.15 and 1 inclusively; the lower it is the higher chance there should be for the player to earn rare items.
rareMultiplier | |
rewardItems |
Definition at line 772 of file ModPlayer.cs.
|
virtual |
Allows you to automatically add a ModPlayer instead of using Mod.AddPlayer. Return true to allow autoloading; by default returns the mod's autoload property. Name is initialized to the overriding class name. Use this to either force or stop an autoload, or change the name that identifies this type of ModPlayer.
name |
Definition at line 67 of file ModPlayer.cs.
References Terraria.ModLoader.ModProperties.Autoload, Terraria.ModLoader.ModPlayer.mod, and Terraria.ModLoader.Mod.Properties.
Referenced by Terraria.ModLoader.Mod.AutoloadPlayer().
|
virtual |
Allows you to determine whether the given NPC can hit this player. Return false to block this player from being hit by the NPC. Returns true by default. CooldownSlot determines which of the player's cooldown counters to use (-1, 0, or 1), and defaults to -1.
npc | |
cooldownSlot |
Definition at line 694 of file ModPlayer.cs.
|
virtual |
Allows you to determine whether the given hostile projectile can hit this player. Return false to block this player from being hit. Returns true by default.
proj |
Definition at line 721 of file ModPlayer.cs.
|
virtual |
Return false to prevent a transaction. Called before the transaction.
vendor | The NPC vendor. |
shopInventory | The current inventory of the NPC shop. |
item | The item the player is attempting to buy. |
Definition at line 903 of file ModPlayer.cs.
Referenced by Terraria.ModLoader.PlayerHooks.CanBuyItem().
|
virtual |
Allows you to determine whether a player can hit the given NPC by swinging a melee weapon. Return true to allow hitting the target, return false to block this player from hitting the target, and return null to use the vanilla code for whether the target can be hit. Returns null by default.
item | |
target |
Definition at line 569 of file ModPlayer.cs.
|
virtual |
Allows you to determine whether a projectile created by this player can hit the given NPC. 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. Returns null by default.
proj | |
target |
Definition at line 601 of file ModPlayer.cs.
|
virtual |
Allows you to determine whether a melee weapon swung by this player can hit the given opponent player. Return false to block this weapon from hitting the target. Returns true by default.
item | |
target |
Definition at line 634 of file ModPlayer.cs.
|
virtual |
Allows you to determine whether a projectile created by this player can hit the given opponent player. Return false to block the projectile from hitting the target. Returns true by default.
proj | |
target |
Definition at line 664 of file ModPlayer.cs.
|
virtual |
Return false to prevent a transaction. Called before the transaction.
vendor | The NPC vendor. |
shopInventory | The current inventory of the NPC shop. |
item | The item the player is attempting to sell. |
Definition at line 883 of file ModPlayer.cs.
Referenced by Terraria.ModLoader.PlayerHooks.CanSellItem().
|
virtual |
Allows you to change the item the player gains from catching a fish. The fishingRod and bait parameters refer to the said items in the player's inventory. The liquidType parameter is 0 if the player is fishing in water, 1 for lava, and 2 for honey. The poolSize parameter is the tile size of the pool the player is fishing in. The worldLayer parameter is 0 if the player is in the sky, 1 if the player is on the surface, 2 if the player is underground, 3 if the player is in the caverns, and 4 if the player is in the underworld. The questFish parameter is the item ID for the day's Angler quest. Modify the caughtType parameter to change the item the player catches. The junk parameter is whether the player catches junk; you can set this to true if you make the player catch a junk item, and is mostly used to pass information (has no effect on the game).
fishingRod | |
bait | |
power | |
liquidType | |
poolSize | |
worldLayer | |
questFish | |
caughtType | |
junk |
Definition at line 755 of file ModPlayer.cs.
|
virtual |
Allows you to copy information about this player to the clientClone parameter. You should copy information that you intend to sync between server and client. This hook is called in the Player.clientClone method. See SendClientChanges for more info.
clientClone |
Definition at line 188 of file ModPlayer.cs.
|
virtual |
Whether or not ammo will be consumed upon usage. Return false to stop the ammo from being depleted. Returns true by default. If false is returned, the OnConsumeAmmo hook is never called.
weapon | |
ammo |
Definition at line 517 of file ModPlayer.cs.
|
virtual |
In this hook, you should copy the custom biome variables from this player to the other player parameter. This hook is used to help with client/server syncing.
other |
Definition at line 161 of file ModPlayer.cs.
|
virtual |
Whether or not this player and the other player parameter have the same custom biome variables. This hook is used to help with client/server syncing. Returns true by default.
other |
Definition at line 153 of file ModPlayer.cs.
|
virtual |
Allows you to create special effects when this player is drawn, such as creating dust, modifying the color the player is drawn in, etc. The fullBright parameter makes it so that the drawn player ignores the modified color and lighting. Note that the fullBright parameter only works if r, g, b, and/or a is not equal to 1. Make sure to add the indexes of any dusts you create to Main.playerDrawDust, and the indexes of any gore you create to Main.playerDrawGore.
drawInfo | |
r | |
g | |
b | |
a | |
fullBright |
Definition at line 791 of file ModPlayer.cs.
|
virtual |
Allows you to modify the armor and accessories that visually appear on the player. In addition, you can create special effects around this character, such as creating dust.
Definition at line 320 of file ModPlayer.cs.
|
virtual |
Allows you to modify what items are possible for the player to earn when giving a Strange Plant to the Dye Trader.
rewardPool |
Definition at line 779 of file ModPlayer.cs.
|
virtual |
Allows you to modify the player's fishing power. As an example of the type of stuff that should go here, the phase of the moon can influence fishing power.
fishingRod | |
bait | |
fishingLevel |
Definition at line 764 of file ModPlayer.cs.
|
virtual |
Allows you to temporarily modify the amount of life a life healing item will heal for, based on player buffs, accessories, etc. This is only called for items with a healLife value.
item | The item. |
quickHeal | Whether the item is being used through quick heal or not. |
healValue | The amount of life being healed. |
Definition at line 426 of file ModPlayer.cs.
|
virtual |
Allows you to temporarily modify the amount of mana a mana healing item will heal for, based on player buffs, accessories, etc. This is only called for items with a healMana value.
item | The item. |
quickHeal | Whether the item is being used through quick heal or not. |
healValue | The amount of mana being healed. |
Definition at line 435 of file ModPlayer.cs.
|
virtual |
Allows you to change the background that displays when viewing the map. Return null if you do not want to change the background. Returns null by default.
Definition at line 211 of file ModPlayer.cs.
|
virtual |
Allows you to temporarily modify a weapon's crit chance based on player buffs, etc.
item | The item |
crit | The crit chance, ranging from 0 to 100 |
Definition at line 507 of file ModPlayer.cs.
|
virtual |
Allows you to temporarily modify a weapon's damage based on player buffs, etc. This is useful for creating new classes of damage, or for making subclasses of damage (for example, Shroomite armor set boosts).
item | |
damage |
Definition at line 471 of file ModPlayer.cs.
|
virtual |
Allows you to temporarily modify a weapon's knockback based on player buffs, etc. This allows you to customize knockback beyond the Player class's limited fields.
item | |
knockback |
Definition at line 499 of file ModPlayer.cs.
|
virtual |
Allows you to make anything happen right before damage is subtracted from the player's health.
pvp | |
quiet | |
damage | |
hitDirection | |
crit |
Definition at line 349 of file ModPlayer.cs.
|
virtual |
Called whenever the player is loaded (on the player selection screen). This can be used to initialize data structures, etc.
Definition at line 74 of file ModPlayer.cs.
|
virtual |
Allows you to make anything happen when the player dies.
damage | |
hitDirection | |
pvp | |
damageSource |
Definition at line 385 of file ModPlayer.cs.
|
virtual |
Allows you to load custom data you have saved for this player.
tag |
Definition at line 107 of file ModPlayer.cs.
|
virtual |
Allows you to load pre-v0.9 custom data you have saved for this player.
reader |
Definition at line 114 of file ModPlayer.cs.
|
virtual |
Allows you to give this player's melee weapon special effects, such as creating light or dust.
item | |
hitbox |
Definition at line 551 of file ModPlayer.cs.
|
virtual |
Allows you to multiply an item's regular melee speed. Returns 1f by default. Values greater than 1 increase the item speed.
item | The item. |
Definition at line 416 of file ModPlayer.cs.
|
virtual |
Allows you to modify the drawing of the player head on the minimap. This is done by removing from, adding to, or rearranging the list, by setting some of the layers' visible field to false, etc.
layers |
Definition at line 812 of file ModPlayer.cs.
|
virtual |
Allows you to modify the drawing parameters of the player before drawing begins.
drawInfo |
Definition at line 798 of file ModPlayer.cs.
Referenced by Terraria.ModLoader.PlayerHooks.ModifyDrawInfo().
|
virtual |
Allows you to modify the drawing of the player. This is done by removing from, adding to, or rearranging the list, by setting some of the layers' visible field to false, etc.
layers |
Definition at line 805 of file ModPlayer.cs.
|
virtual |
Allows you to modify the damage, etc., that an NPC does to this player.
npc | |
damage | |
crit |
Definition at line 704 of file ModPlayer.cs.
|
virtual |
Allows you to modify the damage, etc., that a hostile projectile does to this player.
proj | |
damage | |
crit |
Definition at line 731 of file ModPlayer.cs.
|
virtual |
Allows you to modify the damage, knockback, etc., that this player does to an NPC by swinging a melee weapon.
item | |
target | |
damage | |
knockback | |
crit |
Definition at line 581 of file ModPlayer.cs.
|
virtual |
Allows you to modify the damage, knockback, etc., that a projectile created by this player does to an NPC.
proj | |
target | |
damage | |
knockback | |
crit | |
hitDirection |
Definition at line 614 of file ModPlayer.cs.
|
virtual |
Allows you to modify the damage, etc., that a melee weapon swung by this player does to an opponent player.
item | |
target | |
damage | |
crit |
Definition at line 645 of file ModPlayer.cs.
|
virtual |
Allows you to modify the damage, etc., that a projectile created by this player does to an opponent player.
proj | |
target | |
damage | |
crit |
Definition at line 675 of file ModPlayer.cs.
|
virtual |
Allows you to temporarily modify the amount of mana an item will consume on use, based on player buffs, accessories, etc. This is only called for items with a mana value.
item | The item being used. |
reduce | Used for decreasingly stacking buffs (most common). Only ever use -= on this field. |
mult | Use to directly multiply the item's effective mana cost. Good for debuffs, or things which should stack separately (eg meteor armor set bonus). |
Definition at line 444 of file ModPlayer.cs.
|
virtual |
Called on the Client while the nurse chat is displayed. Return false to prevent the player from healing. If you return false, you need to set chatText so the user knows why they can't heal.
nurse | The Nurse NPC instance. |
health | How much health the player gains. |
removeDebuffs | If set to false, debuffs will not be healed. |
chatText | Set this to the Nurse chat text that will display if healing is prevented. |
Definition at line 915 of file ModPlayer.cs.
|
virtual |
Called on the Client while the nurse chat is displayed and after ModifyNurseHeal. Allows custom pricing for Nurse services. See https://terraria.gamepedia.com/Nurse for the default pricing.
nurse | The Nurse NPC instance. |
health | How much health the player gains. |
removeDebuffs | Whether or not debuffs will be healed. |
price |
Definition at line 926 of file ModPlayer.cs.
|
virtual |
Use this hook to modify Main.screenPosition after weapon zoom and camera lerp have taken place.
Definition at line 818 of file ModPlayer.cs.
|
virtual |
Allows you to temporarily modify this weapon's damage based on player buffs, etc. This is useful for creating new classes of damage, or for making subclasses of damage (for example, Shroomite armor set boosts).
item | The item being used |
add | Used for additively stacking buffs (most common). Only ever use += on this field. |
mult | Use to directly multiply the player's effective damage. Good for debuffs, or things which should stack separately (eg ammo type buffs) |
Definition at line 481 of file ModPlayer.cs.
|
virtual |
Allows you to temporarily modify this weapon's damage based on player buffs, etc. This is useful for creating new classes of damage, or for making subclasses of damage (for example, Shroomite armor set boosts).
item | The item being used |
add | Used for additively stacking buffs (most common). Only ever use += on this field. Things with effects like "5% increased MyDamageClass damage" would use this: add += 0.05f |
mult | Use to directly multiply the player's effective damage. Good for debuffs, or things which should stack separately (eg ammo type buffs) |
flat | This is a flat damage bonus that will be added after add and mult are applied. It facilitates effects like "4 more damage from weapons" |
Definition at line 491 of file ModPlayer.cs.
|
virtual |
Use this to modify the zoom factor for the player. The zoom correlates to the percentage of half the screen size the zoom can reach. A value of -1 passed in means no vanilla scope is in effect. A value of 1.0 means the scope can zoom half a screen width/height away, putting the player on the edge of the game screen. Vanilla values include .8, .6666, and .5.
zoom |
Definition at line 825 of file ModPlayer.cs.
|
virtual |
Allows you to modify the power of the player's natural life regeneration. This can be done by multiplying the regen parameter by any number. For example, campfires multiply it by 1.1, while walking multiplies it by 0.5.
regen |
Definition at line 231 of file ModPlayer.cs.
|
virtual |
Allows you to make things happen when ammo is consumed. Called before the ammo stack is reduced.
weapon | |
ammo |
Definition at line 528 of file ModPlayer.cs.
|
virtual |
Allows you to make stuff happen when a player consumes mana on use of an item.
item | The item being used. |
manaConsumed | The mana consumed from the player. |
Definition at line 462 of file ModPlayer.cs.
|
virtual |
Called on the LocalPlayer when that player enters the world. SP and Client. Only called on the player who is entering. A possible use is ensuring that UI elements are reset to the configuration specified in data saved to the ModPlayer. Can also be used for informational messages.
player | The player that entered the world. |
Definition at line 846 of file ModPlayer.cs.
|
virtual |
This hook is called when a player damages anything, whether it be an NPC or another player, using anything, whether it be a melee weapon or a projectile. The x and y parameters are the coordinates of the victim parameter's center.
x | |
y | |
victim |
Definition at line 560 of file ModPlayer.cs.
|
virtual |
Allows you to create special effects when an NPC hits this player (for example, inflicting debuffs).
npc | |
damage | |
crit |
Definition at line 713 of file ModPlayer.cs.
|
virtual |
Allows you to create special effects when a hostile projectile hits this player.
proj | |
damage | |
crit |
Definition at line 740 of file ModPlayer.cs.
|
virtual |
Allows you to create special effects when this player hits an NPC by swinging a melee weapon (for example how the Pumpkin Sword creates pumpkin heads).
item | |
target | |
damage | |
knockback | |
crit |
Definition at line 592 of file ModPlayer.cs.
|
virtual |
Allows you to create special effects when a projectile created by this player hits an NPC (for example, inflicting debuffs).
proj | |
target | |
damage | |
knockback | |
crit |
Definition at line 625 of file ModPlayer.cs.
|
virtual |
Allows you to create special effects when this player's melee weapon hits an opponent player.
item | |
target | |
damage | |
crit |
Definition at line 655 of file ModPlayer.cs.
|
virtual |
Allows you to create special effects when a projectile created by this player hits an opponent player.
proj | |
target | |
damage | |
crit |
Definition at line 685 of file ModPlayer.cs.
|
virtual |
Allows you to make stuff happen when a player doesn't have enough mana for the item they are trying to use. If the player has high enough mana after this hook runs, mana consumption will happen normally. Only runs once per item use.
item | The item being used. |
neededMana | The mana needed to use the item. |
Definition at line 454 of file ModPlayer.cs.
|
virtual |
Called when a player respawns in the world.
player | The player that respawns |
Definition at line 853 of file ModPlayer.cs.
|
virtual |
Called on clients when a player connects.
player | The player that connected. |
Definition at line 832 of file ModPlayer.cs.
|
virtual |
Called when a player disconnects.
player | The player that disconnected. |
Definition at line 839 of file ModPlayer.cs.
|
virtual |
Called whenever the player buys an item from an NPC.
vendor | The NPC vendor. |
shopInventory | The current inventory of the NPC shop. |
item | The item the player just purchased. |
Definition at line 893 of file ModPlayer.cs.
Referenced by Terraria.ModLoader.PlayerHooks.PostBuyItem().
|
virtual |
Allows you to make anything happen when the player takes damage.
pvp | |
quiet | |
damage | |
hitDirection | |
crit |
Definition at line 360 of file ModPlayer.cs.
|
virtual |
Allows you to do anything after the update code for the player's held item is run. Hooks for the middle of the held item update code have more specific names in ModItem and ModPlayer.
Definition at line 399 of file ModPlayer.cs.
|
virtual |
Called on the Client after the player heals themselves with the Nurse NPC.
nurse | The Nurse npc providing the heal. |
health | How much health the player gained. |
///
removeDebuffs | Whether or not debuffs were healed. |
price | The price the player paid in copper coins. |
Definition at line 936 of file ModPlayer.cs.
Referenced by Terraria.ModLoader.PlayerHooks.PostNurseHeal().
|
virtual |
PreSavePlayer and PostSavePlayer wrap the vanilla player saving code (both are before the ModPlayer.Save). Useful for advanced situations where a save might be corrupted or rendered unusable by the values that normally would save.
Definition at line 139 of file ModPlayer.cs.
|
virtual |
Called whenever the player sells an item to an NPC.
vendor | The NPC vendor. |
shopInventory | The current inventory of the NPC shop. |
item | The item the player just sold. |
Definition at line 873 of file ModPlayer.cs.
Referenced by Terraria.ModLoader.PlayerHooks.PostSellItem().
|
virtual |
This is called at the very end of the Player.Update method. Final general update tasks can be placed here.
Definition at line 308 of file ModPlayer.cs.
|
virtual |
This is called right after all of this player's buffs update on the player. This can be used to modify the effects that the buff updates had on this player, and can also be used for general update tasks.
Definition at line 269 of file ModPlayer.cs.
|
virtual |
This is called right after all of this player's equipment and armor sets update on the player, which is sometime after PostUpdateBuffs is called. This can be used to modify the effects that the equipment had on this player, and can also be used for general update tasks.
Definition at line 284 of file ModPlayer.cs.
|
virtual |
This is called after miscellaneous update code is called in Player.Update, which is sometime after PostUpdateEquips is called. This can be used for general update tasks.
Definition at line 290 of file ModPlayer.cs.
|
virtual |
This is called after the player's horizontal speeds are modified, which is sometime after PostUpdateMiscEffects is called, and right before the player's horizontal position is updated. Use this to modify maxRunSpeed, accRunSpeed, runAcceleration, and similar variables before the player moves forwards/backwards.
Definition at line 296 of file ModPlayer.cs.
|
virtual |
This hook is called before every time the player takes damage. The pvp parameter is whether the damage was from another player. The quiet parameter determines whether the damage will be communicated to the server. The damage, hitDirection, and crit parameters can be modified. Set the customDamage parameter to true if you want to use your own damage formula (this parameter will disable automatically subtracting the player's defense from the damage). Set the playSound parameter to false to disable the player's hurt sound, and the genGore parameter to false to disable the dust particles that spawn. (These are useful for creating your own sound or gore.) The deathText parameter can be modified to change the player's death message if the player dies. Return false to stop the player from taking damage. Returns true by default.
pvp | |
quiet | |
damage | |
hitDirection | |
crit | |
customDamage | |
playSound | |
genGore | |
damageSource |
Definition at line 336 of file ModPlayer.cs.
|
virtual |
Allows you to do anything before the update code for the player's held item is run. Return false to stop the held item update code from being run (for example, if the player is frozen). Returns true by default.
Definition at line 392 of file ModPlayer.cs.
|
virtual |
This hook is called whenever the player is about to be killed after reaching 0 health. Set the playSound parameter to false to stop the death sound from playing. Set the genGore parameter to false to stop the gore and dust from being created. (These are useful for creating your own sound or gore.) Return false to stop the player from being killed. Only return false if you know what you are doing! Returns true by default.
damage | |
hitDirection | |
pvp | |
playSound | |
genGore | |
damageSource |
Definition at line 373 of file ModPlayer.cs.
|
virtual |
Currently never gets called, so this is useless.
Definition at line 92 of file ModPlayer.cs.
|
virtual |
PreSavePlayer and PostSavePlayer wrap the vanilla player saving code (both are before the ModPlayer.Save). Useful for advanced situations where a save might be corrupted or rendered unusable by the values that normally would save.
Definition at line 133 of file ModPlayer.cs.
|
virtual |
This is called at the beginning of every tick update for this player, after checking whether the player exists.
Definition at line 244 of file ModPlayer.cs.
|
virtual |
This is called sometime after SetControls is called, and right before all the buffs update on this player. This hook can be used to add buffs to the player based on the player's state (for example, the Campfire buff is added if the player is near a Campfire).
Definition at line 263 of file ModPlayer.cs.
|
virtual |
This is called right before modifying the player's position based on velocity. Use this to make direct changes to the velocity.
Definition at line 302 of file ModPlayer.cs.
|
virtual |
Use this to check on hotkeys you have registered. While SetControls is set even while in text entry mode, this hook is only called during gameplay.
triggersSet |
Definition at line 251 of file ModPlayer.cs.
|
virtual |
Allows you to do things with the custom biome information you send between client and server.
reader |
Definition at line 175 of file ModPlayer.cs.
Referenced by Terraria.ModLoader.PlayerHooks.ReceiveCustomBiomes().
|
virtual |
This is where you reset any fields you add to your ModPlayer subclass to their default states. This is necessary in order to reset your fields if they are conditionally set by a tick update but the condition is no longer satisfied.
Definition at line 80 of file ModPlayer.cs.
|
virtual |
Allows you to save custom data for this player. Returns null by default.
Definition at line 99 of file ModPlayer.cs.
|
virtual |
Allows you to sync any information that has changed between the server and client. Here, you should check the information you have copied in the clientClone parameter; if they differ between this player and the clientPlayer parameter, then you should send that information using NetMessage.SendData or ModPacket.Send.
clientPlayer |
Definition at line 204 of file ModPlayer.cs.
|
virtual |
Allows you to send custom biome information between client and server.
writer |
Definition at line 168 of file ModPlayer.cs.
Referenced by Terraria.ModLoader.PlayerHooks.SendCustomBiomes().
|
virtual |
Use this to modify the control inputs that the player receives. For example, the Confused debuff swaps the values of player.controlLeft and player.controlRight. This is called sometime after PreUpdate is called.
Definition at line 257 of file ModPlayer.cs.
|
virtual |
Definition at line 127 of file ModPlayer.cs.
|
virtual |
Allows you to modify the inventory newly created players or killed mediumcore players will start with. To add items to the player's inventory, create a new Item, call its SetDefaults method for whatever ID you want, call its Prefix method with a parameter of -1 if you want to give it a random prefix, then add it to the items list parameter.
items | |
mediumcoreDeath | If true, the inventory is being setup for a character that dies in mediumcore rather than a newly created player. |
Definition at line 122 of file ModPlayer.cs.
|
virtual |
Called whenever the player shift-clicks an item slot. This can be used to override default clicking behavior (ie. selling, trashing, moving items).
inventory | The array of items the slot is part of. |
context | The Terraria.UI.ItemSlot.Context of the inventory. |
slot | The index in the inventory of the clicked slot. |
Definition at line 863 of file ModPlayer.cs.
|
virtual |
This is called before this player's weapon creates a projectile. You can use it to create special effects, such as changing the speed, changing the initial position, and/or firing multiple projectiles. Return false to stop the game from shooting the default projectile (do this if you manually spawn your own projectile). Returns true by default.
item | |
position | |
speedX | |
speedY | |
type | |
damage | |
knockBack |
Definition at line 542 of file ModPlayer.cs.
|
virtual |
Allows you to sync information about this player between server and client. The toWho and fromWho parameters correspond to the remoteClient/toClient and ignoreClient arguments, respectively, of NetMessage.SendData/ModPacket.Send. The newPlayer parameter is whether or not the player is joining the server (it is true on the joining client).
toWho | |
fromWho | |
newPlayer |
Definition at line 197 of file ModPlayer.cs.
bool Terraria.ModLoader.ModPlayer.TypeEquals | ( | ModPlayer | other | ) |
Definition at line 53 of file ModPlayer.cs.
References Terraria.ModLoader.ModPlayer.mod, and Terraria.ModLoader.ModPlayer.Name.
|
virtual |
Allows you to modify the player's stats while the game is paused due to the autopause setting being on. This is called in single player only, some time before the player's tick update would happen when the game isn't paused.
Definition at line 238 of file ModPlayer.cs.
|
virtual |
Allows you to give the player a negative life regeneration based on its state (for example, the "On Fire!" debuff makes the player take damage-over-time). This is typically done by setting player.lifeRegen to 0 if it is positive, setting player.lifeRegenTime to 0, and subtracting a number from player.lifeRegen. The player will take damage at a rate of half the number you subtract per second.
Definition at line 218 of file ModPlayer.cs.
|
virtual |
Allows you to set biome variables in your ModPlayer class based on tile counts.
Definition at line 145 of file ModPlayer.cs.
|
virtual |
Allows you to create special visual effects in the area around the player. For example, the blood moon's red filter on the screen or the slime rain's falling slime in the background. You must create classes that override Terraria.Graphics.Shaders.ScreenShaderData or Terraria.Graphics.Effects.CustomSky, add them in your mod's Load hook, then call Player.ManageSpecialBiomeVisuals. See the ExampleMod if you do not have access to the source code.
Definition at line 181 of file ModPlayer.cs.
|
virtual |
Similar to UpdateDead, except this is only called when the player is dead. If this is called, then ResetEffects will not be called.
Definition at line 86 of file ModPlayer.cs.
|
virtual |
Called after Update Accessories.
wallSpeedBuff | |
tileSpeedBuff | |
tileRangeBuff |
Definition at line 278 of file ModPlayer.cs.
|
virtual |
Allows you to increase the player's life regeneration based on its state. This can be done by incrementing player.lifeRegen by a certain number. The player will recover life at a rate of half the number you add per second. You can also increment player.lifeRegenTime to increase the speed at which the player reaches its maximum natural life regeneration.
Definition at line 224 of file ModPlayer.cs.
|
virtual |
This is called after VanillaUpdateVanityAccessory() in player.UpdateEquips()
Definition at line 314 of file ModPlayer.cs.
|
virtual |
Allows you to multiply an item's regular use time. Returns 1f by default. Values greater than 1 increase the item speed.
item | The item. |
Definition at line 407 of file ModPlayer.cs.
|
get |
Whether each player gets a ModPlayer by cloning the ModPlayer added to the Mod or by creating a new ModPlayer object with the same type as the ModPlayer added to the Mod. The accessor returns true by default. Return false if you want to assign fields through the constructor.
Definition at line 60 of file ModPlayer.cs.
|
getset |
The mod that added this type of ModPlayer.
Definition at line 20 of file ModPlayer.cs.
Referenced by Terraria.ModLoader.ModPlayer.Autoload(), Terraria.ModLoader.PlayerHooks.SendCustomBiomes(), and Terraria.ModLoader.ModPlayer.TypeEquals().
|
getset |
The name of this ModPlayer. Used for distinguishing between multiple ModPlayers added by a single Mod, in addition to the argument passed to Player.GetModPlayer.
Definition at line 28 of file ModPlayer.cs.
Referenced by Terraria.ModLoader.Mod.AutoloadPlayer(), Terraria.ModLoader.PlayerHooks.SendCustomBiomes(), and Terraria.ModLoader.ModPlayer.TypeEquals().
|
getset |
The Player instance that this ModPlayer instance is attached to.
Definition at line 36 of file ModPlayer.cs.