v1.11.2 equivalent

This repo should always reflect the contents of the public version
This commit is contained in:
apotofkoolaid committed 2024-06-18 05:19:10 -05:00
1 parent 2b1399e3f3
commit b2671c97e3
118 files changed
+706 -794

No files matched your search

Binary file not shown.
Binary file not shown.
Binary file not shown.
+13 -19
View File
@@ -8,51 +8,45 @@ namespace UnCalamityModMusic.Common.Configs
{
public override ConfigScope Mode => ConfigScope.ClientSide;
[Header("$Mods.UnCalamityModMusic.Configs.MusicConfig.MusicTogglesHeader")]
[Header("$Mods.UnCalamityModMusic.Configs.MusicConfig.MusicChangesHeader")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(true)]
public bool WorkshopThemes { get; set; }
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(true)]
public bool WorkshopThemes { get; set; }
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(true)]
public bool HardmodeInterlude { get; set; }
[Header("$Mods.UnCalamityModMusic.Configs.MusicConfig.AlternateMusicHeader")]
[BackgroundColor(192, 54, 64, 192)]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(false)]
public bool DeepAbyssAlt { get; set; }
public bool DeepAbyssAltTheme { get; set; }
[ReloadRequired]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(false)]
public bool CrimsonAlt { get; set; }
public bool CrimsonAltTheme { get; set; }
[ReloadRequired]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(false)]
public bool RainAlt { get; set; }
public bool RainAltTheme { get; set; }
[ReloadRequired]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(false)]
public bool BloodMoonAlt { get; set; }
public bool BloodMoonAltTheme { get; set; }
[ReloadRequired]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(false)]
public bool KingSlimeAlt { get; set; }
public bool KingSlimeAltTheme { get; set; }
[ReloadRequired]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(false)]
public bool EyeofCthulhuAlt { get; set; }
public bool EyeofCthulhuAltTheme { get; set; }
[ReloadRequired]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(false)]
public bool DestroyerAlt { get; set; }
public bool DestroyerAltTheme { get; set; }
[Header("$Mods.UnCalamityModMusic.Configs.MusicConfig.ConditionChangesHeader")]
@@ -62,6 +56,6 @@ namespace UnCalamityModMusic.Common.Configs
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(false)]
public bool OverrideAnahitasLure { get; set; }
public bool OverrideAnahitasLureTheme { get; set; }
}
}
@@ -44,7 +44,6 @@ namespace UnCalamityModMusic.Common.ModCompatibility
AddMusic("WorkshopTier2", "HeartPlusUp", "Biomes");
AddMusic("WorkshopTier1", "HeartPlusUp", "Biomes");
AddMusic("TownNight", "HeartPlusUp", "Biomes");
AddMusic("TownNight_Noiseless", "HeartPlusUp", "Biomes");
AddMusic("TownDay", "HeartPlusUp", "Biomes");
//AddMusic("JungleTemple", "Universe", "Biomes");
AddMusic("Dungeon", "HeartPlusUp", "Biomes");
+2 -2
View File
@@ -252,7 +252,7 @@ namespace UnCalamityModMusic.Common.Music
public override bool IsSceneEffectActive(Player player)
{
return PlayerFlags.ZoneDeepAbyss && !(PlayerFlags.TownSceneActive || PlayerFlags.WorkshopSceneActive) && ModContent.GetInstance<MusicConfig>().DeepAbyssAlt;
return PlayerFlags.ZoneDeepAbyss && !(PlayerFlags.TownSceneActive || PlayerFlags.WorkshopSceneActive) && ModContent.GetInstance<MusicConfig>().DeepAbyssAltTheme;
}
}
public class GlowingMushroomFields : ModSceneEffect
@@ -290,7 +290,7 @@ namespace UnCalamityModMusic.Common.Music
}
public class Crimson : ModSceneEffect
{
public override int Music => ModContent.GetInstance<MusicConfig>().CrimsonAlt ? MusicPathing.GetMusicSlot("CrimsonAlt") : MusicPathing.GetMusicSlot("Crimson");
public override int Music => ModContent.GetInstance<MusicConfig>().CrimsonAltTheme ? MusicPathing.GetMusicSlot("CrimsonAlt") : MusicPathing.GetMusicSlot("Crimson");
public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh;
+7 -29
View File
@@ -1,7 +1,5 @@
using Microsoft.Xna.Framework;
using System;
using System;
using Terraria;
using Terraria.GameContent.Events;
using Terraria.ID;
using Terraria.ModLoader;
using UnCalamityModMusic.Common.Configs;
@@ -9,27 +7,7 @@ using UnCalamityModMusic.Common.ModCompatibility;
namespace UnCalamityModMusic.Common.Music
{
public class FalseEpilogue : ModSystem
{
public int FalseEpilogueMusicSlot = 0;
public override void OnWorldLoad()
{
FalseEpilogueMusicSlot = MusicPathing.GetMusicSlot("FalseEpilogue");
}
public override void UpdateUI(GameTime gameTime)
{
Player player = Main.player[Main.myPlayer];
if (CreditsRollEvent.IsEventOngoing && !player.hasCreditsSceneMusicBox)
{
Main.musicBox2 = FalseEpilogueMusicSlot;
return;
}
}
}
public class MoonLord : ModSceneEffect
public class MoonLord : ModSceneEffect
{
public override int Music => InfernumCompatibility.DecideOnMusicPath("MoonLord", "MoonLord");
@@ -48,7 +26,7 @@ namespace UnCalamityModMusic.Common.Music
public override bool IsSceneEffectActive(Player player)
{
return ImpendingDoomSystem.ImpendingDoomCountdown > 0 || NPC.MoonLordCountdown > 0;
return WorldFlags.CustomImpendingDoom > 0 || NPC.MoonLordCountdown > 0;
}
public override void SpecialVisuals(Player player, bool isActive)
@@ -198,7 +176,7 @@ namespace UnCalamityModMusic.Common.Music
}
public class Destroyer : ModSceneEffect
{
public override int Music => ModContent.GetInstance<MusicConfig>().DestroyerAlt ? MusicPathing.GetMusicSlot("DestroyerAlt") : InfernumCompatibility.DecideOnMusicPath("Destroyer", "MechBosses");
public override int Music => ModContent.GetInstance<MusicConfig>().DestroyerAltTheme ? MusicPathing.GetMusicSlot("DestroyerAlt") : InfernumCompatibility.DecideOnMusicPath("Destroyer", "MechBosses");
public override SceneEffectPriority Priority => InfernumCompatibility.DecideOnScenePriority(SceneEffectPriority.BossLow);
@@ -219,7 +197,7 @@ namespace UnCalamityModMusic.Common.Music
public override bool IsSceneEffectActive(Player player)
{
return ImminentDestructionSystem.ImminentDestructionCountdown > 0;
return WorldFlags.ImminentDestruction > 0;
}*/
}
public class QueenSlime : ModSceneEffect
@@ -318,7 +296,7 @@ namespace UnCalamityModMusic.Common.Music
}
public class EyeofCthulhu : ModSceneEffect
{
public override int Music => ModContent.GetInstance<MusicConfig>().EyeofCthulhuAlt ? MusicPathing.GetMusicSlot("EyeofCthulhuAlt") : InfernumCompatibility.DecideOnMusicPath("EyeofCthulhu", "EyeOfCthulhu");
public override int Music => ModContent.GetInstance<MusicConfig>().EyeofCthulhuAltTheme ? MusicPathing.GetMusicSlot("EyeofCthulhuAlt") : InfernumCompatibility.DecideOnMusicPath("EyeofCthulhu", "EyeOfCthulhu");
public override SceneEffectPriority Priority => InfernumCompatibility.DecideOnScenePriority(SceneEffectPriority.BossLow);
@@ -329,7 +307,7 @@ namespace UnCalamityModMusic.Common.Music
}
public class KingSlime : ModSceneEffect
{
public override int Music => ModContent.GetInstance<MusicConfig>().KingSlimeAlt ? MusicPathing.GetMusicSlot("KingSlimeAlt") : InfernumCompatibility.DecideOnMusicPath("KingSlime", "KingSlime");
public override int Music => ModContent.GetInstance<MusicConfig>().KingSlimeAltTheme ? MusicPathing.GetMusicSlot("KingSlimeAlt") : InfernumCompatibility.DecideOnMusicPath("KingSlime", "KingSlime");
public override SceneEffectPriority Priority => InfernumCompatibility.DecideOnScenePriority(SceneEffectPriority.BossLow);
+4 -45
View File
@@ -1,5 +1,4 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria;
using Terraria.GameContent.Events;
using Terraria.ID;
using Terraria.ModLoader;
@@ -7,47 +6,7 @@ using UnCalamityModMusic.Common.Configs;
namespace UnCalamityModMusic.Common.Music
{
public class FrostMoon : ModSystem
{
/*public int FrostMoonMusicSlot = 0;
public override void OnWorldLoad()
{
FrostMoonMusicSlot = MusicPathing.GetMusicSlot("FrostMoon");
}
public override void UpdateUI(GameTime gameTime)
{
Player player = Main.player[Main.myPlayer];
if (Main.snowMoon && Main.musicBox2 == -1 && (PlayerFlags.onSurface || Main.remixWorld))
{
Main.musicBox2 = FrostMoonMusicSlot;
return;
}
}*/
}
public class PumpkinMoon : ModSystem
{
/*public int PumpkinMoonMusicSlot = 0;
public override void OnWorldLoad()
{
PumpkinMoonMusicSlot = MusicPathing.GetMusicSlot("PumpkinMoon");
}
public override void UpdateUI(GameTime gameTime)
{
Player player = Main.player[Main.myPlayer];
if (Main.pumpkinMoon && Main.musicBox2 == -1 && (PlayerFlags.onSurface || Main.remixWorld))
{
Main.musicBox2 = PumpkinMoonMusicSlot;
return;
}
}*/
}
public class TorchGod : ModSceneEffect
public class TorchGod : ModSceneEffect
{
/*public override int Music => MusicPathing.GetMusicSlot("TorchGod");
@@ -249,7 +208,7 @@ namespace UnCalamityModMusic.Common.Music
}
public class BloodMoon : ModSceneEffect
{
public override int Music => ModContent.GetInstance<MusicConfig>().BloodMoonAlt ? MusicPathing.GetMusicSlot("BloodMoonAlt") : (PlayerFlags.deathMode ? MusicPathing.GetMusicSlot("BloodMoonDeath") : MusicPathing.GetMusicSlot("BloodMoon"));
public override int Music => ModContent.GetInstance<MusicConfig>().BloodMoonAltTheme ? MusicPathing.GetMusicSlot("BloodMoonAlt") : (PlayerFlags.deathMode ? MusicPathing.GetMusicSlot("BloodMoonDeath") : MusicPathing.GetMusicSlot("BloodMoon"));
public override SceneEffectPriority Priority => SceneEffectPriority.Environment;
@@ -325,7 +284,7 @@ namespace UnCalamityModMusic.Common.Music
}
public class Rain : ModSceneEffect
{
public override int Music => ModContent.GetInstance<MusicConfig>().RainAlt ? MusicPathing.GetMusicSlot("RainAlt") : MusicPathing.GetMusicSlot("Rain");
public override int Music => ModContent.GetInstance<MusicConfig>().RainAltTheme ? MusicPathing.GetMusicSlot("RainAlt") : MusicPathing.GetMusicSlot("Rain");
public override SceneEffectPriority Priority => SceneEffectPriority.BiomeMedium;
+2 -2
View File
@@ -16,7 +16,7 @@ namespace UnCalamityModMusic.Common.Music
public override bool IsSceneEffectActive(Player player)
{
return IsAnahitaLureActive() && ModContent.GetInstance<MusicConfig>().OverrideAnahitasLure;
return IsAnahitaLureActive() && ModContent.GetInstance<MusicConfig>().OverrideAnahitasLureTheme;
}
public static bool IsAnahitaLureActive()
@@ -71,7 +71,7 @@ namespace UnCalamityModMusic.Common.Music
}
public class Rain_LureOverride : LureOverrideBaseScene
{
public override string Path => ModContent.GetInstance<MusicConfig>().RainAlt ? "RainAlt" : "Rain";
public override string Path => ModContent.GetInstance<MusicConfig>().RainAltTheme ? "RainAlt" : "Rain";
public override bool IsSceneEffectActive(Player player)
{
+7 -30
View File
@@ -1,15 +1,11 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.DataStructures;
using Terraria.GameContent.Drawing;
using Terraria.GameContent.ObjectInteractions;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using Terraria.ObjectData;
using Terraria.Utilities;
namespace UnCalamityModMusic.Common
{
@@ -17,26 +13,10 @@ namespace UnCalamityModMusic.Common
{
public abstract int MusicBoxTile { get; }
public virtual int? MusicBoxTileAlt { get; } = null;
public abstract string MusicFilePath { get; }
public override void SetStaticDefaults()
{
ItemID.Sets.CanGetPrefixes[Type] = false;
ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.MusicBox;
if (!String.IsNullOrEmpty(MusicFilePath) && MusicPathing.GetMusicSlot(MusicFilePath) > 0)
{
if (MusicBoxTileAlt == null)
{
MusicLoader.AddMusicBox(Mod, MusicPathing.GetMusicSlot(MusicFilePath), Type, MusicBoxTile);
}
else
{
MusicLoader.AddMusicBox(Mod, MusicPathing.GetMusicSlot(MusicFilePath), Type, MusicBoxTileAlt.Value);
}
}
}
public override void SetDefaults()
@@ -44,21 +24,19 @@ namespace UnCalamityModMusic.Common
Item.DefaultToMusicBox(MusicBoxTile);
}
}
public abstract class MusicBoxTile : ModTile
{
public override void SetStaticDefaults()
{
Main.tileFrameImportant[Type] = true;
Main.tileObsidianKill[Type] = true;
TileID.Sets.HasOutlines[Type] = true;
TileID.Sets.DisableSmartCursor[Type] = true;
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2);
TileObjectData.newTile.Origin = new Point16(0, 1);
TileObjectData.newTile.LavaDeath = false;
TileObjectData.newTile.DrawYOffset = 2;
TileObjectData.newTile.StyleLineSkip = 2;
TileObjectData.addTile(Type);
TileID.Sets.DisableSmartCursor[Type] = true;
AddMapEntry(new Color(191, 142, 111), Language.GetText("ItemName.MusicBox"));
}
@@ -71,32 +49,31 @@ namespace UnCalamityModMusic.Common
player.cursorItemIconID = TileLoader.GetItemDropFromTypeAndStyle(Type);
}
public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true;
public override bool CreateDust(int i, int j, ref int type) => false;
public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData)
{
Tile tile = Main.tile[i, j];
if (Lighting.UpdateEveryFrame && new FastRandom(Main.TileFrameSeed).WithModifier(i, j).Next(4) != 0)
if (Main.gamePaused || !Main.instance.IsActive || Lighting.UpdateEveryFrame && !Main.rand.NextBool(4))
{
return;
}
if (TileDrawing.IsVisible(tile) && tile.TileFrameX == 36 && tile.TileFrameY % 36 == 0 && (int)Main.timeForVisualEffects % 7 == 0 && Main.rand.NextBool(3))
if (tile.TileFrameX == 36 && tile.TileFrameY % 36 == 0 && (int)Main.timeForVisualEffects % 7 == 0 && Main.rand.NextBool(3))
{
int goreType = Main.rand.Next(570, 573);
Vector2 position = new Vector2(i * 16 + 8, j * 16 - 8);
Vector2 velocity = new Vector2(Main.WindForVisuals * 2f, -0.5f);
velocity.X *= Main.rand.NextFloat(0.5f, 1.5f);
velocity.Y *= Main.rand.NextFloat(0.5f, 1.5f);
velocity.X *= 1f + Main.rand.NextFloat(-0.5f, 0.5f);
velocity.Y *= 1f + Main.rand.NextFloat(-0.5f, 0.5f);
if (goreType == 572)
{
position.X -= 8f;
}
else if (goreType == 571)
if (goreType == 571)
{
position.X -= 4f;
}
-31
View File
@@ -1,31 +0,0 @@
using System.Collections.Generic;
using System.Reflection;
using Terraria;
using Terraria.ModLoader;
namespace UnCalamityModMusic.Common
{
public class MusicBoxConnecting : ModSystem
{
private static void ConnectMusicBox(string musicKey, int musicBoxItem)
{
int musicPath = MusicPathing.GetMusicSlot(musicKey);
if (musicPath > 0)
{
FieldInfo info = typeof(MusicLoader).GetField("musicToItem", BindingFlags.NonPublic | BindingFlags.Static);
var musicToItem = (Dictionary<int, int>)info.GetValue(null);
musicToItem[musicPath] = musicBoxItem;
}
}
public override void PostSetupContent()
{
if (!Main.dedServ)
{
ConnectMusicBox("TownNight_Noiseless", ModContent.ItemType<Content.Items.TownNightMusicBox>());
}
}
}
}
+170
View File
@@ -0,0 +1,170 @@
using Terraria;
using Terraria.ModLoader;
using UnCalamityModMusic.Common.Configs;
namespace UnCalamityModMusic.Common
{
public class MusicBoxRegistry : ModSystem
{
private static void AddMusicBox(string musicKey, int musicBoxItem, int musicBoxTile)
{
int musicPath = MusicPathing.GetMusicSlot(musicKey);
if (musicPath > 0)
{
MusicLoader.AddMusicBox(UnCalamityModMusic.Instance, musicPath, musicBoxItem, musicBoxTile);
}
}
public override void PostSetupContent()
{
if (!Main.dedServ)
{
//Alternates
if (ModContent.GetInstance<MusicConfig>().DestroyerAltTheme)
{
//AddMusicBox("DestroyerAlt", ModContent.ItemType<Content.Items.DestroyerMusicBox>(), ModContent.TileType<Content.Tiles.DestroyerMusicBox>());
}
else
{
//AddMusicBox("Destroyer", ModContent.ItemType<Content.Items.DestroyerMusicBox>(), ModContent.TileType<Content.Tiles.DestroyerMusicBox>());
}
if (ModContent.GetInstance<MusicConfig>().EyeofCthulhuAltTheme)
{
AddMusicBox("EyeofCthulhuAlt", ModContent.ItemType<Content.Items.EyeofCthulhuMusicBox>(), ModContent.TileType<Content.Tiles.EyeofCthulhuMusicBox>());
}
else
{
AddMusicBox("EyeofCthulhu", ModContent.ItemType<Content.Items.EyeofCthulhuMusicBox>(), ModContent.TileType<Content.Tiles.EyeofCthulhuMusicBox>());
}
if (ModContent.GetInstance<MusicConfig>().KingSlimeAltTheme)
{
AddMusicBox("KingSlimeAlt", ModContent.ItemType<Content.Items.KingSlimeMusicBox>(), ModContent.TileType<Content.Tiles.KingSlimeMusicBox>());
}
else
{
AddMusicBox("KingSlime", ModContent.ItemType<Content.Items.KingSlimeMusicBox>(), ModContent.TileType<Content.Tiles.KingSlimeMusicBox>());
}
if (ModContent.GetInstance<MusicConfig>().BloodMoonAltTheme)
{
AddMusicBox("BloodMoonAlt", ModContent.ItemType<Content.Items.BloodMoonMusicBox>(), ModContent.TileType<Content.Tiles.BloodMoonMusicBox>());
}
else
{
AddMusicBox("BloodMoon", ModContent.ItemType<Content.Items.BloodMoonMusicBox>(), ModContent.TileType<Content.Tiles.BloodMoonMusicBox>());
}
AddMusicBox("AbyssLayer3Alt", ModContent.ItemType<Content.Items.AbyssLayer3AltMusicBox>(), ModContent.TileType<Content.Tiles.AbyssLayer3AltMusicBox>());
if (ModContent.GetInstance<MusicConfig>().CrimsonAltTheme)
{
AddMusicBox("CrimsonAlt", ModContent.ItemType<Content.Items.CrimsonMusicBox>(), ModContent.TileType<Content.Tiles.CrimsonMusicBox>());
}
else
{
AddMusicBox("Crimson", ModContent.ItemType<Content.Items.CrimsonMusicBox>(), ModContent.TileType<Content.Tiles.CrimsonMusicBox>());
}
if (ModContent.GetInstance<MusicConfig>().RainAltTheme)
{
AddMusicBox("RainAlt", ModContent.ItemType<Content.Items.RainMusicBox>(), ModContent.TileType<Content.Tiles.RainMusicBox>());
}
else
{
AddMusicBox("Rain", ModContent.ItemType<Content.Items.RainMusicBox>(), ModContent.TileType<Content.Tiles.RainMusicBox>());
}
//Biomes
AddMusicBox("Space", ModContent.ItemType<Content.Items.SpaceMusicBox>(), ModContent.TileType<Content.Tiles.SpaceMusicBox>());
AddMusicBox("Underworld", ModContent.ItemType<Content.Items.UnderworldMusicBox>(), ModContent.TileType<Content.Tiles.UnderworldMusicBox>());
//AddMusicBox("Aether", ModContent.ItemType<Content.Items.AetherMusicBox>(), ModContent.TileType<Content.Tiles.AetherMusicBox>());
//AddMusicBox("Graveyard", ModContent.ItemType<Content.Items.GraveyardMusicBox>(), ModContent.TileType<Content.Tiles.GraveyardMusicBox>());
AddMusicBox("Meteorite", ModContent.ItemType<Content.Items.MeteoriteMusicBox>(), ModContent.TileType<Content.Tiles.MeteoriteMusicBox>());
AddMusicBox("WorkshopTier6", ModContent.ItemType<Content.Items.WorkshopTier6MusicBox>(), ModContent.TileType<Content.Tiles.WorkshopTier6MusicBox>());
AddMusicBox("WorkshopTier5", ModContent.ItemType<Content.Items.WorkshopTier5MusicBox>(), ModContent.TileType<Content.Tiles.WorkshopTier5MusicBox>());
AddMusicBox("WorkshopTier4", ModContent.ItemType<Content.Items.WorkshopTier4MusicBox>(), ModContent.TileType<Content.Tiles.WorkshopTier4MusicBox>());
AddMusicBox("WorkshopTier3", ModContent.ItemType<Content.Items.WorkshopTier3MusicBox>(), ModContent.TileType<Content.Tiles.WorkshopTier3MusicBox>());
AddMusicBox("WorkshopTier2", ModContent.ItemType<Content.Items.WorkshopTier2MusicBox>(), ModContent.TileType<Content.Tiles.WorkshopTier2MusicBox>());
AddMusicBox("WorkshopTier1", ModContent.ItemType<Content.Items.WorkshopTier1MusicBox>(), ModContent.TileType<Content.Tiles.WorkshopTier1MusicBox>());
AddMusicBox("TownNight", ModContent.ItemType<Content.Items.TownNightMusicBox>(), ModContent.TileType<Content.Tiles.TownNightMusicBox>());
AddMusicBox("TownDay", ModContent.ItemType<Content.Items.TownDayMusicBox>(), ModContent.TileType<Content.Tiles.TownDayMusicBox>());
//AddMusicBox("JungleTemple", ModContent.ItemType<Content.Items.JungleTempleMusicBox>(), ModContent.TileType<Content.Tiles.JungleTempleMusicBox>());
AddMusicBox("Dungeon", ModContent.ItemType<Content.Items.DungeonMusicBox>(), ModContent.TileType<Content.Tiles.DungeonMusicBox>());
AddMusicBox("GlowingMushroomFields", ModContent.ItemType<Content.Items.GlowingMushroomFieldsMusicBox>(), ModContent.TileType<Content.Tiles.GlowingMushroomFieldsMusicBox>());
AddMusicBox("Corruption", ModContent.ItemType<Content.Items.CorruptionMusicBox>(), ModContent.TileType<Content.Tiles.CorruptionMusicBox>());
AddMusicBox("CorruptionUnderground", ModContent.ItemType<Content.Items.CorruptionUndergroundMusicBox>(), ModContent.TileType<Content.Tiles.CorruptionUndergroundMusicBox>());
AddMusicBox("CrimsonUnderground", ModContent.ItemType<Content.Items.CrimsonUndergroundMusicBox>(), ModContent.TileType<Content.Tiles.CrimsonUndergroundMusicBox>());
AddMusicBox("Geodes", ModContent.ItemType<Content.Items.GeodesMusicBox>(), ModContent.TileType<Content.Tiles.GeodesMusicBox>());
AddMusicBox("Tundra", ModContent.ItemType<Content.Items.TundraMusicBox>(), ModContent.TileType<Content.Tiles.TundraMusicBox>());
AddMusicBox("TundraUnderground", ModContent.ItemType<Content.Items.TundraUndergroundMusicBox>(), ModContent.TileType<Content.Tiles.TundraUndergroundMusicBox>());
//AddMusicBox("JungleNight", ModContent.ItemType<Content.Items.JungleNightMusicBox>(), ModContent.TileType<Content.Tiles.JungleNightMusicBox>());
//AddMusicBox("JungleDay", ModContent.ItemType<Content.Items.JungleDayMusicBox>(), ModContent.TileType<Content.Tiles.JungleDayMusicBox>());
//AddMusicBox("JungleUndergroundHardmode", ModContent.ItemType<Content.Items.JungleUndergroundHardmodeMusicBox>(), ModContent.TileType<Content.Tiles.JungleUndergroundHardmodeMusicBox>());
//AddMusicBox("JungleUnderground", ModContent.ItemType<Content.Items.JungleUndergroundMusicBox>(), ModContent.TileType<Content.Tiles.JungleUndergroundMusicBox>());
//AddMusicBox("Hallow", ModContent.ItemType<Content.Items.HallowMusicBox>(), ModContent.TileType<Content.Tiles.HallowMusicBox>());
//AddMusicBox("HallowUnderground", ModContent.ItemType<Content.Items.HallowUndergroundMusicBox>(), ModContent.TileType<Content.Tiles.HallowUndergroundMusicBox>());
//AddMusicBox("DesertUnderground", ModContent.ItemType<Content.Items.DesertUndergroundMusicBox>(), ModContent.TileType<Content.Tiles.DesertUndergroundMusicBox>());
//AddMusicBox("UndergroundHardmode", ModContent.ItemType<Content.Items.UndergroundHardmodeMusicBox>(), ModContent.TileType<Content.Tiles.UndergroundHardmodeMusicBox>());
AddMusicBox("Caverns", ModContent.ItemType<Content.Items.CavernsMusicBox>(), ModContent.TileType<Content.Tiles.CavernsMusicBox>());
AddMusicBox("Underground", ModContent.ItemType<Content.Items.UndergroundMusicBox>(), ModContent.TileType<Content.Tiles.UndergroundMusicBox>());
AddMusicBox("OceanNight", ModContent.ItemType<Content.Items.OceanNightMusicBox>(), ModContent.TileType<Content.Tiles.OceanNightMusicBox>());
AddMusicBox("OceanDay", ModContent.ItemType<Content.Items.OceanDayMusicBox>(), ModContent.TileType<Content.Tiles.OceanDayMusicBox>());
AddMusicBox("Desert", ModContent.ItemType<Content.Items.DesertMusicBox>(), ModContent.TileType<Content.Tiles.DesertMusicBox>());
AddMusicBox("ForestNight", ModContent.ItemType<Content.Items.ForestNightMusicBox>(), ModContent.TileType<Content.Tiles.ForestNightMusicBox>());
AddMusicBox("ForestDayEvening", ModContent.ItemType<Content.Items.ForestDayEveningMusicBox>(), ModContent.TileType<Content.Tiles.ForestDayEveningMusicBox>());
AddMusicBox("ForestDayAfternoon", ModContent.ItemType<Content.Items.ForestDayAfternoonMusicBox>(), ModContent.TileType<Content.Tiles.ForestDayAfternoonMusicBox>());
AddMusicBox("ForestDayMorning", ModContent.ItemType<Content.Items.ForestDayMorningMusicBox>(), ModContent.TileType<Content.Tiles.ForestDayMorningMusicBox>());
AddMusicBox("ForestDayDawn", ModContent.ItemType<Content.Items.ForestDayDawnMusicBox>(), ModContent.TileType<Content.Tiles.ForestDayDawnMusicBox>());
//Bosses
AddMusicBox("MoonLord", ModContent.ItemType<Content.Items.MoonLordMusicBox>(), ModContent.TileType<Content.Tiles.MoonLordMusicBox>());
//AddMusicBox("LunaticCultist", ModContent.ItemType<Content.Items.LunaticCultistMusicBox>(), ModContent.TileType<Content.Tiles.LunaticCultistMusicBox>());
//AddMusicBox("EmpressofLight", ModContent.ItemType<Content.Items.EmpressofLightMusicBox>(), ModContent.TileType<Content.Tiles.EmpressofLightMusicBox>());
//AddMusicBox("DukeFishron", ModContent.ItemType<Content.Items.DukeFishronMusicBox>(), ModContent.TileType<Content.Tiles.DukeFishronMusicBox>());
//AddMusicBox("Golem", ModContent.ItemType<Content.Items.GolemMusicBox>(), ModContent.TileType<Content.Tiles.GolemMusicBox>());
//AddMusicBox("Plantera", ModContent.ItemType<Content.Items.PlanteraMusicBox>(), ModContent.TileType<Content.Tiles.PlanteraMusicBox>());
//AddMusicBox("MechanicalTrio", ModContent.ItemType<Content.Items.MechanicalTrioMusicBox>(), ModContent.TileType<Content.Tiles.MechanicalTrioMusicBox>());
//AddMusicBox("SkeletronPrime", ModContent.ItemType<Content.Items.SkeletronPrimeMusicBox>(), ModContent.TileType<Content.Tiles.SkeletronPrimeMusicBox>());
//AddMusicBox("Twins", ModContent.ItemType<Content.Items.TwinsMusicBox>(), ModContent.TileType<Content.Tiles.TwinsMusicBox>());
//AddMusicBox("QueenSlime", ModContent.ItemType<Content.Items.QueenSlimeMusicBox>(), ModContent.TileType<Content.Tiles.QueenSlimeMusicBox>());
AddMusicBox("WallofFlesh", ModContent.ItemType<Content.Items.WallofFleshMusicBox>(), ModContent.TileType<Content.Tiles.WallofFleshMusicBox>());
AddMusicBox("Skeletron", ModContent.ItemType<Content.Items.SkeletronMusicBox>(), ModContent.TileType<Content.Tiles.SkeletronMusicBox>());
//AddMusicBox("QueenBee", ModContent.ItemType<Content.Items.QueenBeeMusicBox>(), ModContent.TileType<Content.Tiles.QueenBeeMusicBox>());
AddMusicBox("BrainofCthulhu", ModContent.ItemType<Content.Items.BrainofCthulhuMusicBox>(), ModContent.TileType<Content.Tiles.BrainofCthulhuMusicBox>());
AddMusicBox("EaterofWorlds", ModContent.ItemType<Content.Items.EaterofWorldsMusicBox>(), ModContent.TileType<Content.Tiles.EaterofWorldsMusicBox>());
//Events
//AddMusicBox("FrostMoon", ModContent.ItemType<Content.Items.FrostMoonMusicBox>(), ModContent.TileType<Content.Tiles.FrostMoonMusicBox>());
//AddMusicBox("PumpkinMoon", ModContent.ItemType<Content.Items.PumpkinMoonMusicBox>(), ModContent.TileType<Content.Tiles.PumpkinMoonMusicBox>());
//AddMusicBox("TorchGod", ModContent.ItemType<Content.Items.TorchGodMusicBox>(), ModContent.TileType<Content.Tiles.TorchGodMusicBox>());
//AddMusicBox("LunarTowersSolar", ModContent.ItemType<Content.Items.LunarTowersSolarMusicBox>(), ModContent.TileType<Content.Tiles.LunarTowersSolarMusicBox>());
//AddMusicBox("LunarTowersNebula", ModContent.ItemType<Content.Items.LunarTowersNebulaMusicBox>(), ModContent.TileType<Content.Tiles.LunarTowersNebulaMusicBox>());
//AddMusicBox("LunarTowersVortex", ModContent.ItemType<Content.Items.LunarTowersVortexMusicBox>(), ModContent.TileType<Content.Tiles.LunarTowersVortexMusicBox>());
//AddMusicBox("LunarTowersStardust", ModContent.ItemType<Content.Items.LunarTowersStardustMusicBox>(), ModContent.TileType<Content.Tiles.LunarTowersStardustMusicBox>());
//AddMusicBox("MartianMadness", ModContent.ItemType<Content.Items.MartianMadnessMusicBox>(), ModContent.TileType<Content.Tiles.MartianMadnessMusicBox>());
//AddMusicBox("PirateInvasion", ModContent.ItemType<Content.Items.PirateInvasionMusicBox>(), ModContent.TileType<Content.Tiles.PirateInvasionMusicBox>());
//AddMusicBox("GoblinArmy", ModContent.ItemType<Content.Items.GoblinArmyMusicBox>(), ModContent.TileType<Content.Tiles.GoblinArmyMusicBox>());
//AddMusicBox("SolarEclipse", ModContent.ItemType<Content.Items.SolarEclipseMusicBox>(), ModContent.TileType<Content.Tiles.SolarEclipseMusicBox>());
AddMusicBox("BloodMoonDeath", ModContent.ItemType<Content.Items.BloodMoonDeathMusicBox>(), ModContent.TileType<Content.Tiles.BloodMoonDeathMusicBox>());
AddMusicBox("SlimeRain", ModContent.ItemType<Content.Items.SlimeRainMusicBox>(), ModContent.TileType<Content.Tiles.SlimeRainMusicBox>());
//AddMusicBox("Blizzard", ModContent.ItemType<Content.Items.BlizzardMusicBox>(), ModContent.TileType<Content.Tiles.BlizzardMusicBox>());
//AddMusicBox("Sandstorm", ModContent.ItemType<Content.Items.SandstormMusicBox>(), ModContent.TileType<Content.Tiles.SandstormMusicBox>());
//AddMusicBox("Thunderstorm", ModContent.ItemType<Content.Items.ThunderstormMusicBox>(), ModContent.TileType<Content.Tiles.ThunderstormMusicBox>());
//AddMusicBox("WindyDay", ModContent.ItemType<Content.Items.WindyDayMusicBox>(), ModContent.TileType<Content.Tiles.WindyDayMusicBox>());
AddMusicBox("LanternFestival", ModContent.ItemType<Content.Items.LanternFestivalMusicBox>(), ModContent.TileType<Content.Tiles.LanternFestivalMusicBox>());
//Misc
AddMusicBox("HardmodeInterlude", ModContent.ItemType<Content.Items.HardmodeInterludeMusicBox>(), ModContent.TileType<Content.Tiles.HardmodeInterludeMusicBox>());
AddMusicBox("FalseEpilogue", ModContent.ItemType<Content.Items.FalseEpilogueMusicBox>(), ModContent.TileType<Content.Tiles.FalseEpilogueMusicBox>());
//AddMusicBox("DragonsLull", ModContent.ItemType<Content.Items.DragonsLullMusicBox>(), ModContent.TileType<Content.Tiles.DragonsLullMusicFaux>());
AddMusicBox("RainLegacy", ModContent.ItemType<Content.Items.RainLegacyMusicBox>(), ModContent.TileType<Content.Tiles.RainLegacyMusicBox>());
//AddMusicBox("ImpendingDoom", ModContent.ItemType<Content.Items.ImpendingDoomMusicBox>(), ModContent.TileType<Content.Tiles.ImpendingDoomMusicBox>());
//AddMusicBox("CultistRitual", ModContent.ItemType<Content.Items.CultistRitualMusicBox>(), ModContent.TileType<Content.Tiles.CultistRitualMusicBox>());
//AddMusicBox("ImminentDestruction", ModContent.ItemType<Content.Items.ImminentDestructionMusicBox>(), ModContent.TileType<Content.Tiles.ImminentDestructionMusicBox>());
}
}
}
}
-321
View File
@@ -1,321 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.IO;
using UnCalamityModMusic.Common.Configs;
namespace UnCalamityModMusic.Common
{
//This system was created by Nycro for the main Calamity Mod
//An altered form of it is here so VCMM doesn't have to rely on external code
public record class MusicEventEntry(string Id, int Song, TimeSpan Length, TimeSpan IntroSilence, TimeSpan OutroSilence, Func<bool> ShouldPlay, Func<bool> Enabled);
public class MusicEvents : ModSystem
{
#region Statics
public static MusicEventEntry CurrentEvent { get; set; } = null;
public static DateTime? TrackStart { get; set; } = null;
public static DateTime? TrackEnd { get; set; } = null;
public static int LastPlayedEvent { get; set; } = -1;
public static TimeSpan? OutroSilence { get; set; } = null;
public static bool NoFade { get; set; } = false;
public static Thread EventTrackerThread { get; set; } = null;
public static List<string> PlayedEvents { get; set; } = [];
public static List<MusicEventEntry> EventCollection { get; set; } = [];
private static bool oldWorld { get; set; } = true;
#endregion
#region Events List
public override void OnModLoad()
{
static void AddEntry(string eventId, string songName, TimeSpan length, Func<bool> shouldPlay, Func<bool> enabled, TimeSpan? introSilence = null, TimeSpan? outroSilence = null)
{
MusicEventEntry entry = new(eventId, MusicPathing.GetMusicSlot(songName), length, introSilence ?? TimeSpan.Zero, outroSilence ?? TimeSpan.Zero, shouldPlay, enabled);
EventCollection.Add(entry);
}
// Hardmode Interlude
AddEntry("HardmodeStarted", "HardmodeInterlude", TimeSpan.FromSeconds(206.400d), () => Main.hardMode, () => ModContent.GetInstance<MusicConfig>().HardmodeInterlude);
}
public override void Unload() => EventCollection.Clear();
#endregion
#region Event Handling
public override void PostUpdateTime()
{
// If the Boss Rush is active, any would-be music events should be cancelled out and marked as played
if (PlayerFlags.bossRushActive)
{
foreach (MusicEventEntry entry in EventCollection)
{
if (entry.ShouldPlay())
PlayedEvents.Add(entry.Id);
}
TrackStart = null;
LastPlayedEvent = -1;
OutroSilence = null;
TrackEnd = null;
CurrentEvent = null;
return;
}
// If the player has already completed conditions to trigger certain music events, we don't
// want to queue a bunch of tracks to play as soon as they enter the world, so instead just mark them as played
if (oldWorld)
{
foreach (MusicEventEntry entry in EventCollection)
{
if (entry.ShouldPlay())
PlayedEvents.Add(entry.Id);
}
oldWorld = false;
}
// If the event has just finished, we want a little silence before fading back to normal
if (TrackEnd is not null)
{
// `silence` is the time after a track ends before music goes back to normal
TimeSpan silence = OutroSilence.Value;
TimeSpan postTrack = DateTime.Now - TrackEnd.Value;
// Play silence for the time specified
if (postTrack < silence)
{
int silenceSlot = MusicLoader.GetMusicSlot(Mod, "Assets/Sounds/Silence");
Main.musicBox2 = silenceSlot;
}
else
{
LastPlayedEvent = -1;
TrackEnd = null;
OutroSilence = null;
}
return;
}
// Only check for new events to play if none is currently playing
// This makes sure events always finish before a new one starts
if (CurrentEvent is null)
{
foreach (MusicEventEntry musicEvent in EventCollection)
{
// Make sure the event hasn't already played and SHOULD play
if (!PlayedEvents.Contains(musicEvent.Id) && musicEvent.ShouldPlay())
{
// Even if an event isn't marked as enabled, it should be counted
// as "played" so it isn't played when the player doesn't expect it
PlayedEvents.Add(musicEvent.Id);
// Events are always enabled on the server
if (Main.dedServ || musicEvent.Enabled())
{
// Assign the current event and start time
CurrentEvent = musicEvent;
TrackStart = DateTime.Now + musicEvent.IntroSilence;
// On clients, use a background thread to make sure the track always plays for exactly
// the specified length, regardless of if the game gets minimized, lags, or time becomes
// detangled from a consistent 60fps in any other way
if (!Main.dedServ)
{
EventTrackerThread = new(WatchMusicEvent);
EventTrackerThread.Start();
}
break;
}
}
}
}
if (TrackStart is not null)
{
if (TrackStart > DateTime.Now)
{
int silenceSlot = MusicLoader.GetMusicSlot(Mod, "Assets/Sounds/Silence");
Main.musicBox2 = silenceSlot;
NoFade = true;
}
else
{
Main.musicBox2 = CurrentEvent.Song;
if (NoFade)
{
Main.musicFade[CurrentEvent.Song] = 1f;
NoFade = false;
}
// If the event has finished playing, mark the end as now and clear the current event
if (DateTime.Now - TrackStart >= CurrentEvent.Length)
{
int silenceSlot = MusicLoader.GetMusicSlot(Mod, "Assets/Sounds/Silence");
Main.musicBox2 = silenceSlot;
Main.musicFade[CurrentEvent.Song] = 0f;
TrackEnd = DateTime.Now;
LastPlayedEvent = CurrentEvent.Song;
OutroSilence = CurrentEvent.OutroSilence;
TrackStart = null;
CurrentEvent = null;
}
}
}
}
/// <summary>
/// Watches for the game minimizing at any point, and adjusts the amount of time to play the song for accordingly
/// </summary>
public static void WatchMusicEvent()
{
DateTime? minimized = null;
while (CurrentEvent is not null)
{
bool musicPaused = !Main.instance.IsActive;
if (musicPaused && !minimized.HasValue)
minimized = DateTime.Now;
else if (!musicPaused && minimized.HasValue)
{
TrackStart += DateTime.Now - minimized.Value;
minimized = null;
}
}
EventTrackerThread = null;
}
#endregion
#region Event Saving
public override void SaveWorldData(TagCompound tag)
{
tag["VCMM:PlayedMusicEventCount"] = PlayedEvents.Count;
for (int i = 0; i < PlayedEvents.Count; i++)
{
tag[$"VCMM:PlayedMusicEvent{i}"] = PlayedEvents[i];
}
}
public override void LoadWorldData(TagCompound tag)
{
PlayedEvents.Clear();
if (tag.TryGet("VCMM:PlayedMusicEventCount", out int playedMusicEventCount))
{
for (int i = 0; i < playedMusicEventCount; i++)
{
if (tag.TryGet($"VCMM:PlayedMusicEvent{i}", out string playedEvent))
PlayedEvents.Add(playedEvent);
}
}
oldWorld = false;
}
public override void OnWorldUnload()
{
oldWorld = true;
TrackStart = null;
TrackEnd = null;
CurrentEvent = null;
PlayedEvents.Clear();
NoFade = false;
LastPlayedEvent = -1;
}
#endregion
#region Event Syncing
public static void SendSyncRequest()
{
ModPacket packet = UnCalamityModMusic.Instance.GetPacket();
packet.Write((byte)Netcode.VanillaCalamityModMusicMessageType.MusicEventSyncRequest);
packet.Send();
}
public static void FulfillSyncRequest(int requester)
{
// Only fulfill requests as the server host
if (!Main.dedServ)
{
return;
}
ModPacket packet = UnCalamityModMusic.Instance.GetPacket();
packet.Write((byte)Netcode.VanillaCalamityModMusicMessageType.MusicEventSyncResponse);
int trackCount = PlayedEvents.Count;
packet.Write(trackCount);
for (int i = 0; i < trackCount; i++)
{
packet.Write(PlayedEvents[i]);
}
packet.Send(toClient: requester);
}
public static void ReceiveSyncResponse(BinaryReader reader)
{
// Only receive info on clients
if (Main.dedServ)
{
return;
}
PlayedEvents.Clear();
int trackCount = reader.ReadInt32();
for (int i = 0; i < trackCount; i++)
{
PlayedEvents.Add(reader.ReadString());
}
}
#endregion
}
public class MusicEventsPlayer : ModPlayer
{
public override void OnEnterWorld()
{
if (Main.netMode == NetmodeID.MultiplayerClient && Player.whoAmI != Main.myPlayer)
{
MusicEvents.SendSyncRequest();
}
}
}
}
-26
View File
@@ -1,26 +0,0 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace UnCalamityModMusic.Common
{
public class NPCShops : GlobalNPC
{
public override void ModifyShop(NPCShop shop)
{
var calamityMod = ModLoader.TryGetMod("CalamityMod", out Mod calamity);
if (calamityMod && shop.NpcType == calamity.Find<ModNPC>("FAP").Type)
{
shop.Add(ModContent.ItemType<Content.Items.HardmodeInterludeMusicBox>(), Condition.Hardmode);
shop.Add(ModContent.ItemType<Content.Items.FalseEpilogueMusicBox>(), Condition.DownedMoonLord);
}
if (!calamityMod && shop.NpcType == NPCID.Princess)
{
shop.Add(ModContent.ItemType<Content.Items.HardmodeInterludeMusicBox>(), Condition.Hardmode);
shop.Add(ModContent.ItemType<Content.Items.FalseEpilogueMusicBox>(), Condition.DownedMoonLord);
}
}
}
}
-62
View File
@@ -1,62 +0,0 @@
using System.IO;
using System;
using Terraria.ModLoader;
namespace UnCalamityModMusic.Common
{
public class Netcode
{
public enum VanillaCalamityModMusicMessageType : byte
{
MusicEventSyncRequest,
MusicEventSyncResponse
}
public static void HandlePacket(Mod mod, BinaryReader reader, int whoAmI)
{
try
{
VanillaCalamityModMusicMessageType msgType = (VanillaCalamityModMusicMessageType)reader.ReadByte();
switch (msgType)
{
case VanillaCalamityModMusicMessageType.MusicEventSyncRequest:
{
MusicEvents.FulfillSyncRequest(whoAmI);
break;
}
case VanillaCalamityModMusicMessageType.MusicEventSyncResponse:
{
MusicEvents.ReceiveSyncResponse(reader);
break;
}
default:
{
UnCalamityModMusic.Instance.Logger.Error($"Failed to parse VCMM packet: No VCMM packet exists with ID {msgType}.");
throw new Exception("Failed to parse VCMM packet: Invalid VCMM packet ID.");
}
}
}
catch (Exception e)
{
if (e is EndOfStreamException eose)
{
UnCalamityModMusic.Instance.Logger.Error("Failed to parse VCMM packet: Packet was too short, missing data, or otherwise corrupt.", eose);
}
else if (e is ObjectDisposedException ode)
{
UnCalamityModMusic.Instance.Logger.Error("Failed to parse VCMM packet: Packet reader disposed or destroyed.", ode);
}
else if (e is IOException ioe)
{
UnCalamityModMusic.Instance.Logger.Error("Failed to parse VCMM packet: An unknown I/O error occurred.", ioe);
}
else
{
throw;
}
}
}
}
}
+3 -12
View File
@@ -1,7 +1,6 @@
using System.Reflection;
using Terraria;
using Terraria.GameContent.Events;
using Terraria.ID;
using Terraria.ModLoader;
namespace UnCalamityModMusic.Common
@@ -122,16 +121,8 @@ namespace UnCalamityModMusic.Common
}
else
{
if (player.ZoneShadowCandle || player.inventory[player.selectedItem].type == ItemID.ShadowCandle)
{
inTown = false;
inUgTown = false;
}
else
{
inTown = player.townNPCs > 2f && (((notRaining && player.ZoneOverworldHeight) && (notInExcludedTownEvent && player.ZoneOverworldHeight)) || inSpace);
inUgTown = player.townNPCs > 2f && (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight || player.ZoneUnderworldHeight);
}
inTown = player.townNPCs > 2f && (((notRaining && player.ZoneOverworldHeight) && (notInExcludedTownEvent && player.ZoneOverworldHeight)) || inSpace);
inUgTown = player.townNPCs > 2f && (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight || player.ZoneUnderworldHeight);
}
if (calamityMod)
@@ -162,7 +153,7 @@ namespace UnCalamityModMusic.Common
downedPlaguebringerGoliath = (bool)calamity.Call("GetBossDowned", "plaguebringergoliath");
downedAstrumAureus = (bool)calamity.Call("GetBossDowned", "astrumaureus");
downedLeviathan = (bool)calamity.Call("GetBossDowned", "anahitaleviathan");
downedCalamitasClone = (bool)calamity.Call("GetBossDowned", "calamitasclone");
downedCalamitasClone = (bool)calamity.Call("GetBossDowned", "calamitas");
downedBrimstoneElemental = (bool)calamity.Call("GetBossDowned", "brimstoneelemental");
downedAquaticScourge = (bool)calamity.Call("GetBossDowned", "aquaticscourge");
downedCryogen = (bool)calamity.Call("GetBossDowned", "cryogen");
+156
View File
@@ -0,0 +1,156 @@
using Microsoft.Xna.Framework;
using System;
using System.IO;
using System.Threading;
using Terraria;
using Terraria.GameContent.Events;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.IO;
namespace UnCalamityModMusic.Common
{
public class WorldFlags : ModSystem
{
public static bool passedResurrection = false;
public static bool passedMemory = false;
public static bool musicPlaying = false;
public static int resMusicSlot = 0;
public static int memoryMusicSlot = 0;
public static readonly TimeSpan resTiming = new TimeSpan(0, 0, 3, 21);
public static DateTime? resStarted = null;
public static Thread isMusicTiming = null;
public static Thread musicTiming => new Thread((ThreadStart)delegate
{
DateTime? dateTime = null;
while (musicPlaying)
{
if (!Main.instance.IsActive && !dateTime.HasValue)
{
dateTime = DateTime.Now;
}
else if (Main.instance.IsActive && dateTime.HasValue)
{
if (musicPlaying)
{
resStarted += DateTime.Now - dateTime.Value;
break;
}
dateTime = null;
}
}
dateTime = null;
isMusicTiming = null;
});
public override void OnWorldLoad()
{
if (Main.hardMode)
{
passedResurrection = true;
}
else
{
passedResurrection = false;
}
if (NPC.downedMoonlord)
{
passedMemory = true;
}
else
{
passedMemory = false;
}
resMusicSlot = MusicPathing.GetMusicSlot("HardmodeInterlude");
memoryMusicSlot = MusicPathing.GetMusicSlot("FalseEpilogue");
}
public override void OnWorldUnload()
{
passedResurrection = false;
passedMemory = false;
resStarted = null;
musicPlaying = false;
}
public override void LoadWorldData(TagCompound tag)
{
passedResurrection = tag.ContainsKey("passedResurrection");
passedMemory = tag.ContainsKey("passedMemory");
}
public override void SaveWorldData(TagCompound tag)
{
if (passedResurrection)
{
tag["passedResurrection"] = true;
}
if (passedMemory)
{
tag["passedMemory"] = true;
}
}
public override void NetSend(BinaryWriter writer)
{
var flags = new BitsByte();
flags[0] = passedResurrection;
flags[1] = passedMemory;
writer.Write(flags);
}
public override void NetReceive(BinaryReader reader)
{
BitsByte flags = reader.ReadByte();
passedResurrection = flags[0];
passedMemory = flags[1];
}
public override void UpdateUI(GameTime gameTime)
{
Player player = Main.player[Main.myPlayer];
if (isMusicTiming == null)
{
if (!passedResurrection && Main.hardMode)
{
passedResurrection = true;
musicPlaying = true;
resStarted = DateTime.Now;
isMusicTiming = musicTiming;
isMusicTiming.Start();
}
}
if (resStarted.HasValue)
{
if (Main.musicVolume == 0)
{
resStarted = null;
musicPlaying = false;
return;
}
}
if (CreditsRollEvent.IsEventOngoing && !player.hasCreditsSceneMusicBox)
{
Main.musicBox2 = memoryMusicSlot;
return;
}
if (resStarted.HasValue && !PlayerFlags.bossRushActive && Main.netMode != NetmodeID.MultiplayerClient)
{
DateTime now = DateTime.Now;
DateTime? date = resStarted;
if (now - date < resTiming)
{
Main.musicBox2 = resMusicSlot;
return;
}
}
}
}
}
+1 -3
View File
@@ -11,9 +11,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.AbyssLayer3AltMusicBox>();
public override string MusicFilePath => "AbyssLayer3Alt";
public override void AddRecipes()
public override void AddRecipes()
{
var calamityMod = ModLoader.TryGetMod("CalamityMod", out Mod calamity);
+1 -3
View File
@@ -11,9 +11,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.BloodMoonDeathMusicBox>();
public override string MusicFilePath => "BloodMoonDeath";
public override void AddRecipes()
public override void AddRecipes()
{
var calamityMod = ModLoader.TryGetMod("CalamityMod", out Mod calamity);
+3 -5
View File
@@ -10,15 +10,13 @@ namespace UnCalamityModMusic.Content.Items
[LegacyName("BloodMoon1MusicBox")]
public class BloodMoonMusicBox : MusicBoxItem
{
public override LocalizedText DisplayName => ModContent.GetInstance<MusicConfig>().BloodMoonAlt ? Language.GetOrRegister("Mods.UnCalamityModMusic.Items.BloodMoonMusicBox.DisplayNameAlt") : Language.GetOrRegister("Mods.UnCalamityModMusic.Items.BloodMoonMusicBox.DisplayName");
public override LocalizedText DisplayName => ModContent.GetInstance<MusicConfig>().BloodMoonAltTheme ? Language.GetOrRegister("Mods.UnCalamityModMusic.Items.BloodMoonMusicBox.DisplayNameAlt") : Language.GetOrRegister("Mods.UnCalamityModMusic.Items.BloodMoonMusicBox.DisplayName");
public override LocalizedText Tooltip => ModContent.GetInstance<MusicConfig>().BloodMoonAlt ? Language.GetOrRegister("Mods.UnCalamityModMusic.Items.BloodMoonMusicBox.TooltipAlt") : Language.GetOrRegister("Mods.UnCalamityModMusic.Items.BloodMoonMusicBox.Tooltip");
public override LocalizedText Tooltip => ModContent.GetInstance<MusicConfig>().BloodMoonAltTheme ? Language.GetOrRegister("Mods.UnCalamityModMusic.Items.BloodMoonMusicBox.TooltipAlt") : Language.GetOrRegister("Mods.UnCalamityModMusic.Items.BloodMoonMusicBox.Tooltip");
public override int MusicBoxTile => ModContent.TileType<Tiles.BloodMoonMusicBox>();
public override string MusicFilePath => ModContent.GetInstance<MusicConfig>().BloodMoonAlt ? "BloodMoonAlt" : "BloodMoon";
public override void AddRecipes()
public override void AddRecipes()
{
var calamityMod = ModLoader.TryGetMod("CalamityMod", out Mod calamity);
+1 -3
View File
@@ -9,9 +9,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.BrainofCthulhuMusicBox>();
public override string MusicFilePath => "BrainofCthulhu";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.BrainofCthulhuTrophy, 1)
+1 -3
View File
@@ -10,9 +10,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.CavernsMusicBox>();
public override string MusicFilePath => "Caverns";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.StoneBlock, 10)
+1 -3
View File
@@ -9,9 +9,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.CorruptionMusicBox>();
public override string MusicFilePath => "Corruption";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Ebonwood, 10)
@@ -10,9 +10,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.CorruptionUndergroundMusicBox>();
public override string MusicFilePath => "CorruptionUnderground";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.EbonstoneBlock, 10)
+3 -5
View File
@@ -9,15 +9,13 @@ namespace UnCalamityModMusic.Content.Items
{
public class CrimsonMusicBox : MusicBoxItem
{
public override LocalizedText DisplayName => ModContent.GetInstance<MusicConfig>().CrimsonAlt ? Language.GetOrRegister("Mods.UnCalamityModMusic.Items.CrimsonMusicBox.DisplayNameAlt") : Language.GetOrRegister("Mods.UnCalamityModMusic.Items.CrimsonMusicBox.DisplayName");
public override LocalizedText DisplayName => ModContent.GetInstance<MusicConfig>().CrimsonAltTheme ? Language.GetOrRegister("Mods.UnCalamityModMusic.Items.CrimsonMusicBox.DisplayNameAlt") : Language.GetOrRegister("Mods.UnCalamityModMusic.Items.CrimsonMusicBox.DisplayName");
public override LocalizedText Tooltip => ModContent.GetInstance<MusicConfig>().CrimsonAlt ? Language.GetOrRegister("Mods.UnCalamityModMusic.Items.CrimsonMusicBox.TooltipAlt") : Language.GetOrRegister("Mods.UnCalamityModMusic.Items.CrimsonMusicBox.Tooltip");
public override LocalizedText Tooltip => ModContent.GetInstance<MusicConfig>().CrimsonAltTheme ? Language.GetOrRegister("Mods.UnCalamityModMusic.Items.CrimsonMusicBox.TooltipAlt") : Language.GetOrRegister("Mods.UnCalamityModMusic.Items.CrimsonMusicBox.Tooltip");
public override int MusicBoxTile => ModContent.TileType<Tiles.CrimsonMusicBox>();
public override string MusicFilePath => ModContent.GetInstance<MusicConfig>().CrimsonAlt ? "CrimsonAlt" : "Crimson";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Shadewood, 10)
+1 -3
View File
@@ -10,9 +10,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.CrimsonUndergroundMusicBox>();
public override string MusicFilePath => "CrimsonUnderground";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.CrimstoneBlock, 10)
+1 -3
View File
@@ -9,9 +9,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.DesertMusicBox>();
public override string MusicFilePath => "Desert";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Cactus, 10)
+1 -3
View File
@@ -9,9 +9,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.DungeonMusicBox>();
public override string MusicFilePath => "Dungeon";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.BlueBrick, 10)
+1 -3
View File
@@ -9,9 +9,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.EaterofWorldsMusicBox>();
public override string MusicFilePath => "EaterofWorlds";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.EaterofWorldsTrophy, 1)
+3 -5
View File
@@ -9,15 +9,13 @@ namespace UnCalamityModMusic.Content.Items
{
public class EyeofCthulhuMusicBox : MusicBoxItem
{
public override LocalizedText DisplayName => ModContent.GetInstance<MusicConfig>().EyeofCthulhuAlt ? Language.GetOrRegister("Mods.UnCalamityModMusic.Items.EyeofCthulhuMusicBox.DisplayNameAlt") : Language.GetOrRegister("Mods.UnCalamityModMusic.Items.EyeofCthulhuMusicBox.DisplayName");
public override LocalizedText DisplayName => ModContent.GetInstance<MusicConfig>().EyeofCthulhuAltTheme ? Language.GetOrRegister("Mods.UnCalamityModMusic.Items.EyeofCthulhuMusicBox.DisplayNameAlt") : Language.GetOrRegister("Mods.UnCalamityModMusic.Items.EyeofCthulhuMusicBox.DisplayName");
public override LocalizedText Tooltip => ModContent.GetInstance<MusicConfig>().EyeofCthulhuAlt ? Language.GetOrRegister("Mods.UnCalamityModMusic.Items.EyeofCthulhuMusicBox.TooltipAlt") : Language.GetOrRegister("Mods.UnCalamityModMusic.Items.EyeofCthulhuMusicBox.Tooltip");
public override LocalizedText Tooltip => ModContent.GetInstance<MusicConfig>().EyeofCthulhuAltTheme ? Language.GetOrRegister("Mods.UnCalamityModMusic.Items.EyeofCthulhuMusicBox.TooltipAlt") : Language.GetOrRegister("Mods.UnCalamityModMusic.Items.EyeofCthulhuMusicBox.Tooltip");
public override int MusicBoxTile => ModContent.TileType<Tiles.EyeofCthulhuMusicBox>();
public override string MusicFilePath => ModContent.GetInstance<MusicConfig>().EyeofCthulhuAlt ? "EyeofCthulhuAlt" : "EyeofCthulhu";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.EyeofCthulhuTrophy, 1)
+36 -2
View File
@@ -1,3 +1,6 @@
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using UnCalamityModMusic.Common;
@@ -8,6 +11,37 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.FalseEpilogueMusicBox>();
public override string MusicFilePath => "FalseEpilogue";
}
public override void AddRecipes()
{
var calamityMod = ModLoader.TryGetMod("CalamityMod", out Mod calamity);
if (calamityMod)
{
try
{
Recipe.Create(Type, 1)
.AddIngredient(calamity, "ExodiumClusterOre", 10)
.AddIngredient(calamity, "Phantoplasm", 10)
.AddIngredient(ItemID.LunarBar, 3)
.AddIngredient(ItemID.MusicBox, 1)
.AddTile(Recipes.musicBoxCraftingStation)
.Register();
}
catch
{
UnCalamityModMusic.Instance.Logger.Debug(Language.GetTextValue("Mods.UnCalamityModMusic.Recipes.NameMismatchError"));
}
}
else
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.FragmentStardust, 10)
.AddIngredient(ItemID.Ectoplasm, 10)
.AddIngredient(ItemID.LunarBar, 3)
.AddIngredient(ItemID.MusicBox, 1)
.AddTile(Recipes.musicBoxCraftingStation)
.Register();
}
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 693 B

After

Width:  |  Height:  |  Size: 284 B

+1 -3
View File
@@ -10,9 +10,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.ForestDayAfternoonMusicBox>();
public override string MusicFilePath => "ForestDayAfternoon";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Wood, 10)
+1 -3
View File
@@ -10,9 +10,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.ForestDayDawnMusicBox>();
public override string MusicFilePath => "ForestDayDawn";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Wood, 10)
+1 -3
View File
@@ -10,9 +10,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.ForestDayEveningMusicBox>();
public override string MusicFilePath => "ForestDayEvening";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Wood, 10)
+1 -3
View File
@@ -10,9 +10,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.ForestDayMorningMusicBox>();
public override string MusicFilePath => "ForestDayMorning";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Wood, 10)
+1 -3
View File
@@ -10,9 +10,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.ForestNightMusicBox>();
public override string MusicFilePath => "ForestNight";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Wood, 10)
+1 -3
View File
@@ -9,9 +9,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.GeodesMusicBox>();
public override string MusicFilePath => "Geodes";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Granite, 10)
@@ -9,9 +9,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.GlowingMushroomFieldsMusicBox>();
public override string MusicFilePath => "GlowingMushroomFields";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.GlowingMushroom, 10)
+13 -2
View File
@@ -1,3 +1,5 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using UnCalamityModMusic.Common;
@@ -8,6 +10,15 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.HardmodeInterludeMusicBox>();
public override string MusicFilePath => "HardmodeInterlude";
}
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.SoulofFlight, 3)
.AddIngredient(ItemID.SoulofLight, 3)
.AddIngredient(ItemID.SoulofNight, 3)
.AddIngredient(ItemID.MusicBox, 1)
.AddTile(Recipes.musicBoxCraftingStation)
.Register();
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 551 B

After

Width:  |  Height:  |  Size: 266 B

+3 -5
View File
@@ -9,15 +9,13 @@ namespace UnCalamityModMusic.Content.Items
{
public class KingSlimeMusicBox : MusicBoxItem
{
public override LocalizedText DisplayName => ModContent.GetInstance<MusicConfig>().KingSlimeAlt ? Language.GetOrRegister("Mods.UnCalamityModMusic.Items.KingSlimeMusicBox.DisplayNameAlt") : Language.GetOrRegister("Mods.UnCalamityModMusic.Items.KingSlimeMusicBox.DisplayName");
public override LocalizedText DisplayName => ModContent.GetInstance<MusicConfig>().KingSlimeAltTheme ? Language.GetOrRegister("Mods.UnCalamityModMusic.Items.KingSlimeMusicBox.DisplayNameAlt") : Language.GetOrRegister("Mods.UnCalamityModMusic.Items.KingSlimeMusicBox.DisplayName");
public override LocalizedText Tooltip => ModContent.GetInstance<MusicConfig>().KingSlimeAlt ? Language.GetOrRegister("Mods.UnCalamityModMusic.Items.KingSlimeMusicBox.TooltipAlt") : Language.GetOrRegister("Mods.UnCalamityModMusic.Items.KingSlimeMusicBox.Tooltip");
public override LocalizedText Tooltip => ModContent.GetInstance<MusicConfig>().KingSlimeAltTheme ? Language.GetOrRegister("Mods.UnCalamityModMusic.Items.KingSlimeMusicBox.TooltipAlt") : Language.GetOrRegister("Mods.UnCalamityModMusic.Items.KingSlimeMusicBox.Tooltip");
public override int MusicBoxTile => ModContent.TileType<Tiles.KingSlimeMusicBox>();
public override string MusicFilePath => ModContent.GetInstance<MusicConfig>().KingSlimeAlt ? "KingSlimeAlt" : "KingSlime";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.KingSlimeTrophy, 1)
+1 -3
View File
@@ -9,9 +9,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.LanternFestivalMusicBox>();
public override string MusicFilePath => "LanternFestival";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddRecipeGroup(RecipeGroupID.Wood, 10)
+1 -3
View File
@@ -9,9 +9,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.MeteoriteMusicBox>();
public override string MusicFilePath => "Meteorite";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Meteorite, 10)
+1 -3
View File
@@ -9,9 +9,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.MoonLordMusicBox>();
public override string MusicFilePath => "MoonLord";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.MoonLordTrophy, 1)
+1 -3
View File
@@ -9,9 +9,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.OceanDayMusicBox>();
public override string MusicFilePath => "OceanDay";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.PalmWood, 10)
+1 -3
View File
@@ -9,9 +9,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.OceanNightMusicBox>();
public override string MusicFilePath => "OceanNight";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.PalmWood, 10)
+32 -11
View File
@@ -1,4 +1,3 @@
using System;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
@@ -12,15 +11,37 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.RainLegacyMusicBox>();
public override string MusicFilePath => "RainLegacy";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ModContent.ItemType<RainMusicBox>(), 1)
.AddIngredient(ModContent.ItemType<MoonLordMusicBox>(), 1)
.AddTile(Recipes.musicBoxCraftingStationVanilla)
.Register();
}
}
var calamityMod = ModLoader.TryGetMod("CalamityMod", out Mod calamity);
if (calamityMod)
{
try
{
Recipe.Create(Type, 1)
.AddIngredient(calamity, "ExodiumClusterOre", 10)
.AddIngredient(ItemID.RainCloud, 10)
.AddIngredient(ItemID.LunarBar, 3)
.AddIngredient(ItemID.MusicBox, 1)
.AddTile(Recipes.musicBoxCraftingStation)
.Register();
}
catch
{
UnCalamityModMusic.Instance.Logger.Debug(Language.GetTextValue("Mods.UnCalamityModMusic.Recipes.NameMismatchError"));
}
}
else
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.FragmentVortex, 10)
.AddIngredient(ItemID.RainCloud, 10)
.AddIngredient(ItemID.LunarBar, 3)
.AddIngredient(ItemID.MusicBox, 1)
.AddTile(Recipes.musicBoxCraftingStation)
.Register();
}
}
}
}
+3 -5
View File
@@ -9,15 +9,13 @@ namespace UnCalamityModMusic.Content.Items
{
public class RainMusicBox : MusicBoxItem
{
public override LocalizedText DisplayName => ModContent.GetInstance<MusicConfig>().RainAlt ? Language.GetOrRegister("Mods.UnCalamityModMusic.Items.RainMusicBox.DisplayNameAlt") : Language.GetOrRegister("Mods.UnCalamityModMusic.Items.RainMusicBox.DisplayName");
public override LocalizedText DisplayName => ModContent.GetInstance<MusicConfig>().RainAltTheme ? Language.GetOrRegister("Mods.UnCalamityModMusic.Items.RainMusicBox.DisplayNameAlt") : Language.GetOrRegister("Mods.UnCalamityModMusic.Items.RainMusicBox.DisplayName");
public override LocalizedText Tooltip => ModContent.GetInstance<MusicConfig>().RainAlt ? Language.GetOrRegister("Mods.UnCalamityModMusic.Items.RainMusicBox.TooltipAlt") : Language.GetOrRegister("Mods.UnCalamityModMusic.Items.RainMusicBox.Tooltip");
public override LocalizedText Tooltip => ModContent.GetInstance<MusicConfig>().RainAltTheme ? Language.GetOrRegister("Mods.UnCalamityModMusic.Items.RainMusicBox.TooltipAlt") : Language.GetOrRegister("Mods.UnCalamityModMusic.Items.RainMusicBox.Tooltip");
public override int MusicBoxTile => ModContent.TileType<Tiles.RainMusicBox>();
public override string MusicFilePath => ModContent.GetInstance<MusicConfig>().RainAlt ? "RainAlt" : "Rain";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Glowstick, 10)
+1 -3
View File
@@ -9,9 +9,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.SkeletronMusicBox>();
public override string MusicFilePath => "Skeletron";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.SkeletronTrophy, 1)
+1 -3
View File
@@ -9,9 +9,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.SlimeRainMusicBox>();
public override string MusicFilePath => "SlimeRain";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Gel, 10)
+1 -3
View File
@@ -9,9 +9,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.SpaceMusicBox>();
public override string MusicFilePath => "Space";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Cloud, 10)
+1 -3
View File
@@ -9,9 +9,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.TownDayMusicBox>();
public override string MusicFilePath => "TownDay";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddRecipeGroup(RecipeGroupID.Wood, 10)
+17 -3
View File
@@ -1,4 +1,5 @@
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
using UnCalamityModMusic.Common;
@@ -9,9 +10,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.TownNightMusicBox>();
public override string MusicFilePath => "TownNight";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddRecipeGroup(RecipeGroupID.Wood, 10)
@@ -21,5 +20,20 @@ namespace UnCalamityModMusic.Content.Items
.AddTile(Recipes.musicBoxCraftingStation)
.Register();
}
public class TownNightNoiselessRecording : GlobalItem
{
public override void UpdateAccessory(Item item, Player player, bool hideVisual)
{
if (item.type == ItemID.MusicBox && Main.curMusic == MusicPathing.GetMusicSlot("TownNight_Noiseless"))
{
if (Main.rand.NextBool(150))
{
SoundEngine.PlaySound(SoundID.Item166);
item.SetDefaults(ModContent.ItemType<TownNightMusicBox>());
}
}
}
}
}
}
+1 -3
View File
@@ -9,9 +9,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.TundraMusicBox>();
public override string MusicFilePath => "Tundra";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.BorealWood, 10)
+1 -3
View File
@@ -9,9 +9,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.TundraUndergroundMusicBox>();
public override string MusicFilePath => "TundraUnderground";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.IceBlock, 10)
+1 -3
View File
@@ -10,9 +10,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.UndergroundMusicBox>();
public override string MusicFilePath => "Underground";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.StoneBlock, 10)
+1 -3
View File
@@ -9,9 +9,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.UnderworldMusicBox>();
public override string MusicFilePath => "Underworld";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.AshWood, 10)
+1 -3
View File
@@ -9,9 +9,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.WallofFleshMusicBox>();
public override string MusicFilePath => "WallofFlesh";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.WallofFleshTrophy, 1)
+1 -3
View File
@@ -10,9 +10,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.WorkshopTier1MusicBox>();
public override string MusicFilePath => "WorkshopTier1";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddRecipeGroup(RecipeGroupID.Wood, 10)
+1 -3
View File
@@ -11,9 +11,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.WorkshopTier2MusicBox>();
public override string MusicFilePath => "WorkshopTier2";
public override void AddRecipes()
public override void AddRecipes()
{
var calamityMod = ModLoader.TryGetMod("CalamityMod", out Mod calamity);
+1 -3
View File
@@ -10,9 +10,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.WorkshopTier3MusicBox>();
public override string MusicFilePath => "WorkshopTier3";
public override void AddRecipes()
public override void AddRecipes()
{
Recipe.Create(Type, 1)
.AddRecipeGroup("VCMM:MythrilBarGroup", 3)
+1 -3
View File
@@ -11,9 +11,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.WorkshopTier4MusicBox>();
public override string MusicFilePath => "WorkshopTier4";
public override void AddRecipes()
public override void AddRecipes()
{
var calamityMod = ModLoader.TryGetMod("CalamityMod", out Mod calamity);
+1 -3
View File
@@ -11,9 +11,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.WorkshopTier5MusicBox>();
public override string MusicFilePath => "WorkshopTier5";
public override void AddRecipes()
public override void AddRecipes()
{
var calamityMod = ModLoader.TryGetMod("CalamityMod", out Mod calamity);
+1 -3
View File
@@ -11,9 +11,7 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.WorkshopTier6MusicBox>();
public override string MusicFilePath => "WorkshopTier6";
public override void AddRecipes()
public override void AddRecipes()
{
var calamityMod = ModLoader.TryGetMod("CalamityMod", out Mod calamity);
+68
View File
@@ -0,0 +1,68 @@
using Terraria;
using Terraria.GameContent.ItemDropRules;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using UnCalamityModMusic.Common;
namespace UnCalamityModMusic.Content
{
public class Loot : GlobalNPC
{
public override void ModifyNPCLoot(NPC npc, NPCLoot npcLoot)
{
if (npc.type == NPCID.WallofFlesh)
{
DropResurrection(1, npcLoot);
}
if (npc.type == NPCID.MoonLordCore)
{
DropMemory(1, npcLoot);
}
}
public override void OnKill(NPC npc)
{
if (npc.type == NPCID.MoonLordCore)
{
NPC.SetEventFlagCleared(ref WorldFlags.passedMemory, -1);
}
}
private static void DropResurrection(int stack, NPCLoot npcLoot)
{
LeadingConditionRule rule = new(new ResurrectionCondition());
rule.OnSuccess(ItemDropRule.Common(ModContent.ItemType<Items.HardmodeInterludeMusicBox>(), 1));
npcLoot.Add(rule);
}
private static void DropMemory(int stack, NPCLoot npcLoot)
{
LeadingConditionRule rule = new(new MemoryCondition());
rule.OnSuccess(ItemDropRule.Common(ModContent.ItemType<Items.FalseEpilogueMusicBox>(), 1));
npcLoot.Add(rule);
}
}
internal class ResurrectionCondition : IItemDropRuleCondition
{
public bool CanDrop(DropAttemptInfo info) => !info.IsInSimulation && info.npc.type == NPCID.WallofFlesh && !WorldFlags.passedResurrection;
public bool CanShowItemDropInUI() => true;
public string GetConditionDescription() => Language.GetTextValue("Mods.UnCalamityModMusic.Loot.FirstKillCondition");
}
internal class MemoryCondition : IItemDropRuleCondition
{
public bool CanDrop(DropAttemptInfo info) => !info.IsInSimulation && info.npc.type == NPCID.MoonLordCore && !WorldFlags.passedMemory;
public bool CanShowItemDropInUI() => true;
public string GetConditionDescription() => Language.GetTextValue("Mods.UnCalamityModMusic.Loot.FirstKillCondition");
}
}
+96 -19
View File
@@ -8,9 +8,8 @@ namespace UnCalamityModMusic.Content
public class Recipes : ModSystem
{
public static int musicBoxCraftingStation = TileID.HeavyWorkBench;
public static int musicBoxCraftingStationVanilla = TileID.TinkerersWorkbench;
public static RecipeGroup CopperOreGroup;
public static RecipeGroup CopperOreGroup;
public static RecipeGroup GoldOreGroup;
public static RecipeGroup CobaltOreGroup;
public static RecipeGroup CopperBarGroup;
@@ -103,6 +102,7 @@ namespace UnCalamityModMusic.Content
{
var calamityMod = ModLoader.TryGetMod("CalamityMod", out Mod calamity);
var calamityModMusic = ModLoader.TryGetMod("CalamityModMusic", out Mod cmusic);
var otherCalamityModMusic = ModLoader.TryGetMod("OtherCalamityModMusic", out Mod othermusic);
var calamityVanities = ModLoader.TryGetMod("CalValEX", out Mod calval);
var catalystMod = ModLoader.TryGetMod("CatalystMod", out Mod catalyst);
@@ -161,10 +161,22 @@ namespace UnCalamityModMusic.Content
{
recipeFinder.DisableRecipe();
}
if (recipeFinder.HasResult(cmusic.Find<ModItem>("AdultEidolonWyrmMusicBox")))
{
recipeFinder.DisableRecipe();
}
if (recipeFinder.HasResult(cmusic.Find<ModItem>("CalamitasDefeatMusicBox")))
{
recipeFinder.DisableRecipe();
}
if (recipeFinder.HasResult(cmusic.Find<ModItem>("CalamityTitleMusicBox")))
{
recipeFinder.DisableRecipe();
}
if (recipeFinder.HasResult(cmusic.Find<ModItem>("YharonLegacyMusicBox")))
{
recipeFinder.DisableRecipe();
}
}
}
@@ -280,6 +292,20 @@ namespace UnCalamityModMusic.Content
UnCalamityModMusic.Instance.Logger.Debug(Language.GetTextValue("Mods.UnCalamityModMusic.Recipes.NameMismatchError"));
}
//Adult Eidolon Wyrm
try
{
Recipe.Create(cmusic.Find<ModItem>("AdultEidolonWyrmMusicBox").Type, 1)
.AddIngredient(calamity, "HalibutCannon", 1)
.AddIngredient(ItemID.MusicBox, 1)
.AddTile(musicBoxCraftingStation)
.Register();
}
catch
{
UnCalamityModMusic.Instance.Logger.Debug(Language.GetTextValue("Mods.UnCalamityModMusic.Recipes.NameMismatchError"));
}
//Anahita
try
{
@@ -532,7 +558,7 @@ namespace UnCalamityModMusic.Content
try
{
Recipe.Create(cmusic.Find<ModItem>("BossRushTier5MusicBox").Type, 1)
.AddIngredient(calamity, "SupremeCalamitasTrophy", 1)
.AddIngredient(calamity, "Rock", 1)
.AddIngredient(calamity, "ShadowspecBar", 3)
.AddIngredient(ItemID.MusicBox, 1)
.AddTile(musicBoxCraftingStation)
@@ -763,6 +789,22 @@ namespace UnCalamityModMusic.Content
UnCalamityModMusic.Instance.Logger.Debug(Language.GetTextValue("Mods.UnCalamityModMusic.Recipes.NameMismatchError"));
}
//Calamity Title
try
{
Recipe.Create(cmusic.Find<ModItem>("CalamityTitleMusicBox").Type, 1)
.AddIngredient(calamity, "EssenceofHavoc", 10)
.AddIngredient(calamity, "BrimstoneSlag", 10)
.AddIngredient(calamity, "CalamityDust", 10)
.AddIngredient(ItemID.MusicBox, 1)
.AddTile(musicBoxCraftingStation)
.Register();
}
catch
{
UnCalamityModMusic.Instance.Logger.Debug(Language.GetTextValue("Mods.UnCalamityModMusic.Recipes.NameMismatchError"));
}
//Ceaseless Void
try
{
@@ -995,22 +1037,8 @@ namespace UnCalamityModMusic.Content
UnCalamityModMusic.Instance.Logger.Debug(Language.GetTextValue("Mods.UnCalamityModMusic.Recipes.NameMismatchError"));
}
//Primordial Wyrm
try
{
Recipe.Create(cmusic.Find<ModItem>("PrimordialWyrmMusicBox").Type, 1)
.AddIngredient(calamity, "HalibutCannon", 1)
.AddIngredient(ItemID.MusicBox, 1)
.AddTile(musicBoxCraftingStation)
.Register();
}
catch
{
UnCalamityModMusic.Instance.Logger.Debug(Language.GetTextValue("Mods.UnCalamityModMusic.Recipes.NameMismatchError"));
}
//Profaned Guardians
try
//Profaned Guardians
try
{
Recipe.Create(cmusic.Find<ModItem>("ProfanedGuardiansMusicBox").Type, 1)
.AddIngredient(calamity, "ProfanedGuardianTrophy", 1)
@@ -1141,6 +1169,20 @@ namespace UnCalamityModMusic.Content
UnCalamityModMusic.Instance.Logger.Debug(Language.GetTextValue("Mods.UnCalamityModMusic.Recipes.NameMismatchError"));
}
//Yharon Legacy
try
{
Recipe.Create(cmusic.Find<ModItem>("YharonLegacyMusicBox").Type, 1)
.AddIngredient(calamity, "ForgottenDragonEgg", 1)
.AddIngredient(ItemID.MusicBox, 1)
.AddTile(musicBoxCraftingStation)
.Register();
}
catch
{
UnCalamityModMusic.Instance.Logger.Debug(Language.GetTextValue("Mods.UnCalamityModMusic.Recipes.NameMismatchError"));
}
//Yharon Phase 1
try
{
@@ -1172,6 +1214,25 @@ namespace UnCalamityModMusic.Content
#endregion
#region Calamity Addon Music Boxes
/*if (otherCalamityModMusic)
{
//Planetoids
try
{
Recipe.Create(othermusic.Find<ModItem>("PlanetoidsMusicBox").Type, 1)
.AddIngredient(ItemID.Cloud, 10)
.AddIngredient(ItemID.DirtBlock, 10)
.AddIngredient(calamity, "Cinderplate", 10)
.AddIngredient(ItemID.MusicBox, 1)
.AddTile(musicBoxCraftingStation)
.Register();
}
catch
{
UnCalamityModMusic.Instance.Logger.Debug(Language.GetTextValue("Mods.UnCalamityModMusic.Recipes.NameMismatchError"));
}
}*/
if (calamityVanities)
{
//Astral Blight
@@ -1220,6 +1281,22 @@ namespace UnCalamityModMusic.Content
{
UnCalamityModMusic.Instance.Logger.Debug(Language.GetTextValue("Mods.UnCalamityModMusic.Recipes.NameMismatchError"));
}
//Astrageldon Title
try
{
Recipe.Create(catalyst.Find<ModItem>("AstrageldonTitleMusicBox").Type, 1)
.AddIngredient(calamity, "AstralOre", 10)
.AddIngredient(catalyst, "AstraJelly", 10)
.AddIngredient(catalyst, "MetanovaBar", 3)
.AddIngredient(ItemID.MusicBox, 1)
.AddTile(musicBoxCraftingStation)
.Register();
}
catch
{
UnCalamityModMusic.Instance.Logger.Debug(Language.GetTextValue("Mods.UnCalamityModMusic.Recipes.NameMismatchError"));
}
}
#endregion
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 329 B

-2
View File
@@ -5,8 +5,6 @@ namespace UnCalamityModMusic.Content.Tiles.External
{
public class MusicBox : MusicBoxTile
{
public override string HighlightTexture => "UnCalamityModMusic/Content/Menus/Blank";
public override void MouseOver(int i, int j)
{
Main.LocalPlayer.cursorItemIconEnabled = false;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 549 B

After

Width:  |  Height:  |  Size: 445 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 291 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 575 B

After

Width:  |  Height:  |  Size: 451 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 B

Loaded 100 of 118 files, more files were not shown because too many files have changed in this diff. Show more