tModLoader  0.12 Alpha
A mod to make and play Terraria mods
Terraria.ModLoader.ModMount 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 ModMount will exist for each mount, so storing player specific data on the ModMount 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...

Inherits Terraria.ModLoader.ModTexturedType.

Public Member Functions

 ModMount ()
 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 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 JumpSpeed (Player mountedPlayer, ref float jumpSeed, float xVelocity)
 Allows you to modify the mount's jump speed based on its state. 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 ModMount is shared between all players. Custom dust spawning logic is also possible via the skipDust parameter. More...
 
override void SetStaticDefaults ()
 Allows you to modify the properties after initial loading has completed. This is where you would set properties of this type of mount. More...
 
sealed override void SetupContent ()
 If you make a new ModType, seal this override, and call SetStaticDefaults in it. 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...
 
- Public Member Functions inherited from Terraria.ModLoader.ModType
virtual bool IsLoadingEnabled (Mod mod)
 Allows you to stop Mod.AddContent from actually adding this content. Useful for items that can be disabled by a config. More...
 
virtual void Load ()
 Allows you to perform one-time loading tasks. Beware that mod content has not finished loading here, things like ModContent lookup tables or ID Sets are not fully populated. More...
 
virtual void Unload ()
 Allows you to safely unload things you added in Load. More...
 

Protected Member Functions

virtual string GetExtraTexture (MountTextureType textureType)
 
sealed override void Register ()
 If you make a new ModType, seal this override. More...
 

Properties

Mount.MountData MountData [get, set]
 The vanilla MountData object that is controlled by this ModMount. More...
 
int Type [get, set]
 The index of this ModMount in the Mount.mounts array. More...
 
- Properties inherited from Terraria.ModLoader.ModTexturedType
virtual string Texture [get]
 The file name of this type's texture file in the mod loader's file space. More...
 
- Properties inherited from Terraria.ModLoader.ModType
string FullName [get]
 The internal name of this, including the mod it is from. More...
 
Mod Mod [get, set]
 The mod this belongs to. More...
 
virtual string Name [get]
 The internal name of this. More...
 
- Properties inherited from Terraria.ModLoader.IModType
string FullName [get]
 => $"{Mod.Name}/{Name}" More...
 
Mod Mod [get]
 The mod this belongs to. More...
 
string Name [get]
 The internal name of this instance. 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 ModMount will exist for each mount, so storing player specific data on the ModMount 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.

Constructor & Destructor Documentation

◆ ModMount()

Terraria.ModLoader.ModMount.ModMount ( )

Constructor

Member Function Documentation

◆ AimAbility()

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

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

Parameters
player
mousePosition

◆ Dismount()

virtual void Terraria.ModLoader.ModMount.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

◆ Draw()

virtual bool Terraria.ModLoader.ModMount.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

◆ JumpHeight()

virtual void Terraria.ModLoader.ModMount.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

◆ JumpSpeed()

virtual void Terraria.ModLoader.ModMount.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

◆ Register()

sealed override void Terraria.ModLoader.ModMount.Register ( )
protectedvirtual

If you make a new ModType, seal this override.

Implements Terraria.ModLoader.ModType.

◆ SetMount()

virtual void Terraria.ModLoader.ModMount.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 ModMount 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

◆ SetStaticDefaults()

override void Terraria.ModLoader.ModMount.SetStaticDefaults ( )
virtual

Allows you to modify the properties after initial loading has completed. This is where you would set properties of this type of mount.

Reimplemented from Terraria.ModLoader.ModType.

◆ SetupContent()

sealed override void Terraria.ModLoader.ModMount.SetupContent ( )
virtual

If you make a new ModType, seal this override, and call SetStaticDefaults in it.

Reimplemented from Terraria.ModLoader.ModType.

◆ UpdateEffects()

virtual void Terraria.ModLoader.ModMount.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

◆ UpdateFrame()

virtual bool Terraria.ModLoader.ModMount.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

◆ UseAbility()

virtual void Terraria.ModLoader.ModMount.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

Property Documentation

◆ MountData

Mount.MountData Terraria.ModLoader.ModMount.MountData
getset

The vanilla MountData object that is controlled by this ModMount.

◆ Type

int Terraria.ModLoader.ModMount.Type
getset

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