* Divine Swine and Horrible Hog now have proper animations when transforming into Piggy * Horrible Hog now has a new and improved death animation * Moved all biome powder transformation handling to a new GlobalProjectile class, PowderTransformationsProjectile * Disgusting Meat's animation should be better synced in Multiplayer * Disgusting Meat should now properly disable the following upgrades in Multiplayer: * Advanced Combat Techniques: Volume I * Advanced Combat Techniques: Volume II * Peddler's Satchel * Disgusting Meat no longer disables the following permanent upgrades: * Minecart Upgrade Kit * Torch God's Favor
51 lines
1.7 KiB
C#
51 lines
1.7 KiB
C#
using System;
|
|
using System.IO;
|
|
using CalamityMod.Items.Tools;
|
|
using MonoMod.Core.Platforms;
|
|
using Terraria;
|
|
using Terraria.GameContent;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Packets
|
|
{
|
|
internal class DisgustingMeatPlayerSyncPacket : CalamityPacket
|
|
{
|
|
public static DisgustingMeatPlayerSyncPacket Instance { get; private set; }
|
|
|
|
public static void Send(DisgustingMeatPlayer playerToSync, int toClient = -1, int ignoreClient = -1)
|
|
{
|
|
if (playerToSync is null)
|
|
return;
|
|
|
|
var packet = Instance.CreateBasePacket();
|
|
packet.WriteWhoAmI(playerToSync);
|
|
packet.Write(playerToSync.DoingVomitAnimation);
|
|
packet.Write(playerToSync.EjectMiscUpgrades);
|
|
packet.Write(playerToSync.VomitTime);
|
|
packet.Write((int)playerToSync.Player.eyeHelper.CurrentEyeFrame);
|
|
packet.Send(toClient, ignoreClient);
|
|
}
|
|
|
|
public override void HandlePacket(BinaryReader packet, int sender)
|
|
{
|
|
var player = packet.ReadPlayer();
|
|
var doingVomitAnimation = packet.ReadBoolean();
|
|
var ejectMiscUpgrades = packet.ReadBoolean();
|
|
var vomitTime = packet.ReadInt32();
|
|
var currentEyeFrame = packet.ReadInt32();
|
|
|
|
if (player is null)
|
|
return;
|
|
|
|
var modPlayer = player.GetModPlayer<DisgustingMeatPlayer>();
|
|
modPlayer.DoingVomitAnimation = doingVomitAnimation;
|
|
modPlayer.EjectMiscUpgrades = ejectMiscUpgrades;
|
|
modPlayer.VomitTime = vomitTime;
|
|
player.eyeHelper.CurrentEyeFrame = (PlayerEyeHelper.EyeFrame)currentEyeFrame;
|
|
|
|
if (Main.dedServ)
|
|
Send(modPlayer, ignoreClient: sender);
|
|
}
|
|
}
|
|
}
|