tModLoader v0.11.8.9
A mod to make and play Terraria mods
Terraria.ModLoader.MountLoader Class Reference

This serves as the central place from which mounts are stored and mount-related functions are carried out. More...

+ Collaboration diagram for Terraria.ModLoader.MountLoader:

Static Public Member Functions

static void AimAbility (Mount mount, Player player, Vector2 mousePosition)
 Allows you to make things happen when the mount ability is aiming (while charging). More...
 
static void Dismount (Mount mount, 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...
 
static bool Draw (Mount mount, 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)
 See ModMountData.Draw(List<DrawData>, int, Player, ref Texture2D, ref Texture2D, ref Vector2, ref Rectangle, ref Color, ref Color, ref float, ref SpriteEffects, ref Vector2, ref float, float) More...
 
static ModMountData GetMount (int type)
 Gets the ModMountData instance corresponding to the given type. Returns null if no ModMountData has the given type. More...
 
static void JumpHeight (Player mountedPlayer, Mount.MountData mount, ref int jumpHeight, float xVelocity)
 
static void JumpSpeed (Player mountedPlayer, Mount.MountData mount, ref float jumpSpeed, float xVelocity)
 
static void SetMount (Mount mount, 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...
 
static 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...
 

Static Private Attributes

static int nextMount = MountID.Count
 

Detailed Description

This serves as the central place from which mounts are stored and mount-related functions are carried out.

Definition at line 13 of file MountLoader.cs.

Member Function Documentation

◆ AimAbility()

static void Terraria.ModLoader.MountLoader.AimAbility ( Mount  mount,
Player  player,
Vector2  mousePosition 
)
static

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

Parameters
mount
player
mousePosition

Definition at line 109 of file MountLoader.cs.

109 {
110 if (IsModMountData(mount._data)) {
111 mount._data.modMountData.AimAbility(player, mousePosition);
112 }
113 }

◆ Dismount()

static void Terraria.ModLoader.MountLoader.Dismount ( Mount  mount,
Player  player,
ref bool  skipDust 
)
static

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
mount
player
skipDustSet to true to skip the vanilla dust spawning logic

Definition at line 135 of file MountLoader.cs.

135 {
136 if (IsModMountData(mount._data)) {
137 mount._data.modMountData.Dismount(player, ref skipDust);
138 }
139 }

◆ Draw()

static bool Terraria.ModLoader.MountLoader.Draw ( Mount  mount,
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 
)
static

See ModMountData.Draw(List<DrawData>, int, Player, ref Texture2D, ref Texture2D, ref Vector2, ref Rectangle, ref Color, ref Color, ref float, ref SpriteEffects, ref Vector2, ref float, float)

Definition at line 144 of file MountLoader.cs.

144 {
145 if (IsModMountData(mount._data)) {
146 return mount._data.modMountData.Draw(playerDrawData, drawType, drawPlayer, ref texture, ref glowTexture, ref drawPosition, ref frame, ref drawColor, ref glowColor, ref rotation, ref spriteEffects, ref drawOrigin, ref drawScale, shadow);
147 }
148 return true;
149 }

◆ GetMount()

static ModMountData Terraria.ModLoader.MountLoader.GetMount ( int  type)
static

Gets the ModMountData instance corresponding to the given type. Returns null if no ModMountData has the given type.

Parameters
typeThe type of the mount.
Returns
Null if not found, otherwise the ModMountData associated with the mount.

Definition at line 23 of file MountLoader.cs.

23 {
24 if (mountDatas.ContainsKey(type)) {
25 return mountDatas[type];
26 }
27 return null;
28 }

◆ JumpHeight()

static void Terraria.ModLoader.MountLoader.JumpHeight ( Player  mountedPlayer,
Mount.MountData  mount,
ref int  jumpHeight,
float  xVelocity 
)
static

Definition at line 58 of file MountLoader.cs.

58 {
59 if (IsModMountData(mount)) {
60 mount.modMountData.JumpHeight(ref jumpHeight, xVelocity);
61 mount.modMountData.JumpHeight(mountedPlayer, ref jumpHeight, xVelocity);
62 }
63 }

◆ JumpSpeed()

static void Terraria.ModLoader.MountLoader.JumpSpeed ( Player  mountedPlayer,
Mount.MountData  mount,
ref float  jumpSpeed,
float  xVelocity 
)
static

Definition at line 65 of file MountLoader.cs.

65 {
66 if (IsModMountData(mount)) {
67 mount.modMountData.JumpSpeed(ref jumpSpeed, xVelocity);
68 mount.modMountData.JumpSpeed(mountedPlayer, ref jumpSpeed, xVelocity);
69 }
70 }

◆ SetMount()

static void Terraria.ModLoader.MountLoader.SetMount ( Mount  mount,
Player  player,
ref bool  skipDust 
)
static

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
mount
player
skipDustSet to true to skip the vanilla dust spawning logic

Definition at line 122 of file MountLoader.cs.

122 {
123 if (IsModMountData(mount._data)) {
124 mount._data.modMountData.SetMount(player, ref skipDust);
125 }
126 }

◆ UseAbility()

static void Terraria.ModLoader.MountLoader.UseAbility ( Player  player,
Vector2  mousePosition,
bool  toggleOn 
)
static

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 98 of file MountLoader.cs.

98 {
99 if (IsModMountData(player.mount._data)) {
100 player.mount._data.modMountData.UseAbility(player, mousePosition, toggleOn);
101 }
102 }

Member Data Documentation

◆ nextMount

int Terraria.ModLoader.MountLoader.nextMount = MountID.Count
staticprivate

Definition at line 15 of file MountLoader.cs.