diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index e7af14fa61..cd9789f1f7 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -92,6 +92,7 @@ namespace CalamityMod.ILEditing On_TileDrawing.DrawSingleTile += GlowMaskTileRender; On_Main.DoUpdate_HandleChat += SpawnPunchCard; On_Player.PlaceThing_CannonBall += AllowCannonJellyfishUse; + On_Player.IsItemSlotUnlockedAndUsable += MasterModeCelestialOnionCheck; // Mana Burn (Chaos Stone) and Chalice of the Blood God IL_Player.ApplyLifeAndOrMana += ManaSicknessAndChaliceBufferHeal; diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 8563814c11..a4ee6e5024 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -37,6 +37,7 @@ using Microsoft.Xna.Framework.Graphics; using Mono.Cecil.Cil; using MonoMod.Cil; using ReLogic.Content; +using Steamworks; using Terraria; using Terraria.Audio; using Terraria.Chat; @@ -2485,5 +2486,16 @@ namespace CalamityMod.ILEditing #endregion #endregion + + #region Make Celestial Onion give the Master Mode slot + public static bool MasterModeCelestialOnionCheck(Terraria.On_Player.orig_IsItemSlotUnlockedAndUsable orig, Player self, int slot) + { + if ((slot == 9 || slot == 19) && self.Calamity().extraAccessoryML && !Main.gameMenu) + { + return true; + } + return orig(self, slot); + } + #endregion } } diff --git a/Items/PermanentBoosters/CelestialOnion.cs b/Items/PermanentBoosters/CelestialOnion.cs index 255737a155..8b0d74a480 100644 --- a/Items/PermanentBoosters/CelestialOnion.cs +++ b/Items/PermanentBoosters/CelestialOnion.cs @@ -46,19 +46,4 @@ namespace CalamityMod.Items.PermanentBoosters return true; } } - - public class CelestialOnionAccessorySlot : ModAccessorySlot - { - // Celestial Onion does not work in Master Mode. - public override bool IsEnabled() - { - // GetModPlayer will throw an index error in this step of the loading process for whatever reason - // We prematurely stop it from getting to that point - if (!Player.active || Main.masterMode) - return false; - - return Player.Calamity().extraAccessoryML; - } - public override bool IsHidden() => IsEmpty && !IsEnabled(); - } }