1using Microsoft.Xna.Framework;
2using Microsoft.Xna.Framework.Graphics;
4using System.Collections.Generic;
5using Terraria.DataStructures;
16 internal static readonly IDictionary<int, ModMountData> mountDatas =
new Dictionary<int, ModMountData>();
24 if (mountDatas.ContainsKey(type)) {
25 return mountDatas[type];
30 internal static int ReserveMountID() {
38 internal static void ResizeArrays() {
39 Array.Resize(ref MountID.Sets.Cart,
nextMount);
40 Array.Resize(ref Mount.mounts,
nextMount);
43 internal static void Unload() {
48 internal static bool IsModMountData(Mount.MountData mountData) {
49 return mountData.modMountData !=
null;
52 internal static void SetupMount(Mount.MountData mount) {
53 if (IsModMountData(mount)) {
54 GetMount(mount.modMountData.Type).SetupMount(mount);
58 public static void JumpHeight(Player mountedPlayer, Mount.MountData mount, ref
int jumpHeight,
float xVelocity) {
59 if (IsModMountData(mount)) {
60 mount.modMountData.JumpHeight(ref jumpHeight, xVelocity);
61 mount.modMountData.JumpHeight(mountedPlayer, ref jumpHeight, xVelocity);
65 public static void JumpSpeed(Player mountedPlayer, Mount.MountData mount, ref
float jumpSpeed,
float xVelocity) {
66 if (IsModMountData(mount)) {
67 mount.modMountData.JumpSpeed(ref jumpSpeed, xVelocity);
68 mount.modMountData.JumpSpeed(mountedPlayer, ref jumpSpeed, xVelocity);
72 internal static void UpdateEffects(Player mountedPlayer) {
73 if (IsModMountData(Mount.mounts[mountedPlayer.mount.Type])) {
78 internal static bool UpdateFrame(Player mountedPlayer,
int state, Vector2 velocity) {
79 if (IsModMountData(Mount.mounts[mountedPlayer.mount.Type])) {
86 internal static bool CustomBodyFrame(Mount.MountData mount) {
87 if (IsModMountData(mount) && mount.modMountData.CustomBodyFrame()) {
98 public static void UseAbility(Player player, Vector2 mousePosition,
bool toggleOn) {
99 if (IsModMountData(player.mount._data)) {
100 player.mount._data.modMountData.UseAbility(player, mousePosition, toggleOn);
109 public static void AimAbility(Mount mount, Player player, Vector2 mousePosition) {
110 if (IsModMountData(mount._data)) {
111 mount._data.modMountData.AimAbility(player, mousePosition);
122 public static void SetMount(Mount mount, Player player, ref
bool skipDust) {
123 if (IsModMountData(mount._data)) {
124 mount._data.modMountData.SetMount(player, ref skipDust);
135 public static void Dismount(Mount mount, Player player, ref
bool skipDust) {
136 if (IsModMountData(mount._data)) {
137 mount._data.modMountData.Dismount(player, ref skipDust);
144 public 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) {
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);
This class serves as a place for you to place all your properties and hooks for each mount....
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 UpdateEffects(Player player)
Allows you to make things happen when mount is used (creating dust etc.) Can also be used for mount s...
static bool AllowVanillaClients
This serves as the central place from which mounts are stored and mount-related functions are carried...
static ModMountData GetMount(int type)
Gets the ModMountData instance corresponding to the given type. Returns null if no ModMountData has t...
static void JumpHeight(Player mountedPlayer, Mount.MountData mount, ref int jumpHeight, float xVelocity)
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,...
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,...
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 initializa...
static void JumpSpeed(Player mountedPlayer, Mount.MountData mount, ref float jumpSpeed, float xVelocity)
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....
static void AimAbility(Mount mount, Player player, Vector2 mousePosition)
Allows you to make things happen when the mount ability is aiming (while charging).