Exemplo n.º 1
0
        public override void clientClone(ModPlayer clientClone)
        {
            ShieldPlayer clone = clientClone as ShieldPlayer;

            // Here we would make a backup clone of values that are only correct on the local players Player instance.
            clone.barrierDyeItem = barrierDyeItem;
        }
Exemplo n.º 2
0
        public override void SendClientChanges(ModPlayer clientPlayer)
        {
            ShieldPlayer clone = clientPlayer as ShieldPlayer;

            if (sendUpdatePacket || clone?.barrierDyeItem?.type != barrierDyeItem?.type)
            {
                ShieldPacket packet = new ShieldPacket(this);
                packet.Send(-1, player.whoAmI, false);
            }
        }
Exemplo n.º 3
0
        public ShieldPacket(ShieldPlayer sPlayer)
        {
            whoAmI = (byte)sPlayer.player.whoAmI;
            shield = sPlayer.Shield;

            if (sPlayer.barrierDyeItem is null)
            {
                dyeType = ModContent.ItemType <BaseBarrierDye>();
            }
            else
            {
                dyeType = sPlayer.barrierDyeItem.type;
            }
        }
Exemplo n.º 4
0
        protected override void Receive()
        {
            ShieldPlayer player = Main.player[whoAmI].GetModPlayer <ShieldPlayer>();

            player.Shield = shield;

            if (player.barrierDyeItem is null || player.barrierDyeItem.type != dyeType)
            {
                Item item = new Item();
                item.SetDefaults(dyeType);
                player.barrierDyeItem    = item;
                player.rechargeAnimation = 0;
            }

            if (Main.netMode == Terraria.ID.NetmodeID.Server)
            {
                Send(-1, player.player.whoAmI, false);
                return;
            }
        }