This commit is contained in:
apotofkoolaid committed 2024-09-26 01:21:57 -05:00
1 parent 46256b081e
commit 0d1b0d2714
203 files changed
+1149 -678

No files matched your search

-1
View File
@@ -2,7 +2,6 @@
## files generated by popular Visual Studio add-ons.
*.csproj
*.sln
Properties/
# User-specific files
*.suo
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+11 -7
View File
@@ -8,15 +8,19 @@ namespace UnCalamityModMusic.Common.Configs
{
public override ConfigScope Mode => ConfigScope.ClientSide;
[Header("$Mods.UnCalamityModMusic.Configs.MusicConfig.MusicChangesHeader")]
[Header("$Mods.UnCalamityModMusic.Configs.MusicConfig.MusicTogglesHeader")]
[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)]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(true)]
public bool HardmodeInterlude { get; set; }
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(false)]
public bool DeepAbyssAltTheme { get; set; }
public bool AbyssLayer3Alt { get; set; }
[Header("$Mods.UnCalamityModMusic.Configs.MusicConfig.ConditionChangesHeader")]
@@ -26,6 +30,6 @@ namespace UnCalamityModMusic.Common.Configs
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(false)]
public bool OverrideAnahitasLureTheme { get; set; }
public bool OverrideAnahitasLure { get; set; }
}
}
+7 -2
View File
@@ -27,9 +27,14 @@ namespace UnCalamityModMusic.Common.Configs
[Header("$Mods.UnCalamityModMusic.Configs.OtherConfig.OtherChangesHeader")]
[ReloadRequired]
[ReloadRequired]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(true)]
public bool MusicBoxRecipes { get; set; }
[ReloadRequired]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(true)]
public bool MusicBoxResprite { get; set; }
}
}
}
@@ -38,6 +38,7 @@ 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");
@@ -87,7 +88,8 @@ namespace UnCalamityModMusic.Common.ModCompatibility
AddMusic("KingSlime", "HeartPlusUp", "Bosses");
//AddMusic("FrostMoon", "HeartPlusUp", "Events");
//AddMusic("PumpkinMoon", "HeartPlusUp", "Events");
//AddMusic("TorchGod", "HeartPlusUp", "Events");
AddMusic("TorchGod", "HeartPlusUp", "Events");
AddMusic("TorchGodRevengeance", "HeartPlusUp", "Events");
//AddMusic("LunarTowersSolar", "HeartPlusUp", "Events");
//AddMusic("LunarTowersNebula", "HeartPlusUp", "Events");
//AddMusic("LunarTowersVortex", "HeartPlusUp", "Events");
@@ -97,13 +99,16 @@ namespace UnCalamityModMusic.Common.ModCompatibility
//AddMusic("FrostLegion", "HeartPlusUp", "Events");
//AddMusic("GoblinArmy", "HeartPlusUp", "Events");
//AddMusic("SolarEclipse", "HeartPlusUp", "Events");
AddMusic("BloodMoonDeath", "Thriplerex", "Events");
AddMusic("BloodMoon", "Thriplerex", "Events");
AddMusic("BloodMoonDeath", "Thriplerex", "Events");
AddMusic("SlimeRain", "HeartPlusUp", "Events");
//AddMusic("Blizzard", "Universe", "Events");
//AddMusic("Sandstorm", "Universe", "Events");
AddMusic("OceanRain", "HeartPlusUp", "Events");
//AddMusic("Thunderstorm", "Universe", "Events");
AddMusic("TownRain", "HeartPlusUp", "Events");
AddMusic("Rain", "HeartPlusUp", "Events");
AddMusic("TownParty", "HeartPlusUp", "Events");
//AddMusic("WindyDay", "HeartPlusUp", "Events");
AddMusic("LanternFestival", "HeartPlusUp", "Events");
AddMusic("HardmodeInterlude", "Salvati", "Misc");
+1 -1
View File
@@ -37,7 +37,7 @@ namespace UnCalamityModMusic.Common.Music
public override int Music => MusicPathing.GetAmbienceSlot(Path);
public override SceneEffectPriority Priority => (Main.LocalPlayer.townNPCs > 2f || ModContent.GetInstance<LanternFestival>().IsSceneEffectActive(Main.LocalPlayer)) ? SceneEffectPriority.Environment : ScenePriority;
public override SceneEffectPriority Priority => (Main.LocalPlayer.townNPCs > 2f || ModContent.GetInstance<LanternFestival>().IsSceneEffectActive(Main.LocalPlayer)) ? SceneEffectPriority.Environment + 1 : ScenePriority;
public override float GetWeight(Player player)
{
+1 -1
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>().DeepAbyssAltTheme;
return PlayerFlags.ZoneDeepAbyss && !(PlayerFlags.TownSceneActive || PlayerFlags.WorkshopSceneActive) && ModContent.GetInstance<MusicConfig>().AbyssLayer3Alt;
}
}
public class GlowingMushroomFields : ModSceneEffect
+26 -5
View File
@@ -1,13 +1,34 @@
using System;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.GameContent.Events;
using Terraria.ID;
using Terraria.ModLoader;
using UnCalamityModMusic.Common.Configs;
using UnCalamityModMusic.Common.ModCompatibility;
namespace UnCalamityModMusic.Common.Music
{
public class MoonLord : ModSceneEffect
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 && PlayerFlags.CalamityMusicEventInactive)
{
Main.musicBox2 = FalseEpilogueMusicSlot;
return;
}
}
}
public class MoonLord : ModSceneEffect
{
public override int Music => InfernumCompatibility.DecideOnMusicPath("MoonLord", "MoonLord");
@@ -26,7 +47,7 @@ namespace UnCalamityModMusic.Common.Music
public override bool IsSceneEffectActive(Player player)
{
return WorldFlags.CustomImpendingDoom > 0 || NPC.MoonLordCountdown > 0;
return ImpendingDoomSystem.ImpendingDoomCountdown > 0 || NPC.MoonLordCountdown > 0;
}
public override void SpecialVisuals(Player player, bool isActive)
@@ -197,7 +218,7 @@ namespace UnCalamityModMusic.Common.Music
public override bool IsSceneEffectActive(Player player)
{
return WorldFlags.ImminentDestruction > 0;
return ImminentDestructionSystem.ImminentDestructionCountdown > 0;
}*/
}
public class QueenSlime : ModSceneEffect
+92 -12
View File
@@ -1,4 +1,5 @@
using Terraria;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.GameContent.Events;
using Terraria.ID;
using Terraria.ModLoader;
@@ -6,16 +7,56 @@ using UnCalamityModMusic.Common.Configs;
namespace UnCalamityModMusic.Common.Music
{
public class TorchGod : ModSceneEffect
public class FrostMoon : ModSystem
{
/*public override int Music => MusicPathing.GetMusicSlot("TorchGod");
/*public int FrostMoonMusicSlot = 0;
public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh;
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) && PlayerFlags.CalamityMusicEventInactive)
{
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) && PlayerFlags.CalamityMusicEventInactive)
{
Main.musicBox2 = PumpkinMoonMusicSlot;
return;
}
}*/
}
public class TorchGod : ModSceneEffect
{
public override int Music => PlayerFlags.revengeanceMode ? MusicPathing.GetMusicSlot("TorchGodRevengeance") : MusicPathing.GetMusicSlot("TorchGod");
public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh;
public override bool IsSceneEffectActive(Player player)
{
return player.happyFunTorchTime || (NPC.AnyNPCs(NPCID.TorchGod) && Main.npc[NPC.FindFirstNPC(NPCID.TorchGod)].Distance(player.Center) <= PlayerFlags.MusicTileRange);
}*/
}
}
public class LunarTowersSolar : ModSceneEffect
{
@@ -229,8 +270,8 @@ namespace UnCalamityModMusic.Common.Music
public override bool IsSceneEffectActive(Player player)
{
bool condition1 = !Main.remixWorld && PlayerFlags.isRaining && player.ZoneSnow && PlayerFlags.onSurface && !PlayerFlags.ZoneAstralInfection && !(Main.bloodMoon || Main.eclipse);
bool condition2 = Main.remixWorld && PlayerFlags.isRaining && player.ZoneSnow && PlayerFlags.onRemixedSurface && !PlayerFlags.ZoneAstralInfection && !(Main.bloodMoon || Main.eclipse);
bool condition1 = !Main.remixWorld && PlayerFlags.isRaining && player.ZoneSnow && PlayerFlags.onSurface && !(PlayerFlags.inSpace || PlayerFlags.ZoneAstralInfection) && !(Main.bloodMoon || Main.eclipse);
bool condition2 = Main.remixWorld && PlayerFlags.isRaining && player.ZoneSnow && PlayerFlags.onRemixedSurface && !(PlayerFlags.inSpace || PlayerFlags.ZoneAstralInfection) && !(Main.bloodMoon || Main.eclipse);
return condition1 || condition2;
}*/
@@ -251,8 +292,8 @@ namespace UnCalamityModMusic.Common.Music
public override bool IsSceneEffectActive(Player player)
{
bool condition1 = !Main.remixWorld && PlayerFlags.ZoneSandstorm && !PlayerFlags.ugDesertOriginalHeight && !PlayerFlags.ZoneAstralInfection && !(Main.bloodMoon || Main.eclipse);
bool condition2 = Main.remixWorld && PlayerFlags.ZoneSandstorm && PlayerFlags.onRemixedSurface && !PlayerFlags.ZoneAstralInfection && !(Main.bloodMoon || Main.eclipse);
bool condition1 = !Main.remixWorld && PlayerFlags.ZoneSandstorm && !PlayerFlags.ugDesertOriginalHeight && !(PlayerFlags.inSpace || PlayerFlags.ZoneAstralInfection) && !(Main.bloodMoon || Main.eclipse);
bool condition2 = Main.remixWorld && PlayerFlags.ZoneSandstorm && PlayerFlags.onRemixedSurface && !(PlayerFlags.inSpace || PlayerFlags.ZoneAstralInfection) && !(Main.bloodMoon || Main.eclipse);
return condition1 || condition2;
}
@@ -268,7 +309,21 @@ namespace UnCalamityModMusic.Common.Music
return Main.slimeRain && PlayerFlags.onSurface && !(player.ZoneGraveyard || PlayerFlags.inSpace) && !(Main.bloodMoon || Main.eclipse);
}
}
public class Thunderstorm : ModSceneEffect
public class OceanRain : ModSceneEffect
{
public override int Music => MusicPathing.GetMusicSlot("OceanRain");
public override SceneEffectPriority Priority => SceneEffectPriority.BiomeMedium;
public override bool IsSceneEffectActive(Player player)
{
bool condition1 = !Main.remixWorld && PlayerFlags.isRaining && player.ZoneBeach && PlayerFlags.ZoneOverworldHeightExtra && !(player.ZoneSnow || player.ZoneGraveyard || player.ZoneMeteor);
bool condition2 = Main.remixWorld && PlayerFlags.isRaining && player.ZoneBeach && (double)(player.position.Y / 16f) > Main.rockLayer && player.position.Y / 16f < (float)(Main.maxTilesY - 350) && !(player.ZoneSnow || player.ZoneGraveyard || player.ZoneMeteor);
return condition1 || condition2;
}
}
public class Thunderstorm : ModSceneEffect
{
/*public override int Music => MusicPathing.GetMusicSlot("Thunderstorm");
@@ -282,7 +337,18 @@ namespace UnCalamityModMusic.Common.Music
return condition1 || condition2;
}*/
}
public class Rain : ModSceneEffect
public class TownRain : ModSceneEffect
{
public override int Music => MusicPathing.GetMusicSlot("TownRain");
public override SceneEffectPriority Priority => SceneEffectPriority.Environment;
public override bool IsSceneEffectActive(Player player)
{
return PlayerFlags.inTownWithRain && PlayerFlags.notInExcludedTownBiome && !(/*Main._shouldUseStormMusic || */player.ZoneBeach || player.ZoneSnow || player.ZoneGraveyard || player.ZoneMeteor);
}
}
public class Rain : ModSceneEffect
{
public override int Music => MusicPathing.GetMusicSlot("Rain");
@@ -296,7 +362,21 @@ namespace UnCalamityModMusic.Common.Music
return condition1 || condition2;
}
}
public class WindyDay : ModSceneEffect
public class TownParty : ModSceneEffect
{
public override int Music => MusicPathing.GetMusicSlot("TownParty");
public override SceneEffectPriority Priority => SceneEffectPriority.Environment + 1;
public override bool IsSceneEffectActive(Player player)
{
bool condition1 = BirthdayParty.PartyIsUp && PlayerFlags.inTown && PlayerFlags.notInExcludedTownBiome && PlayerFlags.notRaining;
bool condition2 = BirthdayParty.PartyIsUp && PlayerFlags.inUgTown && PlayerFlags.notInExcludedTownBiome;
return condition1 || condition2;
}
}
public class WindyDay : ModSceneEffect
{
/*public override int Music => MusicPathing.GetMusicSlot("WindyDay");
+1 -1
View File
@@ -16,7 +16,7 @@ namespace UnCalamityModMusic.Common.Music
public override bool IsSceneEffectActive(Player player)
{
return IsAnahitaLureActive() && ModContent.GetInstance<MusicConfig>().OverrideAnahitasLureTheme;
return IsAnahitaLureActive() && ModContent.GetInstance<MusicConfig>().OverrideAnahitasLure;
}
public static bool IsAnahitaLureActive()
+41 -7
View File
@@ -1,11 +1,16 @@
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;
using UnCalamityModMusic.Common.Configs;
namespace UnCalamityModMusic.Common
{
@@ -13,30 +18,58 @@ namespace UnCalamityModMusic.Common
{
public abstract int MusicBoxTile { get; }
public virtual int? MusicBoxTileAlt { get; } = null;
public abstract string MusicFilePath { get; }
public virtual void MusicBoxRecipe() { return; }
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()
{
Item.DefaultToMusicBox(MusicBoxTile);
}
public override void AddRecipes()
{
if (ModContent.GetInstance<OtherConfig>().MusicBoxRecipes)
{
MusicBoxRecipe();
}
}
}
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"));
}
@@ -49,31 +82,32 @@ 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 (Main.gamePaused || !Main.instance.IsActive || Lighting.UpdateEveryFrame && !Main.rand.NextBool(4))
if (Lighting.UpdateEveryFrame && new FastRandom(Main.TileFrameSeed).WithModifier(i, j).Next(4) != 0)
{
return;
}
if (tile.TileFrameX == 36 && tile.TileFrameY % 36 == 0 && (int)Main.timeForVisualEffects % 7 == 0 && Main.rand.NextBool(3))
if (TileDrawing.IsVisible(tile) && 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 *= 1f + Main.rand.NextFloat(-0.5f, 0.5f);
velocity.Y *= 1f + Main.rand.NextFloat(-0.5f, 0.5f);
velocity.X *= Main.rand.NextFloat(0.5f, 1.5f);
velocity.Y *= Main.rand.NextFloat(0.5f, 1.5f);
if (goreType == 572)
{
position.X -= 8f;
}
if (goreType == 571)
else if (goreType == 571)
{
position.X -= 4f;
}
+31
View File
@@ -0,0 +1,31 @@
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>());
}
}
}
}
-121
View File
@@ -1,121 +0,0 @@
using Terraria;
using Terraria.ModLoader;
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
AddMusicBox("AbyssLayer3Alt", ModContent.ItemType<Content.Items.AbyssLayer3AltMusicBox>(), ModContent.TileType<Content.Tiles.AbyssLayer3AltMusicBox>());
//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("Crimson", ModContent.ItemType<Content.Items.CrimsonMusicBox>(), ModContent.TileType<Content.Tiles.CrimsonMusicBox>());
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("Destroyer", ModContent.ItemType<Content.Items.DestroyerMusicBox>(), ModContent.TileType<Content.Tiles.DestroyerMusicBox>());
//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>());
AddMusicBox("EyeofCthulhu", ModContent.ItemType<Content.Items.EyeofCthulhuMusicBox>(), ModContent.TileType<Content.Tiles.EyeofCthulhuMusicBox>());
AddMusicBox("KingSlime", ModContent.ItemType<Content.Items.KingSlimeMusicBox>(), ModContent.TileType<Content.Tiles.KingSlimeMusicBox>());
//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("BloodMoon", ModContent.ItemType<Content.Items.BloodMoonMusicBox>(), ModContent.TileType<Content.Tiles.BloodMoonMusicBox>());
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("Rain", ModContent.ItemType<Content.Items.RainMusicBox>(), ModContent.TileType<Content.Tiles.RainMusicBox>());
//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
@@ -0,0 +1,321 @@
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();
}
}
}
}
+5 -1
View File
@@ -85,6 +85,7 @@ namespace UnCalamityModMusic.Common
{"FrostMoon", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/FrostMoon")},
{"PumpkinMoon", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/PumpkinMoon")},
{"TorchGod", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/TorchGod")},
{"TorchGodRevengeance", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/TorchGodRevengeance")},
{"LunarTowersSolar", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/LunarTowersSolar")},
{"LunarTowersNebula", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/LunarTowersNebula")},
{"LunarTowersVortex", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/LunarTowersVortex")},
@@ -95,13 +96,16 @@ namespace UnCalamityModMusic.Common
{"FrostLegion", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/FrostLegion")},
{"GoblinArmy", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/GoblinArmy")},
{"SolarEclipse", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/SolarEclipse")},
{"BloodMoonDeath", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/BloodMoonDeath")},
{"BloodMoon", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/BloodMoon")},
{"BloodMoonDeath", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/BloodMoonDeath")},
{"SlimeRain", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/SlimeRain")},
{"Blizzard", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/Blizzard")},
{"Sandstorm", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/Sandstorm")},
{"OceanRain", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/OceanRain")},
{"Thunderstorm", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/Thunderstorm")},
{"TownRain", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/TownRain")},
{"Rain", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/Rain")},
{"TownParty", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/TownParty")},
{"WindyDay", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/WindyDay")},
{"LanternFestival", MusicLoader.GetMusicSlot(mod, "Assets/Music/Events/LanternFestival")},
+26
View File
@@ -0,0 +1,26 @@
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
@@ -0,0 +1,62 @@
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;
}
}
}
}
}
+47 -11
View File
@@ -1,6 +1,8 @@
using System.Reflection;
using System;
using System.Reflection;
using Terraria;
using Terraria.GameContent.Events;
using Terraria.ID;
using Terraria.ModLoader;
namespace UnCalamityModMusic.Common
@@ -11,7 +13,8 @@ namespace UnCalamityModMusic.Common
public static bool onRemixedSurface;
public static bool inSpace;
public static bool inTown;
public static bool inUgTown;
public static bool inTownWithRain;
public static bool inUgTown;
public static bool isRaining;
public static bool notRaining;
public static bool largeWorld;
@@ -25,12 +28,12 @@ namespace UnCalamityModMusic.Common
public static bool TownSceneActive;
public static bool WorkshopSceneActive;
public static bool infernumMode;
public static bool infernumMode;
public static bool deathMode;
public static bool revengeanceMode;
public static bool bossRushActive;
public static bool ZoneBrimstoneCrags;
public static bool ZoneBrimstoneCrags;
public static bool ZoneProfanedTemple;
public static bool ZoneAstralInfection;
public static bool ZoneSulfurSea;
@@ -77,7 +80,9 @@ namespace UnCalamityModMusic.Common
public static bool ZoneMarbleCave;
public static bool ZoneHive;
public static float MusicTileRange = 525f * 16f;
public static bool CalamityMusicEventInactive = true;
public static float MusicTileRange = 525f * 16f;
public override void PreUpdate()
{
@@ -105,8 +110,8 @@ namespace UnCalamityModMusic.Common
ugDesertOriginalHeight = (double)player.position.Y >= Main.worldSurface * 16.0 + (double)(Main.screenHeight / 2);
ZoneSandstorm = Sandstorm.Happening && player.ZoneDesert && !player.ZoneBeach;
ZoneOverworldHeightExtra = (!player.ZoneDesert && player.ZoneOverworldHeight) || (player.ZoneDesert && !ugDesertOriginalHeight);
TownSceneActive = ModContent.GetInstance<Music.TownDay>().IsSceneEffectActive(player) || ModContent.GetInstance<Music.TownNight>().IsSceneEffectActive(player);
WorkshopSceneActive = ModContent.GetInstance<Music.WorkshopTier1>().IsSceneEffectActive(player) || ModContent.GetInstance<Music.WorkshopTier2>().IsSceneEffectActive(player) || ModContent.GetInstance<Music.WorkshopTier3>().IsSceneEffectActive(player) || ModContent.GetInstance<Music.WorkshopTier4>().IsSceneEffectActive(player) || ModContent.GetInstance<Music.WorkshopTier5>().IsSceneEffectActive(player) || ModContent.GetInstance<Music.WorkshopTier6>().IsSceneEffectActive(player);
TownSceneActive = ModContent.GetInstance<Music.TownDay>().IsSceneEffectActive(player) || ModContent.GetInstance<Music.TownNight>().IsSceneEffectActive(player) || ModContent.GetInstance<Music.TownRain>().IsSceneEffectActive(player) || ModContent.GetInstance<Music.TownParty>().IsSceneEffectActive(player);
WorkshopSceneActive = ModContent.GetInstance<Music.WorkshopTier1>().IsSceneEffectActive(player) || ModContent.GetInstance<Music.WorkshopTier2>().IsSceneEffectActive(player) || ModContent.GetInstance<Music.WorkshopTier3>().IsSceneEffectActive(player) || ModContent.GetInstance<Music.WorkshopTier4>().IsSceneEffectActive(player) || ModContent.GetInstance<Music.WorkshopTier5>().IsSceneEffectActive(player) || ModContent.GetInstance<Music.WorkshopTier6>().IsSceneEffectActive(player);
WorkshopTier6Bosses = downedExoMechs || downedSupremeCalamitas;
WorkshopTier5Bosses = NPC.downedMoonlord || downedProfanedGuardians || downedDragonfolly || downedProvidence || downedCeaselessVoid || downedStormWeaver || downedSignus || downedPolterghast || downedOldDuke || downedDevourerofGods || downedYharon;
@@ -117,12 +122,23 @@ namespace UnCalamityModMusic.Common
if (noTownMusic)
{
inTown = false;
inTownWithRain = 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);
if (player.ZoneShadowCandle || player.inventory[player.selectedItem].type == ItemID.ShadowCandle)
{
inTown = false;
inTownWithRain = false;
inUgTown = false;
}
else
{
inTown = player.townNPCs > 2f && ((notRaining && notInExcludedTownEvent && player.ZoneOverworldHeight) || inSpace);
inTownWithRain = player.townNPCs > 2f && isRaining && notInExcludedTownEvent && ZoneOverworldHeightExtra;
inUgTown = player.townNPCs > 2f && (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight || player.ZoneUnderworldHeight);
}
}
if (calamityMod)
@@ -153,7 +169,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", "calamitas");
downedCalamitasClone = (bool)calamity.Call("GetBossDowned", "calamitasclone");
downedBrimstoneElemental = (bool)calamity.Call("GetBossDowned", "brimstoneelemental");
downedAquaticScourge = (bool)calamity.Call("GetBossDowned", "aquaticscourge");
downedCryogen = (bool)calamity.Call("GetBossDowned", "cryogen");
@@ -164,7 +180,9 @@ namespace UnCalamityModMusic.Common
deathMode = (bool)calamity.Call("DifficultyActive", "death");
revengeanceMode = (bool)calamity.Call("DifficultyActive", "revengeance");
bossRushActive = (bool)calamity.Call("DifficultyActive", "bossrush");
}
CalamityMusicEventInactive = CalamityMusicEvent() == null;
}
if (infernumMod)
{
@@ -193,5 +211,23 @@ namespace UnCalamityModMusic.Common
return false;
}
public static DateTime? CalamityMusicEvent()
{
if (ModLoader.TryGetMod("CalamityMod", out Mod calamity))
{
Type musicEventType = calamity.GetType().Assembly.GetType("CalamityMod.Systems.MusicEventSystem");
if (musicEventType != null)
{
PropertyInfo trackStartProperty = musicEventType.GetProperty("TrackStart", BindingFlags.Static | BindingFlags.Public);
DateTime? trackStartValue = trackStartProperty.GetValue(null) as DateTime?;
return trackStartValue;
}
}
return null;
}
}
}
-156
View File
@@ -1,156 +0,0 @@
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;
}
}
}
}
}
+3 -1
View File
@@ -11,7 +11,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.AbyssLayer3AltMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "AbyssLayer3Alt";
public override void MusicBoxRecipe()
{
var calamityMod = ModLoader.TryGetMod("CalamityMod", out Mod calamity);
+5 -2
View File
@@ -11,7 +11,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.BloodMoonDeathMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "BloodMoonDeath";
public override void MusicBoxRecipe()
{
var calamityMod = ModLoader.TryGetMod("CalamityMod", out Mod calamity);
@@ -37,7 +39,8 @@ namespace UnCalamityModMusic.Content.Items
Recipe.Create(Type, 1)
.AddRecipeGroup("VCMM:EvilPowderGroup", 10)
.AddIngredient(ItemID.Deathweed, 3)
.AddIngredient(ItemID.MusicBox, 1)
.AddIngredient(ItemID.BloodMoonStarter, 1)
.AddIngredient(ItemID.MusicBox, 1)
.AddTile(Recipes.musicBoxCraftingStation)
.Register();
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 332 B

+5 -2
View File
@@ -11,7 +11,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.BloodMoonMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "BloodMoon";
public override void MusicBoxRecipe()
{
var calamityMod = ModLoader.TryGetMod("CalamityMod", out Mod calamity);
@@ -37,7 +39,8 @@ namespace UnCalamityModMusic.Content.Items
Recipe.Create(Type, 1)
.AddRecipeGroup("VCMM:EvilPowderGroup", 10)
.AddIngredient(ItemID.FallenStar, 3)
.AddIngredient(ItemID.MusicBox, 1)
.AddIngredient(ItemID.BloodMoonStarter, 1)
.AddIngredient(ItemID.MusicBox, 1)
.AddTile(Recipes.musicBoxCraftingStation)
.Register();
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 306 B

After

Width:  |  Height:  |  Size: 320 B

+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.BrainofCthulhuMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "BrainofCthulhu";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.BrainofCthulhuTrophy, 1)
+3 -1
View File
@@ -10,7 +10,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.CavernsMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "Caverns";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.StoneBlock, 10)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 303 B

After

Width:  |  Height:  |  Size: 316 B

+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.CorruptionMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "Corruption";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Ebonwood, 10)
@@ -10,7 +10,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.CorruptionUndergroundMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "CorruptionUnderground";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.EbonstoneBlock, 10)
+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.CrimsonMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "Crimson";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Shadewood, 10)
+3 -1
View File
@@ -10,7 +10,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.CrimsonUndergroundMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "CrimsonUnderground";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.CrimstoneBlock, 10)
+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.DesertMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "Desert";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Cactus, 10)
+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.DungeonMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "Dungeon";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.BlueBrick, 10)
+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.EaterofWorldsMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "EaterofWorlds";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.EaterofWorldsTrophy, 1)
+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.EyeofCthulhuMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "EyeofCthulhu";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.EyeofCthulhuTrophy, 1)
+2 -36
View File
@@ -1,6 +1,3 @@
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using UnCalamityModMusic.Common;
@@ -11,37 +8,6 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.FalseEpilogueMusicBox>();
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();
}
}
}
public override string MusicFilePath => "FalseEpilogue";
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 B

After

Width:  |  Height:  |  Size: 693 B

+3 -1
View File
@@ -10,7 +10,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.ForestDayAfternoonMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "ForestDayAfternoon";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Wood, 10)
+3 -1
View File
@@ -10,7 +10,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.ForestDayDawnMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "ForestDayDawn";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Wood, 10)
+3 -1
View File
@@ -10,7 +10,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.ForestDayEveningMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "ForestDayEvening";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Wood, 10)
+3 -1
View File
@@ -10,7 +10,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.ForestDayMorningMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "ForestDayMorning";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Wood, 10)
+3 -1
View File
@@ -10,7 +10,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.ForestNightMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "ForestNight";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Wood, 10)
+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.GeodesMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "Geodes";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Granite, 10)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 332 B

After

Width:  |  Height:  |  Size: 355 B

@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.GlowingMushroomFieldsMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "GlowingMushroomFields";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.GlowingMushroom, 10)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

After

Width:  |  Height:  |  Size: 265 B

+2 -13
View File
@@ -1,5 +1,3 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using UnCalamityModMusic.Common;
@@ -10,15 +8,6 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.HardmodeInterludeMusicBox>();
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();
}
}
public override string MusicFilePath => "HardmodeInterlude";
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 266 B

After

Width:  |  Height:  |  Size: 551 B

+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.KingSlimeMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "KingSlime";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.KingSlimeTrophy, 1)
+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.LanternFestivalMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "LanternFestival";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddRecipeGroup(RecipeGroupID.Wood, 10)
+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.MeteoriteMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "Meteorite";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Meteorite, 10)
+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.MoonLordMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "MoonLord";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.MoonLordTrophy, 1)
+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.OceanDayMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "OceanDay";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.PalmWood, 10)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 359 B

After

Width:  |  Height:  |  Size: 353 B

+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.OceanNightMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "OceanNight";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.PalmWood, 10)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 310 B

After

Width:  |  Height:  |  Size: 445 B

+25
View File
@@ -0,0 +1,25 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using UnCalamityModMusic.Common;
namespace UnCalamityModMusic.Content.Items
{
public class OceanRainMusicBox : MusicBoxItem
{
public override int MusicBoxTile => ModContent.TileType<Tiles.OceanRainMusicBox>();
public override string MusicFilePath => "OceanRain";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.ShellPileBlock, 10)
.AddIngredient(ItemID.RainCloud, 10)
.AddIngredient(ItemID.Coral, 3)
.AddIngredient(ItemID.MusicBox, 1)
.AddTile(Recipes.musicBoxCraftingStation)
.Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

+11 -32
View File
@@ -1,3 +1,4 @@
using System;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
@@ -11,37 +12,15 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.RainLegacyMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "RainLegacy";
public override void AddRecipes()
{
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();
}
}
}
Recipe.Create(Type, 1)
.AddIngredient(ModContent.ItemType<RainMusicBox>(), 1)
.AddIngredient(ModContent.ItemType<MoonLordMusicBox>(), 1)
.AddTile(Recipes.musicBoxCraftingStationVanilla)
.Register();
}
}
}
+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.RainMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "Rain";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Glowstick, 10)
+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.SkeletronMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "Skeletron";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.SkeletronTrophy, 1)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 907 B

After

Width:  |  Height:  |  Size: 948 B

+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.SlimeRainMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "SlimeRain";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Gel, 10)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 364 B

After

Width:  |  Height:  |  Size: 383 B

+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.SpaceMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "Space";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Cloud, 10)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 297 B

After

Width:  |  Height:  |  Size: 376 B

+25
View File
@@ -0,0 +1,25 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using UnCalamityModMusic.Common;
namespace UnCalamityModMusic.Content.Items
{
public class TorchGodMusicBox : MusicBoxItem
{
public override int MusicBoxTile => ModContent.TileType<Tiles.TorchGodMusicBox>();
public override string MusicFilePath => "TorchGod";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.StoneBlock, 10)
.AddIngredient(ItemID.Torch, 10)
.AddIngredient(ItemID.UltrabrightTorch, 10)
.AddIngredient(ItemID.MusicBox, 1)
.AddTile(Recipes.musicBoxCraftingStation)
.Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

@@ -0,0 +1,38 @@
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using UnCalamityModMusic.Common;
namespace UnCalamityModMusic.Content.Items
{
public class TorchGodRevengeanceMusicBox : MusicBoxItem
{
public override int MusicBoxTile => ModContent.TileType<Tiles.TorchGodRevengeanceMusicBox>();
public override string MusicFilePath => "TorchGodRevengeance";
public override void MusicBoxRecipe()
{
var calamityMod = ModLoader.TryGetMod("CalamityMod", out Mod calamity);
if (calamityMod)
{
try
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.StoneBlock, 10)
.AddIngredient(calamity, "GloomTorch", 10)
.AddIngredient(calamity, "RefractivePrismTorch", 10)
.AddIngredient(ItemID.MusicBox, 1)
.AddTile(Recipes.musicBoxCraftingStation)
.Register();
}
catch
{
UnCalamityModMusic.Instance.Logger.Debug(Language.GetTextValue("Mods.UnCalamityModMusic.Recipes.NameMismatchError"));
}
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 412 B

+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.TownDayMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "TownDay";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddRecipeGroup(RecipeGroupID.Wood, 10)
+3 -17
View File
@@ -1,5 +1,4 @@
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
using UnCalamityModMusic.Common;
@@ -10,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.TownNightMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "TownNight";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddRecipeGroup(RecipeGroupID.Wood, 10)
@@ -20,20 +21,5 @@ 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>());
}
}
}
}
}
}
+26
View File
@@ -0,0 +1,26 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using UnCalamityModMusic.Common;
namespace UnCalamityModMusic.Content.Items
{
public class TownPartyMusicBox : MusicBoxItem
{
public override int MusicBoxTile => ModContent.TileType<Tiles.TownPartyMusicBox>();
public override string MusicFilePath => "TownParty";
public override void MusicBoxRecipe()
{
//Canonically, a party requires at least 10 balloons
Recipe.Create(Type, 1)
.AddRecipeGroup("VCMM:SillyTiedBalloonGroup", 10)
.AddIngredient(ItemID.SilverCoin, 10)
.AddIngredient(ItemID.Sunflower, 3)
.AddIngredient(ItemID.MusicBox, 1)
.AddTile(Recipes.musicBoxCraftingStation)
.Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 483 B

+25
View File
@@ -0,0 +1,25 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using UnCalamityModMusic.Common;
namespace UnCalamityModMusic.Content.Items
{
public class TownRainMusicBox : MusicBoxItem
{
public override int MusicBoxTile => ModContent.TileType<Tiles.TownRainMusicBox>();
public override string MusicFilePath => "TownRain";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.Glowstick, 10)
.AddIngredient(ItemID.SilverCoin, 10)
.AddIngredient(ItemID.WaterBucket, 3)
.AddIngredient(ItemID.MusicBox, 1)
.AddTile(Recipes.musicBoxCraftingStation)
.Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 451 B

+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.TundraMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "Tundra";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.BorealWood, 10)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 353 B

After

Width:  |  Height:  |  Size: 378 B

+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.TundraUndergroundMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "TundraUnderground";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.IceBlock, 10)
+3 -1
View File
@@ -10,7 +10,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.UndergroundMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "Underground";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.StoneBlock, 10)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 344 B

After

Width:  |  Height:  |  Size: 349 B

+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.UnderworldMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "Underworld";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.AshWood, 10)
+3 -1
View File
@@ -9,7 +9,9 @@ namespace UnCalamityModMusic.Content.Items
{
public override int MusicBoxTile => ModContent.TileType<Tiles.WallofFleshMusicBox>();
public override void AddRecipes()
public override string MusicFilePath => "WallofFlesh";
public override void MusicBoxRecipe()
{
Recipe.Create(Type, 1)
.AddIngredient(ItemID.WallofFleshTrophy, 1)
Loaded 100 of 203 files, more files were not shown because too many files have changed in this diff. Show more