From 3e29cbb632e85d84b14cf0fa0982d3d02de82ba0 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 11 Aug 2020 16:37:29 -0400 Subject: [PATCH] fixed elementals from hote not displaying to others in multiplayer --- Items/Accessories/HeartoftheElements.cs | 60 ++++++++++++----------- Projectiles/Summon/SandElementalMinion.cs | 2 +- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/Items/Accessories/HeartoftheElements.cs b/Items/Accessories/HeartoftheElements.cs index 0fb723f893..3cf01f76dd 100644 --- a/Items/Accessories/HeartoftheElements.cs +++ b/Items/Accessories/HeartoftheElements.cs @@ -51,11 +51,10 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - //Don't do anything if the player fucked up somehow, somewhere - if (player.whoAmI != Main.myPlayer || player is null || player.dead) - return; - - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, (float)Main.DiscoR / 255f, (float)Main.DiscoG / 255f, (float)Main.DiscoB / 255f); + if (player != null && !player.dead) + { + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, (float)Main.DiscoR / 255f, (float)Main.DiscoG / 255f, (float)Main.DiscoB / 255f); + } CalamityPlayer modPlayer = player.Calamity(); modPlayer.allWaifus = !hideVisual; modPlayer.elementalHeart = true; @@ -89,29 +88,32 @@ namespace CalamityMod.Items.Accessories { player.ClearBuff(BuffType()); } - if (player.FindBuffIndex(BuffType()) == -1) + if (player != null && player.whoAmI == Main.myPlayer && !player.dead) { - player.AddBuff(BuffType(), 3600, true); - } - if (player.ownedProjectileCounts[brimmy] < 1) - { - Projectile.NewProjectile(player.Center, velocity, brimmy, elementalDmg, kBack, player.whoAmI, 0f, 0f); - } - if (player.ownedProjectileCounts[siren] < 1) - { - Projectile.NewProjectile(player.Center, velocity, siren, elementalDmg, kBack, player.whoAmI, 0f, 0f); - } - if (player.ownedProjectileCounts[healer] < 1) - { - Projectile.NewProjectile(player.Center, velocity, healer, elementalDmg, kBack, player.whoAmI, 0f, 0f); - } - if (player.ownedProjectileCounts[sandy] < 1) - { - Projectile.NewProjectile(player.Center, velocity, sandy, elementalDmg, kBack, player.whoAmI, 0f, 0f); - } - if (player.ownedProjectileCounts[cloudy] < 1) - { - Projectile.NewProjectile(player.Center, velocity, cloudy, elementalDmg, kBack, player.whoAmI, 0f, 0f); + if (player.FindBuffIndex(BuffType()) == -1) + { + player.AddBuff(BuffType(), 3600, true); + } + if (player.ownedProjectileCounts[brimmy] < 1) + { + Projectile.NewProjectile(player.Center, velocity, brimmy, elementalDmg, kBack, player.whoAmI); + } + if (player.ownedProjectileCounts[siren] < 1) + { + Projectile.NewProjectile(player.Center, velocity, siren, elementalDmg, kBack, player.whoAmI); + } + if (player.ownedProjectileCounts[healer] < 1) + { + Projectile.NewProjectile(player.Center, velocity, healer, elementalDmg, kBack, player.whoAmI); + } + if (player.ownedProjectileCounts[sandy] < 1) + { + Projectile.NewProjectile(player.Center, velocity, sandy, elementalDmg, kBack, player.whoAmI); + } + if (player.ownedProjectileCounts[cloudy] < 1) + { + Projectile.NewProjectile(player.Center, velocity, cloudy, elementalDmg, kBack, player.whoAmI); + } } } else @@ -125,12 +127,12 @@ namespace CalamityMod.Items.Accessories } //Flower Boots code - if (player.velocity.Y == 0f && player.grappling[0] == -1) + if (player != null && !player.dead && player.velocity.Y == 0f && player.grappling[0] == -1) { int x = (int)player.Center.X / 16; int y = (int)(player.position.Y + (float)player.height - 1f) / 16; Tile tile = Main.tile[x, y]; - if (tile == null) + if (tile is null) { tile = new Tile(); } diff --git a/Projectiles/Summon/SandElementalMinion.cs b/Projectiles/Summon/SandElementalMinion.cs index b9793548d7..b5eb286cb6 100644 --- a/Projectiles/Summon/SandElementalMinion.cs +++ b/Projectiles/Summon/SandElementalMinion.cs @@ -43,7 +43,6 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - bool flag64 = projectile.type == ModContent.ProjectileType(); Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.sandWaifu && !modPlayer.allWaifus) @@ -51,6 +50,7 @@ namespace CalamityMod.Projectiles.Summon projectile.active = false; return; } + bool flag64 = projectile.type == ModContent.ProjectileType(); if (flag64) { if (player.dead)