Hadarian Wings now update based on the hover control setting
This commit is contained in:
1 parent
51b9123cee
commit
856c548e43
1 file changed
+36
-20
@@ -1,5 +1,7 @@
|
||||
using CalamityMod.Dusts;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.Graphics.Shaders;
|
||||
@@ -16,7 +18,7 @@ namespace CalamityMod.Items.Accessories.Wings
|
||||
SacrificeTotal = 1;
|
||||
DisplayName.SetDefault("Hadarian Wings");
|
||||
Tooltip.SetDefault("Powered by the Astral Infection\n" +
|
||||
"Hold down to hover during flight, greatly extending flight duration\n" +
|
||||
"This line gets modified below\n" +
|
||||
"Horizontal speed: 9.00\n" +
|
||||
"Acceleration multiplier: 1.75\n" +
|
||||
"Good vertical speed\n" +
|
||||
@@ -32,35 +34,49 @@ namespace CalamityMod.Items.Accessories.Wings
|
||||
Item.rare = ItemRarityID.Lime;
|
||||
Item.accessory = true;
|
||||
}
|
||||
public override void ModifyTooltips(List<TooltipLine> tooltips)
|
||||
{
|
||||
string hoverText = Player.Settings.HoverControl == Player.Settings.HoverControlMode.Hold ? "Hold DOWN and JUMP to hover" : "Press DOWN to toggle hover\nPress UP to deactivate hover";
|
||||
|
||||
TooltipLine hover = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1");
|
||||
if (hover != null)
|
||||
hover.Text = hoverText;
|
||||
}
|
||||
|
||||
public override void UpdateAccessory(Player player, bool hideVisual)
|
||||
{
|
||||
if (player.controlJump && player.wingTime > 0f && !player.canJumpAgain_Cloud && player.jump == 0)
|
||||
{
|
||||
if (player.controlDown && !player.merman)
|
||||
{
|
||||
player.velocity.Y *= 0.9f;
|
||||
if (player.velocity.Y > -2f && player.velocity.Y < 1f)
|
||||
{
|
||||
player.velocity.Y = 1E-05f;
|
||||
}
|
||||
player.wingTime += 0.75f;
|
||||
}
|
||||
bool hovering = player.TryingToHoverDown && !player.merman;
|
||||
if (hovering)
|
||||
{
|
||||
player.velocity.Y *= 0.2f;
|
||||
if (player.velocity.Y > -2f && player.velocity.Y < 2f)
|
||||
{
|
||||
// I can't get the player to have zero y velocity (setting it to 0 doesn't work and I tried a lot of numbers)
|
||||
player.velocity.Y = 0.105f;
|
||||
}
|
||||
player.wingTime += 0.75f;
|
||||
}
|
||||
|
||||
if (player.velocity.Y != 0f && !hideVisual)
|
||||
{
|
||||
int num59 = 4;
|
||||
float xOffset = 4f;
|
||||
if (player.direction == 1)
|
||||
{
|
||||
num59 = -40;
|
||||
xOffset = -40f;
|
||||
}
|
||||
int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 1.75f);
|
||||
Main.dust[num60].noGravity = true;
|
||||
Main.dust[num60].velocity *= 0.3f;
|
||||
if (Main.rand.NextBool(10))
|
||||
{
|
||||
Main.dust[num60].fadeIn = 2f;
|
||||
}
|
||||
Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player);
|
||||
if (!hovering || Main.rand.NextBool(3))
|
||||
{
|
||||
int idx = Dust.NewDust(new Vector2(player.Center.X + xOffset, player.Center.Y - 15f), 30, 30, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 1.75f);
|
||||
Main.dust[idx].noGravity = true;
|
||||
Main.dust[idx].velocity *= 0.3f;
|
||||
if (Main.rand.NextBool(10))
|
||||
{
|
||||
Main.dust[idx].fadeIn = 2f;
|
||||
}
|
||||
Main.dust[idx].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
player.noFallDmg = true;
|
||||
|
||||
Reference in new issue
Block a user