Terraria ModLoader  0.11.5
A framework for Terraria mods
Terraria.ModLoader.ModMountData Class Reference

This class serves as a place for you to place all your properties and hooks for each mount. Create instances of ModMoundData (preferably overriding this class) to pass as parameters to Mod.AddMount. Only one instance of ModMountData will exist for each mount, so storing player specific data on the ModMountData is not good. Modders can use player.mount._mountSpecificData or a ModPlayer class to store player specific data relating to a mount. Use SetMount to assign these fields. More...

+ Collaboration diagram for Terraria.ModLoader.ModMountData:

Public Member Functions

 ModMountData ()
 Constructor More...
 
virtual void AimAbility (Player player, Vector2 mousePosition)
 Allows you to make things happen when the mount ability is aiming (while charging). More...
 
virtual bool Autoload (ref string name, ref string texture, IDictionary< MountTextureType, string > extraTextures)
 Allows you to automatically load a mount instead of using Mod.AddMount. Return true to allow autoloading; by default returns the mod's autoload property. Name is initialized to the overriding class name, texture is initialized to the namespace and overriding class name with periods replaced with slashes, and extraTextures is initialized to a dictionary containing all MountTextureTypes as keys, with texture + "_" + the texture type name as values. Use this method to either force or stop an autoload, change the default display name and texture path, and to modify the extra mount textures. More...
 
virtual void Dismount (Player player, ref bool skipDust)
 Allows you to make things happen when this mount is de-spawned. Useful for player-specific cleanup, see SetMount. Custom dust spawning logic is also possible via the skipDust parameter. More...
 
virtual bool Draw (List< DrawData > playerDrawData, int drawType, Player drawPlayer, ref Texture2D texture, ref Texture2D glowTexture, ref Vector2 drawPosition, ref Rectangle frame, ref Color drawColor, ref Color glowColor, ref float rotation, ref SpriteEffects spriteEffects, ref Vector2 drawOrigin, ref float drawScale, float shadow)
 Allows for complete customization of mount drawing. This method will be called once for each supported mount texture layer that exists. Use drawType to conditionally apply changes. drawType corresponds to the following: 0: backTexture, 1: backTextureExtra, 2: frontTexture. 3: frontTextureExtra Corresponding glow textures, such as backTextureGlow, are paired with their corresponding texture and passed into this method as well. Return false if you are manually adding DrawData to playerDrawData to replace the vanilla draw behavior, otherwise tweak ref variables to customize the drawing and add additional DrawData to playerDrawData. More...
 
virtual void JumpHeight (ref int jumpHeight, float xVelocity)
 
virtual void JumpHeight (Player mountedPlayer, ref int jumpHeight, float xVelocity)
 Allows you to modify the mount's jump height based on its state. More...
 
virtual void JumpSpeed (ref float jumpSeed, float xVelocity)
 
virtual void JumpSpeed (Player mountedPlayer, ref float jumpSeed, float xVelocity)
 Allows you to modify the mount's jump speed based on its state. More...
 
virtual void SetDefaults ()
 Allows you to set the properties of this type of mount. More...
 
virtual void SetMount (Player player, ref bool skipDust)
 Allows you to make things happen when this mount is spawned in. Useful for player-specific initialization, utilizing player.mount._mountSpecificData or a ModPlayer class since ModMountData is shared between all players. Custom dust spawning logic is also possible via the skipDust parameter. More...
 
virtual void UpdateEffects (Player player)
 Allows you to make things happen when mount is used (creating dust etc.) Can also be used for mount special abilities. More...
 
virtual bool UpdateFrame (Player mountedPlayer, int state, Vector2 velocity)
 Allows for manual updating of mount frame. Return false to stop the default frame behavior. Returns true by default. More...
 
virtual void UseAbility (Player player, Vector2 mousePosition, bool toggleOn)
 Allows you to make things happen while the mouse is pressed while the mount is active. Called each tick the mouse is pressed. More...
 

Properties

Mod mod [get, set]
 The mod which has added this ModMountData. More...
 
Mount.MountData mountData [get, set]
 The vanilla MountData object that is controlled by this ModMountData. More...
 
string Name [get, set]
 The name of this type of mount. More...
 
int Type [get, set]
 The index of this ModMountData in the Mount.mounts array. More...
 

Detailed Description

This class serves as a place for you to place all your properties and hooks for each mount. Create instances of ModMoundData (preferably overriding this class) to pass as parameters to Mod.AddMount. Only one instance of ModMountData will exist for each mount, so storing player specific data on the ModMountData is not good. Modders can use player.mount._mountSpecificData or a ModPlayer class to store player specific data relating to a mount. Use SetMount to assign these fields.

Definition at line 14 of file ModMountData.cs.

Constructor & Destructor Documentation

Terraria.ModLoader.ModMountData.ModMountData ( )

Constructor

Definition at line 53 of file ModMountData.cs.

53  {
54  mountData = new Mount.MountData();
55  }
Mount.MountData mountData
The vanilla MountData object that is controlled by this ModMountData.
Definition: ModMountData.cs:21

Member Function Documentation

virtual void Terraria.ModLoader.ModMountData.AimAbility ( Player  player,
Vector2  mousePosition 
)
virtual

Allows you to make things happen when the mount ability is aiming (while charging).

Parameters
player
mousePosition

Definition at line 145 of file ModMountData.cs.

145  {
146  }
virtual bool Terraria.ModLoader.ModMountData.Autoload ( ref string  name,
ref string  texture,
IDictionary< MountTextureType, string >  extraTextures 
)
virtual

Allows you to automatically load a mount instead of using Mod.AddMount. Return true to allow autoloading; by default returns the mod's autoload property. Name is initialized to the overriding class name, texture is initialized to the namespace and overriding class name with periods replaced with slashes, and extraTextures is initialized to a dictionary containing all MountTextureTypes as keys, with texture + "_" + the texture type name as values. Use this method to either force or stop an autoload, change the default display name and texture path, and to modify the extra mount textures.

Parameters
name
texture
extraTextures
Returns

Definition at line 64 of file ModMountData.cs.

References Terraria.ModLoader.ModMountData.mod, Terraria.ModLoader.ModMountData.mountData, and Terraria.ModLoader.ModMountData.SetDefaults().

64  {
65  return mod.Properties.Autoload;
66  }
Mod mod
The mod which has added this ModMountData.
Definition: ModMountData.cs:29
ModProperties Properties
Definition: Mod.cs:52
bool Autoload
Whether or not this mod will autoload content by default. Autoloading content means you do not need t...

+ Here is the call graph for this function:

virtual void Terraria.ModLoader.ModMountData.Dismount ( Player  player,
ref bool  skipDust 
)
virtual

Allows you to make things happen when this mount is de-spawned. Useful for player-specific cleanup, see SetMount. Custom dust spawning logic is also possible via the skipDust parameter.

Parameters
player
skipDustSet to true to skip the vanilla dust spawning logic

Definition at line 163 of file ModMountData.cs.

163  {
164  }
virtual bool Terraria.ModLoader.ModMountData.Draw ( List< DrawData >  playerDrawData,
int  drawType,
Player  drawPlayer,
ref Texture2D  texture,
ref Texture2D  glowTexture,
ref Vector2  drawPosition,
ref Rectangle  frame,
ref Color  drawColor,
ref Color  glowColor,
ref float  rotation,
ref SpriteEffects  spriteEffects,
ref Vector2  drawOrigin,
ref float  drawScale,
float  shadow 
)
virtual

Allows for complete customization of mount drawing. This method will be called once for each supported mount texture layer that exists. Use drawType to conditionally apply changes. drawType corresponds to the following: 0: backTexture, 1: backTextureExtra, 2: frontTexture. 3: frontTextureExtra Corresponding glow textures, such as backTextureGlow, are paired with their corresponding texture and passed into this method as well. Return false if you are manually adding DrawData to playerDrawData to replace the vanilla draw behavior, otherwise tweak ref variables to customize the drawing and add additional DrawData to playerDrawData.

Parameters
playerDrawData
drawTypeCorresponds to the following: 0: backTexture, 1: backTextureExtra, 2: frontTexture. 3: frontTextureExtra
drawPlayer
texture
glowTextureThe corresponding glow texture, if present
drawPosition
frame
drawColor
glowColor
rotation
spriteEffects
drawOrigin
drawScale
shadow
Returns

Definition at line 187 of file ModMountData.cs.

187  {
188  return true;
189  }
virtual void Terraria.ModLoader.ModMountData.JumpHeight ( ref int  jumpHeight,
float  xVelocity 
)
virtual

Definition at line 83 of file ModMountData.cs.

83  {
84  }
virtual void Terraria.ModLoader.ModMountData.JumpHeight ( Player  mountedPlayer,
ref int  jumpHeight,
float  xVelocity 
)
virtual

Allows you to modify the mount's jump height based on its state.

Parameters
mountedPlayer
jumpHeight
xVelocity

Definition at line 92 of file ModMountData.cs.

92  {
93  }
virtual void Terraria.ModLoader.ModMountData.JumpSpeed ( ref float  jumpSeed,
float  xVelocity 
)
virtual

Definition at line 96 of file ModMountData.cs.

96  {
97  }
virtual void Terraria.ModLoader.ModMountData.JumpSpeed ( Player  mountedPlayer,
ref float  jumpSeed,
float  xVelocity 
)
virtual

Allows you to modify the mount's jump speed based on its state.

Parameters
mountedPlayer
jumpSeed
xVelocity

Definition at line 105 of file ModMountData.cs.

105  {
106  }
virtual void Terraria.ModLoader.ModMountData.SetDefaults ( )
virtual

Allows you to set the properties of this type of mount.

Definition at line 79 of file ModMountData.cs.

Referenced by Terraria.ModLoader.ModMountData.Autoload().

79  {
80  }

+ Here is the caller graph for this function:

virtual void Terraria.ModLoader.ModMountData.SetMount ( Player  player,
ref bool  skipDust 
)
virtual

Allows you to make things happen when this mount is spawned in. Useful for player-specific initialization, utilizing player.mount._mountSpecificData or a ModPlayer class since ModMountData is shared between all players. Custom dust spawning logic is also possible via the skipDust parameter.

Parameters
player
skipDustSet to true to skip the vanilla dust spawning logic

Definition at line 154 of file ModMountData.cs.

154  {
155  }
virtual void Terraria.ModLoader.ModMountData.UpdateEffects ( Player  player)
virtual

Allows you to make things happen when mount is used (creating dust etc.) Can also be used for mount special abilities.

Parameters
player

Definition at line 112 of file ModMountData.cs.

112  {
113  }
virtual bool Terraria.ModLoader.ModMountData.UpdateFrame ( Player  mountedPlayer,
int  state,
Vector2  velocity 
)
virtual

Allows for manual updating of mount frame. Return false to stop the default frame behavior. Returns true by default.

Parameters
mountedPlayer
state
velocity
Returns

Definition at line 122 of file ModMountData.cs.

122  {
123  return true;
124  }
virtual void Terraria.ModLoader.ModMountData.UseAbility ( Player  player,
Vector2  mousePosition,
bool  toggleOn 
)
virtual

Allows you to make things happen while the mouse is pressed while the mount is active. Called each tick the mouse is pressed.

Parameters
player
mousePosition
toggleOnDoes nothing yet

Definition at line 137 of file ModMountData.cs.

137  {
138  }

Property Documentation

Mod Terraria.ModLoader.ModMountData.mod
getset
Mount.MountData Terraria.ModLoader.ModMountData.mountData
getset

The vanilla MountData object that is controlled by this ModMountData.

Definition at line 21 of file ModMountData.cs.

Referenced by Terraria.ModLoader.ModMountData.Autoload(), and Terraria.ModLoader.Mod.LoadMusic().

string Terraria.ModLoader.ModMountData.Name
getset

The name of this type of mount.

Definition at line 45 of file ModMountData.cs.

Referenced by Terraria.ModLoader.Mod.AddMount().

int Terraria.ModLoader.ModMountData.Type
getset

The index of this ModMountData in the Mount.mounts array.

Definition at line 37 of file ModMountData.cs.

Referenced by Terraria.ModLoader.Mod.AddMount(), Terraria.ModLoader.Mod.LoadMusic(), and Terraria.ModLoader.ModContent.MusicExists().