//////////////// protected override void Update() { if (Main.netMode == NetmodeID.Server) { var myplayer = this.Player.GetModPlayer <GreenHellPlayer>(); if (this.InfectionStageSnapshot != myplayer.InfectionStage) { PlayerStatePayload.SendToClients(this.PlayerWho, -1); } } }
//////////////// protected override void OnEnter(bool isCurrentPlayer, object data) { // Finally got sick of SyncPlayer/SendClientData if (Main.netMode == NetmodeID.MultiplayerClient) { if (isCurrentPlayer) { PlayerStatePayload.SendToServer(); } } else if (Main.netMode == NetmodeID.Server) { var myplayer = this.Player.GetModPlayer <GreenHellPlayer>(); this.InfectionStageSnapshot = myplayer.InfectionStage; } }
internal static void GiveTo(GreenHellPlayer myplayer, bool syncIfServer) { var config = GreenHellConfig.Instance; int duration = config.Get <int>(nameof(config.InfectionTickDuration)); myplayer.player.AddBuff(ModContent.BuffType <InfectionDeBuff>(), duration, !syncIfServer); if (myplayer.InfectionStage < InfectionDeBuff.Stages) { myplayer.InfectionStage++; } if (syncIfServer && Main.netMode == NetmodeID.Server) { PlayerStatePayload.SendToClients(myplayer.player.whoAmI); } InfectionDeBuff.UpdateIcon(myplayer); }