Remove Unused SyncDifficultiesPacket

This commit is contained in:
Flowaria committed 2025-11-23 20:33:14 +09:00
1 parent 30fce8b426
commit 88caebd4ae
2 files changed
-50

No files matched your search

-9
View File
@@ -169,14 +169,6 @@ namespace CalamityMod
NetMessage.SendData(MessageID.SyncNPC, toClient, ignoreClient, null, npcWhoAmI);
}
public static void SyncCalamityWorldDifficulties(int sender)
{
if (Main.netMode == NetmodeID.SinglePlayer)
return;
SyncDifficultiesPacket.Send();
}
public static void NewNPC_ClientSide(Vector2 spawnPosition, int npcType, Player player)
{
if (Main.netMode == NetmodeID.SinglePlayer)
@@ -256,7 +248,6 @@ namespace CalamityMod
MousePositionSync,
// World state sync
SyncDifficulties,
SwitchToDifficulty,
// Music events
-41
View File
@@ -1,41 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CalamityMod.World;
using Terraria;
namespace CalamityMod.Packets
{
public sealed class SyncDifficultiesPacket : CalamityPacket
{
// MIGRATED COMMENTS FROM: 'CalamityNetcode.cs'
//TODO - Something so that other mods that hijack the difficulty ui can also use the remainder of the reader to have their own shit
public static SyncDifficultiesPacket Instance { get; private set; }
public override byte MessageType => (byte)CalamityModMessageType.SyncDifficulties;
public static void Send(int toClient = -1, int ignoreClient = -1)
{
var packet = Instance.CreateBasePacket();
var difficultyFlags = new BitsByte();
difficultyFlags[0] = CalamityWorld.revenge;
difficultyFlags[1] = CalamityWorld.death;
packet.Write((byte)difficultyFlags);
packet.Send(toClient, ignoreClient);
}
public override void HandlePacket(in BinaryReader packet, int sender)
{
var difficultyFlags = (BitsByte)packet.ReadByte();
CalamityWorld.revenge = difficultyFlags[0];
CalamityWorld.death = difficultyFlags[1];
if (Main.dedServ)
Send(ignoreClient: sender);
}
}
}