tModLoader v0.11.8.9
A mod to make and play 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 (Player mountedPlayer, ref int jumpHeight, float xVelocity)
 Allows you to modify the mount's jump height based on its state. More...
 
virtual void JumpHeight (ref int jumpHeight, 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 JumpSpeed (ref float jumpSeed, float xVelocity)
 
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

◆ ModMountData()

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

References Terraria.ModLoader.ModMountData.mountData.

Member Function Documentation

◆ AimAbility()

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 }

◆ Autoload()

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.

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

References Terraria.ModLoader.ModProperties.Autoload, Terraria.ModLoader.ModMountData.mod, and Terraria.ModLoader.Mod.Properties.

◆ Dismount()

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 }

◆ Draw()

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 }

◆ JumpHeight() [1/2]

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 }

◆ JumpHeight() [2/2]

virtual void Terraria.ModLoader.ModMountData.JumpHeight ( ref int  jumpHeight,
float  xVelocity 
)
virtual

Definition at line 83 of file ModMountData.cs.

83 {
84 }

◆ JumpSpeed() [1/2]

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 }

◆ JumpSpeed() [2/2]

virtual void Terraria.ModLoader.ModMountData.JumpSpeed ( ref float  jumpSeed,
float  xVelocity 
)
virtual

Definition at line 96 of file ModMountData.cs.

96 {
97 }

◆ SetDefaults()

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.

79 {
80 }

◆ SetMount()

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 }

◆ UpdateEffects()

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 }

◆ UpdateFrame()

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 }

◆ UseAbility()

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

Mod Terraria.ModLoader.ModMountData.mod
getset

The mod which has added this ModMountData.

Definition at line 29 of file ModMountData.cs.

29 {
30 get;
31 internal set;
32 }

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

◆ mountData

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.

21 {
22 get;
23 internal set;
24 }

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

◆ Name

string Terraria.ModLoader.ModMountData.Name
getset

The name of this type of mount.

Definition at line 45 of file ModMountData.cs.

45 {
46 get;
47 internal set;
48 }

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

◆ Type

int Terraria.ModLoader.ModMountData.Type
getset

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

Definition at line 37 of file ModMountData.cs.

37 {
38 get;
39 internal set;
40 }