tModLoader v0.11.8.9
A mod to make and play Terraria mods
ModMountData.cs
Go to the documentation of this file.
1using Microsoft.Xna.Framework;
2using Microsoft.Xna.Framework.Graphics;
3using System;
4using System.Collections.Generic;
5using Terraria.DataStructures;
6
7namespace Terraria.ModLoader
8{
14 public class ModMountData
15 {
16 internal string texture;
17
21 public Mount.MountData mountData {
22 get;
23 internal set;
24 }
25
29 public Mod mod {
30 get;
31 internal set;
32 }
33
37 public int Type {
38 get;
39 internal set;
40 }
41
45 public string Name {
46 get;
47 internal set;
48 }
49
53 public ModMountData() {
54 mountData = new Mount.MountData();
55 }
56
64 public virtual bool Autoload(ref string name, ref string texture, IDictionary<MountTextureType, string> extraTextures) {
65 return mod.Properties.Autoload;
66 }
67
68 internal void SetupMount(Mount.MountData mountData) {
69 ModMountData newMountData = (ModMountData)MemberwiseClone();
70 newMountData.mountData = mountData;
71 mountData.modMountData = newMountData;
72 newMountData.mod = mod;
73 newMountData.SetDefaults();
74 }
75
79 public virtual void SetDefaults() {
80 }
81
82 [Obsolete("JumpHeight now has a Player parameter.")]
83 public virtual void JumpHeight(ref int jumpHeight, float xVelocity) {
84 }
85
92 public virtual void JumpHeight(Player mountedPlayer, ref int jumpHeight, float xVelocity) {
93 }
94
95 [Obsolete("JumpSpeed now has a Player parameter.")]
96 public virtual void JumpSpeed(ref float jumpSeed, float xVelocity) {
97 }
98
105 public virtual void JumpSpeed(Player mountedPlayer, ref float jumpSeed, float xVelocity) {
106 }
107
112 public virtual void UpdateEffects(Player player) {
113 }
114
122 public virtual bool UpdateFrame(Player mountedPlayer, int state, Vector2 velocity) {
123 return true;
124 }
125
126 //todo: MountLoader is never called for this, why is this in here? Made it internal for now
127 internal virtual bool CustomBodyFrame() {
128 return false;
129 }
130
137 public virtual void UseAbility(Player player, Vector2 mousePosition, bool toggleOn) {
138 }
139
145 public virtual void AimAbility(Player player, Vector2 mousePosition) {
146 }
147
154 public virtual void SetMount(Player player, ref bool skipDust) {
155 }
156
163 public virtual void Dismount(Player player, ref bool skipDust) {
164 }
165
187 public 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) {
188 return true;
189 }
190 }
191}
Mod is an abstract class that you will override. It serves as a central place from which the mod's co...
Definition: Mod.cs:25
ModProperties Properties
Definition: Mod.cs:52
This class serves as a place for you to place all your properties and hooks for each mount....
Definition: ModMountData.cs:15
virtual void JumpSpeed(ref float jumpSeed, float xVelocity)
Definition: ModMountData.cs:96
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,...
virtual bool UpdateFrame(Player mountedPlayer, int state, Vector2 velocity)
Allows for manual updating of mount frame. Return false to stop the default frame behavior....
virtual void SetMount(Player player, ref bool skipDust)
Allows you to make things happen when this mount is spawned in. Useful for player-specific initializa...
int Type
The index of this ModMountData in the Mount.mounts array.
Definition: ModMountData.cs:37
string Name
The name of this type of mount.
Definition: ModMountData.cs:45
virtual void SetDefaults()
Allows you to set the properties of this type of mount.
Definition: ModMountData.cs:79
virtual void JumpSpeed(Player mountedPlayer, ref float jumpSeed, float xVelocity)
Allows you to modify the mount's jump speed based on its state.
Mount.MountData mountData
The vanilla MountData object that is controlled by this ModMountData.
Definition: ModMountData.cs:21
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 supporte...
Mod mod
The mod which has added this ModMountData.
Definition: ModMountData.cs:29
virtual void AimAbility(Player player, Vector2 mousePosition)
Allows you to make things happen when the mount ability is aiming (while charging).
virtual void JumpHeight(Player mountedPlayer, ref int jumpHeight, float xVelocity)
Allows you to modify the mount's jump height based on its state.
Definition: ModMountData.cs:92
virtual void UpdateEffects(Player player)
Allows you to make things happen when mount is used (creating dust etc.) Can also be used for mount s...
virtual void JumpHeight(ref int jumpHeight, float xVelocity)
Definition: ModMountData.cs:83
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....
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 autoload...
Definition: ModMountData.cs:64
bool Autoload
Whether or not this mod will autoload content by default. Autoloading content means you do not need t...