Made Onion give the Master slot

This commit is contained in:
Doze-Zoze authored and Cameron Ewell committed 2025-04-07 14:52:50 -04:00
1 parent 7841cdcd0f
commit 92a20a1bed
3 files changed
+13 -15

No files matched your search

+1
View File
@@ -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;
+12
View File
@@ -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
}
}
-15
View File
@@ -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();
}
}