Terraria ModLoader  0.11.7.8
A mod to make and play Terraria mods
ModMountData.cs
Go to the documentation of this file.
1 using Microsoft.Xna.Framework;
2 using Microsoft.Xna.Framework.Graphics;
3 using System;
4 using System.Collections.Generic;
5 using Terraria.DataStructures;
6 
7 namespace 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 }
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&#39;s jump height based on its state.
Definition: ModMountData.cs:92
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...
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
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...
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 void SetDefaults()
Allows you to set the properties of this type of mount.
Definition: ModMountData.cs:79
Mod mod
The mod which has added this ModMountData.
Definition: ModMountData.cs:29
virtual void JumpSpeed(ref float jumpSeed, float xVelocity)
Definition: ModMountData.cs:96
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...
This class serves as a place for you to place all your properties and hooks for each mount...
Definition: ModMountData.cs:14
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.
virtual bool UpdateFrame(Player mountedPlayer, int state, Vector2 velocity)
Allows for manual updating of mount frame. Return false to stop the default frame behavior...
Mount.MountData mountData
The vanilla MountData object that is controlled by this ModMountData.
Definition: ModMountData.cs:21
Mod is an abstract class that you will override. It serves as a central place from which the mod&#39;s co...
Definition: Mod.cs:24
virtual void JumpSpeed(Player mountedPlayer, ref float jumpSeed, float xVelocity)
Allows you to modify the mount&#39;s jump speed based on its state.
virtual void JumpHeight(ref int jumpHeight, float xVelocity)
Definition: ModMountData.cs:83