need to fix the dash speed bug with spacesuit and spacesurf

This commit is contained in:
Emilia(SleepeeSoftware) 2026-02-21 16:38:15 +01:00
parent a9a8153acd
commit ec42e38dae
12 changed files with 137 additions and 39 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 773 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 763 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

View File

@ -1,3 +1,4 @@
using Microsoft.Xna.Framework;
using Terraria; using Terraria;
using Terraria.ID; using Terraria.ID;
using Terraria.ModLoader; using Terraria.ModLoader;
@ -33,8 +34,8 @@ namespace Emiliasmod.Content.Items.Accessories
} }
public override void UpdateAccessory(Player player, bool hideVisual) { public override void UpdateAccessory(Player player, bool hideVisual) {
player.rocketBoots = 4; player.rocketBoots = 2;
player.vanityRocketBoots = 4; player.vanityRocketBoots = 2;
player.waterWalk2 = true; player.waterWalk2 = true;
player.waterWalk = true; player.waterWalk = true;
@ -43,13 +44,16 @@ namespace Emiliasmod.Content.Items.Accessories
player.fireWalk = true; player.fireWalk = true;
player.noFallDmg = true; player.noFallDmg = true;
player.lavaRose = true; player.lavaRose = true;
player.lavaMax += 20 * 60; //player.lavaMax += 20 * 60;
player.statDefense += DefenseBonus; player.statDefense += DefenseBonus;
player.arcticDivingGear = true; player.arcticDivingGear = true;
//player.wereWolf = true;
player.accMerman = true; player.accMerman = true;
if (Main.dayTime == false)
{
player.wereWolf = true;
}
player.buffImmune[BuffID.BrokenArmor] = true; player.buffImmune[BuffID.BrokenArmor] = true;
player.buffImmune[BuffID.Bleeding] = true; player.buffImmune[BuffID.Bleeding] = true;
@ -68,16 +72,14 @@ namespace Emiliasmod.Content.Items.Accessories
player.lifeRegen += 4; player.lifeRegen += 4;
player.PotionDelayModifier -= 0.25f; player.PotionDelayModifier -= 0.25f;
player.GetDamage(DamageClass.Generic) += 10f; player.GetDamage(DamageClass.Generic) += 0.10f;
player.GetAttackSpeed(DamageClass.Generic) += 10f; player.GetAttackSpeed(DamageClass.Generic) += 0.10f;
player.GetCritChance(DamageClass.Generic) += 4f; player.GetCritChance(DamageClass.Generic) += 4f;
player.GetKnockback(DamageClass.Summon) += 0.5f; player.GetKnockback(DamageClass.Summon) += 0.5f;
player.blockRange += 1; player.blockRange += 1;
player.pickSpeed -= 0.15f; player.pickSpeed -= 0.15f;
//player.accRunSpeed = 6.75f; player.moveSpeed += 0.08f;
//player.runAcceleration = 1.25f;
player.moveSpeed += 0.25f;
if (!hideVisual) { if (!hideVisual) {
player.CancelAllBootRunVisualEffects(); player.CancelAllBootRunVisualEffects();
@ -101,12 +103,11 @@ namespace Emiliasmod.Content.Items.Accessories
public override void PostUpdateRunSpeeds() { public override void PostUpdateRunSpeeds() {
//// We only want our additional changes to apply if ExampleStatBonusAccessory is equipped and not on a mount. //// We only want our additional changes to apply if ExampleStatBonusAccessory is equipped and not on a mount.
//if (Player.mount.Active || !SpacesuitStatBonusAccessory) { if (Player.mount.Active || !SpacesuitStatBonusAccessory) {
// return; return;
//} }
// The following modifications are similar to Shadow Armor set bonus // The following modifications are similar to Shadow Armor set bonus
//Player.canFloatInWater = true;
Player.runAcceleration *= 1.75f; Player.runAcceleration *= 1.75f;
Player.maxRunSpeed *= 1.15f; Player.maxRunSpeed *= 1.15f;
Player.accRunSpeed *= 6.75f; Player.accRunSpeed *= 6.75f;

View File

@ -13,31 +13,21 @@ namespace Emiliasmod.Content.Items.Accessories
} }
public override void SetDefaults() { public override void SetDefaults() {
Item.width = 22; Item.CloneDefaults(ItemID.LongRainbowTrailWings);
Item.height = 20; //Item.width = 22;
//Item.height = 20;
Item.value = Item.sellPrice(platinum: 1, gold: 35); Item.value = Item.sellPrice(platinum: 1, gold: 35);
Item.rare = ItemRarityID.Red; Item.rare = ItemRarityID.Red;
Item.accessory = true; Item.accessory = true;
} }
public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising,
ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) {
ascentWhenFalling = 1.2f; // Falling glide speed
ascentWhenRising = 0.4f; // Rising speed
maxCanAscendMultiplier = 1f;
maxAscentMultiplier = 3f;
constantAscend = 0.135f;
}
public override void UpdateAccessory(Player player, bool hideVisual) public override void UpdateAccessory(Player player, bool hideVisual)
{ {
player.wingTimeMax = 100000000; player.wingTimeMax = 100000;
player.moveSpeed += 0.1f; player.moveSpeed += 0.1f;
player.jumpSpeedBoost += 1.8f; //player.jumpSpeedBoost += 1.8f;
player.maxFallSpeed += 0.10f;
player.maxRunSpeed *= 1.75f;
player.wingAccRunSpeed += 0.75f;
} }
public override void AddRecipes() { public override void AddRecipes() {
Recipe recipe = CreateRecipe(); Recipe recipe = CreateRecipe();
recipe.AddCondition(Condition.DownedMoonLord); recipe.AddCondition(Condition.DownedMoonLord);

View File

@ -1,3 +1,4 @@
using Emiliasmod.Content.Projectiles;
using Terraria; using Terraria;
using Terraria.ID; using Terraria.ID;
using Terraria.ModLoader; using Terraria.ModLoader;
@ -10,23 +11,35 @@ namespace Emiliasmod.Content.Items
// https://github.com/tModLoader/tModLoader/tree/stable/ExampleMod // https://github.com/tModLoader/tModLoader/tree/stable/ExampleMod
public class EmiliasWand : ModItem public class EmiliasWand : ModItem
{ {
public override void SetStaticDefaults() {
// As mentioned in the documentation, IsDrill and IsChainsaw automatically reduce useTime and useAnimation to 60% of what is set in SetDefaults and decrease tileBoost by 1, but only for vanilla items.
// We set it here despite it doing nothing because it is likely to be used by other mods to provide special effects to drill or chainsaw items globally.
ItemID.Sets.IsDrill[Type] = true;
}
// The Display Name and Tooltip of this item can be edited in the 'Localization/en-US_Mods.Emiliasmod.hjson' file. // The Display Name and Tooltip of this item can be edited in the 'Localization/en-US_Mods.Emiliasmod.hjson' file.
public override void SetDefaults() public override void SetDefaults()
{ {
Item.damage = 300; Item.damage = 300;
Item.DamageType = DamageClass.Melee;
Item.pick = 300; Item.pick = 300;
Item.width = 40; Item.DamageType = DamageClass.MeleeNoSpeed;
Item.height = 200; Item.tileBoost = 5;
Item.useTime = 10; Item.width = 14;
Item.useAnimation = 10; Item.height = 64;
Item.useStyle = ItemUseStyleID.Shoot; Item.useTime = 2;
Item.useAnimation = 15;
Item.crit = 36;
Item.knockBack = 6; Item.knockBack = 6;
Item.useStyle = ItemUseStyleID.Shoot;
Item.value = Item.buyPrice(platinum: 1); Item.value = Item.buyPrice(platinum: 1);
Item.rare = ItemRarityID.Red; Item.rare = ItemRarityID.Red;
//Item.UseSound = SoundID.Item1; //Item.UseSound = SoundID.Item1;
Item.autoReuse = true; Item.shoot = ModContent.ProjectileType<EmiliasWandProjectile>();
Item.useTurn = true; Item.shootSpeed = 16f; // Adjusts how far away from the player to hold the projectile
Item.noMelee = true; // Turns off damage from the item itself, as we have a projectile
Item.noUseGraphic = true; // Stops the item from drawing in your hands, for the aforementioned reason
Item.channel = true;
} }
public override void AddRecipes() public override void AddRecipes()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 720 B

After

Width:  |  Height:  |  Size: 773 B

View File

@ -0,0 +1,92 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace Emiliasmod.Content.Projectiles
{
public class EmiliasWandProjectile : ModProjectile
{
public override void SetStaticDefaults() {
// Prevents jitter when stepping up and down blocks and half blocks
ProjectileID.Sets.HeldProjDoesNotUsePlayerGfxOffY[Type] = true;
}
public override void SetDefaults() {
Projectile.width = 14;
Projectile.height = 64;
Projectile.friendly = true;
Projectile.tileCollide = false;
Projectile.penetrate = -1;
Projectile.DamageType = DamageClass.Melee;
Projectile.ownerHitCheck = true;
Projectile.aiStyle = -1; // Replace with 20 if you do not want custom code
Projectile.hide = true; // Hides the projectile, so it will draw in the player's hand when we set the player's heldProj to this one.
}
// This code is adapted and simplified from aiStyle 20 to use a different dust and more noises. If you want to use aiStyle 20, you do not need to do any of this.
// It should be noted that this projectile has no effect on mining and is mostly visual.
public override void AI() {
Player player = Main.player[Projectile.owner];
Projectile.timeLeft = 60;
// Animation code could go here if the projectile was animated.
// Plays a sound every 20 ticks. In aiStyle 20, soundDelay is set to 30 ticks.
if (Projectile.soundDelay <= 0) {
SoundEngine.PlaySound(SoundID.Item22, Projectile.Center);
Projectile.soundDelay = 20;
}
Vector2 playerCenter = player.RotatedRelativePoint(player.MountedCenter);
if (Main.myPlayer == Projectile.owner) {
// This code must only be ran on the client of the projectile owner
if (player.channel) {
float holdoutDistance = player.HeldItem.shootSpeed * Projectile.scale;
// Calculate a normalized vector from player to mouse and multiply by holdoutDistance to determine resulting holdoutOffset
Vector2 holdoutOffset = holdoutDistance * Vector2.Normalize(Main.MouseWorld - playerCenter);
if (holdoutOffset.X != Projectile.velocity.X || holdoutOffset.Y != Projectile.velocity.Y) {
// This will sync the projectile, most importantly, the velocity.
Projectile.netUpdate = true;
}
// Projectile.velocity acts as a holdoutOffset for held projectiles.
Projectile.velocity = holdoutOffset;
}
else {
Projectile.Kill();
}
}
if (Projectile.velocity.X > 0f) {
player.ChangeDir(1);
}
else if (Projectile.velocity.X < 0f) {
player.ChangeDir(-1);
}
Projectile.spriteDirection = Projectile.direction;
player.ChangeDir(Projectile.direction); // Change the player's direction based on the projectile's own
player.heldProj = Projectile.whoAmI; // We tell the player that the drill is the held projectile, so it will draw in their hand
player.SetDummyItemTime(2); // Make sure the player's item time does not change while the projectile is out
Projectile.Center = playerCenter; // Centers the projectile on the player. Projectile.velocity will be added to this in later Terraria code causing the projectile to be held away from the player at a set distance.
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
player.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation();
// Gives the drill a slight jiggle
Projectile.velocity.X *= 1f + Main.rand.Next(-3, 4) * 0.01f;
Projectile.velocity.Y *= 1f + Main.rand.Next(-3, 4) * 0.01f;
// Spawning dust
if (Main.rand.NextBool(10)) {
Dust dust = Dust.NewDustDirect(Projectile.position + Projectile.velocity * Main.rand.Next(6, 10) * 0.15f, Projectile.width, Projectile.height, DustID.Honey, 0f, 0f, 80, Color.White, 1f);
dust.position.X -= 4f;
dust.noGravity = true;
dust.velocity.X *= 0.5f;
dust.velocity.Y = -Main.rand.Next(3, 8) * 0.1f;
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

View File

@ -13,6 +13,8 @@ Items: {
Spacesurf: { Spacesurf: {
DisplayName: Spacesurf DisplayName: Spacesurf
Tooltip: "Surfing through the void" Tooltip: Surfing through the void
} }
} }
Projectiles.EmiliasWandProjectile.DisplayName: Emilias Wand Projectile