+ Fixed for real this time

This commit is contained in:
Big E authored and Cameron Ewell committed 2026-06-10 14:30:36 -04:00
1 parent fe1e35bb26
commit 72d9d2080b
3 files changed
+60 -4

No files matched your search

@@ -0,0 +1,39 @@
using System.IO;
using CalamityMod.Systems;
using Terraria;
using Terraria.ModLoader.IO;
namespace CalamityMod.Packets.Entities
{
internal sealed class TrustyOldRodEnemyPacket : CalamityPacket
{
public static TrustyOldRodEnemyPacket Instance { get; private set; }
public static void Send(Player player, int bobberWhoAmI, int rarity = 1, bool lava = false, bool honey = false, int toClient = -1, int ignoreClient = -1)
{
if (player is null)
return;
var packet = Instance.CreateBasePacket();
packet.WriteWhoAmI(player);
packet.Write(bobberWhoAmI);
packet.Write(rarity);
packet.WriteFlags(lava, honey);
packet.Send(toClient, ignoreClient);
}
public override void HandlePacket(BinaryReader packet, int sender)
{
var player = packet.ReadPlayer();
var bobber = packet.ReadInt32();
var rarity = packet.ReadInt32();
packet.ReadFlags(out bool lava, out bool honey);
if (player is null)
return;
if (Main.dedServ)
TrustyOldRodEnemySystem.SpawnTrustyOldRodNPC(player, bobber, rarity, lava, honey);
}
}
}
+10 -3
View File
@@ -2949,6 +2949,7 @@ namespace CalamityMod.Projectiles
public float PersistentFishingData = -1;
/// <summary> <inheritdoc cref="PersistentFishingData"/> </summary>
public Vector2 PersistentFishingDataVector2 = Vector2.Zero;
public bool RunFishingMinigames(Projectile projectile)
{
var owner = Main.player[projectile.owner];
@@ -3759,7 +3760,8 @@ namespace CalamityMod.Projectiles
}
bool pulledNPC = Main.rand.NextBool(TrustyOldRod.enemyChance.Item1, TrustyOldRod.enemyChance.Item2);
if (owner.HeldItem.type == ModContent.ItemType<TrustyOldRod>() && reelingIn && projectile.ai[1] != 0 && pulledNPC)
if (owner.HeldItem.type == ModContent.ItemType<TrustyOldRod>() && reelingIn && projectile.ai[1] != 0 && projectile.localAI[1] != 0 && pulledNPC)
{
// Remove any item you would have fished up
projectile.ai[1] = 0;
@@ -3769,11 +3771,16 @@ namespace CalamityMod.Projectiles
if (roll == 1) rarity = 3; // UltraRare (1/100)
else if (roll <= 21) rarity = 2; // Rare ~(1/5)
else rarity = 1; // Common ~(4/5)
TrustyOldRodEnemySystem.SpawnTrustyOldRodNPC(owner, projectile.whoAmI, rarity, projectile.lavaWet, projectile.honeyWet);
if (Main.netMode == NetmodeID.MultiplayerClient && Main.myPlayer == owner.whoAmI)
TrustyOldRodEnemyPacket.Send(owner, projectile.whoAmI, rarity, projectile.lavaWet, projectile.honeyWet);
else if(Main.netMode == NetmodeID.SinglePlayer)
TrustyOldRodEnemySystem.SpawnTrustyOldRodNPC(owner, projectile.whoAmI, rarity, projectile.lavaWet, projectile.honeyWet);
TrustyOldRodEnemySystem.DoTrustyOldRodVFX(owner, projectile.whoAmI, rarity, projectile.lavaWet, projectile.honeyWet);
projectile.ai[0] = 2; // snap line
return false;
}
return false;
}
#endregion
+11 -1
View File
@@ -36,6 +36,7 @@ using Terraria.Audio;
using Terraria.GameContent.Events;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.UI;
namespace CalamityMod.Systems
{
@@ -662,6 +663,16 @@ namespace CalamityMod.Systems
}
}
#endregion
}
public static void DoTrustyOldRodVFX(Player owner, int bobberWhoAmI, int rarity = 1, bool Lava = false, bool Honey = false)
{
Projectile bobber = Main.projectile[bobberWhoAmI];
bool common = rarity == 1;
bool rare = rarity == 2;
bool ultraRare = rarity == 3;
float scale = (common ? 1 : rare ? 2.5f : 6);
for (int i = 0; i < (int)(12 * scale); i++)
{
@@ -686,7 +697,6 @@ namespace CalamityMod.Systems
SoundStyle epicFail = new("CalamityMod/Sounds/Item/WaterSplash", 2);
SoundEngine.PlaySound(epicFail with { Volume = 0.4f + 0.1f * scale, Pitch = 0.2f - 0.1f * scale }, bobber.Center);
bobber.velocity += -Vector2.UnitY * (common ? 10 : rare ? 20 : 45);
#endregion
}
}
}