Made Onion give the Master slot
This commit is contained in:
1 parent
7841cdcd0f
commit
92a20a1bed
3 files changed
+13
-15
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user