diff --git a/Content/Abilities/Faewhip/Whip.cs b/Content/Abilities/Faewhip/Whip.cs index 3b45b1c03..518047a58 100644 --- a/Content/Abilities/Faewhip/Whip.cs +++ b/Content/Abilities/Faewhip/Whip.cs @@ -1,5 +1,6 @@ using StarlightRiver.Core.Loaders; using StarlightRiver.Core.Systems.DummyTileSystem; +using StarlightRiver.Core.Systems; using System; using Terraria.GameInput; using static Terraria.ModLoader.ModContent; @@ -272,7 +273,7 @@ public override void UpdateActive() public override void DrawActiveEffects(SpriteBatch spriteBatch) { - if (!Active || !CustomHooks.PlayerTarget.canUseTarget) + if (!Active || !PlayerTargetSystem.canUseTarget) return; if (trail is null || trail.IsDisposed) diff --git a/Content/CustomHooks/Mechanics.PassiveLight.cs b/Content/Biomes/BiomePassiveLightingSystem.cs similarity index 83% rename from Content/CustomHooks/Mechanics.PassiveLight.cs rename to Content/Biomes/BiomePassiveLightingSystem.cs index 3fc1955aa..4af50e2b0 100644 --- a/Content/CustomHooks/Mechanics.PassiveLight.cs +++ b/Content/Biomes/BiomePassiveLightingSystem.cs @@ -1,12 +1,10 @@ -using StarlightRiver.Content.Biomes; -using StarlightRiver.Content.Bosses.SquidBoss; -using StarlightRiver.Content.Events; -using System.Collections.Generic; +using StarlightRiver.Content.Bosses.SquidBoss; using Terraria.ID; -namespace StarlightRiver.Content.CustomHooks +namespace StarlightRiver.Content.Biomes { - class PassiveLight : ModSystem + //TODO: See if splitting this across the biome classes creates a performance concern + class BiomePassiveLightingSystem : ModSystem { private static float mult = 0; private static bool vitricLava = false; @@ -72,9 +70,9 @@ public override void PostUpdateEverything() float progress = 0.5f + yOff / (float)StarlightWorld.vitricBiome.Height * 0.7f; progress = MathHelper.Max(0.5f, progress); - preComputedVitricColors[yOff].X = (0.3f + (yOff > 70 ? ((yOff - 70) * 0.006f) : 0)) * progress * mult; - preComputedVitricColors[yOff].Y = (0.48f + (yOff > 70 ? ((yOff - 70) * 0.0005f) : 0)) * progress * mult; - preComputedVitricColors[yOff].Z = (0.65f - (yOff > 70 ? ((yOff - 70) * 0.005f) : 0)) * progress * mult; + preComputedVitricColors[yOff].X = (0.3f + (yOff > 70 ? (yOff - 70) * 0.006f : 0)) * progress * mult; + preComputedVitricColors[yOff].Y = (0.48f + (yOff > 70 ? (yOff - 70) * 0.0005f : 0)) * progress * mult; + preComputedVitricColors[yOff].Z = (0.65f - (yOff > 70 ? (yOff - 70) * 0.005f : 0)) * progress * mult; if (yOff > 90 && mult < 1) { @@ -84,7 +82,7 @@ public override void PostUpdateEverything() } } - inSquidBiome = Main.LocalPlayer.InModBiome(ModContent.GetInstance()); + inSquidBiome = Main.LocalPlayer.InModBiome(ModContent.GetInstance()); if (squidDomeRect == default) { diff --git a/Content/Biomes/MoonstoneBiome.cs b/Content/Biomes/MoonstoneBiome.cs index 52155ea82..16df77e22 100644 --- a/Content/Biomes/MoonstoneBiome.cs +++ b/Content/Biomes/MoonstoneBiome.cs @@ -1,14 +1,16 @@ -//TODO ON WORLDGEN: -//Wall updates -//General cleanup of post-shape stuff - +using StarlightRiver.Content.Items.Utility; using StarlightRiver.Content.Tiles.Moonstone; using StarlightRiver.Core.Loaders; +using StarlightRiver.Core.Systems.CameraSystem; using StarlightRiver.Core.Systems.ScreenTargetSystem; using System; +using System.Linq; using System.Reflection; +using Terraria.DataStructures; using Terraria.Graphics.Effects; using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader.IO; namespace StarlightRiver.Content.Biomes { @@ -58,6 +60,9 @@ public class MoonstoneBiomeSystem : ModSystem private bool drawingBGtarget = false; + public bool moonstoneForced; + public bool meteorForced; + public ParticleSystem particleSystem; public ParticleSystem particleSystemMedium; public ParticleSystem particleSystemLarge; @@ -88,6 +93,7 @@ public override void Load() On_Main.DrawBackgroundBlackFill += DrawParticleTarget; On_Main.DrawSurfaceBG += DistortBG; + On_WorldGen.meteor += ReplaceMeteorWithMoonstone; } public override void PostUpdateEverything() @@ -244,6 +250,111 @@ private void DrawParticleTarget(On_Main.orig_DrawBackgroundBlackFill orig, Main Main.spriteBatch.Begin(default, default, Main.DefaultSamplerState, default, Main.Rasterizer, default, Main.GameViewMatrix.TransformationMatrix); } + /// + /// If the next meteor-like event to spawn should me a moonstone or not + /// + /// + private bool ShouldBeMoonstone() + { + if (moonstoneForced) + { + moonstoneForced = false; + return true; + } + + if (meteorForced) + { + meteorForced = false; + return false; + } + + return Main.rand.NextBool(); + } + + private bool ReplaceMeteorWithMoonstone(On_WorldGen.orig_meteor orig, int i, int j, bool ignorePlayers) + { + CameraSystem.shake += 80; + Terraria.Audio.SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode); + + if (ShouldBeMoonstone()) + { + var target = new Point16(); + + while (!SafeToSpawnMoonstone(target)) + { + int x = Main.rand.Next(Main.maxTilesX); + + for (int y = 0; y < Main.maxTilesY; y++) + { + if (Framing.GetTileSafely(x, y).HasTile) + { + target = new Point16(x, y - 20); + break; + } + } + } + + for (int x = -10; x < 10; x++) + { + for (int y = -30; y < 30; y++) + { + if (Math.Abs(x) < 10 - Math.Abs(y) / 3 + StarlightWorld.genNoise.GetPerlin(x * 4, y * 4) * 8) + WorldGen.PlaceTile(target.X + x, target.Y + y, ModContent.TileType(), true, true); + } + } + + for (int x = -15; x < 15; x++) + { + for (int y = 0; y < 40; y++) + { + if (Math.Abs(x) < 10 - Math.Abs(y) / 3 + StarlightWorld.genNoise.GetPerlin(x * 4, y * 4) * 8) + WorldGen.PlaceTile(target.X + x, target.Y + y, ModContent.TileType(), true, true); + } + } + + Terraria.Chat.ChatHelper.BroadcastChatMessage(NetworkText.FromLiteral("A shard of the moon has landed!"), new Color(107, 233, 231)); + + if (Main.netMode == NetmodeID.Server) + NetMessage.SendTileSquare(Main.myPlayer, target.X - 30, target.Y - 30, 60, 70, TileChangeType.None); + + return true; + } + else + { + return orig(i, j, ignorePlayers); + } + } + + /// + /// Emulates teh various safety checks vanilla uses for if a meteor can be spawned + /// + /// The center point that a moonstone is attempting to be spawned at + /// + private bool SafeToSpawnMoonstone(Point16 test) + { + if (test == Point16.Zero) + return false; + + for (int x = -35; x < 35; x++) + { + for (int y = -35; y < 35; y++) + { + if (WorldGen.InWorld(test.X + x, test.Y + y)) + { + Tile tile = Framing.GetTileSafely(test + new Point16(x, y)); + + if (tile.TileType == TileID.Containers || tile.TileType == TileID.Containers2) + return false; + } + } + } + + if (Main.npc.Any(n => n.active && n.friendly && Vector2.Distance(n.Center, test.ToVector2() * 16) <= 35 * 16)) + return false; + else + return true; + } + protected void UpdateMoonParticles(Particle particle) { float parallax = 0.6f; @@ -265,5 +376,17 @@ protected void UpdateMoonParticles(Particle particle) particle.Color = color * opacity * fade; particle.Timer--; } + + public override void SaveWorldData(TagCompound tag) + { + tag.Add("moonstoneForced", moonstoneForced); + tag.Add("meteorForced", meteorForced); + } + + public override void LoadWorldData(TagCompound tag) + { + moonstoneForced = tag.GetBool("moonstoneForced"); + meteorForced = tag.GetBool("meteorForced"); + } } } \ No newline at end of file diff --git a/Content/Bosses/SquidBoss/NPCs.ArenaActor.cs b/Content/Bosses/SquidBoss/NPCs.ArenaActor.cs index 306a69317..906e68345 100644 --- a/Content/Bosses/SquidBoss/NPCs.ArenaActor.cs +++ b/Content/Bosses/SquidBoss/NPCs.ArenaActor.cs @@ -1,8 +1,11 @@ +using MonoMod.Cil; using StarlightRiver.Content.Biomes; -using StarlightRiver.Content.CustomHooks; +using StarlightRiver.Content.Configs; using StarlightRiver.Content.Items.Permafrost; +using StarlightRiver.Content.NPCs.BaseTypes; using StarlightRiver.Content.Tiles.Permafrost; using StarlightRiver.Core.Loaders; +using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.CutawaySystem; using StarlightRiver.Core.Systems.LightingSystem; using System; @@ -21,7 +24,7 @@ class ArenaActor : ModNPC private readonly List platforms = new(); public int waterfallWidth = 0; - ParticleSystem bubblesSystem = new(AssetDirectory.SquidBoss + "Bubble", UpdateBubblesBody); + public static ParticleSystem bubblesSystem; private Vector2 domeOffset = new(0, -886); private static VertexPositionColorTexture[] verticies; @@ -41,6 +44,14 @@ class ArenaActor : ModNPC private int WhitelistID => WallType(); + public override void Load() + { + bubblesSystem = new(AssetDirectory.SquidBoss + "Bubble", UpdateBubblesBody); + + if (!Main.dedServ) + IL_Main.DoDraw_WallsTilesNPCs += RenderArenaLayers; + } + public override void SetStaticDefaults() { DisplayName.SetDefault(""); @@ -69,6 +80,14 @@ public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestia database.Entries.Remove(bestiaryEntry); } + private void RenderArenaLayers(ILContext il) + { + var c = new ILCursor(il); + c.TryGotoNext(n => n.MatchLdfld
("DrawCacheNPCsBehindNonSolidTiles")); + + c.EmitDelegate(RenderArenaLayersInner); + } + public override bool NeedSaving() { return true; @@ -314,6 +333,49 @@ private void RegeneratePlatforms() platforms.Add(Main.npc[i]); } + public static void RenderArenaLayersInner() + { + if (!Main.LocalPlayer.InModBiome()) + return; + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(default, default, SamplerState.PointClamp, default, Main.Rasterizer, default, Main.GameViewMatrix.TransformationMatrix); + + NPC npc = latestActor?.NPC; + + if (npc != null && npc.active) + { + if (BackgroundReflectionSystem.canUseTarget || !ModContent.GetInstance().ReflectionConfig.ReflectionsOn) + (npc.ModNPC as ArenaActor).DrawBigWindow(Main.spriteBatch); + + int boss = -1; + var drawCache = new List(); + + for (int k = 0; k < Main.maxNPCs; k++) //draw NPCs and find boss + { + NPC NPC2 = Main.npc[k]; + + if (NPC2.active && NPC2.ModNPC is IUnderwater) + { + if (NPC2.type == ModContent.NPCType()) + boss = k; + else + drawCache.Add(NPC2); + } + } + + drawCache.ForEach(n => (n.ModNPC as IUnderwater).DrawUnderWater(Main.spriteBatch, 0)); + + foreach (Projectile proj in Main.projectile.Where(n => n.active && n.ModProjectile is IUnderwater)) //draw all Projectiles + (proj.ModProjectile as IUnderwater).DrawUnderWater(Main.spriteBatch, 0); + + if (boss != -1 && Main.npc[boss].ModNPC is IUnderwater) + (Main.npc[boss].ModNPC as IUnderwater).DrawUnderWater(Main.spriteBatch, 0); //draw boss ontop if extant + + drawCache.ForEach(n => (n.ModNPC as IUnderwater).DrawUnderWater(Main.spriteBatch, 1)); //draw layer for NPCs over bosses, used for the front part of tentacles + } + } + public void DrawWater(SpriteBatch spriteBatch) { Texture2D tex = Assets.Bosses.SquidBoss.CathedralWater.Value; @@ -529,9 +591,9 @@ private void DrawReflections(SpriteBatch spriteBatch) Color tintColor = Color.White; tintColor.A = (byte)(NPC.AnyNPCs(NPCType()) ? 25 : 75); - ReflectionTarget.DrawReflection(spriteBatch, screenPos: NPC.Center - reflectionMap.Size() / 2 + new Vector2(0, -7 * 16 - 3) - Main.screenPosition, normalMap: reflectionMap, flatOffset: new Vector2(-0.0075f, 0.05f), offsetScale: 0.04f, tintColor: tintColor, restartSpriteBatch: false); - ReflectionTarget.DrawReflection(spriteBatch, screenPos: NPC.Center - domeMap.Size() / 2 + domeOffset - Main.screenPosition, normalMap: domeMap, flatOffset: new Vector2(0f, 0.15f), offsetScale: 0.08f, tintColor: tintColor, restartSpriteBatch: false); - ReflectionTarget.isDrawReflectablesThisFrame = true; + BackgroundReflectionSystem.DrawReflection(spriteBatch, screenPos: NPC.Center - reflectionMap.Size() / 2 + new Vector2(0, -7 * 16 - 3) - Main.screenPosition, normalMap: reflectionMap, flatOffset: new Vector2(-0.0075f, 0.05f), offsetScale: 0.04f, tintColor: tintColor, restartSpriteBatch: false); + BackgroundReflectionSystem.DrawReflection(spriteBatch, screenPos: NPC.Center - domeMap.Size() / 2 + domeOffset - Main.screenPosition, normalMap: domeMap, flatOffset: new Vector2(0f, 0.15f), offsetScale: 0.08f, tintColor: tintColor, restartSpriteBatch: false); + BackgroundReflectionSystem.isDrawReflectablesThisFrame = true; } private void SpawnPlatform(int x, int y, bool small = false) diff --git a/Content/Bosses/SquidBoss/NPCs.ArenaBlocker.cs b/Content/Bosses/SquidBoss/NPCs.ArenaBlocker.cs index 63fe34d9a..45981bd26 100644 --- a/Content/Bosses/SquidBoss/NPCs.ArenaBlocker.cs +++ b/Content/Bosses/SquidBoss/NPCs.ArenaBlocker.cs @@ -12,19 +12,9 @@ class ArenaBlocker : ModNPC public override string Texture => AssetDirectory.Invisible; - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - return false; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) + public override void Load() { - return State == 0; - } - - public override bool CheckActive() - { - return !NPC.AnyNPCs(NPCType()); + On_Player.Update_NPCCollision += ForceColliding; } public override void SetDefaults() @@ -44,6 +34,26 @@ public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestia database.Entries.Remove(bestiaryEntry); } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return State == 0; + } + + public override bool CheckActive() + { + return !NPC.AnyNPCs(NPCType()); + } + + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) + { + target.immune = true; + target.immuneTime = 1; + + target.position.Y = NPC.position.Y + NPC.height; + target.velocity.Y += 5; + target.noKnockback = true; + } + public override void AI() { if (!NPC.AnyNPCs(NPCType())) @@ -62,6 +72,39 @@ public override void AI() } } + private void ForceColliding(On_Player.orig_Update_NPCCollision orig, Player self) + { + foreach(NPC npc in Main.ActiveNPCs) + { + int specialHit = 0; + float damageMult = 0f; + Rectangle npcRect = default; + + if (npc.type == NPCType() && NPCLoader.CanHitPlayer(NPC, self, ref specialHit)) + { + NPC.GetMeleeCollisionData(self.Hitbox, npc.whoAmI, ref specialHit, ref damageMult, ref npcRect); + + if (self.Hitbox.Intersects(npcRect)) + { + var hit = new Player.HurtInfo() { Damage = NPC.damage }; + NPCLoader.OnHitPlayer(NPC, self, hit); + + var hit2 = new Player.HurtModifiers(); + NPCLoader.ModifyHitPlayer(NPC, self, ref hit2); + + return; + } + } + } + + orig(self); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + return false; + } + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { if (Timer > 150) @@ -93,15 +136,5 @@ public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color Lighting.AddLight(pos4, color.ToVector3() * 0.4f); } } - - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - target.immune = true; - target.immuneTime = 1; - - target.position.Y = NPC.position.Y + NPC.height; - target.velocity.Y += 5; - target.noKnockback = true; - } } } \ No newline at end of file diff --git a/Content/Bosses/VitricBoss/NPCs.ArenaBacks.cs b/Content/Bosses/VitricBoss/NPCs.ArenaBacks.cs index 04ff72af3..a38cee42a 100644 --- a/Content/Bosses/VitricBoss/NPCs.ArenaBacks.cs +++ b/Content/Bosses/VitricBoss/NPCs.ArenaBacks.cs @@ -1,5 +1,5 @@ using StarlightRiver.Content.Biomes; -using StarlightRiver.Content.CustomHooks; +using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.CameraSystem; using StarlightRiver.Helpers; using System.Collections.Generic; @@ -280,8 +280,8 @@ protected void DrawReflections(SpriteBatch spriteBatch, Texture2D reflectionMap, { Color tintColor = new Color(75, 150, 255, NPC.AnyNPCs(NPCType()) ? 70 : 200); - ReflectionTarget.DrawReflection(spriteBatch, screenPos, normalMap: reflectionMap, flatOffset: new Vector2(-0.0025f, 0.07f), offsetScale: 0.04f, tintColor: tintColor, restartSpriteBatch: false, sourceRect: sourceRect); - ReflectionTarget.isDrawReflectablesThisFrame = true; + BackgroundReflectionSystem.DrawReflection(spriteBatch, screenPos, normalMap: reflectionMap, flatOffset: new Vector2(-0.0025f, 0.07f), offsetScale: 0.04f, tintColor: tintColor, restartSpriteBatch: false, sourceRect: sourceRect); + BackgroundReflectionSystem.isDrawReflectablesThisFrame = true; } public virtual void ScrollDraw(SpriteBatch sb) //im lazy @@ -396,12 +396,6 @@ public override void MainDraw(SpriteBatch sb) Core.Systems.LightingSystem.LightingBufferRenderer.DrawWithLighting(tex3, target2, source2, Color.White); Core.Systems.LightingSystem.LightingBufferRenderer.DrawWithLighting(tex2, target.TopLeft() + new Vector2(64, -78), tex2.Bounds, Color.White); - if (Holidays.AnySpecialEvent)//1 in 32 or any special date event - { - Texture2D egg = Assets.Bosses.VitricBoss.VitricRightEasterEgg.Value; - Core.Systems.LightingSystem.LightingBufferRenderer.DrawWithLighting(egg, target, source, Color.White); - } - sb.End(); sb.Begin(SpriteSortMode.Immediate, BlendState.Additive, SamplerState.LinearClamp, default, Main.Rasterizer, default, Main.GameViewMatrix.TransformationMatrix); @@ -441,13 +435,6 @@ public override void ScrollDraw(SpriteBatch sb) sb.End(); sb.Begin(default, default, SamplerState.PointClamp, default, Main.Rasterizer, default, Main.GameViewMatrix.TransformationMatrix); - - if (Holidays.AnySpecialEvent)//1 in 32 or any special date event - { - Texture2D egg = Assets.Bosses.VitricBoss.VitricRightEasterEgg.Value; - Core.Systems.LightingSystem.LightingBufferRenderer.DrawWithLighting(egg, target1, source1, Color.White); - Core.Systems.LightingSystem.LightingBufferRenderer.DrawWithLighting(egg, target2, source2, Color.White); - } } protected override int PlatformCount => 7; diff --git a/Content/CustomHooks/Audio.CustomInventorySounds.cs b/Content/CustomHooks/Audio.CustomInventorySounds.cs deleted file mode 100644 index 86d51f1fc..000000000 --- a/Content/CustomHooks/Audio.CustomInventorySounds.cs +++ /dev/null @@ -1,116 +0,0 @@ -namespace StarlightRiver.Content.CustomHooks -{ - class CustomInventorySounds : HookGroup - { - //gonna break if anyone else touches playSound - - public override void Load() - { - //TODO: Reimplement - //IL.Terraria.UI.ItemSlot.LeftClick_ItemArray_int_int += PlayCustomSound; - } - - /* - private void PlayCustomSound(ILContext il) - { - ILCursor c = new ILCursor(il); - - while (c.TryGotoNext(n => n.MatchCall
("PlaySound"))) //swap every sound call - { - var branchTarget = il.DefineLabel(c.Next.Next); //so we can skip to after the vanilla sound call later - - c.Index -= 5; //back up 5 instructions to just under where the soundID is pushed - - c.Emit(OpCodes.Ldarg_0); //load Item array - c.Emit(OpCodes.Ldarg_2); //load index - c.Emit(OpCodes.Ldelem_Ref); //push Item ref - - c.EmitDelegate>(PlayNewSound); //play the custom sound if applicable - c.Emit(OpCodes.Br, branchTarget); //move past sound call - - //load a sound ID back onto the stack since mac / linux check both paths even if its an unconditional branch () - c.Emit(OpCodes.Ldc_I4_0); //putting a 0 but the actual value does not matter - - c.Index += 7; //so we wont keep patching the same call lol - } - } - - private SlotId PlayNewSound(int originalSoundID, Item Item) - { - AudioConfig config = GetInstance(); - - if (config.InvSounds == CustomSounds.None) - return SlotId.Invalid; - - float pitch = -0.6f; - - if (Item.IsAir) - { - Item = Main.mouseItem; - pitch += 0.6f; - } - - if (originalSoundID != 7) - pitch += 0.3f; - - //this is gross. The alternative is moving this into a GlobalItem instead. Thus its here. - if (Item.ModItem is ICustomInventorySound) - return (Item.ModItem as ICustomInventorySound).InventorySound(pitch); - - else if (config.InvSounds == CustomSounds.Specific) - return Terraria.Audio.SoundEngine.PlaySound(originalSoundID, -1, -1, 1, 1, 0); - - else if (Item.potion || Item.healMana != 0 || (Item.buffType != -1 && (Item.Name.Contains("potion") || Item.Name.Contains("Potion")))) //should probably figure a better check for this somehow? 1.4 content tags maybe? - return SoundHelper.PlayPitched("Pickups/PickupPotion", 1, 0.5f + pitch * 0.5f); - - else if (Item.type == ItemID.CopperCoin || Item.type == ItemID.SilverCoin || Item.type == ItemID.GoldCoin || Item.type == ItemID.PlatinumCoin) //coins are early since they're ammo and have damage and place tiles. - return SoundHelper.PlayPitched(SoundID.Coins, 1, 0.3f + pitch); - - else if (Item.dye > 0) //dyes - return SoundHelper.PlayPitched("Pickups/PickupPotion", 1, 0.9f + pitch * 0.25f); - - else if (Item.createTile != -1) //placables - return SoundHelper.PlayPitched("Pickups/PickupGeneric", 1, 1 + pitch); - - else if (Item.defense > 0) //armor and shields - return SoundHelper.PlayPitched("Pickups/PickupArmor", 1, 0.5f + pitch); - - else if (Item.vanity) //vanity - return SoundHelper.PlayPitched("Pickups/PickupVanity", 1, 0.5f + pitch); - - else if (Item.accessory) //non-vanity non-shield accessories - return SoundHelper.PlayPitched("Pickups/PickupAccessory", 1, 0.1f + pitch); - - else if (Item.pick > 0 || Item.axe > 0 || Item.hammer > 0) //tools - return SoundHelper.PlayPitched("Pickups/PickupTool", 1, 0.5f + pitch); - - else if (Item.damage > 0) //weapons and ammo - { - if (Item.DamageType.Type == Terraria.ModLoader.DamageClass.Melee.Type) //melee weapons - return SoundHelper.PlayPitched("Pickups/PickupMelee", 1, 0.5f + pitch); - - else if (Item.useAmmo == ItemID.MusketBall) //guns - return SoundHelper.PlayPitched("Pickups/PickupGun", 1, 0 + pitch); - - else if (Item.DamageType.Type == Terraria.ModLoader.DamageClass.Ranged.Type) //other ranged weapons - return SoundHelper.PlayPitched("Pickups/PickupGeneric", 1, 0.9f + pitch * 0.5f); - - else if (Item.DamageType.Type == Terraria.ModLoader.DamageClass.Magic.Type || Item.DamageType.Type == Terraria.ModLoader.DamageClass.Summon.Type) //magic and summoning weapons - return SoundHelper.PlayPitched("Pickups/PickupGeneric", 1, 0.5f + pitch); - - else if (Item.ammo == ItemID.WoodenArrow) //arrows - return SoundHelper.PlayPitched("Pickups/PickupGeneric", 1, 0.5f + pitch); - - else if (Item.ammo > 0) //other ammo - return SoundHelper.PlayPitched("Pickups/PickupGeneric", 1, 0.5f + pitch); - - else //edge cases - return SoundHelper.PlayPitched("Pickups/PickupGeneric", 1, 0.5f + pitch); - } - - else - return Terraria.Audio.SoundEngine.PlaySound(originalSoundID, -1, -1, 1, 1, 0); - } - */ - } -} \ No newline at end of file diff --git a/Content/CustomHooks/Content.AstralMeteor.cs b/Content/CustomHooks/Content.AstralMeteor.cs deleted file mode 100644 index 09f6c0197..000000000 --- a/Content/CustomHooks/Content.AstralMeteor.cs +++ /dev/null @@ -1,130 +0,0 @@ -using StarlightRiver.Core.Systems.CameraSystem; -using System; -using System.Linq; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader.IO; - -namespace StarlightRiver.Content.CustomHooks -{ - class AstralMeteor : ModSystem - { - public bool moonstoneForced; - public bool meteorForced; - - //Swaps the vanilla meteor events out, could create conflicts if other mods attempt the same but shouldnt be anything fatal - public override void Load() - { - On_WorldGen.meteor += AluminumMeteor; - } - - public override void SaveWorldData(TagCompound tag) - { - tag.Add("moonstoneForced", moonstoneForced); - tag.Add("meteorForced", meteorForced); - } - - public override void LoadWorldData(TagCompound tag) - { - moonstoneForced = tag.GetBool("moonstoneForced"); - meteorForced = tag.GetBool("meteorForced"); - } - - private bool ShouldBeMoonstone() - { - if (moonstoneForced) - { - moonstoneForced = false; - return true; - } - - if (meteorForced) - { - meteorForced = false; - return false; - } - - return Main.rand.NextBool(); - } - - private bool AluminumMeteor(On_WorldGen.orig_meteor orig, int i, int j, bool ignorePlayers) - { - CameraSystem.shake += 80; - Terraria.Audio.SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode); - - if (ShouldBeMoonstone()) - { - var target = new Point16(); - - while (!CheckAroundMeteor(target)) - { - int x = Main.rand.Next(Main.maxTilesX); - - for (int y = 0; y < Main.maxTilesY; y++) - { - if (Framing.GetTileSafely(x, y).HasTile) - { - target = new Point16(x, y - 20); - break; - } - } - } - - for (int x = -10; x < 10; x++) - { - for (int y = -30; y < 30; y++) - { - if (Math.Abs(x) < 10 - Math.Abs(y) / 3 + StarlightWorld.genNoise.GetPerlin(x * 4, y * 4) * 8) - WorldGen.PlaceTile(target.X + x, target.Y + y, ModContent.TileType(), true, true); - } - } - - for (int x = -15; x < 15; x++) - { - for (int y = 0; y < 40; y++) - { - if (Math.Abs(x) < 10 - Math.Abs(y) / 3 + StarlightWorld.genNoise.GetPerlin(x * 4, y * 4) * 8) - WorldGen.PlaceTile(target.X + x, target.Y + y, ModContent.TileType(), true, true); - } - } - - Terraria.Chat.ChatHelper.BroadcastChatMessage(NetworkText.FromLiteral("A shard of the moon has landed!"), new Color(107, 233, 231)); - - if (Main.netMode == NetmodeID.Server) - NetMessage.SendTileSquare(Main.myPlayer, target.X - 30, target.Y - 30, 60, 70, TileChangeType.None); - - return true; - } - else - { - return orig(i, j, ignorePlayers); - } - } - - private bool CheckAroundMeteor(Point16 test) - { - if (test == Point16.Zero) - return false; - - for (int x = -35; x < 35; x++) - { - for (int y = -35; y < 35; y++) - { - if (WorldGen.InWorld(test.X + x, test.Y + y)) - { - Tile tile = Framing.GetTileSafely(test + new Point16(x, y)); - - if (tile.TileType == TileID.Containers || tile.TileType == TileID.Containers2) - return false; - } - } - } - - if (Main.npc.Any(n => n.active && n.friendly && Vector2.Distance(n.Center, test.ToVector2() * 16) <= 35 * 16)) - return false; - else - return true; - } - } -} \ No newline at end of file diff --git a/Content/CustomHooks/Content.PrehardmodeWarning.cs b/Content/CustomHooks/Content.PrehardmodeWarning.cs deleted file mode 100644 index 4442aa70d..000000000 --- a/Content/CustomHooks/Content.PrehardmodeWarning.cs +++ /dev/null @@ -1,19 +0,0 @@ -using StarlightRiver.Content.GUI; -using StarlightRiver.Core.Loaders.UILoading; - -namespace StarlightRiver.Content.CustomHooks -{ - class PrehardmodeWarning : HookGroup - { - public override void Load() - { - On_WorldGen.StartHardmode += WorldGen_StartHardmode; - } - - private void WorldGen_StartHardmode(On_WorldGen.orig_StartHardmode orig) - { - orig(); - UILoader.GetUIState().Display("Thank you for playing!", "You've reached the current end of Starlight River. Hardmode content is planned and under development, follow us on social media for spoilers and future updates."); - } - } -} \ No newline at end of file diff --git a/Content/CustomHooks/Content.RelicItems.cs b/Content/CustomHooks/Content.RelicItems.cs index a5d010db7..53172ca1a 100644 --- a/Content/CustomHooks/Content.RelicItems.cs +++ b/Content/CustomHooks/Content.RelicItems.cs @@ -6,7 +6,7 @@ namespace StarlightRiver.Content.CustomHooks { - class RelicItems : HookGroup + class RelicItems : ModSystem { //gonna be really weird if anything does anything else here I think public override void Load() diff --git a/Content/CustomHooks/HookGroup.cs b/Content/CustomHooks/HookGroup.cs deleted file mode 100644 index bf5cd1c1e..000000000 --- a/Content/CustomHooks/HookGroup.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace StarlightRiver.Content.CustomHooks -{ - public class HookGroup : IOrderedLoadable - { - public virtual float Priority => 1f; - - public virtual void Load() { } - - public virtual void Unload() { } - } -} \ No newline at end of file diff --git a/Content/CustomHooks/Mechanics.AccessorySlotControl.cs b/Content/CustomHooks/Mechanics.AccessorySlotControl.cs deleted file mode 100644 index 630fa656e..000000000 --- a/Content/CustomHooks/Mechanics.AccessorySlotControl.cs +++ /dev/null @@ -1,55 +0,0 @@ -using StarlightRiver.Content.Items.BaseTypes; -using Terraria.UI; - -namespace StarlightRiver.Content.CustomHooks -{ - public class AccessorySlotControl : HookGroup - { - //Should be a fairly stable hook in theory, but some vanilla behavior is repeated/replaced here. Could be refactored in the future, this is old code. - public override void Load() - { - On_ItemSlot.Draw_SpriteBatch_ItemArray_int_int_Vector2_Color += DrawSpecial; - } - - private void DrawSpecial(On_ItemSlot.orig_Draw_SpriteBatch_ItemArray_int_int_Vector2_Color orig, SpriteBatch sb, Item[] inv, int context, int slot, Vector2 position, Color color) - { - if (inv[slot].ModItem is CursedAccessory && context == 10) - { - Texture2D back = Assets.GUI.CursedBack.Value; - Color backcolor = (!Main.expertMode && slot == 8) ? Color.White * 0.25f : Color.White * 0.75f; - - sb.Draw(back, position, null, backcolor, 0f, default, Main.inventoryScale, SpriteEffects.None, 0f); - RedrawItem(sb, inv, position, slot, color); - } - else - { - orig(sb, inv, context, slot, position, color); - } - } - - //this is vanilla code. Only reasonable alternative is likely porting all drawing to IL. - internal static void RedrawItem(SpriteBatch sb, Item[] inv, Vector2 position, int slot, Color color) - { - Item item = inv[slot]; - Vector2 scaleVector = Vector2.One * 52 * Main.inventoryScale; - Texture2D popupTex = Terraria.GameContent.TextureAssets.Item[item.type].Value; - Rectangle source = popupTex.Frame(1, 1, 0, 0); - Color currentColor = color; - float scaleFactor2 = 1f; - ItemSlot.GetItemLight(ref currentColor, ref scaleFactor2, item, false); - float scaleFactor = 1f; - - if (source.Width > 32 || source.Height > 32) - scaleFactor = (source.Width <= source.Height) ? (32f / source.Height) : (32f / source.Width); - - scaleFactor *= Main.inventoryScale; - Vector2 drawPos = position + scaleVector / 2f - source.Size() * scaleFactor / 2f; - Vector2 origin = source.Size() * (scaleFactor2 / 2f - 0.5f); - - if (ItemLoader.PreDrawInInventory(item, sb, drawPos, source, item.GetAlpha(currentColor), item.GetColor(color), origin, scaleFactor * scaleFactor2)) - sb.Draw(popupTex, drawPos, source, Color.White, 0f, origin, scaleFactor * scaleFactor2, SpriteEffects.None, 0f); - - ItemLoader.PostDrawInInventory(item, sb, drawPos, source, item.GetAlpha(currentColor), item.GetColor(color), origin, scaleFactor * scaleFactor2); - } - } -} \ No newline at end of file diff --git a/Content/CustomHooks/Mechanics.ArenaBlockerForcer.cs b/Content/CustomHooks/Mechanics.ArenaBlockerForcer.cs deleted file mode 100644 index 60c92ac5a..000000000 --- a/Content/CustomHooks/Mechanics.ArenaBlockerForcer.cs +++ /dev/null @@ -1,46 +0,0 @@ -using StarlightRiver.Content.Bosses.SquidBoss; -using static Terraria.ModLoader.ModContent; - -namespace StarlightRiver.Content.CustomHooks -{ - class ArenaBlockerForcer : HookGroup - { - public override void Load() - { - On_Player.Update_NPCCollision += ForceColliding; - } - - // for the most part vanilla - private void ForceColliding(On_Player.orig_Update_NPCCollision orig, Player self) - { - var rectangle = new Rectangle((int)self.position.X, (int)self.position.Y, self.width, self.height); - - for (int i = 0; i < 200; i++) - { - if (!Main.npc[i].active || Main.npc[i].friendly || Main.npc[i].damage <= 0) - continue; - - NPC NPC = Main.npc[i]; - int type = NPC.type; - var NPCRect = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); - int specialHit = -1; - float damageMultipler = 1; - - NPC.GetMeleeCollisionData(rectangle, i, ref specialHit, ref damageMultipler, ref NPCRect); - - if (rectangle.Intersects(NPCRect) && type == NPCType() && NPCLoader.CanHitPlayer(NPC, self, ref specialHit)) - { - var hit = new Player.HurtInfo() { Damage = NPC.damage }; - NPCLoader.OnHitPlayer(NPC, self, hit); - - var hit2 = new Player.HurtModifiers(); - NPCLoader.ModifyHitPlayer(NPC, self, ref hit2); - - return; - } - } - - orig(self); - } - } -} \ No newline at end of file diff --git a/Content/CustomHooks/Mechanics.MouseSlotUseableInator.cs b/Content/CustomHooks/Mechanics.MouseSlotUseableInator.cs deleted file mode 100644 index c90bf66ae..000000000 --- a/Content/CustomHooks/Mechanics.MouseSlotUseableInator.cs +++ /dev/null @@ -1,79 +0,0 @@ -using Mono.Cecil.Cil; -using MonoMod.Cil; -using System; - -namespace StarlightRiver.Content.CustomHooks -{ - class MouseSlotUsableInator : HookGroup - { - public override void Load() - { - On_Player.dropItemCheck += DontDropCoolStuff; - Terraria.UI.On_ItemSlot.LeftClick_ItemArray_int_int += LockMouseToSpecialItem; - Terraria.UI.On_ItemSlot.Draw_SpriteBatch_ItemArray_int_int_Vector2_Color += DrawSpecial; - - //IL_Player.ScrollHotbar += AllowBigScrolling; disabled since it appears to do nothing currently and breaks auto-select - //IL_Player.Update += AllowBigHotkeying; PORTTODO: Fix IL, never mind this is unused for now. fix later if we actually use it! - } - - private void DrawSpecial(Terraria.UI.On_ItemSlot.orig_Draw_SpriteBatch_ItemArray_int_int_Vector2_Color orig, SpriteBatch sb, Item[] inv, int context, int slot, Vector2 position, Color color) - { - if (inv[slot].ModItem is InworldItem && !(inv[slot].ModItem as InworldItem).VisibleInUI) - return; - - if (inv[slot].ModItem is InworldItem && context == 13) - { - Texture2D back = Assets.GUI.TempBack.Value; - var source = new Rectangle(0, 52 * (int)(Main.GameUpdateCount / 4 % 4), 52, 52); - - sb.Draw(back, position, source, Color.White, 0f, default, Main.inventoryScale, SpriteEffects.None, 0f); - //AccessorySlotControl.RedrawItem(sb, inv, position, slot, color); bandaid fix - } - - else - { - orig(sb, inv, context, slot, position, color); - } - } - - private void AllowBigHotkeying(ILContext il) - { - var c = new ILCursor(il); - c.TryGotoNext(n => n.MatchStloc(29), n => n.MatchLdcI4(0), n => n.MatchStloc(30), n => n.MatchLdsfld
("drawingPlayerChat")); - c.Index += 9; - - ILLabel label = il.DefineLabel(c.Next); - - c.Index -= 4; - c.EmitDelegate>(ShouldAllowHotkey); - c.Emit(OpCodes.Brtrue, label); - } - - private bool ShouldAllowHotkey() - { - return Main.mouseItem.ModItem is InworldItem; - } - - private void AllowBigScrolling(ILContext il) - { - var c = new ILCursor(il); - c.TryGotoNext(n => n.MatchLdcI4(10)); - c.Index++; - - c.Emit(OpCodes.Pop); - c.Emit(OpCodes.Ldc_I4, 60); - } - - private void LockMouseToSpecialItem(Terraria.UI.On_ItemSlot.orig_LeftClick_ItemArray_int_int orig, Item[] inv, int context, int slot) - { - if (!(Main.mouseItem.ModItem is Core.InworldItem && !Main.mouseItem.IsAir)) - orig(inv, context, slot); - } - - private void DontDropCoolStuff(On_Player.orig_dropItemCheck orig, Terraria.Player self) - { - if (!(Main.mouseItem.ModItem is Core.InworldItem && !Main.mouseItem.IsAir)) - orig(self); - } - } -} \ No newline at end of file diff --git a/Content/CustomHooks/Mechanics.NoBuild.cs b/Content/CustomHooks/Mechanics.NoBuild.cs deleted file mode 100644 index 0f372338b..000000000 --- a/Content/CustomHooks/Mechanics.NoBuild.cs +++ /dev/null @@ -1,476 +0,0 @@ -using StarlightRiver.Content.Bosses.SquidBoss; -using StarlightRiver.Content.Tiles.Permafrost; -using StarlightRiver.Core.Systems.BossRushSystem; -using System.Collections.Generic; -using System.IO; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader.IO; -using static Terraria.ModLoader.ModContent; - -namespace StarlightRiver.Content.CustomHooks -{ - class ProtectionGlobalTime : GlobalTile - { - public override bool CanExplode(int i, int j, int type) - { - if (IsProtected(i, j)) - return false; - - return base.CanExplode(i, j, type); - } - - public bool IsProtected(int x, int y) //TODO: move this to an easily accessible class later (not a fucking global item) - { - if (StarlightRiver.debugMode) - return false; - - if (!Main.gameMenu || Main.dedServ) //shouldnt trigger while generating the world from the menu - { - foreach (Rectangle region in ProtectionWorld.ProtectedRegions) - { - if (region.Contains(new Point(x, y))) - return true; - } - - foreach (Ref region in ProtectionWorld.RuntimeProtectedRegions) - { - if (region.Value.Contains(new Point(x, y))) - return true; - } - - Tile tile = Framing.GetTileSafely(x, y); - - // Let the player break their own tombstones atleast. - if (tile.TileType == TileID.Tombstones) - return false; - - if (tile.WallType == WallType()) - return true; - - if (tile.WallType == WallType()) - { - for (int k = 0; k < Main.maxProjectiles; k++) //this is gross. Unfortunate. - { - Projectile proj = Main.projectile[k]; - - if (proj.active && proj.timeLeft > 10 && proj.ModProjectile is InteractiveProjectile && (proj.ModProjectile as InteractiveProjectile).CheckPoint(x, y)) - return false; - } - - return true; - } - } - - if (BossRushSystem.isBossRush) - return true; - - return false; - } - } - - public class ProtectionGlobalItem : GlobalItem - { - public static List blacklist = [ItemID.WaterBucket, - ItemID.LavaBucket, - ItemID.HoneyBucket, - ItemID.BottomlessBucket, - ItemID.Wrench, - ItemID.BlueWrench, - ItemID.GreenWrench, - ItemID.YellowWrench, - ItemID.MulticolorWrench, - ItemID.ActuationRod, - ItemID.Actuator, - ItemID.WireKite, - ItemID.WireCutter, - ItemID.WireBulb, - ItemID.Paintbrush, - ItemID.PaintRoller, - ItemID.PaintScraper, - ItemID.SpectrePaintbrush, - ItemID.SpectrePaintRoller, - ItemID.SpectrePaintScraper - ]; - - public static List whitelist = [ItemID.AcornAxe]; - - public override void Load() - { - On_Player.PickTile += DontPickInZone; - On_Player.PickWall += DontPickWallInZone; - On_WorldGen.PlaceTile += DontManuallyPlaceInZone; - On_WorldGen.PoundTile += DontPoundTile; - On_WorldGen.PlaceWire += DontPlaceWire; - On_WorldGen.PlaceWire2 += DontPlaceWire2; - On_WorldGen.PlaceWire3 += DontPlaceWire3; - On_WorldGen.PlaceWire4 += DontPlaceWire4; - On_WorldGen.PlaceActuator += DontPlaceActuator; - On_WorldGen.KillTile += DontExplodeAtRuntime; - On_Player.CheckForGoodTeleportationSpot += DontTeleport; - } - - /// - /// Returns true if a protected region contains given coordinates - /// - /// - /// - /// - public bool IsProtected(int x, int y) - { - if (StarlightRiver.debugMode) - return false; - - if (!Main.gameMenu || Main.dedServ) //shouldnt trigger while generating the world from the menu - { - foreach (Rectangle region in ProtectionWorld.ProtectedRegions) - { - if (region.Contains(new Point(x, y))) - return true; - } - - foreach (Ref region in ProtectionWorld.RuntimeProtectedRegions) - { - if (region.Value.Contains(new Point(x, y))) - return true; - } - - Tile tile = Framing.GetTileSafely(x, y); - - // Let the player break their own tombstones atleast. - if (tile.TileType == TileID.Tombstones) - return false; - - if (tile.WallType == WallType()) - return true; - - if (tile.WallType == WallType()) - { - for (int k = 0; k < Main.maxProjectiles; k++) //this is gross. Unfortunate. - { - Projectile proj = Main.projectile[k]; - - if (proj.active && proj.timeLeft > 10 && proj.ModProjectile is InteractiveProjectile && (proj.ModProjectile as InteractiveProjectile).CheckPoint(x, y)) - return false; - } - - return true; - } - } - - if (BossRushSystem.isBossRush) - return true; - - return false; - } - - private bool DontPoundTile(On_WorldGen.orig_PoundTile orig, int x, int y) - { - if (IsProtected(x, y)) - { - FailFX(new Point16(x, y)); - return false; - } - - return orig(x, y); - } - - private bool DontPlaceWire(On_WorldGen.orig_PlaceWire orig, int x, int y) - { - if (IsProtected(x, y)) - { - FailFX(new Point16(x, y)); - return false; - } - - return orig(x, y); - } - - private bool DontPlaceWire2(On_WorldGen.orig_PlaceWire2 orig, int x, int y) - { - if (IsProtected(x, y)) - { - FailFX(new Point16(x, y)); - return false; - } - - return orig(x, y); - } - - private bool DontPlaceWire3(On_WorldGen.orig_PlaceWire3 orig, int x, int y) - { - if (IsProtected(x, y)) - { - FailFX(new Point16(x, y)); - return false; - } - - return orig(x, y); - } - - private bool DontPlaceWire4(On_WorldGen.orig_PlaceWire4 orig, int x, int y) - { - if (IsProtected(x, y)) - { - FailFX(new Point16(x, y)); - return false; - } - - return orig(x, y); - } - - private bool DontPlaceActuator(On_WorldGen.orig_PlaceActuator orig, int x, int y) - { - if (IsProtected(x, y)) - { - FailFX(new Point16(x, y)); - return false; - } - - return orig(x, y); - } - - private void DontPickWallInZone(On_Player.orig_PickWall orig, Player self, int x, int y, int damage) - { - if (IsProtected(x, y)) - { - FailFX(new Point16(x, y)); - return; - } - - orig(self, x, y, damage); - } - - private void DontPickInZone(On_Player.orig_PickTile orig, Player self, int x, int y, int pickPower) - { - if (IsProtected(x, y)) - { - FailFX(new Point16(x, y)); - return; - } - - orig(self, x, y, pickPower); - } - - private bool DontManuallyPlaceInZone(On_WorldGen.orig_PlaceTile orig, int i, int j, int type, bool mute, bool forced, int plr, int style) - { - if (IsProtected(i, j)) - { - FailFX(new Point16(i, j)); - return false; - } - - return orig(i, j, type, mute, forced, plr, style); - } - - private void DontExplodeAtRuntime(On_WorldGen.orig_KillTile orig, int i, int j, bool fail, bool effectOnly, bool noItem) - { - if (IsProtected(i, j) && !WorldGen.generatingWorld) - { - // Disabling for now since this breaks dashables... we will need a better fix for bombs only later. - //FailFX(new Point16(i, j)); - //return; - } - - orig(i, j, fail, effectOnly, noItem); - } - - private Vector2 DontTeleport(On_Player.orig_CheckForGoodTeleportationSpot orig, Player self, ref bool canSpawn, int teleportStartX, int teleportRangeX, int teleportStartY, int teleportRangeY, Player.RandomTeleportationAttemptSettings settings) - { - Vector2 result = orig(self, ref canSpawn, teleportStartX, teleportRangeX, teleportStartY, teleportRangeY, settings); - - // If invalid spot, recurse untill a valid one is found - if (IsProtected((int)result.X, (int)result.Y)) - { - settings.attemptsBeforeGivingUp--; - result = self.CheckForGoodTeleportationSpot(ref canSpawn, teleportStartX, teleportRangeX, teleportStartY, teleportRangeY, settings); - } - - return result; - } - - public override bool CanUseItem(Item Item, Player player) - { - if (player != Main.LocalPlayer) - return base.CanUseItem(Item, player); - - if (whitelist.Contains(Item.type)) - return base.CanUseItem(Item, player); - - if (Item.createTile != -1 || Item.createWall != -1 || blacklist.Contains(Item.type)) - { - Point16 targetPoint = Main.SmartCursorIsUsed ? new Point16(Main.SmartCursorX, Main.SmartCursorY) : new Point16(Player.tileTargetX, Player.tileTargetY); - - if (IsProtected(targetPoint.X, targetPoint.Y)) - { - player.AddBuff(BuffID.Cursed, 10, false); - FailFX(targetPoint); - return false; - } - } - - return base.CanUseItem(Item, player); - } - - private void FailFX(Point16 pos) - { - Terraria.Audio.SoundEngine.PlaySound(SoundID.DD2_LightningBugZap, pos.ToVector2() * 16); - - for (int k = 0; k < 10; k++) - Dust.NewDust(pos.ToVector2() * 16, 16, 16, DustType(), 0, 0, 0, Color.Red, 0.2f); - } - } - - public class ProtectionGlobalProjectile : GlobalProjectile //gravestones shouldnt do terrible things - { - public override bool AppliesToEntity(Projectile entity, bool lateInstantiation) - { - return entity.aiStyle == ProjAIStyleID.GraveMarker; - } - - public override void PostAI(Projectile Projectile) - { - - foreach (Rectangle region in ProtectionWorld.ProtectedRegions) - { - if (region.Contains(new Point((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16))) - { - Projectile.active = false; - } - } - - foreach (Ref region in ProtectionWorld.RuntimeProtectedRegions) - { - if (region.Value.Contains(new Point((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16))) - { - Projectile.active = false; - } - } - } - } - - public class ProtectionWorld : ModSystem - { - public static List ProtectedRegions = []; - - private static readonly Dictionary> RuntimeRegionsByPoint = []; - public static readonly List> RuntimeProtectedRegions = []; - - public override void PostDrawTiles() - { - if (!StarlightRiver.debugMode) - return; - - Main.spriteBatch.Begin(default, default, SamplerState.PointWrap, default, Main.Rasterizer, default, Main.GameViewMatrix.TransformationMatrix); - - foreach (Rectangle rect in ProtectedRegions) - { - Texture2D tex = Assets.MagicPixel.Value; - var target = new Rectangle(rect.X * 16 - (int)Main.screenPosition.X, rect.Y * 16 - (int)Main.screenPosition.Y, rect.Width * 16, rect.Height * 16); - Main.spriteBatch.Draw(tex, target, Color.Red * 0.25f); - } - - foreach (Ref rectRef in RuntimeProtectedRegions) - { - Rectangle rect = rectRef.Value; - Texture2D tex = Assets.MagicPixel.Value; - var target = new Rectangle(rect.X * 16 - (int)Main.screenPosition.X, rect.Y * 16 - (int)Main.screenPosition.Y, rect.Width * 16, rect.Height * 16); - Main.spriteBatch.Draw(tex, target, Color.Blue * 0.25f); - } - - Main.spriteBatch.End(); - } - - public override void PreWorldGen() - { - ProtectedRegions.Clear(); - RuntimeProtectedRegions.Clear(); - RuntimeRegionsByPoint.Clear(); - } - - public override void LoadWorldData(TagCompound tag) - { - ProtectedRegions.Clear(); - RuntimeProtectedRegions.Clear(); - RuntimeRegionsByPoint.Clear(); - - int length = tag.GetInt("RegionCount"); - - for (int k = 0; k < length; k++) - { - ProtectedRegions.Add(new Rectangle - ( - tag.GetInt("x" + k), - tag.GetInt("y" + k), - tag.GetInt("w" + k), - tag.GetInt("h" + k) - )); - } - } - - public override void SaveWorldData(TagCompound tag) - { - tag["RegionCount"] = ProtectedRegions.Count; - - for (int k = 0; k < ProtectedRegions.Count; k++) - { - Rectangle region = ProtectedRegions[k]; - tag.Add("x" + k, region.X); - tag.Add("y" + k, region.Y); - tag.Add("w" + k, region.Width); - tag.Add("h" + k, region.Height); - } - } - - public override void NetSend(BinaryWriter writer) - { - writer.Write(ProtectedRegions.Count); - - for (int i = 0; i < ProtectedRegions.Count; i++) - { - Rectangle region = ProtectedRegions[i]; - writer.Write(region.X); - writer.Write(region.Y); - writer.Write(region.Width); - writer.Write(region.Height); - } - } - - public override void NetReceive(BinaryReader reader) - { - ProtectedRegions.Clear(); - - int numRegions = reader.ReadInt32(); - - for (int i = 0; i < numRegions; i++) - { - ProtectedRegions.Add(new Rectangle - { - X = reader.ReadInt32(), - Y = reader.ReadInt32(), - Width = reader.ReadInt32(), - Height = reader.ReadInt32() - }); - } - } - - public static void AddRegionBySource(Point16 source, Rectangle region) - { - if (!RuntimeRegionsByPoint.ContainsKey(source)) - { - var refRect = new Ref(region); - RuntimeRegionsByPoint.Add(source, refRect); - RuntimeProtectedRegions.Add(refRect); - } - } - - public static void RemoveRegionBySource(Point16 source) - { - if (RuntimeRegionsByPoint.TryGetValue(source, out Ref refRect)) - { - RuntimeProtectedRegions.Remove(refRect); - RuntimeRegionsByPoint.Remove(source); - } - } - } -} \ No newline at end of file diff --git a/Content/CustomHooks/Visuals.CharacterSelectAddons.cs b/Content/CustomHooks/Visuals.CharacterSelectAddons.cs index 189348627..0ec64156b 100644 --- a/Content/CustomHooks/Visuals.CharacterSelectAddons.cs +++ b/Content/CustomHooks/Visuals.CharacterSelectAddons.cs @@ -9,11 +9,10 @@ namespace StarlightRiver.Content.CustomHooks { - class CharacterSelectAddons : HookGroup + class CharacterSelectAddons : ModSystem { public static ParticleSystem sparkles; - //Relies on other mods not doing anything visual here to work properly, but there is very little actual danger here, its just some extra draw calls in the UI element. public override void Load() { if (Main.dedServ) @@ -27,7 +26,7 @@ public override void Load() public override void Unload() { - sparkles ??= null; + sparkles = null; } private static void updateSparkles(Particle particle) diff --git a/Content/CustomHooks/Visuals.DrawLayers.cs b/Content/CustomHooks/Visuals.DrawLayers.cs deleted file mode 100644 index 61bb6e88f..000000000 --- a/Content/CustomHooks/Visuals.DrawLayers.cs +++ /dev/null @@ -1,28 +0,0 @@ -namespace StarlightRiver.Content.CustomHooks -{ - class DrawLayers : HookGroup - { - //A few different hooks for drawing on certain layers. Orig is always run and its just draw calls. - public override void Load() - { - if (Main.dedServ) - return; - - Terraria.DataStructures.On_PlayerDrawLayers.DrawPlayer_RenderAllLayers += PostDrawPlayerLayer; - } - - private void PostDrawPlayerLayer(Terraria.DataStructures.On_PlayerDrawLayers.orig_DrawPlayer_RenderAllLayers orig, ref Terraria.DataStructures.PlayerDrawSet drawinfo) - { - Player drawPlayer = drawinfo.drawPlayer; - float shadow = drawinfo.shadow; - - if (!Main.gameMenu && shadow == 0) - drawPlayer.GetModPlayer().PreDraw(drawPlayer, Main.spriteBatch); - - orig(ref drawinfo); - - if (!Main.gameMenu && shadow == 0) - drawPlayer.GetModPlayer().PostDraw(drawPlayer, Main.spriteBatch); - } - } -} \ No newline at end of file diff --git a/Content/CustomHooks/Visuals.DrawUnderCathedralWater.cs b/Content/CustomHooks/Visuals.DrawUnderCathedralWater.cs deleted file mode 100644 index df34649ad..000000000 --- a/Content/CustomHooks/Visuals.DrawUnderCathedralWater.cs +++ /dev/null @@ -1,81 +0,0 @@ -using MonoMod.Cil; -using StarlightRiver.Content.Biomes; -using StarlightRiver.Content.Bosses.SquidBoss; -using StarlightRiver.Content.Configs; -using StarlightRiver.Content.NPCs.BaseTypes; -using System.Collections.Generic; -using System.Linq; - -namespace StarlightRiver.Content.CustomHooks -{ - class DrawUnderCathedralWater : HookGroup - { - //Rare method to hook but not the best finding logic, but its really just some draws so nothing should go terribly wrong. - public override void Load() - { - if (Main.dedServ) - return; - - IL_Main.DoDraw_WallsTilesNPCs += DrawWater; - } - - public override void Unload() - { - IL_Main.DoDraw_WallsTilesNPCs -= DrawWater; - } - - private void DrawWater(ILContext il) - { - var c = new ILCursor(il); - c.TryGotoNext(n => n.MatchLdfld
("DrawCacheNPCsBehindNonSolidTiles")); - //c.Index--; - - c.EmitDelegate(DrawWater); - } - - private delegate void DrawWaterDelegate(); - - public static void DrawWater() - { - if (!Main.LocalPlayer.InModBiome()) - return; - - Main.spriteBatch.End(); - Main.spriteBatch.Begin(default, default, SamplerState.PointClamp, default, Main.Rasterizer, default, Main.GameViewMatrix.TransformationMatrix); - - NPC npc = ArenaActor.latestActor?.NPC; - - if (npc != null && npc.active) - { - if (ReflectionTarget.canUseTarget || !ModContent.GetInstance().ReflectionConfig.ReflectionsOn) - (npc.ModNPC as ArenaActor).DrawBigWindow(Main.spriteBatch); - - int boss = -1; - var drawCache = new List(); - - for (int k = 0; k < Main.maxNPCs; k++) //draw NPCs and find boss - { - NPC NPC2 = Main.npc[k]; - - if (NPC2.active && NPC2.ModNPC is IUnderwater) - { - if (NPC2.type == ModContent.NPCType()) - boss = k; - else - drawCache.Add(NPC2); - } - } - - drawCache.ForEach(n => (n.ModNPC as IUnderwater).DrawUnderWater(Main.spriteBatch, 0)); - - foreach (Projectile proj in Main.projectile.Where(n => n.active && n.ModProjectile is IUnderwater)) //draw all Projectiles - (proj.ModProjectile as IUnderwater).DrawUnderWater(Main.spriteBatch, 0); - - if (boss != -1 && Main.npc[boss].ModNPC is IUnderwater) - (Main.npc[boss].ModNPC as IUnderwater).DrawUnderWater(Main.spriteBatch, 0); //draw boss ontop if extant - - drawCache.ForEach(n => (n.ModNPC as IUnderwater).DrawUnderWater(Main.spriteBatch, 1)); //draw layer for NPCs over bosses, used for the front part of tentacles - } - } - } -} \ No newline at end of file diff --git a/Content/CustomHooks/Visuals.InventoryParticleDrawing.cs b/Content/CustomHooks/Visuals.InventoryParticleDrawing.cs deleted file mode 100644 index 0e2d53ea1..000000000 --- a/Content/CustomHooks/Visuals.InventoryParticleDrawing.cs +++ /dev/null @@ -1,24 +0,0 @@ -using StarlightRiver.Content.Items.BaseTypes; -using StarlightRiver.Core.Loaders; - -namespace StarlightRiver.Content.CustomHooks -{ - class InventoryParticleDrawing : HookGroup - { - //Just drawing some ParticleSystems over the inventory UI. Nothing bad. - public override void Load() - { - if (Main.dedServ) - return; - - On_Main.DrawInterface_27_Inventory += DrawInventoryParticles; - } - - private void DrawInventoryParticles(On_Main.orig_DrawInterface_27_Inventory orig, Main self) - { - orig(self); - CursedAccessoryParticleManager.CursedSystem.DrawParticles(Main.spriteBatch); - CursedAccessoryParticleManager.ShardsSystem.DrawParticles(Main.spriteBatch); - } - } -} \ No newline at end of file diff --git a/Content/CustomHooks/Visuals.PlayerLayerManipulation.cs b/Content/CustomHooks/Visuals.PlayerLayerManipulation.cs index 9178df62a..d9b084193 100644 --- a/Content/CustomHooks/Visuals.PlayerLayerManipulation.cs +++ b/Content/CustomHooks/Visuals.PlayerLayerManipulation.cs @@ -3,7 +3,7 @@ namespace StarlightRiver.Content.CustomHooks { - class PlayerLayerManipulation : HookGroup + class PlayerLayerManipulation : ModSystem { //Swaps out some variables on PlayerLayer drawData for certain effects like the pancake and spinning. //This might look weird if other mods do strange PlayerLayer stuff but it shouldnt have consquences outside of visuals. The actual patch is a bit iffy rn tho, come fix this later. diff --git a/Content/CustomHooks/Visuals.PrimitiveDrawing.cs b/Content/CustomHooks/Visuals.PrimitiveDrawing.cs index 7b80fd167..cb0d86dfc 100644 --- a/Content/CustomHooks/Visuals.PrimitiveDrawing.cs +++ b/Content/CustomHooks/Visuals.PrimitiveDrawing.cs @@ -1,6 +1,6 @@ namespace StarlightRiver.Content.CustomHooks { - public class PrimitiveDrawing : HookGroup + public class PrimitiveDrawing : ModSystem { // Should not interfere with anything. public override void Load() diff --git a/Content/Foregrounds/Foregrounds.AshHellForeground.cs b/Content/Foregrounds/Foregrounds.AshHellForeground.cs index 712cab25b..ba75328e2 100644 --- a/Content/Foregrounds/Foregrounds.AshHellForeground.cs +++ b/Content/Foregrounds/Foregrounds.AshHellForeground.cs @@ -3,13 +3,15 @@ namespace StarlightRiver.Content.Foregrounds { - class AshHellForeground : ParticleForeground + class AshHellForeground : Foreground { + ParticleSystem particles; + public override bool Visible => Main.LocalPlayer.ZoneUnderworldHeight; - public override void OnLoad() + public override void Load() { - ParticleSystem = new ParticleSystem("StarlightRiver/Assets/GUI/Fire", UpdateAshParticles); + particles = new ParticleSystem("StarlightRiver/Assets/GUI/Fire", UpdateAshParticles); } private void UpdateAshParticles(Particle particle) @@ -40,11 +42,11 @@ public override void Draw(SpriteBatch spriteBatch, float opacity) { if (Main.rand.NextBool(50)) { - ParticleSystem.AddParticle(Vector2.Zero, new Vector2(Main.rand.NextFloat(1.4f, 2.6f), Main.rand.NextFloat(-1.4f, -0.8f)), 0, Main.rand.NextFloat(1, 2), Color.White, + particles.AddParticle(Vector2.Zero, new Vector2(Main.rand.NextFloat(1.4f, 2.6f), Main.rand.NextFloat(-1.4f, -0.8f)), 0, Main.rand.NextFloat(1, 2), Color.White, 1500, new Vector2((StarlightWorld.permafrostCenter + Main.rand.Next(-400, 400)) * 16, 16 * (Main.maxTilesY - 40))); } - ParticleSystem.DrawParticles(Main.spriteBatch); + particles.DrawParticles(Main.spriteBatch); } } } \ No newline at end of file diff --git a/Content/Foregrounds/Foregrounds.OvergrowForeground.cs b/Content/Foregrounds/Foregrounds.OvergrowForeground.cs index c4ff1ddfe..f59556c4a 100644 --- a/Content/Foregrounds/Foregrounds.OvergrowForeground.cs +++ b/Content/Foregrounds/Foregrounds.OvergrowForeground.cs @@ -3,12 +3,14 @@ namespace StarlightRiver.Content.Foregrounds { - class OvergrowForeground : ParticleForeground + class OvergrowForeground : Foreground { - public override void OnLoad() + ParticleSystem particles; + + public override void Load() { - ParticleSystem = new ParticleSystem("StarlightRiver/Assets/GUI/HolyBig", UpdateOvergrowWells); - } + particles = new ParticleSystem("StarlightRiver/Assets/GUI/HolyBig", UpdateOvergrowWells); + } public override bool Visible => Main.LocalPlayer.InModBiome(ModContent.GetInstance()); @@ -32,16 +34,16 @@ public override void Draw(SpriteBatch spriteBatch, float opacity) { for (int i = (int)Main.worldSurface; i < Main.maxTilesY - 200; i += 20) { - ParticleSystem.AddParticle(new Vector2(0, 0), new Vector2(0.4f, Main.rand.NextFloat(-2, -1)), 0, Main.rand.NextFloat(1.5f, 2), + particles.AddParticle(new Vector2(0, 0), new Vector2(0.4f, Main.rand.NextFloat(-2, -1)), 0, Main.rand.NextFloat(1.5f, 2), Color.White * 0.05f, 600, new Vector2(Main.dungeonX * 16 + k * 800 * direction + Main.rand.Next(30), i * 16)); - ParticleSystem.AddParticle(new Vector2(0, 0), new Vector2(0.15f, Main.rand.NextFloat(-2, -1)), 0, Main.rand.NextFloat(0.5f, 0.8f), + particles.AddParticle(new Vector2(0, 0), new Vector2(0.15f, Main.rand.NextFloat(-2, -1)), 0, Main.rand.NextFloat(0.5f, 0.8f), Color.White * 0.05f, 600, new Vector2(Main.dungeonX * 16 + k * 900 * direction + Main.rand.Next(15), i * 16)); } } } - ParticleSystem.DrawParticles(Main.spriteBatch); + particles.DrawParticles(Main.spriteBatch); } } } \ No newline at end of file diff --git a/Content/GUI/DialogUI.cs b/Content/GUI/DialogUI.cs index a7231ab38..b9d494e4a 100644 --- a/Content/GUI/DialogUI.cs +++ b/Content/GUI/DialogUI.cs @@ -7,6 +7,7 @@ using Terraria.ID; using Terraria.UI; using Terraria.UI.Chat; +using static System.Net.Mime.MediaTypeNames; using static Terraria.ModLoader.ModContent; namespace StarlightRiver.Content.GUI @@ -266,11 +267,12 @@ public static void ClearButtons() public static void AddButton(string message, Action onClick) { + var font = Terraria.GameContent.FontAssets.MouseText.Value; var add = new RichTextButton(message, onClick, new Vector2(widthOff, HeightOff)); - add.Width.Set(Markdown.GetWidth(message, 1) + 20, 0); + add.Width.Set(ChatManager.GetStringSize(font, message, Vector2.One).X + 20, 0); add.Height.Set(32, 0); - widthOff += Markdown.GetWidth(message, 1) + 30; + widthOff += ChatManager.GetStringSize(font, message, Vector2.One).X + 30; UILoader.GetUIState().Append(add); } } diff --git a/Content/Items/ArmsDealer/Weapons.DefenseSystem.cs b/Content/Items/ArmsDealer/Weapons.DefenseSystem.cs index 233576599..d5d1aeed8 100644 --- a/Content/Items/ArmsDealer/Weapons.DefenseSystem.cs +++ b/Content/Items/ArmsDealer/Weapons.DefenseSystem.cs @@ -1,4 +1,4 @@ -using StarlightRiver.Content.CustomHooks; +using StarlightRiver.Core.Systems; using System.Collections.Generic; using System.IO; using Terraria.Audio; @@ -147,7 +147,7 @@ private void DrawRadial(Player player, SpriteBatch spriteBatch) return; // Don't draw radial menu for render target - if (!PlayerTarget.canUseTarget) + if (!PlayerTargetSystem.canUseTarget) return; // Get the held instance, if it exists diff --git a/Content/Items/BarrierDye/BaseBarrierDye.cs b/Content/Items/BarrierDye/BaseBarrierDye.cs index 2a861ea52..a9fd0c028 100644 --- a/Content/Items/BarrierDye/BaseBarrierDye.cs +++ b/Content/Items/BarrierDye/BaseBarrierDye.cs @@ -58,7 +58,7 @@ public override void LoseBarrierEffects(Player Player) public override void PreDrawEffects(SpriteBatch spriteBatch, Player player) { - if (!CustomHooks.PlayerTarget.canUseTarget) + if (!PlayerTargetSystem.canUseTarget) return; BarrierPlayer barrier = player.GetModPlayer(); @@ -75,7 +75,7 @@ public override void PreDrawEffects(SpriteBatch spriteBatch, Player player) Vector2 dir = Vector2.UnitX.RotatedBy(k / 4f * 6.28f) * (3.5f + sin * 1f); Color color = new Color(100, 255, 255) * (opacity - sin * 0.1f) * 0.9f; - spriteBatch.Draw(CustomHooks.PlayerTarget.Target, CustomHooks.PlayerTarget.getPlayerTargetPosition(player.whoAmI) + dir, CustomHooks.PlayerTarget.getPlayerTargetSourceRectangle(player.whoAmI), color); + spriteBatch.Draw(PlayerTargetSystem.Target, PlayerTargetSystem.getPlayerTargetPosition(player.whoAmI) + dir, PlayerTargetSystem.getPlayerTargetSourceRectangle(player.whoAmI), color); } spriteBatch.End(); diff --git a/Content/Items/BarrierDye/MoonstoneBarrierDye.cs b/Content/Items/BarrierDye/MoonstoneBarrierDye.cs index 8fd7027cf..86fc00693 100644 --- a/Content/Items/BarrierDye/MoonstoneBarrierDye.cs +++ b/Content/Items/BarrierDye/MoonstoneBarrierDye.cs @@ -1,5 +1,6 @@ using StarlightRiver.Content.Items.Moonstone; using StarlightRiver.Core.Loaders; +using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.BarrierSystem; using System; using Terraria.Graphics.Effects; @@ -36,14 +37,14 @@ public override void AddRecipes() public override void PostDrawEffects(SpriteBatch spriteBatch, Player Player) { - if (!CustomHooks.PlayerTarget.canUseTarget) + if (!PlayerTargetSystem.canUseTarget) return; BarrierPlayer barrier = Player.GetModPlayer(); - Texture2D tex = CustomHooks.PlayerTarget.Target; + Texture2D tex = PlayerTargetSystem.Target; - Vector2 pos = CustomHooks.PlayerTarget.getPositionOffset(Player.whoAmI); + Vector2 pos = PlayerTargetSystem.getPositionOffset(Player.whoAmI); if (barrier.barrier <= 0) return; @@ -63,15 +64,15 @@ public override void PostDrawEffects(SpriteBatch spriteBatch, Player Player) effect.Parameters["screenWidth"].SetValue(tex.Width); effect.Parameters["screenHeight"].SetValue(tex.Width); - effect.Parameters["screenPosition"].SetValue(CustomHooks.PlayerTarget.getPlayerTargetPosition(Player.whoAmI)); + effect.Parameters["screenPosition"].SetValue(PlayerTargetSystem.getPlayerTargetPosition(Player.whoAmI)); effect.Parameters["drawOriginal"].SetValue(false); spriteBatch.End(); spriteBatch.Begin(default, BlendState.Additive, Main.DefaultSamplerState, default, RasterizerState.CullNone, effect, Main.GameViewMatrix.ZoomMatrix); - Rectangle rect = CustomHooks.PlayerTarget.getPlayerTargetSourceRectangle(Player.whoAmI); + Rectangle rect = PlayerTargetSystem.getPlayerTargetSourceRectangle(Player.whoAmI); - Vector2 drawPos = CustomHooks.PlayerTarget.getPlayerTargetPosition(Player.whoAmI); + Vector2 drawPos = PlayerTargetSystem.getPlayerTargetPosition(Player.whoAmI); spriteBatch.Draw(tex, drawPos, rect, Color.White); diff --git a/Content/Items/BarrierDye/VitricBossBarrierDye.cs b/Content/Items/BarrierDye/VitricBossBarrierDye.cs index b5a12b505..c241d9588 100644 --- a/Content/Items/BarrierDye/VitricBossBarrierDye.cs +++ b/Content/Items/BarrierDye/VitricBossBarrierDye.cs @@ -1,5 +1,6 @@ using StarlightRiver.Content.Items.Vitric; using StarlightRiver.Core.Loaders; +using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.BarrierSystem; using Terraria.ID; @@ -34,14 +35,14 @@ public override void LoseBarrierEffects(Player Player) public override void PostDrawEffects(SpriteBatch spriteBatch, Player Player) { - if (!CustomHooks.PlayerTarget.canUseTarget) + if (!PlayerTargetSystem.canUseTarget) return; BarrierPlayer barrier = Player.GetModPlayer(); - Texture2D tex = CustomHooks.PlayerTarget.Target; + Texture2D tex = PlayerTargetSystem.Target; - Vector2 pos = CustomHooks.PlayerTarget.getPositionOffset(Player.whoAmI); + Vector2 pos = PlayerTargetSystem.getPositionOffset(Player.whoAmI); Effect effect = ShaderLoader.GetShader("MoltenFormAndColor").Value; @@ -55,7 +56,7 @@ public override void PostDrawEffects(SpriteBatch spriteBatch, Player Player) spriteBatch.End(); spriteBatch.Begin(default, BlendState.NonPremultiplied, SamplerState.PointClamp, default, RasterizerState.CullNone, effect, Main.GameViewMatrix.ZoomMatrix); - spriteBatch.Draw(tex, CustomHooks.PlayerTarget.getPlayerTargetPosition(Player.whoAmI), CustomHooks.PlayerTarget.getPlayerTargetSourceRectangle(Player.whoAmI), Color.White); + spriteBatch.Draw(tex, PlayerTargetSystem.getPlayerTargetPosition(Player.whoAmI), PlayerTargetSystem.getPlayerTargetSourceRectangle(Player.whoAmI), Color.White); spriteBatch.End(); spriteBatch.Begin(default, default, Main.DefaultSamplerState, default, Main.Rasterizer, default, Main.GameViewMatrix.TransformationMatrix); diff --git a/Content/Items/BaseTypes/BaseCritterItem.cs b/Content/Items/BaseTypes/BaseCritterItem.cs new file mode 100644 index 000000000..9f85c5696 --- /dev/null +++ b/Content/Items/BaseTypes/BaseCritterItem.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.ID; + +namespace StarlightRiver.Content.Items.BaseTypes +{ + public abstract class BaseCritterItem : ModItem + { + private readonly string itemName; + private readonly string itemTooltip; + private readonly int maxStack; + private readonly int value; + private readonly int rarity; + private readonly int npcID; + private readonly string texturePath; + private readonly bool pathHasName; + + public override string Texture => string.IsNullOrEmpty(texturePath) ? base.Texture : texturePath + (pathHasName ? string.Empty : Name); + + protected BaseCritterItem(string name, string tooltip, int value, int rare, int NPCType, string texturePath = null, bool pathHasName = false, int maxstack = 999) + { + itemName = name; + itemTooltip = tooltip; + maxStack = maxstack; + this.value = value; + rarity = rare; + this.texturePath = texturePath; + this.pathHasName = pathHasName; + npcID = NPCType; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault(itemName); + Tooltip.SetDefault(itemTooltip); + } + + public override void SetDefaults() + { + Item.consumable = true; + + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useTime = Item.useAnimation = 15; + Item.makeNPC = npcID; + + Item.width = 20; + Item.height = 20; + Item.maxStack = maxStack; + Item.value = value; + Item.rare = rarity; + } + } +} diff --git a/Content/Items/BaseTypes/BaseMaterial.cs b/Content/Items/BaseTypes/BaseMaterial.cs new file mode 100644 index 000000000..2e672347b --- /dev/null +++ b/Content/Items/BaseTypes/BaseMaterial.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StarlightRiver.Content.Items.BaseTypes +{ + public abstract class BaseMaterial : ModItem + { + private readonly string name; + private readonly string tooltip; + private readonly int maxStack; + private readonly int value; + private readonly int rarity; + private readonly string texturePath; + private readonly bool pathHasName; + + public override string Texture => string.IsNullOrEmpty(texturePath) ? base.Texture : texturePath + (pathHasName ? string.Empty : Name); + + protected BaseMaterial(string name, string tooltip, int maxstack, int value, int rare, string texturePath = null, bool pathHasName = false) + { + this.name = name; + this.tooltip = tooltip; + maxStack = maxstack; + this.value = value; + rarity = rare; + this.texturePath = texturePath; + this.pathHasName = pathHasName; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault(name); + Tooltip.SetDefault(tooltip); + } + + public override void SetDefaults() + { + Item.width = 16; + Item.height = 16; + Item.maxStack = maxStack; + Item.value = value; + Item.rare = rarity; + } + } +} diff --git a/Content/Items/BaseTypes/BaseTileItem.cs b/Content/Items/BaseTypes/BaseTileItem.cs new file mode 100644 index 000000000..b94b5df1f --- /dev/null +++ b/Content/Items/BaseTypes/BaseTileItem.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.ID; + +namespace StarlightRiver.Content.Items.BaseTypes +{ + public abstract class BaseTileItem : ModItem + { + public string internalName = ""; + public string itemName; + public string itemToolTip; + //private readonly int Tiletype; + private readonly string tileName; + private readonly int rarity; + private readonly string texturePath; + private readonly bool pathHasName; + private readonly int itemValue; + + public override string Name => internalName != "" ? internalName : base.Name; + + public override string Texture => string.IsNullOrEmpty(texturePath) ? AssetDirectory.Debug : texturePath + (pathHasName ? string.Empty : Name); + + public BaseTileItem() { } + + public BaseTileItem(string name, string tooltip, string placetype, int rare = ItemRarityID.White, string texturePath = null, bool pathHasName = false, int ItemValue = 0) + { + itemName = name; + itemToolTip = tooltip; + tileName = placetype; + rarity = rare; + this.texturePath = texturePath; + this.pathHasName = pathHasName; + itemValue = ItemValue; + } + + public BaseTileItem(string internalName, string name, string tooltip, string placetype, int rare = ItemRarityID.White, string texturePath = null, bool pathHasName = false, int ItemValue = 0) + { + this.internalName = internalName; + itemName = name; + itemToolTip = tooltip; + tileName = placetype; + rarity = rare; + this.texturePath = texturePath; + this.pathHasName = pathHasName; + itemValue = ItemValue; + } + + public virtual void SafeSetDefaults() { } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault(itemName ?? "ERROR"); + Tooltip.SetDefault(itemToolTip ?? "Report me please!"); + } + + public override void SetDefaults() + { + if (tileName is null) + return; + + Item.width = 16; + Item.height = 16; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = Mod.Find(tileName).Type; + Item.rare = rarity; + Item.value = itemValue; + SafeSetDefaults(); + } + } +} diff --git a/Content/Items/BaseTypes/BaseWallItem.cs b/Content/Items/BaseTypes/BaseWallItem.cs new file mode 100644 index 000000000..d8d3b2580 --- /dev/null +++ b/Content/Items/BaseTypes/BaseWallItem.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.ID; + +namespace StarlightRiver.Content.Items.BaseTypes +{ + public abstract class BaseWallItem : ModItem + { + public string itemName; + public string itemToolTip; + private readonly int wallType; + private readonly int rarity; + private readonly string texturePath; + private readonly bool pathHasName; + + public override string Texture => string.IsNullOrEmpty(texturePath) ? base.Texture : texturePath + (pathHasName ? string.Empty : Name); + + protected BaseWallItem(string name, string tooltip, int placetype, int rare, string texturePath = null, bool pathHasName = false) + { + itemName = name; + itemToolTip = tooltip; + wallType = placetype; + rarity = rare; + this.texturePath = texturePath; + this.pathHasName = pathHasName; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault(itemName); + Tooltip.SetDefault(itemToolTip); + } + + public override void SetDefaults() + { + Item.width = 16; + Item.height = 16; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = wallType; + Item.rare = rarity; + } + } +} diff --git a/Content/Items/BaseTypes/CursedAccessory.cs b/Content/Items/BaseTypes/CursedAccessory.cs index b7c97c553..81c29da72 100644 --- a/Content/Items/BaseTypes/CursedAccessory.cs +++ b/Content/Items/BaseTypes/CursedAccessory.cs @@ -7,6 +7,7 @@ using Terraria.GameContent; using Terraria.Graphics.Effects; using Terraria.ID; +using Terraria.UI; using Terraria.Utilities; namespace StarlightRiver.Content.Items.BaseTypes @@ -65,7 +66,7 @@ public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 positi Vector2 pos = position - origin * scale + new Vector2(0, 10) + Main.rand.NextVector2Circular(16, 16) + frame.Size() / 2f * scale; if (!GoingBoom) - CursedAccessoryParticleManager.CursedSystem.AddParticle(pos, new Vector2(0, -0.4f), 0, 0.5f, CurseColor, 60, Vector2.Zero, alpha: 0); + CursedAccessorySystem.CursedSystem.AddParticle(pos, new Vector2(0, -0.4f), 0, 0.5f, CurseColor, 60, Vector2.Zero, alpha: 0); drawpos = position - origin * scale + frame.Size() * scale * 0.5f; @@ -73,7 +74,7 @@ public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 positi { float rot = Main.rand.NextFloat(6.28f); float decay = 1f - boomTimer / 60f; - CursedAccessoryParticleManager.CursedSystem.AddParticle(drawpos + Vector2.One.RotatedBy(rot) * decay * 30, -Vector2.One.RotatedBy(rot) * 1.5f * decay, 0, 0.6f * boomTimer / 100f, new Color(255, Main.rand.Next(120, 200), 120) * 0.6f, 20, Vector2.Zero, alpha: 0); + CursedAccessorySystem.CursedSystem.AddParticle(drawpos + Vector2.One.RotatedBy(rot) * decay * 30, -Vector2.One.RotatedBy(rot) * 1.5f * decay, 0, 0.6f * boomTimer / 100f, new Color(255, Main.rand.Next(120, 200), 120) * 0.6f, 20, Vector2.Zero, alpha: 0); } } @@ -85,7 +86,7 @@ public override void OnEquip(Player player, Item item) SoundEngine.PlaySound(SoundID.Item123); for (int k = 0; k <= 50; k++) - CursedAccessoryParticleManager.CursedSystem.AddParticle(drawpos, Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(0.75f), 0, 1, CurseColor, 60, Vector2.Zero, alpha: 0); + CursedAccessorySystem.CursedSystem.AddParticle(drawpos, Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(0.75f), 0, 1, CurseColor, 60, Vector2.Zero, alpha: 0); } } @@ -116,17 +117,17 @@ public override void UpdateInventory(Player Player) { float distance = Main.rand.NextFloat(4.25f); - CursedAccessoryParticleManager.CursedSystem.AddParticle(drawpos, Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(4.25f, 4.75f), 1, 1.2f, CurseColor * 0.6f, 60, Vector2.Zero); - CursedAccessoryParticleManager.CursedSystem.AddParticle(drawpos, Vector2.One.RotatedByRandom(6.28f) * distance, 1, 0.8f, Color.Lerp(new Color(200, 60, 250, 0), CurseColor * 0.8f, distance / 4.25f), 60, Vector2.Zero); + CursedAccessorySystem.CursedSystem.AddParticle(drawpos, Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(4.25f, 4.75f), 1, 1.2f, CurseColor * 0.6f, 60, Vector2.Zero); + CursedAccessorySystem.CursedSystem.AddParticle(drawpos, Vector2.One.RotatedByRandom(6.28f) * distance, 1, 0.8f, Color.Lerp(new Color(200, 60, 250, 0), CurseColor * 0.8f, distance / 4.25f), 60, Vector2.Zero); } - CursedAccessoryParticleManager.ShardsSystem.SetTexture(tex); + CursedAccessorySystem.ShardsSystem.SetTexture(tex); for (int x = 0; x < 5; x++) { for (int y = 0; y < 5; y++) { - CursedAccessoryParticleManager.ShardsSystem.AddParticle( + CursedAccessorySystem.ShardsSystem.AddParticle( drawpos - tex.Size() / 2f + new Vector2(x * tex.Width / 5f, y * tex.Height / 5f), Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(1, 2.55f), 0, @@ -197,7 +198,7 @@ public sealed override void ModifyTooltips(List tooltips) public virtual void SafeModifyTooltips(List tooltips) { } } - class CursedAccessoryParticleManager : ModSystem + class CursedAccessorySystem : ModSystem { public static ParticleSystem CursedSystem; public static ParticleSystem ShardsSystem; @@ -206,6 +207,12 @@ public override void Load() { CursedSystem = new ParticleSystem("StarlightRiver/Assets/Masks/GlowAlpha", UpdateCursedBody, ParticleSystem.AnchorOptions.UI); ShardsSystem = new ParticleSystem("StarlightRiver/Assets/GUI/charm", UpdateShardsBody, ParticleSystem.AnchorOptions.UI); + + if (!Main.dedServ) + { + On_ItemSlot.Draw_SpriteBatch_ItemArray_int_int_Vector2_Color += DrawSpecial; + On_Main.DrawInterface_27_Inventory += DrawInventoryParticles; + } } public override void PostUpdateEverything() @@ -214,6 +221,54 @@ public override void PostUpdateEverything() ShardsSystem?.UpdateParticles(); } + private void DrawSpecial(On_ItemSlot.orig_Draw_SpriteBatch_ItemArray_int_int_Vector2_Color orig, SpriteBatch sb, Item[] inv, int context, int slot, Vector2 position, Color color) + { + if (inv[slot].ModItem is CursedAccessory && context == 10) + { + Texture2D back = Assets.GUI.CursedBack.Value; + Color backcolor = (!Main.expertMode && slot == 8) ? Color.White * 0.25f : Color.White * 0.75f; + + sb.Draw(back, position, null, backcolor, 0f, default, Main.inventoryScale, SpriteEffects.None, 0f); + RedrawItem(sb, inv, position, slot, color); + } + else + { + orig(sb, inv, context, slot, position, color); + } + } + + private void DrawInventoryParticles(On_Main.orig_DrawInterface_27_Inventory orig, Main self) + { + orig(self); + CursedSystem.DrawParticles(Main.spriteBatch); + ShardsSystem.DrawParticles(Main.spriteBatch); + } + + //this is vanilla code. Only reasonable alternative is likely porting all drawing to IL. + internal static void RedrawItem(SpriteBatch sb, Item[] inv, Vector2 position, int slot, Color color) + { + Item item = inv[slot]; + Vector2 scaleVector = Vector2.One * 52 * Main.inventoryScale; + Texture2D popupTex = Terraria.GameContent.TextureAssets.Item[item.type].Value; + Rectangle source = popupTex.Frame(1, 1, 0, 0); + Color currentColor = color; + float scaleFactor2 = 1f; + ItemSlot.GetItemLight(ref currentColor, ref scaleFactor2, item, false); + float scaleFactor = 1f; + + if (source.Width > 32 || source.Height > 32) + scaleFactor = (source.Width <= source.Height) ? (32f / source.Height) : (32f / source.Width); + + scaleFactor *= Main.inventoryScale; + Vector2 drawPos = position + scaleVector / 2f - source.Size() * scaleFactor / 2f; + Vector2 origin = source.Size() * (scaleFactor2 / 2f - 0.5f); + + if (ItemLoader.PreDrawInInventory(item, sb, drawPos, source, item.GetAlpha(currentColor), item.GetColor(color), origin, scaleFactor * scaleFactor2)) + sb.Draw(popupTex, drawPos, source, Color.White, 0f, origin, scaleFactor * scaleFactor2, SpriteEffects.None, 0f); + + ItemLoader.PostDrawInInventory(item, sb, drawPos, source, item.GetAlpha(currentColor), item.GetColor(color), origin, scaleFactor * scaleFactor2); + } + private static void UpdateShardsBody(Particle particle) { particle.Color = Color.White; diff --git a/Core/BaseFlail.cs b/Content/Items/BaseTypes/Weapons/BaseFlail.cs similarity index 95% rename from Core/BaseFlail.cs rename to Content/Items/BaseTypes/Weapons/BaseFlail.cs index 65d36e788..e9e879c02 100644 --- a/Core/BaseFlail.cs +++ b/Content/Items/BaseTypes/Weapons/BaseFlail.cs @@ -3,7 +3,7 @@ using Terraria.Audio; using Terraria.ID; -namespace StarlightRiver.Core +namespace StarlightRiver.Content.Items.BaseTypes.Weapons { public abstract class BaseFlailItem : ModItem { @@ -120,7 +120,7 @@ public override void AI() { Projectile.rotation += Projectile.velocity.X * 0.03f; Owner.ChangeDir(Math.Sign(Projectile.Center.X - Owner.Center.X)); - Owner.itemRotation = MathHelper.WrapAngle(Projectile.AngleFrom(Owner.MountedCenter) - ((Owner.direction < 0) ? MathHelper.Pi : 0)); + Owner.itemRotation = MathHelper.WrapAngle(Projectile.AngleFrom(Owner.MountedCenter) - (Owner.direction < 0 ? MathHelper.Pi : 0)); } float launchspeed = Owner.HeldItem.shootSpeed * MathHelper.Lerp(SpeedMult.X, SpeedMult.Y, ChargeTime / MaxChargeTime); @@ -131,7 +131,7 @@ public override void AI() if (++Timer == 1 && Owner.whoAmI == Main.myPlayer) { - Terraria.Audio.SoundEngine.PlaySound(SoundID.Item19, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item19, Projectile.Center); Projectile.Center = Owner.MountedCenter; Projectile.velocity = Owner.DirectionTo(Main.MouseWorld) * launchspeed; OnLaunch(Owner); @@ -153,9 +153,7 @@ public override void AI() if (falling) //falling towards ground, returns after hitting ground { if (strucktile || ++Timer >= 180) - { Return(launchspeed, Owner); - } else { FallingExtras(Owner); @@ -214,9 +212,9 @@ public override bool OnTileCollide(Vector2 oldVelocity) SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - Projectile.velocity = new Vector2((Projectile.velocity.X != Projectile.oldVelocity.X) ? + Projectile.velocity = new Vector2(Projectile.velocity.X != Projectile.oldVelocity.X ? -Projectile.oldVelocity.X / 5 : Projectile.velocity.X, - (Projectile.velocity.Y != Projectile.oldVelocity.Y) ? + Projectile.velocity.Y != Projectile.oldVelocity.Y ? -Projectile.oldVelocity.Y / 5 : Projectile.velocity.Y); SafeTileCollide(oldVelocity); Timer = 30; diff --git a/Content/Items/BaseTypes/AbstractHeavyFlail.cs b/Content/Items/BaseTypes/Weapons/BaseHeavyFlail.cs similarity index 93% rename from Content/Items/BaseTypes/AbstractHeavyFlail.cs rename to Content/Items/BaseTypes/Weapons/BaseHeavyFlail.cs index af621c8e8..06d0c2c46 100644 --- a/Content/Items/BaseTypes/AbstractHeavyFlail.cs +++ b/Content/Items/BaseTypes/Weapons/BaseHeavyFlail.cs @@ -3,9 +3,9 @@ using System.Linq; using Terraria.ID; -namespace StarlightRiver.Content.Items.BaseTypes +namespace StarlightRiver.Content.Items.BaseTypes.Weapons { - internal abstract class AbstractHeavyFlail : ModItem + internal abstract class BaseHeavyFlail : ModItem { public abstract int ProjType { get; } @@ -25,11 +25,11 @@ public override void SetDefaults() public override bool CanShoot(Player player) { - return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ProjType && (n.ModProjectile as AbstractHeavyFlailProjectile).State < 4); + return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ProjType && (n.ModProjectile as BaseHeavyFlailProjectile).State < 4); } } - internal abstract class AbstractHeavyFlailProjectile : ModProjectile + internal abstract class BaseHeavyFlailProjectile : ModProjectile { public abstract Asset ChainAsset { get; } protected Asset BallAsset; @@ -77,9 +77,7 @@ public override void AI() //Owner.itemAnimation = 10; if (Owner.channel) - { Projectile.timeLeft = 180; - } else if (State != 4) { Projectile.velocity *= 0.5f; @@ -263,13 +261,13 @@ public override bool PreDraw(ref Color lightColor) for (int k = 0; k < max; k++) { var pos = Vector2.Lerp(Owner.Center, Projectile.Center, k / (float)max); - Rectangle source = new Rectangle(0, 0, 8, 22); + var source = new Rectangle(0, 0, 8, 22); if (k > 1) { source.Y += 22; - if (extraStyles > 0 && (k + 3) >= (max - extraStyles * AlternateStyleRepeats)) + if (extraStyles > 0 && k + 3 >= max - extraStyles * AlternateStyleRepeats) source.Y += 22 * (extraStyles - (max - (k + 3)) / AlternateStyleRepeats); } @@ -282,13 +280,13 @@ public override bool PreDraw(ref Color lightColor) Vector2 prev = chainPos[k - 1]; Vector2 curr = chainPos[k]; - Rectangle source = new Rectangle(0, 0, 8, 22); + var source = new Rectangle(0, 0, 8, 22); if (k > 1) { source.Y += 22; - if (extraStyles > 0 && (k + 3) >= (chainPos.Count - extraStyles * AlternateStyleRepeats)) + if (extraStyles > 0 && k + 3 >= chainPos.Count - extraStyles * AlternateStyleRepeats) source.Y += 22 * (extraStyles - (chainPos.Count - (k + 3)) / AlternateStyleRepeats); } diff --git a/Content/Items/BaseTypes/BaseTalisman.cs b/Content/Items/BaseTypes/Weapons/BaseTalisman.cs similarity index 93% rename from Content/Items/BaseTypes/BaseTalisman.cs rename to Content/Items/BaseTypes/Weapons/BaseTalisman.cs index 9f3aea961..6bed97298 100644 --- a/Content/Items/BaseTypes/BaseTalisman.cs +++ b/Content/Items/BaseTypes/Weapons/BaseTalisman.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; using Terraria.ID; -namespace StarlightRiver.Content.Items.BaseTypes +namespace StarlightRiver.Content.Items.BaseTypes.Weapons { internal abstract class BaseTalisman : ModItem where T : BaseTalismanProjectile where T2 : BaseTalismanBuff, new() { @@ -71,7 +71,7 @@ public override void AI() if (flipTimer > 0) { - Projectile.velocity = Projectile.velocity.RotatedBy(6.28f / (float)maxFlip * -direction); + Projectile.velocity = Projectile.velocity.RotatedBy(6.28f / maxFlip * -direction); flipTimer--; } else if (Main.rand.NextBool(100)) @@ -85,7 +85,7 @@ public override void AI() Projectile.velocity += Vector2.UnitY.RotatedBy(Projectile.rotation) * (float)Math.Sin(Projectile.timeLeft / 5f) * 0.25f; Projectile.velocity += Vector2.UnitY.RotatedBy(Projectile.rotation) * (float)Math.Sin(Projectile.timeLeft / 10f + 2) * 0.1f; - if (Projectile.frameCounter++ > (4 - (int)Projectile.velocity.Length() / 6f)) + if (Projectile.frameCounter++ > 4 - (int)Projectile.velocity.Length() / 6f) { Projectile.frameCounter = 0; Projectile.frame++; @@ -142,7 +142,7 @@ private void DrawTalisman(NPC npc, SpriteBatch spriteBatch, Vector2 screenPos, C { for (int k = 0; k < buff.threshold; k++) { - Vector2 off = new Vector2(rand.Next(npc.width), rand.Next(npc.height)); + var off = new Vector2(rand.Next(npc.width), rand.Next(npc.height)); Vector2 pos2 = npc.position + off - Main.screenPosition; spriteBatch.Draw(tex, pos2, null, drawColor * (buff.triggerAnimTime / 15f), 0, tex.Size() / 2f, 1f + (1 - buff.triggerAnimTime / 15f), 0, 0); } @@ -151,7 +151,7 @@ private void DrawTalisman(NPC npc, SpriteBatch spriteBatch, Vector2 screenPos, C { for (int k = 0; k < buff.stacks.Count; k++) { - Vector2 off = new Vector2(rand.Next(npc.width), rand.Next(npc.height)); + var off = new Vector2(rand.Next(npc.width), rand.Next(npc.height)); Vector2 pos2 = npc.position + off - Main.screenPosition; spriteBatch.Draw(tex, pos2, null, drawColor, 0, tex.Size() / 2f, 1f, 0, 0); } diff --git a/Core/BaseWhip.cs b/Content/Items/BaseTypes/Weapons/BaseWhip.cs similarity index 97% rename from Core/BaseWhip.cs rename to Content/Items/BaseTypes/Weapons/BaseWhip.cs index 7b92f6e27..6c61ee048 100644 --- a/Core/BaseWhip.cs +++ b/Content/Items/BaseTypes/Weapons/BaseWhip.cs @@ -6,7 +6,7 @@ using Terraria.GameContent; using Terraria.ID; -namespace StarlightRiver.Core +namespace StarlightRiver.Content.Items.BaseTypes.Weapons { public abstract class BaseWhip : ModProjectile { @@ -60,7 +60,7 @@ public override bool PreAI() Projectile.ai[0]++; Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Projectile.Center = Main.GetPlayerArmPosition(Projectile) + Projectile.velocity * (Projectile.ai[0] - 1f); - Projectile.spriteDirection = (!(Vector2.Dot(Projectile.velocity, Vector2.UnitX) < 0f)) ? 1 : -1; + Projectile.spriteDirection = !(Vector2.Dot(Projectile.velocity, Vector2.UnitX) < 0f) ? 1 : -1; if (Projectile.ai[0] >= flyTime || player.itemAnimation == 0) { @@ -186,9 +186,7 @@ public override bool PreDraw(ref Color lightColor) bool draw = true; if (i == 0) - { origin.Y += handleOffset; - } else if (i == points.Count - 2) { whipFrame.Y = height * 4; diff --git a/Content/Items/BaseTypes/MultiAmmoWeapon.cs b/Content/Items/BaseTypes/Weapons/MultiAmmoWeapon.cs similarity index 97% rename from Content/Items/BaseTypes/MultiAmmoWeapon.cs rename to Content/Items/BaseTypes/Weapons/MultiAmmoWeapon.cs index 05a3c47ed..48b0ced38 100644 --- a/Content/Items/BaseTypes/MultiAmmoWeapon.cs +++ b/Content/Items/BaseTypes/Weapons/MultiAmmoWeapon.cs @@ -4,7 +4,7 @@ using Terraria.ID; using Terraria.UI.Chat; -namespace StarlightRiver.Content.Items.BaseTypes +namespace StarlightRiver.Content.Items.BaseTypes.Weapons { public abstract class MultiAmmoWeapon : ModItem { @@ -186,9 +186,7 @@ public sealed override void ModifyTooltips(List tooltips) return; if (!Main.LocalPlayer.controlDown) - { tooltips.Add(new TooltipLine(Mod, "Ammo", "[c/646464:Press DOWN for ammo information]")); - } else { string ammoList = "Valid Ammunition:\n"; @@ -208,7 +206,7 @@ public sealed override void ModifyTooltips(List tooltips) tooltips.Add(new TooltipLine(StarlightRiver.Instance, "AmmoListTooltip", ammoList)); } - TooltipLine AmmoLine = new TooltipLine(StarlightRiver.Instance, "AmmoLineToolTip", $"Current Ammo:[i:{ammoItem.type}]{ammoItem.stack} {ammoItem.Name}:" + + var AmmoLine = new TooltipLine(StarlightRiver.Instance, "AmmoLineToolTip", $"Current Ammo:[i:{ammoItem.type}]{ammoItem.stack} {ammoItem.Name}:" + $" {ValidAmmos.Find(a => a.ammoID == ammoItem.type).tooltip}"); TooltipLine kbLine = tooltips.Find(n => n.Name == "Knockback"); diff --git a/Content/Items/Breacher/Accessories.ReactivePlating.cs b/Content/Items/Breacher/Accessories.ReactivePlating.cs index 5eae875dc..e4f1f1434 100644 --- a/Content/Items/Breacher/Accessories.ReactivePlating.cs +++ b/Content/Items/Breacher/Accessories.ReactivePlating.cs @@ -1,5 +1,5 @@ -using StarlightRiver.Content.CustomHooks; -using StarlightRiver.Core.Loaders; +using StarlightRiver.Core.Loaders; +using StarlightRiver.Core.Systems; using System; using Terraria.Graphics.Effects; using Terraria.ID; @@ -110,12 +110,12 @@ public void Unload() { } private static void DrawPlayerTarget(int flickerTime, int shieldTimer, Player drawPlayer) { - if (!PlayerTarget.canUseTarget) + if (!PlayerTargetSystem.canUseTarget) return; GraphicsDevice gD = Main.graphics.GraphicsDevice; SpriteBatch spriteBatch = Main.spriteBatch; - Texture2D target = PlayerTarget.Target; + Texture2D target = PlayerTargetSystem.Target; if (Main.dedServ || spriteBatch == null || gD == null || target == null) return; @@ -124,7 +124,7 @@ private static void DrawPlayerTarget(int flickerTime, int shieldTimer, Player dr if (effect != null) { - effect.Parameters["uImageSize0"].SetValue(new Vector2(PlayerTarget.sheetSquareX, PlayerTarget.sheetSquareY)); + effect.Parameters["uImageSize0"].SetValue(new Vector2(PlayerTargetSystem.sheetSquareX, PlayerTargetSystem.sheetSquareY)); effect.Parameters["alpha"].SetValue((float)Math.Pow(shieldTimer / 200f, 0.25f)); spriteBatch.End(); @@ -147,7 +147,7 @@ private static void DrawPlayerTarget(int flickerTime, int shieldTimer, Player dr effect.Parameters["red2"].SetValue(color.ToVector4()); effect.CurrentTechnique.Passes[0].Apply(); - spriteBatch.Draw(target, PlayerTarget.getPlayerTargetPosition(drawPlayer.whoAmI), PlayerTarget.getPlayerTargetSourceRectangle(drawPlayer.whoAmI), Color.White); + spriteBatch.Draw(target, PlayerTargetSystem.getPlayerTargetPosition(drawPlayer.whoAmI), PlayerTargetSystem.getPlayerTargetSourceRectangle(drawPlayer.whoAmI), Color.White); spriteBatch.End(); spriteBatch.Begin(default, default, Main.DefaultSamplerState, default, Main.Rasterizer, default, Main.GameViewMatrix.TransformationMatrix); diff --git a/Content/Items/BuriedArtifacts/Artifacts.CommonDesertArtifactItems.cs b/Content/Items/BuriedArtifacts/Artifacts.CommonDesertArtifactItems.cs index ff7d12cf4..43548cad9 100644 --- a/Content/Items/BuriedArtifacts/Artifacts.CommonDesertArtifactItems.cs +++ b/Content/Items/BuriedArtifacts/Artifacts.CommonDesertArtifactItems.cs @@ -1,37 +1,39 @@ -namespace StarlightRiver.Content.Items.BuriedArtifacts +using StarlightRiver.Content.Items.BaseTypes; + +namespace StarlightRiver.Content.Items.BuriedArtifacts { - public class DesertArtifact1Item : QuickMaterial + public class DesertArtifact1Item : BaseMaterial { public override string Texture => AssetDirectory.Archaeology + "DesertArtifact1"; public DesertArtifact1Item() : base("Ancient Fossil", "Would fetch a nice price!", 999, Item.sellPrice(0, 15, 0, 0), 2) { } } - public class DesertArtifact2Item : QuickMaterial + public class DesertArtifact2Item : BaseMaterial { public override string Texture => AssetDirectory.Archaeology + "DesertArtifact2"; public DesertArtifact2Item() : base("Ancient Fossil", "Would fetch a nice price!", 999, Item.sellPrice(0, 5, 0, 0), 2) { } } - public class DesertArtifact3Item : QuickMaterial + public class DesertArtifact3Item : BaseMaterial { public override string Texture => AssetDirectory.Archaeology + "DesertArtifact3"; public DesertArtifact3Item() : base("Ancient Fossil", "Would fetch a nice price!", 999, Item.sellPrice(0, 5, 0, 0), 2) { } } - public class DesertArtifact4Item : QuickMaterial + public class DesertArtifact4Item : BaseMaterial { public override string Texture => AssetDirectory.Archaeology + "DesertArtifact4"; public DesertArtifact4Item() : base("Ancient Fossil", "Would fetch a nice price!", 999, Item.sellPrice(0, 5, 0, 0), 2) { } } - public class DesertArtifact5Item : QuickMaterial + public class DesertArtifact5Item : BaseMaterial { public override string Texture => AssetDirectory.Archaeology + "DesertArtifact5"; public DesertArtifact5Item() : base("Ancient Fossil", "Would fetch a nice price!", 999, Item.sellPrice(0, 6, 0, 0), 2) { } } - public class DesertArtifact6Item : QuickMaterial + public class DesertArtifact6Item : BaseMaterial { public override string Texture => AssetDirectory.Archaeology + "DesertArtifact6"; public DesertArtifact6Item() : base("Ancient Fossil", "Would fetch a nice price!", 999, Item.sellPrice(0, 7, 0, 0), 2) { } } - public class DesertArtifact7Item : QuickMaterial + public class DesertArtifact7Item : BaseMaterial { public override string Texture => AssetDirectory.Archaeology + "DesertArtifact7"; public DesertArtifact7Item() : base("Ancient Fossil", "Would fetch a nice price!", 999, Item.sellPrice(0, 5, 0, 0), 2) { } diff --git a/Content/Items/BuriedArtifacts/Weapons.ArchaeologistsWhip.cs b/Content/Items/BuriedArtifacts/Weapons.ArchaeologistsWhip.cs index 2ecf1bafd..33749cbc8 100644 --- a/Content/Items/BuriedArtifacts/Weapons.ArchaeologistsWhip.cs +++ b/Content/Items/BuriedArtifacts/Weapons.ArchaeologistsWhip.cs @@ -1,4 +1,5 @@ using ReLogic.Content; +using StarlightRiver.Content.Items.BaseTypes.Weapons; using System.Collections.Generic; using System.Linq; using System.Reflection.Metadata; diff --git a/Content/Items/Dungeon/Weapons.TwistSword.cs b/Content/Items/Dungeon/Weapons.TwistSword.cs index 2f93738ca..52f83f208 100644 --- a/Content/Items/Dungeon/Weapons.TwistSword.cs +++ b/Content/Items/Dungeon/Weapons.TwistSword.cs @@ -1,5 +1,5 @@ -using StarlightRiver.Content.CustomHooks; -using StarlightRiver.Core.Loaders; +using StarlightRiver.Core.Loaders; +using StarlightRiver.Core.Systems; using StarlightRiver.Helpers; using System; using System.Collections.Generic; @@ -189,7 +189,7 @@ public override void Draw(ref PlayerDrawSet drawInfo) Player drawPlayer = drawInfo.drawPlayer; - if (drawPlayer != null && !drawPlayer.HeldItem.IsAir && drawPlayer.HeldItem.type == ItemType() && PlayerTarget.canUseTarget) + if (drawPlayer != null && !drawPlayer.HeldItem.IsAir && drawPlayer.HeldItem.type == ItemType() && PlayerTargetSystem.canUseTarget) { int charge = (drawPlayer.HeldItem.ModItem as TwistSword).charge; Texture2D tex = Assets.GUI.SmallBar1.Value; diff --git a/Content/Items/Forest/Weapons.HeavyFlail.cs b/Content/Items/Forest/Weapons.HeavyFlail.cs index edac44422..f09f60703 100644 --- a/Content/Items/Forest/Weapons.HeavyFlail.cs +++ b/Content/Items/Forest/Weapons.HeavyFlail.cs @@ -1,4 +1,4 @@ -using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Content.Items.BaseTypes.Weapons; using StarlightRiver.Content.Items.Gravedigger; using StarlightRiver.Content.Items.Misc; using StarlightRiver.Core.Systems.CameraSystem; @@ -11,7 +11,7 @@ namespace StarlightRiver.Content.Items.Forest { - internal class HeavyFlail : AbstractHeavyFlail + internal class HeavyFlail : BaseHeavyFlail { public override string Texture => AssetDirectory.ForestItem + Name; @@ -40,7 +40,7 @@ public override void AddRecipes() } } - internal class HeavyFlailProjectile : AbstractHeavyFlailProjectile + internal class HeavyFlailProjectile : BaseHeavyFlailProjectile { public override string Texture => AssetDirectory.ForestItem + Name; diff --git a/Content/Items/Geomancer/GeomancerPlayer.cs b/Content/Items/Geomancer/GeomancerPlayer.cs index 177c92f05..8946627b1 100644 --- a/Content/Items/Geomancer/GeomancerPlayer.cs +++ b/Content/Items/Geomancer/GeomancerPlayer.cs @@ -1,4 +1,5 @@ using StarlightRiver.Core.Loaders; +using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.BarrierSystem; using System; using System.Collections.Generic; @@ -60,7 +61,7 @@ private void PreDrawGlowFX(Player Player, SpriteBatch spriteBatch) if (!SetBonusActive)//removed GetModPlayer since these can directly access it here return; - if (!CustomHooks.PlayerTarget.canUseTarget) + if (!PlayerTargetSystem.canUseTarget) return; float fadeOut = 1; @@ -89,7 +90,7 @@ private void PreDrawGlowFX(Player Player, SpriteBatch spriteBatch) Vector2 dir = Vector2.UnitX.RotatedBy(k / 6f * 6.28f) * (5.5f + sin * 2.2f); Color color = Color.White * (opacity - sin * 0.1f) * 0.9f; - spriteBatch.Draw(CustomHooks.PlayerTarget.Target, CustomHooks.PlayerTarget.getPlayerTargetPosition(Player.whoAmI) + dir, CustomHooks.PlayerTarget.getPlayerTargetSourceRectangle(Player.whoAmI), color * 0.25f * fadeOut); + spriteBatch.Draw(PlayerTargetSystem.Target, PlayerTargetSystem.getPlayerTargetPosition(Player.whoAmI) + dir, PlayerTargetSystem.getPlayerTargetSourceRectangle(Player.whoAmI), color * 0.25f * fadeOut); } } else if (ActivationCounter > 0) @@ -107,7 +108,7 @@ private void PreDrawGlowFX(Player Player, SpriteBatch spriteBatch) { Vector2 dir = Vector2.UnitX.RotatedBy(k / 6f * 6.28f) * (sin * 8f); - spriteBatch.Draw(CustomHooks.PlayerTarget.Target, CustomHooks.PlayerTarget.getPlayerTargetPosition(Player.whoAmI) + dir, CustomHooks.PlayerTarget.getPlayerTargetSourceRectangle(Player.whoAmI), Color.White * 0.25f); + spriteBatch.Draw(PlayerTargetSystem.Target, PlayerTargetSystem.getPlayerTargetPosition(Player.whoAmI) + dir, PlayerTargetSystem.getPlayerTargetSourceRectangle(Player.whoAmI), Color.White * 0.25f); } } } diff --git a/Content/Items/Gravedigger/Materials.LivingBlood.cs b/Content/Items/Gravedigger/Materials.LivingBlood.cs index 0a674e681..c59e0c50c 100644 --- a/Content/Items/Gravedigger/Materials.LivingBlood.cs +++ b/Content/Items/Gravedigger/Materials.LivingBlood.cs @@ -1,10 +1,11 @@ -using Terraria.DataStructures; +using StarlightRiver.Content.Items.BaseTypes; +using Terraria.DataStructures; using Terraria.GameContent.ItemDropRules; using Terraria.ID; namespace StarlightRiver.Content.Items.Gravedigger { - public class LivingBlood : QuickMaterial + public class LivingBlood : BaseMaterial { public override void Load() { diff --git a/Content/Items/Gravedigger/Weapons.RadculasRapier.cs b/Content/Items/Gravedigger/Weapons.RadculasRapier.cs index 144eafcc3..5f31999ed 100644 --- a/Content/Items/Gravedigger/Weapons.RadculasRapier.cs +++ b/Content/Items/Gravedigger/Weapons.RadculasRapier.cs @@ -1,5 +1,5 @@ -using StarlightRiver.Content.CustomHooks; -using StarlightRiver.Core.Loaders; +using StarlightRiver.Core.Loaders; +using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.CameraSystem; using StarlightRiver.Core.Systems.InstancedBuffSystem; using StarlightRiver.Helpers; @@ -113,7 +113,7 @@ public override void Load() private void StarlightPlayer_PostDrawEvent(Player player, SpriteBatch spriteBatch) { - if (PlayerTarget.canUseTarget) + if (PlayerTargetSystem.canUseTarget) { bool active = player.active && !player.outOfRange && !player.dead; if (active && player.GetModPlayer().teleportTimer > 0) @@ -121,7 +121,7 @@ private void StarlightPlayer_PostDrawEvent(Player player, SpriteBatch spriteBatc spriteBatch.End(); spriteBatch.Begin(default, blendState: BlendState.Additive, Main.DefaultSamplerState, default, RasterizerState.CullNone, default, Main.GameViewMatrix.ZoomMatrix); - Main.spriteBatch.Draw(PlayerTarget.Target, PlayerTarget.getPlayerTargetPosition(player.whoAmI), PlayerTarget.getPlayerTargetSourceRectangle(player.whoAmI), new Color(150, 0, 0) * (player.GetModPlayer().teleportTimer / 60f), player.fullRotation, Vector2.Zero, 1f, 0f, 0f); + Main.spriteBatch.Draw(PlayerTargetSystem.Target, PlayerTargetSystem.getPlayerTargetPosition(player.whoAmI), PlayerTargetSystem.getPlayerTargetSourceRectangle(player.whoAmI), new Color(150, 0, 0) * (player.GetModPlayer().teleportTimer / 60f), player.fullRotation, Vector2.Zero, 1f, 0f, 0f); spriteBatch.End(); spriteBatch.Begin(default, default, Main.DefaultSamplerState, default, Main.Rasterizer, default, Main.GameViewMatrix.TransformationMatrix); @@ -134,7 +134,7 @@ private void StarlightPlayer_PostDrawEvent(Player player, SpriteBatch spriteBatc private void StarlightPlayer_PreDrawEvent(Player player, SpriteBatch spriteBatch) { - if (PlayerTarget.canUseTarget) + if (PlayerTargetSystem.canUseTarget) { bool active = player.active && !player.outOfRange && !player.dead; if (active && player.GetModPlayer().trailPositions.Count > 0) @@ -142,11 +142,11 @@ private void StarlightPlayer_PreDrawEvent(Player player, SpriteBatch spriteBatch spriteBatch.End(); spriteBatch.Begin(default, blendState: BlendState.Additive, Main.DefaultSamplerState, default, RasterizerState.CullNone, default, Main.GameViewMatrix.ZoomMatrix); - Rectangle source = PlayerTarget.getPlayerTargetSourceRectangle(player.whoAmI); + Rectangle source = PlayerTargetSystem.getPlayerTargetSourceRectangle(player.whoAmI); for (int x = player.GetModPlayer().trailPositions.Count - 1; x > 0; x--) { - Main.spriteBatch.Draw(PlayerTarget.Target, Main.ReverseGravitySupport(player.GetModPlayer().trailPositions[x] - Main.screenPosition, player.height), + Main.spriteBatch.Draw(PlayerTargetSystem.Target, Main.ReverseGravitySupport(player.GetModPlayer().trailPositions[x] - Main.screenPosition, player.height), source, new Color(100, 0, 0) * (player.GetModPlayer().teleportTimer / 60f), player.fullRotation, source.Size() / 2f, 1f, 0f, 0f); } diff --git a/Content/Items/Haunted/Materials.VengefulSpirit.cs b/Content/Items/Haunted/Materials.VengefulSpirit.cs index 0cb4862b9..58e1c802f 100644 --- a/Content/Items/Haunted/Materials.VengefulSpirit.cs +++ b/Content/Items/Haunted/Materials.VengefulSpirit.cs @@ -1,11 +1,12 @@ -using Terraria.DataStructures; +using StarlightRiver.Content.Items.BaseTypes; +using Terraria.DataStructures; using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.Localization; namespace StarlightRiver.Content.Items.Haunted { - public class VengefulSpirit : QuickMaterial + public class VengefulSpirit : BaseMaterial { private static LocalizedText DropConditionText; public override void Load() diff --git a/Content/Items/Haunted/Weapons.EchochainWhip.cs b/Content/Items/Haunted/Weapons.EchochainWhip.cs index ab0d6888e..89fccd555 100644 --- a/Content/Items/Haunted/Weapons.EchochainWhip.cs +++ b/Content/Items/Haunted/Weapons.EchochainWhip.cs @@ -1,4 +1,5 @@ using ReLogic.Content; +using StarlightRiver.Content.Items.BaseTypes.Weapons; using StarlightRiver.Core.Loaders; using StarlightRiver.Core.Systems.CameraSystem; using StarlightRiver.Helpers; diff --git a/Content/Items/Haunted/Weapons.SpiritSeal.cs b/Content/Items/Haunted/Weapons.SpiritSeal.cs index 2b70c6d60..6ee13512f 100644 --- a/Content/Items/Haunted/Weapons.SpiritSeal.cs +++ b/Content/Items/Haunted/Weapons.SpiritSeal.cs @@ -1,5 +1,5 @@ using StarlightRiver.Content.Buffs; -using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Content.Items.BaseTypes.Weapons; using StarlightRiver.Content.Items.Misc; using StarlightRiver.Core.Systems.InstancedBuffSystem; using System; diff --git a/Content/Items/Infernal/InfernalCatalyst.cs b/Content/Items/Infernal/InfernalCatalyst.cs index 590445e4a..a6b49fb3e 100644 --- a/Content/Items/Infernal/InfernalCatalyst.cs +++ b/Content/Items/Infernal/InfernalCatalyst.cs @@ -1,11 +1,12 @@ -using StarlightRiver.Content.NPCs.Actors; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Content.NPCs.Actors; using System; using Terraria.GameContent.ItemDropRules; using Terraria.ID; namespace StarlightRiver.Content.Items.Infernal { - internal class InfernalCatalyst : QuickMaterial + internal class InfernalCatalyst : BaseMaterial { bool canTransform = true; diff --git a/Content/Items/Jungle/Accessories.Slitherring.cs b/Content/Items/Jungle/Accessories.Slitherring.cs index 57495730a..414874723 100644 --- a/Content/Items/Jungle/Accessories.Slitherring.cs +++ b/Content/Items/Jungle/Accessories.Slitherring.cs @@ -1,5 +1,6 @@ using ReLogic.Content; using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Content.Items.BaseTypes.Weapons; using System.Collections.Generic; using Terraria.DataStructures; using Terraria.GameContent; diff --git a/Content/Items/Magnet/Weapons.ThunderBeads.cs b/Content/Items/Magnet/Weapons.ThunderBeads.cs index de651b68d..fe79d6463 100644 --- a/Content/Items/Magnet/Weapons.ThunderBeads.cs +++ b/Content/Items/Magnet/Weapons.ThunderBeads.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Dusts; +using StarlightRiver.Content.Items.BaseTypes.Weapons; using StarlightRiver.Core.Loaders; using StarlightRiver.Helpers; using System.Collections.Generic; diff --git a/Content/Items/Misc/Materials.DullBlade.cs b/Content/Items/Misc/Materials.DullBlade.cs index 54d523f52..99b909079 100644 --- a/Content/Items/Misc/Materials.DullBlade.cs +++ b/Content/Items/Misc/Materials.DullBlade.cs @@ -1,8 +1,9 @@ -using Terraria.ID; +using StarlightRiver.Content.Items.BaseTypes; +using Terraria.ID; namespace StarlightRiver.Content.Items.Misc { - public class DullBlade : QuickMaterial + public class DullBlade : BaseMaterial { public override string Texture => AssetDirectory.MiscItem + Name; diff --git a/Content/Items/Misc/Materials.StaminaGel.cs b/Content/Items/Misc/Materials.StaminaGel.cs index 21ef0bb08..8d96d0584 100644 --- a/Content/Items/Misc/Materials.StaminaGel.cs +++ b/Content/Items/Misc/Materials.StaminaGel.cs @@ -1,6 +1,8 @@ -namespace StarlightRiver.Content.Items.Misc +using StarlightRiver.Content.Items.BaseTypes; + +namespace StarlightRiver.Content.Items.Misc { - public class StaminaGel : QuickMaterial + public class StaminaGel : BaseMaterial { public StaminaGel() : base("Starlight Gel", "", 999, 100, 2, AssetDirectory.MiscItem) { } } diff --git a/Content/Items/Misc/Materials.TarnishedRing.cs b/Content/Items/Misc/Materials.TarnishedRing.cs index 56333035e..ab24cb219 100644 --- a/Content/Items/Misc/Materials.TarnishedRing.cs +++ b/Content/Items/Misc/Materials.TarnishedRing.cs @@ -1,8 +1,9 @@ -using Terraria.ID; +using StarlightRiver.Content.Items.BaseTypes; +using Terraria.ID; namespace StarlightRiver.Content.Items.Misc { - public class TarnishedRing : QuickMaterial + public class TarnishedRing : BaseMaterial { public override string Texture => AssetDirectory.MiscItem + Name; diff --git a/Content/Items/Misc/SoilgunFiles/Weapons.Soilgun.cs b/Content/Items/Misc/SoilgunFiles/Weapons.Soilgun.cs index b141468e9..c5032948d 100644 --- a/Content/Items/Misc/SoilgunFiles/Weapons.Soilgun.cs +++ b/Content/Items/Misc/SoilgunFiles/Weapons.Soilgun.cs @@ -1,6 +1,6 @@ using Microsoft.Xna.Framework.Graphics; using StarlightRiver.Content.Dusts; -using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Content.Items.BaseTypes.Weapons; using StarlightRiver.Content.Items.Vitric; using StarlightRiver.Core.Systems.CameraSystem; using StarlightRiver.Helpers; diff --git a/Content/Items/Misc/Weapons.CopperCoil.cs b/Content/Items/Misc/Weapons.CopperCoil.cs index 135394169..f7217b209 100644 --- a/Content/Items/Misc/Weapons.CopperCoil.cs +++ b/Content/Items/Misc/Weapons.CopperCoil.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using StarlightRiver.Content.Items.BaseTypes.Weapons; +using System.Collections.Generic; using System.Linq; using Terraria.DataStructures; using Terraria.GameContent.Creative; diff --git a/Content/Items/Misc/Weapons.Earthduster.cs b/Content/Items/Misc/Weapons.Earthduster.cs index bd493b394..4e505f34f 100644 --- a/Content/Items/Misc/Weapons.Earthduster.cs +++ b/Content/Items/Misc/Weapons.Earthduster.cs @@ -1,7 +1,7 @@ using Microsoft.Xna.Framework.Graphics; using StarlightRiver.Content.Buffs; using StarlightRiver.Content.Dusts; -using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Content.Items.BaseTypes.Weapons; using StarlightRiver.Content.Items.Misc.SoilgunFiles; using StarlightRiver.Content.Items.UndergroundTemple; using StarlightRiver.Content.Items.Vitric; diff --git a/Content/Items/Misc/Weapons.Sling.cs b/Content/Items/Misc/Weapons.Sling.cs index 7ed77c108..3847b2118 100644 --- a/Content/Items/Misc/Weapons.Sling.cs +++ b/Content/Items/Misc/Weapons.Sling.cs @@ -1,4 +1,4 @@ -using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Content.Items.BaseTypes.Weapons; using StarlightRiver.Core.Systems.CameraSystem; using StarlightRiver.Helpers; using System.Collections.Generic; diff --git a/Content/Items/Misc/Weapons.Talismans.cs b/Content/Items/Misc/Weapons.Talismans.cs index 378d48a79..9eafd3277 100644 --- a/Content/Items/Misc/Weapons.Talismans.cs +++ b/Content/Items/Misc/Weapons.Talismans.cs @@ -1,4 +1,4 @@ -using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Content.Items.BaseTypes.Weapons; using StarlightRiver.Core.Systems.InstancedBuffSystem; using System; using System.Collections.Generic; diff --git a/Content/Items/Misc/Weapons.TinCoil.cs b/Content/Items/Misc/Weapons.TinCoil.cs index dd3d6f208..ce5060221 100644 --- a/Content/Items/Misc/Weapons.TinCoil.cs +++ b/Content/Items/Misc/Weapons.TinCoil.cs @@ -1,4 +1,5 @@ -using System.Linq; +using StarlightRiver.Content.Items.BaseTypes.Weapons; +using System.Linq; using Terraria.DataStructures; using Terraria.GameContent.Creative; using Terraria.ID; diff --git a/Content/Items/Moonstone/Armors.Datsuzei.cs b/Content/Items/Moonstone/Armors.Datsuzei.cs index 9a67d1550..8282e4e5b 100644 --- a/Content/Items/Moonstone/Armors.Datsuzei.cs +++ b/Content/Items/Moonstone/Armors.Datsuzei.cs @@ -13,7 +13,7 @@ namespace StarlightRiver.Content.Items.Moonstone { - public class Datsuzei : InworldItem + public class Datsuzei : ModItem { public static int activationTimer = 0; //static since this is clientside only and there really shouldnt ever be more than one of these in that context public int comboState = 0; @@ -22,12 +22,14 @@ public class Datsuzei : InworldItem public override string Texture => AssetDirectory.MoonstoneItem + Name; - public override bool VisibleInUI => false; - public override void Load() { StarlightPlayer.PostUpdateEvent += PlayerFrame; On_Main.DrawInterface_30_Hotbar += OverrideHotbar; + + On_Player.dropItemCheck += DontDropSpecialItem; + Terraria.UI.On_ItemSlot.LeftClick_ItemArray_int_int += LockMouseToSpecialItem; + activationTimer = 0; sparkles = new ParticleSystem(AssetDirectory.Dust + "Aurora", updateSparkles, ParticleSystem.AnchorOptions.UI); } @@ -61,6 +63,18 @@ public override void SetDefaults() Item.crit = 10; } + private void LockMouseToSpecialItem(Terraria.UI.On_ItemSlot.orig_LeftClick_ItemArray_int_int orig, Item[] inv, int context, int slot) + { + if (!(Main.mouseItem.ModItem is Datsuzei && !Main.mouseItem.IsAir)) + orig(inv, context, slot); + } + + private void DontDropSpecialItem(On_Player.orig_dropItemCheck orig, Terraria.Player self) + { + if (!(Main.mouseItem.ModItem is Datsuzei && !Main.mouseItem.IsAir)) + orig(self); + } + private void OverrideHotbar(On_Main.orig_DrawInterface_30_Hotbar orig, Main self) { orig(self); diff --git a/Content/Items/Moonstone/Armors.MoonstoneArmor.cs b/Content/Items/Moonstone/Armors.MoonstoneArmor.cs index 7caafe80f..67cb80b43 100644 --- a/Content/Items/Moonstone/Armors.MoonstoneArmor.cs +++ b/Content/Items/Moonstone/Armors.MoonstoneArmor.cs @@ -1,7 +1,7 @@ using NetEasy; -using StarlightRiver.Content.CustomHooks; using StarlightRiver.Content.GUI; using StarlightRiver.Core.Loaders; +using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.BarrierSystem; using StarlightRiver.Core.Systems.PixelationSystem; using System; @@ -219,7 +219,7 @@ public override void ModifyTooltips(List tooltips) private void DrawMoonCharge(Player Player, SpriteBatch spriteBatch) { - if (IsArmorSet(Player) && !Player.dead && PlayerTarget.canUseTarget) + if (IsArmorSet(Player) && !Player.dead && PlayerTargetSystem.canUseTarget) { Texture2D texRing = Assets.Misc.Gauge.Value; Vector2 pos = Player.MountedCenter + new Vector2(0, -16 + MathF.Sin(Main.GameUpdateCount * 0.05f) * 4) + Vector2.UnitY * Player.gfxOffY - Main.screenPosition; diff --git a/Content/Items/Moonstone/Materials.Moonstone.cs b/Content/Items/Moonstone/Materials.Moonstone.cs index bf23c9acb..c91d95362 100644 --- a/Content/Items/Moonstone/Materials.Moonstone.cs +++ b/Content/Items/Moonstone/Materials.Moonstone.cs @@ -1,9 +1,10 @@ -using Terraria.ID; +using StarlightRiver.Content.Items.BaseTypes; +using Terraria.ID; using static Terraria.ModLoader.ModContent; namespace StarlightRiver.Content.Items.Moonstone { - public class MoonstoneOreItem : QuickTileItem + public class MoonstoneOreItem : BaseTileItem { public MoonstoneOreItem() : base("Moonstone", "", "MoonstoneOre", ItemRarityID.Blue, AssetDirectory.MoonstoneItem) { } @@ -13,7 +14,7 @@ public override void SafeSetDefaults() } } - public class MoonstoneBarItem : QuickTileItem + public class MoonstoneBarItem : BaseTileItem { public MoonstoneBarItem() : base("Moonstone Bar", "'Shimmering with twisted starlight'", "MoonstoneBar", ItemRarityID.White, AssetDirectory.MoonstoneItem) { } //TODO: Fix place type diff --git a/Content/Items/Permafrost/AuroraThroneMountWhip.cs b/Content/Items/Permafrost/AuroraThroneMountWhip.cs index 8879d288e..0a6042c9c 100644 --- a/Content/Items/Permafrost/AuroraThroneMountWhip.cs +++ b/Content/Items/Permafrost/AuroraThroneMountWhip.cs @@ -1,4 +1,5 @@ -using System; +using StarlightRiver.Content.Items.BaseTypes.Weapons; +using System; using System.Collections.Generic; using Terraria.Audio; using Terraria.ID; diff --git a/Content/Items/Permafrost/Materials.AuroraIce.cs b/Content/Items/Permafrost/Materials.AuroraIce.cs index 9f3dfaf3f..347d6d0a9 100644 --- a/Content/Items/Permafrost/Materials.AuroraIce.cs +++ b/Content/Items/Permafrost/Materials.AuroraIce.cs @@ -1,10 +1,11 @@ -using System; +using StarlightRiver.Content.Items.BaseTypes; +using System; using Terraria.GameContent; using Terraria.ID; namespace StarlightRiver.Content.Items.Permafrost { - class AuroraIceItem : QuickMaterial + class AuroraIceItem : BaseMaterial { public override string Texture => "StarlightRiver/Assets/Tiles/Permafrost/AuroraIceItem"; @@ -61,7 +62,7 @@ public override void UpdateInventory(Player player) } } - class AuroraIceBar : QuickMaterial + class AuroraIceBar : BaseMaterial { public override string Texture => "StarlightRiver/Assets/Tiles/Permafrost/AuroraIceBar"; diff --git a/Content/Items/Snow/Weapons.FrostFlail.cs b/Content/Items/Snow/Weapons.FrostFlail.cs index 3cb4e1a89..1403e587f 100644 --- a/Content/Items/Snow/Weapons.FrostFlail.cs +++ b/Content/Items/Snow/Weapons.FrostFlail.cs @@ -1,4 +1,4 @@ -using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Content.Items.BaseTypes.Weapons; using StarlightRiver.Content.Items.Forest; using StarlightRiver.Content.Tiles.Misc; using StarlightRiver.Core.Systems.CameraSystem; @@ -11,7 +11,7 @@ namespace StarlightRiver.Content.Items.Snow { - internal class FrostFlail : AbstractHeavyFlail + internal class FrostFlail : BaseHeavyFlail { public override string Texture => AssetDirectory.SnowItem + Name; @@ -40,7 +40,7 @@ public override void AddRecipes() } } - internal class FrostFlailProjectile : AbstractHeavyFlailProjectile + internal class FrostFlailProjectile : BaseHeavyFlailProjectile { public override string Texture => AssetDirectory.SnowItem + Name; diff --git a/Content/Items/Starwood/Materials.DormantScepter.cs b/Content/Items/Starwood/Materials.DormantScepter.cs index 38e8c4847..f7d7a9003 100644 --- a/Content/Items/Starwood/Materials.DormantScepter.cs +++ b/Content/Items/Starwood/Materials.DormantScepter.cs @@ -1,9 +1,10 @@ -using StarlightRiver.Core.Systems.ChestLootSystem; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Core.Systems.ChestLootSystem; using Terraria.ID; namespace StarlightRiver.Content.Items.Starwood { - public class DormantScepter : QuickMaterial + public class DormantScepter : BaseMaterial { public DormantScepter() : base("Dormant Scepter", "The scepter lies dormant, waning for mystical energy", 1, Item.sellPrice(silver: 2), ItemRarityID.Gray, AssetDirectory.StarwoodItem + "StarwoodScepterDormant", true) { } } diff --git a/Content/Items/SteampunkSet/Materials.AncientGear.cs b/Content/Items/SteampunkSet/Materials.AncientGear.cs index 8b21a1641..963e687ed 100644 --- a/Content/Items/SteampunkSet/Materials.AncientGear.cs +++ b/Content/Items/SteampunkSet/Materials.AncientGear.cs @@ -1,8 +1,9 @@ -using Terraria.ID; +using StarlightRiver.Content.Items.BaseTypes; +using Terraria.ID; namespace StarlightRiver.Content.Items.SteampunkSet { - public class AncientGear : QuickMaterial + public class AncientGear : BaseMaterial { public AncientGear() : base("Ancient Gear", "", 999, 200, 2, AssetDirectory.SteampunkItem) { } diff --git a/Content/Items/Underground/UndergroundMaterials.cs b/Content/Items/Underground/UndergroundMaterials.cs index e5c0957b0..dd04d2470 100644 --- a/Content/Items/Underground/UndergroundMaterials.cs +++ b/Content/Items/Underground/UndergroundMaterials.cs @@ -1,4 +1,5 @@ -using System; +using StarlightRiver.Content.Items.BaseTypes; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,7 +7,7 @@ namespace StarlightRiver.Content.Items.Underground { - public class GloomGel : QuickMaterial + public class GloomGel : BaseMaterial { public override string Texture => "StarlightRiver/Assets/Items/Underground/GloomGel"; diff --git a/Content/Items/Utility/CursedDrop.cs b/Content/Items/Utility/CursedDrop.cs index becc2e054..34bd2077d 100644 --- a/Content/Items/Utility/CursedDrop.cs +++ b/Content/Items/Utility/CursedDrop.cs @@ -98,7 +98,7 @@ public override void RightClick(Item item, Player player) SoundEngine.PlaySound(SoundID.Item123.WithPitchOffset(0.2f)); for (int k = 0; k <= 50; k++) - CursedAccessoryParticleManager.CursedSystem.AddParticle(Main.MouseScreen, Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(0.75f), 0, 1, new(25, 17, 49, 0), 60, Vector2.Zero, alpha: 0); + CursedAccessorySystem.CursedSystem.AddParticle(Main.MouseScreen, Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(0.75f), 0, 1, new(25, 17, 49, 0), 60, Vector2.Zero, alpha: 0); Main.mouseItem.stack--; diff --git a/Content/Items/Utility/MeteorForcer.cs b/Content/Items/Utility/MeteorForcer.cs index 3bca62baf..3ecb2b66c 100644 --- a/Content/Items/Utility/MeteorForcer.cs +++ b/Content/Items/Utility/MeteorForcer.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Content.CustomHooks; +using StarlightRiver.Content.Biomes; +using StarlightRiver.Content.CustomHooks; using Terraria.ID; namespace StarlightRiver.Content.Items.Utility @@ -25,8 +26,8 @@ public override void SetDefaults() public override bool? UseItem(Player player) { - ModContent.GetInstance().meteorForced = true; - ModContent.GetInstance().moonstoneForced = false; + ModContent.GetInstance().meteorForced = true; + ModContent.GetInstance().moonstoneForced = false; Main.NewText("A meteor is bound to fall next...", new Color(215, 120, 50)); diff --git a/Content/Items/Utility/MoonstoneForcer.cs b/Content/Items/Utility/MoonstoneForcer.cs index 4550a074b..d85b6ea12 100644 --- a/Content/Items/Utility/MoonstoneForcer.cs +++ b/Content/Items/Utility/MoonstoneForcer.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Content.CustomHooks; +using StarlightRiver.Content.Biomes; +using StarlightRiver.Content.CustomHooks; using Terraria.ID; namespace StarlightRiver.Content.Items.Utility @@ -25,8 +26,8 @@ public override void SetDefaults() public override bool? UseItem(Player player) { - ModContent.GetInstance().meteorForced = false; - ModContent.GetInstance().moonstoneForced = true; + ModContent.GetInstance().meteorForced = false; + ModContent.GetInstance().moonstoneForced = true; Main.NewText("A moonstone is bound to fall next...", new Color(80, 150, 250)); diff --git a/Content/Items/Vitric/Materials.VitricMaterial.cs b/Content/Items/Vitric/Materials.VitricMaterial.cs index 806d0357f..99026243b 100644 --- a/Content/Items/Vitric/Materials.VitricMaterial.cs +++ b/Content/Items/Vitric/Materials.VitricMaterial.cs @@ -1,20 +1,22 @@ -namespace StarlightRiver.Content.Items.Vitric +using StarlightRiver.Content.Items.BaseTypes; + +namespace StarlightRiver.Content.Items.Vitric { - public class VitricOre : QuickMaterial + public class VitricOre : BaseMaterial { public override string Texture => AssetDirectory.VitricItem + Name; public VitricOre() : base("Vitric Shard", "", 999, 500, 2) { } } - public class SandstoneChunk : QuickMaterial + public class SandstoneChunk : BaseMaterial { public override string Texture => AssetDirectory.VitricItem + Name; public SandstoneChunk() : base("Ancient Ceramic", "", 999, 200, 2) { } } - public class MagmaCore : QuickMaterial + public class MagmaCore : BaseMaterial { public override string Texture => AssetDirectory.VitricItem + Name; diff --git a/Content/Items/Vitric/Misc.TempleEntranceKey.cs b/Content/Items/Vitric/Misc.TempleEntranceKey.cs index b23bd213d..6230fd80b 100644 --- a/Content/Items/Vitric/Misc.TempleEntranceKey.cs +++ b/Content/Items/Vitric/Misc.TempleEntranceKey.cs @@ -1,6 +1,8 @@ -namespace StarlightRiver.Content.Items.Vitric +using StarlightRiver.Content.Items.BaseTypes; + +namespace StarlightRiver.Content.Items.Vitric { - public class TempleEntranceKey : QuickMaterial + public class TempleEntranceKey : BaseMaterial { public override string Texture => AssetDirectory.VitricItem + Name; diff --git a/Content/Items/Vitric/Misc.TempleKey.cs b/Content/Items/Vitric/Misc.TempleKey.cs index d5090d46f..8ac00478d 100644 --- a/Content/Items/Vitric/Misc.TempleKey.cs +++ b/Content/Items/Vitric/Misc.TempleKey.cs @@ -1,6 +1,8 @@ -namespace StarlightRiver.Content.Items.Vitric +using StarlightRiver.Content.Items.BaseTypes; + +namespace StarlightRiver.Content.Items.Vitric { - public class TempleKey : QuickMaterial + public class TempleKey : BaseMaterial { public override string Texture => AssetDirectory.VitricItem + Name; diff --git a/Content/NPCs/Vitric/CoolmitePassive.cs b/Content/NPCs/Vitric/CoolmitePassive.cs index 7c33bcbd4..0172c5871 100644 --- a/Content/NPCs/Vitric/CoolmitePassive.cs +++ b/Content/NPCs/Vitric/CoolmitePassive.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Abilities; +using StarlightRiver.Content.Items.BaseTypes; using System.IO; using Terraria.Audio; using Terraria.GameContent.Bestiary; @@ -121,7 +122,7 @@ public override void HitEffect(NPC.HitInfo hit) } } - internal class CoolmitePassiveItem : QuickCritterItem + internal class CoolmitePassiveItem : BaseCritterItem { public CoolmitePassiveItem() : base("Coolmite", "Fragile! Please handle with care.", Item.sellPrice(silver: 15), ItemRarityID.Orange, NPCType(), AssetDirectory.VitricItem) { } } diff --git a/Content/NPCs/Vitric/CoolmiteVariants.cs b/Content/NPCs/Vitric/CoolmiteVariants.cs index 73919b56a..de40273c1 100644 --- a/Content/NPCs/Vitric/CoolmiteVariants.cs +++ b/Content/NPCs/Vitric/CoolmiteVariants.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Abilities; +using StarlightRiver.Content.Items.BaseTypes; using System; using System.IO; using Terraria.Audio; @@ -195,12 +196,12 @@ public override void OnKill() } } - internal class CoolmiteSmolItem : QuickCritterItem + internal class CoolmiteSmolItem : BaseCritterItem { public CoolmiteSmolItem() : base("Coolmini", "Sharp edges! Watch your fingers.", Item.sellPrice(silver: 5), ItemRarityID.Orange, NPCType(), AssetDirectory.VitricItem) { } } - internal class CoolmiteLargeItem : QuickCritterItem + internal class CoolmiteLargeItem : BaseCritterItem { public CoolmiteLargeItem() : base("Coolmismer", "High intensity beauty! Avoid eye and skin exposure.", Item.sellPrice(silver: 25), ItemRarityID.Orange, NPCType(), AssetDirectory.VitricItem) { } } diff --git a/Content/NPCs/Vitric/MagmitePassive.cs b/Content/NPCs/Vitric/MagmitePassive.cs index b113a8999..6d1acef1a 100644 --- a/Content/NPCs/Vitric/MagmitePassive.cs +++ b/Content/NPCs/Vitric/MagmitePassive.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Abilities; +using StarlightRiver.Content.Items.BaseTypes; using System; using System.IO; using Terraria.Audio; @@ -334,7 +335,7 @@ public override bool Update(Gore gore) } } - internal class MagmitePassiveItem : QuickCritterItem + internal class MagmitePassiveItem : BaseCritterItem { public MagmitePassiveItem() : base("Magmite", "Release him!", Item.sellPrice(silver: 15), ItemRarityID.Orange, NPCType(), AssetDirectory.VitricItem) { } } diff --git a/Content/NPCs/Vitric/MagmiteVariants.cs b/Content/NPCs/Vitric/MagmiteVariants.cs index f627f6172..9756360af 100644 --- a/Content/NPCs/Vitric/MagmiteVariants.cs +++ b/Content/NPCs/Vitric/MagmiteVariants.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Abilities; +using StarlightRiver.Content.Items.BaseTypes; using System; using System.IO; using Terraria.Audio; @@ -195,12 +196,12 @@ public override void OnKill() } } - internal class MagmiteSmolItem : QuickCritterItem + internal class MagmiteSmolItem : BaseCritterItem { public MagmiteSmolItem() : base("Magmini", "Nurture him!", Item.sellPrice(silver: 5), ItemRarityID.Orange, NPCType(), AssetDirectory.VitricItem) { } } - internal class MagmiteLargeItem : QuickCritterItem + internal class MagmiteLargeItem : BaseCritterItem { public MagmiteLargeItem() : base("Magmificent", "Admire him!", Item.sellPrice(silver: 25), ItemRarityID.Orange, NPCType(), AssetDirectory.VitricItem) { } } diff --git a/Content/Pickups/FaeflamePickup.cs b/Content/Pickups/FaeflamePickup.cs index 305603af0..59b00a196 100644 --- a/Content/Pickups/FaeflamePickup.cs +++ b/Content/Pickups/FaeflamePickup.cs @@ -1,5 +1,6 @@ using StarlightRiver.Content.Abilities; using StarlightRiver.Content.Abilities.Faewhip; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.DummyTileSystem; using System; @@ -59,7 +60,7 @@ public class FaeflamePickupTile : DummyTile } [SLRDebug] - public class FaeflameTileItem : QuickTileItem + public class FaeflameTileItem : BaseTileItem { public FaeflameTileItem() : base("Faeflame", "{{Debug}} placer for ability pickup", "FaeflamePickupTile", -1) { } diff --git a/Content/Pickups/ForbiddenWindsPickup.cs b/Content/Pickups/ForbiddenWindsPickup.cs index 75fc93838..58b4ef280 100644 --- a/Content/Pickups/ForbiddenWindsPickup.cs +++ b/Content/Pickups/ForbiddenWindsPickup.cs @@ -2,6 +2,7 @@ using StarlightRiver.Content.Abilities.ForbiddenWinds; using StarlightRiver.Content.Abilities.Hint; using StarlightRiver.Content.GUI; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Content.Tiles.Overgrow; using StarlightRiver.Core.Loaders; using StarlightRiver.Core.Loaders.UILoading; @@ -300,7 +301,7 @@ public class ForbiddenWindsPickupTile : DummyTile } [SLRDebug] - public class WindsTileItem : QuickTileItem + public class WindsTileItem : BaseTileItem { public WindsTileItem() : base("Forbidden Winds", "{{Debug}} placer for ability pickup", "ForbiddenWindsPickupTile", -1) { } diff --git a/Content/Pickups/StaminaShard.cs b/Content/Pickups/StaminaShard.cs index 339ea476b..2f20ad6cc 100644 --- a/Content/Pickups/StaminaShard.cs +++ b/Content/Pickups/StaminaShard.cs @@ -1,5 +1,6 @@ using StarlightRiver.Content.Abilities; using StarlightRiver.Content.GUI; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Content.Tiles.Overgrow; using StarlightRiver.Core.Loaders.UILoading; using StarlightRiver.Core.Systems; @@ -128,7 +129,7 @@ public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, } [SLRDebug] - class StaminaShardTileItem : QuickTileItem + class StaminaShardTileItem : BaseTileItem { public override string Texture => "StarlightRiver/Assets/Abilities/Stamina1"; diff --git a/Content/Pickups/StarsightPickup.cs b/Content/Pickups/StarsightPickup.cs index 635bf1d38..02efbd188 100644 --- a/Content/Pickups/StarsightPickup.cs +++ b/Content/Pickups/StarsightPickup.cs @@ -2,6 +2,7 @@ using StarlightRiver.Content.Abilities.Faewhip; using StarlightRiver.Content.Abilities.Hint; using StarlightRiver.Content.GUI; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Content.NPCs.Starlight; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.DummyTileSystem; @@ -76,7 +77,7 @@ public class StarsightPickupTile : DummyTile } [SLRDebug] - public class StarsightTileItem : QuickTileItem + public class StarsightTileItem : BaseTileItem { public StarsightTileItem() : base("Starsight", "{{Debug}} placer for ability pickup", "StarsightPickupTile", -1) { } diff --git a/Content/Tiles/Crafting/CookStation.cs b/Content/Tiles/Crafting/CookStation.cs index 6721e54cd..e208eb160 100644 --- a/Content/Tiles/Crafting/CookStation.cs +++ b/Content/Tiles/Crafting/CookStation.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.GUI; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Content.Items.Utility; using System.Linq; using Terraria.DataStructures; @@ -63,7 +64,7 @@ public override bool RightClick(int i, int j) } } - public class CookStationItem : QuickTileItem + public class CookStationItem : BaseTileItem { public CookStationItem() : base("Prep Station", " to prepare meals", "CookStation", 0, AssetDirectory.CraftingTile) { } diff --git a/Content/Tiles/Desert/AnkhChest.cs b/Content/Tiles/Desert/AnkhChest.cs index aca413eec..860250e3d 100644 --- a/Content/Tiles/Desert/AnkhChest.cs +++ b/Content/Tiles/Desert/AnkhChest.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Abilities; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems.DummyTileSystem; using StarlightRiver.Helpers; using Terraria.Audio; @@ -283,7 +284,7 @@ public override void PostDraw(Color lightColor) } } - class AnkhChestItem : QuickTileItem + class AnkhChestItem : BaseTileItem { public AnkhChestItem() : base("Ankh Chest", "", "AnkhChest", 1, AssetDirectory.DesertTile, false) { } } diff --git a/Content/Tiles/Desert/DesertMonolith.cs b/Content/Tiles/Desert/DesertMonolith.cs index d894c3787..17fedde0c 100644 --- a/Content/Tiles/Desert/DesertMonolith.cs +++ b/Content/Tiles/Desert/DesertMonolith.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Abilities; +using StarlightRiver.Content.Items.BaseTypes; using Terraria.DataStructures; using Terraria.Enums; using Terraria.ID; @@ -103,7 +104,7 @@ public void FrameMonolith(int x, int y, int i, int j) } } - internal class DesertMonolithItem : QuickTileItem + internal class DesertMonolithItem : BaseTileItem { public override string Texture => AssetDirectory.DesertTile + Name; @@ -130,7 +131,7 @@ public override void SetStaticDefaults() } } - internal class DesertMonolithFlippedItem : QuickTileItem + internal class DesertMonolithFlippedItem : BaseTileItem { public override string Texture => AssetDirectory.DesertTile + Name; diff --git a/Content/Tiles/Forest/CommonVegetables.cs b/Content/Tiles/Forest/CommonVegetables.cs index e9680c414..3cfbd6aa2 100644 --- a/Content/Tiles/Forest/CommonVegetables.cs +++ b/Content/Tiles/Forest/CommonVegetables.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Content.Items.Food; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Content.Items.Food; using StarlightRiver.Content.Packets; using Terraria.DataStructures; using Terraria.Enums; @@ -71,7 +72,7 @@ public override void KillMultiTile(int i, int j, int frameX, int frameY) } } - public class CommonVegetablesItem : QuickTileItem + public class CommonVegetablesItem : BaseTileItem { public CommonVegetablesItem() : base("Common Vegetable Seeds", "Plant to grow your own veggies", "CommonVegetables", 1, AssetDirectory.ForestTile) { } } diff --git a/Content/Tiles/Forest/ForestBerryBush.cs b/Content/Tiles/Forest/ForestBerryBush.cs index a383831eb..6a230788e 100644 --- a/Content/Tiles/Forest/ForestBerryBush.cs +++ b/Content/Tiles/Forest/ForestBerryBush.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Content.Packets; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Content.Packets; using Terraria.DataStructures; using Terraria.Enums; using Terraria.ID; @@ -134,7 +135,7 @@ public override void AddRecipes() } } - public class ForestBerryBushItem : QuickTileItem + public class ForestBerryBushItem : BaseTileItem { public ForestBerryBushItem() : base("Berry Bush", "Plant to grow your own berries", "ForestBerryBush", 1, AssetDirectory.ForestTile) { } } diff --git a/Content/Tiles/Forest/LeafWall.cs b/Content/Tiles/Forest/LeafWall.cs index a4bbdb4cf..0c11606fe 100644 --- a/Content/Tiles/Forest/LeafWall.cs +++ b/Content/Tiles/Forest/LeafWall.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Helpers; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Helpers; using System; using Terraria.ID; using static Terraria.ModLoader.ModContent; @@ -71,7 +72,7 @@ public override void RandomUpdate(int i, int j) } } - public class LeafWallItem : QuickWallItem + public class LeafWallItem : BaseWallItem { public override string Texture => AssetDirectory.ForestTile + Name; diff --git a/Content/Tiles/Forest/SlimeberryBush.cs b/Content/Tiles/Forest/SlimeberryBush.cs index 93e67a488..0adda6bf4 100644 --- a/Content/Tiles/Forest/SlimeberryBush.cs +++ b/Content/Tiles/Forest/SlimeberryBush.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Content.Packets; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Content.Packets; using Terraria.DataStructures; using Terraria.Enums; using Terraria.GameContent.ItemDropRules; @@ -114,12 +115,12 @@ public override void KillMultiTile(int i, int j, int frameX, int frameY) } } - public class Slimeberry : QuickMaterial + public class Slimeberry : BaseMaterial { public Slimeberry() : base("Slimeberry", "Ew.", 99, 1, ItemRarityID.Blue, AssetDirectory.ForestTile) { } } - public class SlimeberryBushItem : QuickTileItem + public class SlimeberryBushItem : BaseTileItem { public SlimeberryBushItem() : base("Slimeberry Bush", "Places a slimeberry bush", "SlimeberryBush", ItemRarityID.Blue, AssetDirectory.ForestTile) { } } diff --git a/Content/Tiles/Forest/ThickTreeSapling.cs b/Content/Tiles/Forest/ThickTreeSapling.cs index 95f455738..a939b4cc6 100644 --- a/Content/Tiles/Forest/ThickTreeSapling.cs +++ b/Content/Tiles/Forest/ThickTreeSapling.cs @@ -1,3 +1,4 @@ +using StarlightRiver.Content.Items.BaseTypes; using Terraria.DataStructures; using Terraria.ID; using Terraria.ObjectData; @@ -79,7 +80,7 @@ public override void NumDust(int i, int j, bool fail, ref int num) } } - class ThickTreeAcorn : QuickTileItem + class ThickTreeAcorn : BaseTileItem { public ThickTreeAcorn() : base("Large Acorn", "", "ThickTreeSapling", 1, AssetDirectory.ForestTile, false, ItemValue: Item.buyPrice(silver: 50)) diff --git a/Content/Tiles/Herbology/Crops/Crops.cs b/Content/Tiles/Herbology/Crops/Crops.cs index 0146e8e8c..587609699 100644 --- a/Content/Tiles/Herbology/Crops/Crops.cs +++ b/Content/Tiles/Herbology/Crops/Crops.cs @@ -1,4 +1,5 @@ -using System; +using StarlightRiver.Content.Items.BaseTypes; +using System; using System.Collections.Generic; using Terraria.Audio; using Terraria.DataStructures; @@ -191,7 +192,7 @@ public override int GrowthPercentChance(int i, int j) return 0; } } - public class Rice : QuickTileItem + public class Rice : BaseTileItem { public Rice() : base("Rice", " ", "TallRice", ItemRarityID.White, AssetDirectory.HerbologyCropTile) { } } @@ -200,7 +201,7 @@ public class TallGoldenRice : Crop { public TallGoldenRice() : base("GoldenRice", "Golden Rice", AssetDirectory.HerbologyCropTile, 4) { } } - public class GoldenRice : QuickTileItem + public class GoldenRice : BaseTileItem { public GoldenRice() : base("Golden Rice", " ", "TallGoldenRice", ItemRarityID.Orange, AssetDirectory.HerbologyCropTile) { } } @@ -209,7 +210,7 @@ public class TallAncientFruit : Crop { public TallAncientFruit() : base("AncientFruit", "Ancient Fruit", AssetDirectory.HerbologyCropTile, 6) { } } - public class AncientFruit : QuickTileItem + public class AncientFruit : BaseTileItem { public AncientFruit() : base("Ancient Fruit", " ", "TallAncientFruit", ItemRarityID.Orange, AssetDirectory.HerbologyCropTile) { } } diff --git a/Content/Tiles/Herbology/GreenhouseGlass.cs b/Content/Tiles/Herbology/GreenhouseGlass.cs index 8134cfb9a..a32e7d648 100644 --- a/Content/Tiles/Herbology/GreenhouseGlass.cs +++ b/Content/Tiles/Herbology/GreenhouseGlass.cs @@ -1,3 +1,4 @@ +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Content.Items.Moonstone; using Terraria.ID; @@ -224,7 +225,7 @@ public void GrowVanillaPlant(int i, int j) } } - public class GreenhouseGlassItem : QuickTileItem + public class GreenhouseGlassItem : BaseTileItem { public GreenhouseGlassItem() : base("Greenhouse Glass", "Speeds up the growth of any plant below it\nNeeds a 10 blocks of clear area or transparent blocks above it", "GreenhouseGlass", 1, AssetDirectory.HerbologyTile) { } @@ -254,7 +255,7 @@ public override void SetStaticDefaults() } } - public class GreenhouseWallItem : QuickWallItem + public class GreenhouseWallItem : BaseWallItem { public GreenhouseWallItem() : base("Greenhouse Glass Wall", "Fancy!", ModContent.WallType(), 0, AssetDirectory.HerbologyTile) { } diff --git a/Content/Tiles/Interactive/Bounce.cs b/Content/Tiles/Interactive/Bounce.cs index d59dcbda9..8d327d0a9 100644 --- a/Content/Tiles/Interactive/Bounce.cs +++ b/Content/Tiles/Interactive/Bounce.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Abilities; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Content.Items.Misc; using StarlightRiver.Content.Items.Vitric; using StarlightRiver.Core.Systems.DummyTileSystem; @@ -20,7 +21,7 @@ public override void SetStaticDefaults() } } - internal class BouncerItem : QuickTileItem + internal class BouncerItem : BaseTileItem { public BouncerItem() : base("Vitric Bouncer", "Dash into this to go flying!\nResets jump accessories", "Bouncer", 8, AssetDirectory.InteractiveTile) { } diff --git a/Content/Tiles/Interactive/StaminaGem.cs b/Content/Tiles/Interactive/StaminaGem.cs index d90e8d90a..ee5f11173 100644 --- a/Content/Tiles/Interactive/StaminaGem.cs +++ b/Content/Tiles/Interactive/StaminaGem.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Abilities; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems.DummyTileSystem; using System; using Terraria.DataStructures; @@ -31,7 +32,7 @@ public override void ModifyLight(int i, int j, ref float r, ref float g, ref flo } } - internal class StaminaGemItem : QuickTileItem + internal class StaminaGemItem : BaseTileItem { public StaminaGemItem() : base("Starlight Gem", "Restores starlight when hit with an ability", "StaminaGem", 8, AssetDirectory.InteractiveTile) { } } diff --git a/Content/Tiles/Interactive/StaminaOrb.cs b/Content/Tiles/Interactive/StaminaOrb.cs index 79da1f9ed..3b327816b 100644 --- a/Content/Tiles/Interactive/StaminaOrb.cs +++ b/Content/Tiles/Interactive/StaminaOrb.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Abilities; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems.DummyTileSystem; using System; using Terraria.ID; @@ -67,7 +68,7 @@ public override void Collision(Player Player) } } - public class StaminaOrbItem : QuickTileItem + public class StaminaOrbItem : BaseTileItem { public StaminaOrbItem() : base("Starlight Orb", "Pass through this to gain starlight!\n5 second cooldown", "StaminaOrb", 8, AssetDirectory.InteractiveTile) { } } diff --git a/Content/Tiles/Misc/DisplayCaseFriendly.cs b/Content/Tiles/Misc/DisplayCaseFriendly.cs index 9d8f91c7b..869ef96e8 100644 --- a/Content/Tiles/Misc/DisplayCaseFriendly.cs +++ b/Content/Tiles/Misc/DisplayCaseFriendly.cs @@ -1,4 +1,5 @@ -using Terraria.DataStructures; +using StarlightRiver.Content.Items.BaseTypes; +using Terraria.DataStructures; namespace StarlightRiver.Content.Tiles.Misc { @@ -48,7 +49,7 @@ public override void KillMultiTile(int i, int j, int frameX, int frameY) } } - class DisplayCaseFriendlyItem : QuickTileItem + class DisplayCaseFriendlyItem : BaseTileItem { public DisplayCaseFriendlyItem() : base("Display Case", "Can hold an Item for glamorous display", "DisplayCaseFriendly", 2, "StarlightRiver/Assets/Tiles/Misc/") { } } diff --git a/Content/Tiles/Misc/RatTent.cs b/Content/Tiles/Misc/RatTent.cs index 68b7ca337..571a427aa 100644 --- a/Content/Tiles/Misc/RatTent.cs +++ b/Content/Tiles/Misc/RatTent.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Core.Systems; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Core.Systems; using StarlightRiver.Helpers; using Terraria.DataStructures; using Terraria.ID; @@ -38,7 +39,7 @@ public override void KillMultiTile(int i, int j, int frameX, int frameY) } [SLRDebug] - public class RatTentItem : QuickTileItem + public class RatTentItem : BaseTileItem { public RatTentItem() : base("Strange Tent", "Whats inside?...", "RatTent", 1, AssetDirectory.MiscTile) { } } diff --git a/Content/Tiles/Misc/SandscriptTile.cs b/Content/Tiles/Misc/SandscriptTile.cs index 50e782dfd..1f14bff5e 100644 --- a/Content/Tiles/Misc/SandscriptTile.cs +++ b/Content/Tiles/Misc/SandscriptTile.cs @@ -23,10 +23,5 @@ public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Tile if (Main.rand.NextBool(2)) Dust.NewDustPerfect(new Vector2(i + Main.rand.NextFloat(), j + Main.rand.NextFloat()) * 16, DustID.TreasureSparkle, new Vector2(0, Main.rand.NextFloat(1, 1.6f)), 0, default, 0.5f); } - - public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) - { - RecipeSystem.LearnRecipie(GetInstance().Name); - } } } \ No newline at end of file diff --git a/Content/Tiles/Mushroom/JellyShroom.cs b/Content/Tiles/Mushroom/JellyShroom.cs index 4092ddcb6..7ac62be28 100644 --- a/Content/Tiles/Mushroom/JellyShroom.cs +++ b/Content/Tiles/Mushroom/JellyShroom.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Abilities; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems.DummyTileSystem; using System; using Terraria.Audio; @@ -113,7 +114,7 @@ private void DrawBlob(SpriteBatch spriteBatch, Texture2D tex, Vector2 pos, float } } - class JellyShroomItem : QuickTileItem + class JellyShroomItem : BaseTileItem { public override string Texture => "StarlightRiver/Assets/Tiles/Mushroom/JellyShroomItem"; diff --git a/Content/Tiles/Mushroom/Lumishroom.cs b/Content/Tiles/Mushroom/Lumishroom.cs index 63c4a26db..8f50c2ea5 100644 --- a/Content/Tiles/Mushroom/Lumishroom.cs +++ b/Content/Tiles/Mushroom/Lumishroom.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Helpers; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Helpers; using System; using Terraria.DataStructures; using Terraria.Enums; @@ -42,7 +43,7 @@ public override void PostDraw(int i, int j, SpriteBatch spriteBatch) } } - class LumishroomItem : QuickTileItem + class LumishroomItem : BaseTileItem { public LumishroomItem() : base("Lumishroom", "Glowy...", "Lumishroom", 1, "StarlightRiver/Assets/Tiles/Mushroom/") { } } diff --git a/Content/Tiles/Mushroom/Vibeshroom.cs b/Content/Tiles/Mushroom/Vibeshroom.cs index de1686558..3882b69a1 100644 --- a/Content/Tiles/Mushroom/Vibeshroom.cs +++ b/Content/Tiles/Mushroom/Vibeshroom.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Helpers; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Helpers; using System; using Terraria.DataStructures; using Terraria.Enums; @@ -42,7 +43,7 @@ public override void PostDraw(int i, int j, SpriteBatch spriteBatch) } } - class VibeshroomItem : QuickTileItem + class VibeshroomItem : BaseTileItem { public VibeshroomItem() : base("Vibeshroom", "Vibin'", "Vibeshroom", 1, "StarlightRiver/Assets/Tiles/Mushroom/") { } } diff --git a/Content/Tiles/Overgrow/CrusherTile.cs b/Content/Tiles/Overgrow/CrusherTile.cs index c7128f42c..42b255bfb 100644 --- a/Content/Tiles/Overgrow/CrusherTile.cs +++ b/Content/Tiles/Overgrow/CrusherTile.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Content.NPCs.Overgrow; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Content.NPCs.Overgrow; using StarlightRiver.Core.Systems; using System.Linq; using Terraria.DataStructures; @@ -43,5 +44,5 @@ public override void NearbyEffects(int i, int j, bool closer) } [SLRDebug] - public class CrusherOvergrowItem : QuickTileItem { public CrusherOvergrowItem() : base("Crusher Trap", "", "CrusherTile", 0, AssetDirectory.OvergrowTile) { } } + public class CrusherOvergrowItem : BaseTileItem { public CrusherOvergrowItem() : base("Crusher Trap", "", "CrusherTile", 0, AssetDirectory.OvergrowTile) { } } } \ No newline at end of file diff --git a/Content/Tiles/Overgrow/NoxiousNode.cs b/Content/Tiles/Overgrow/NoxiousNode.cs index 9e5793fde..119b77614 100644 --- a/Content/Tiles/Overgrow/NoxiousNode.cs +++ b/Content/Tiles/Overgrow/NoxiousNode.cs @@ -1,5 +1,6 @@ using StarlightRiver.Content.Abilities; using StarlightRiver.Content.Abilities.Faewhip; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.CameraSystem; using StarlightRiver.Core.Systems.DummyTileSystem; @@ -140,7 +141,7 @@ public bool IsWhipColliding(Vector2 whipPosition) } [SLRDebug] - internal class NoxiousNodeItem : QuickTileItem + internal class NoxiousNodeItem : BaseTileItem { public override string Texture => AssetDirectory.Debug; diff --git a/Content/Tiles/Overgrow/OvergrowDeco.cs b/Content/Tiles/Overgrow/OvergrowDeco.cs index eb668a5b2..b3116b4e0 100644 --- a/Content/Tiles/Overgrow/OvergrowDeco.cs +++ b/Content/Tiles/Overgrow/OvergrowDeco.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Core.Systems; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Core.Systems; using StarlightRiver.Helpers; using Terraria.DataStructures; using Terraria.Enums; @@ -33,7 +34,7 @@ public override void PostDraw(int i, int j, SpriteBatch spriteBatch) } [SLRDebug] - class Rock2x2Item : QuickTileItem + class Rock2x2Item : BaseTileItem { public override string Texture => AssetDirectory.OvergrowTile + Name; diff --git a/Content/Tiles/Overgrow/OvergrowWall.cs b/Content/Tiles/Overgrow/OvergrowWall.cs index 7b1f256b7..ae1bdf920 100644 --- a/Content/Tiles/Overgrow/OvergrowWall.cs +++ b/Content/Tiles/Overgrow/OvergrowWall.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Helpers; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Helpers; using System; using Terraria.ID; using static Terraria.ModLoader.ModContent; @@ -50,13 +51,13 @@ public override void SetStaticDefaults() } } - public class WallOvergrowBrickItem : QuickWallItem + public class WallOvergrowBrickItem : BaseWallItem { public override string Texture => AssetDirectory.OvergrowTile + Name; public WallOvergrowBrickItem() : base("Runic Brick Wall", "", WallType(), 0) { } } - public class WallOvergrowGrassItem : QuickWallItem + public class WallOvergrowGrassItem : BaseWallItem { public override string Texture => AssetDirectory.OvergrowTile + Name; public WallOvergrowGrassItem() : base("Overgrowth Grass Wall", "", WallType(), 0) { } diff --git a/Content/Tiles/Overgrow/OvergrowthLivingWood.cs b/Content/Tiles/Overgrow/OvergrowthLivingWood.cs index 577c8c909..ad5f6e4f0 100644 --- a/Content/Tiles/Overgrow/OvergrowthLivingWood.cs +++ b/Content/Tiles/Overgrow/OvergrowthLivingWood.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using StarlightRiver.Content.Items.BaseTypes; +using Terraria.ID; using Terraria.Localization; namespace StarlightRiver.Content.Tiles.Overgrow @@ -95,7 +96,7 @@ private int GetFrame(int i, int j) } } - public class OvergrowthLivingWoodItem : QuickTileItem + public class OvergrowthLivingWoodItem : BaseTileItem { public override string Texture => AssetDirectory.OvergrowTile + Name; diff --git a/Content/Tiles/Overgrow/SkeletonBrickTile.cs b/Content/Tiles/Overgrow/SkeletonBrickTile.cs index 7a3cccc88..67dd6ca73 100644 --- a/Content/Tiles/Overgrow/SkeletonBrickTile.cs +++ b/Content/Tiles/Overgrow/SkeletonBrickTile.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using StarlightRiver.Content.Items.BaseTypes; +using Terraria.ID; namespace StarlightRiver.Content.Tiles.Overgrow { @@ -65,7 +66,7 @@ public override void AnimateIndividualTile(int type, int i, int j, ref int frame } } - public class SkeletonBrickItem : QuickTileItem + public class SkeletonBrickItem : BaseTileItem { public override string Texture => AssetDirectory.OvergrowTile + Name; diff --git a/Content/Tiles/Overgrow/TorchOvergrow.cs b/Content/Tiles/Overgrow/TorchOvergrow.cs index 0891440fc..7b7065c3e 100644 --- a/Content/Tiles/Overgrow/TorchOvergrow.cs +++ b/Content/Tiles/Overgrow/TorchOvergrow.cs @@ -1,4 +1,5 @@ -using System; +using StarlightRiver.Content.Items.BaseTypes; +using System; using Terraria.DataStructures; using Terraria.ID; using static Terraria.ModLoader.ModContent; @@ -22,7 +23,7 @@ public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Tile } } - public class TorchOvergrowItem : QuickTileItem + public class TorchOvergrowItem : BaseTileItem { public TorchOvergrowItem() : base("Faerie Torch", "Sparkly!", "WispAltarL", 0, AssetDirectory.OvergrowTile) { } } @@ -44,7 +45,7 @@ public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Tile } } - public class BlueTorchOvergrowItem : QuickTileItem + public class BlueTorchOvergrowItem : BaseTileItem { public BlueTorchOvergrowItem() : base("Blue Faerie Torch", "Sparkly! and Blue!", "BlueTorchOvergrow", 0, AssetDirectory.OvergrowTile) { } } diff --git a/Content/Tiles/Overgrow/WindowSmall.cs b/Content/Tiles/Overgrow/WindowSmall.cs index c303bcac1..197b1250c 100644 --- a/Content/Tiles/Overgrow/WindowSmall.cs +++ b/Content/Tiles/Overgrow/WindowSmall.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework.Graphics; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.DummyTileSystem; using System; @@ -26,7 +27,7 @@ public override bool SpawnConditions(int i, int j) } [SLRDebug] - class WindowSmallItem : QuickTileItem + class WindowSmallItem : BaseTileItem { public override string Texture => AssetDirectory.OvergrowTile + "WindowSmall"; diff --git a/Content/Tiles/Overgrow/WispAltar.cs b/Content/Tiles/Overgrow/WispAltar.cs index 70d077ebb..89373c381 100644 --- a/Content/Tiles/Overgrow/WispAltar.cs +++ b/Content/Tiles/Overgrow/WispAltar.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Core.Systems; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Core.Systems; using Terraria.ID; using Terraria.ObjectData; using static Terraria.ModLoader.ModContent; @@ -17,7 +18,7 @@ public override void SetStaticDefaults() } [SLRDebug] - class WispAltarLItem : QuickTileItem + class WispAltarLItem : BaseTileItem { public override string Texture => AssetDirectory.Debug; @@ -36,7 +37,7 @@ public override void SetStaticDefaults() } [SLRDebug] - class WispAltarRItem : QuickTileItem + class WispAltarRItem : BaseTileItem { public override string Texture => AssetDirectory.Debug; diff --git a/Content/Tiles/Paintings/AuroraclePainting.cs b/Content/Tiles/Paintings/AuroraclePainting.cs index b1b5142c4..697125ae8 100644 --- a/Content/Tiles/Paintings/AuroraclePainting.cs +++ b/Content/Tiles/Paintings/AuroraclePainting.cs @@ -1,4 +1,6 @@ -namespace StarlightRiver.Content.Tiles.Paintings +using StarlightRiver.Content.Items.BaseTypes; + +namespace StarlightRiver.Content.Tiles.Paintings { class AuroraclePainting : ModTile { @@ -10,7 +12,7 @@ public override void PostSetDefaults() } } - class AuroraclePaintingItem : QuickTileItem + class AuroraclePaintingItem : BaseTileItem { public AuroraclePaintingItem() : base("Prismatic Waters", "'K. Ra'", "AuroraclePainting", 0, AssetDirectory.PaintingTile) { } } diff --git a/Content/Tiles/Paintings/EggCodexPainting.cs b/Content/Tiles/Paintings/EggCodexPainting.cs index cc83e46d9..3bb05271e 100644 --- a/Content/Tiles/Paintings/EggCodexPainting.cs +++ b/Content/Tiles/Paintings/EggCodexPainting.cs @@ -1,4 +1,6 @@ -namespace StarlightRiver.Content.Tiles.Paintings +using StarlightRiver.Content.Items.BaseTypes; + +namespace StarlightRiver.Content.Tiles.Paintings { class EggCodexPainting : ModTile { @@ -10,7 +12,7 @@ public override void SetStaticDefaults() } } - class EggCodexPaintingItem : QuickTileItem + class EggCodexPaintingItem : BaseTileItem { public EggCodexPaintingItem() : base("Codex Genesis", "'K. Ra'", "EggCodexPainting", 0, AssetDirectory.PaintingTile) { } } diff --git a/Content/Tiles/Paintings/EndOfTimePainting.cs b/Content/Tiles/Paintings/EndOfTimePainting.cs index 13409c9e3..b3dcf49f6 100644 --- a/Content/Tiles/Paintings/EndOfTimePainting.cs +++ b/Content/Tiles/Paintings/EndOfTimePainting.cs @@ -1,4 +1,6 @@ -namespace StarlightRiver.Content.Tiles.Paintings +using StarlightRiver.Content.Items.BaseTypes; + +namespace StarlightRiver.Content.Tiles.Paintings { class EndOfTimePainting : ModTile { @@ -10,7 +12,7 @@ public override void SetStaticDefaults() } } - class EndOfTimePaintingItem : QuickTileItem + class EndOfTimePaintingItem : BaseTileItem { public EndOfTimePaintingItem() : base("End of Time", "'K. Ra'", "EndOfTimePainting", 0, AssetDirectory.PaintingTile) { } } diff --git a/Content/Tiles/Paintings/RatKingPainting.cs b/Content/Tiles/Paintings/RatKingPainting.cs index e2100fbd6..6a2d7f28a 100644 --- a/Content/Tiles/Paintings/RatKingPainting.cs +++ b/Content/Tiles/Paintings/RatKingPainting.cs @@ -1,4 +1,6 @@ -namespace StarlightRiver.Content.Tiles.Paintings +using StarlightRiver.Content.Items.BaseTypes; + +namespace StarlightRiver.Content.Tiles.Paintings { class RatKingPainting : ModTile { @@ -10,7 +12,7 @@ public override void SetStaticDefaults() } } - class RatKingPaintingItem : QuickTileItem + class RatKingPaintingItem : BaseTileItem { public RatKingPaintingItem() : base("Majestic Hoarder", "'K. Ra'", "RatKingPainting", 0, AssetDirectory.PaintingTile) { } } diff --git a/Content/Tiles/Palestone/Palestone.cs b/Content/Tiles/Palestone/Palestone.cs index a46f389b2..d719995fa 100644 --- a/Content/Tiles/Palestone/Palestone.cs +++ b/Content/Tiles/Palestone/Palestone.cs @@ -1,9 +1,10 @@ -using Terraria.ID; +using StarlightRiver.Content.Items.BaseTypes; +using Terraria.ID; using static Terraria.ModLoader.ModContent; namespace StarlightRiver.Content.Tiles.Palestone { - internal class PalestoneItem : QuickTileItem + internal class PalestoneItem : BaseTileItem { public PalestoneItem() : base("Palestone Block", "", "Palestone", 0, AssetDirectory.PalestoneTile) { } } diff --git a/Content/Tiles/Permafrost/AuroraBrick.cs b/Content/Tiles/Permafrost/AuroraBrick.cs index fd2857817..5daee35d3 100644 --- a/Content/Tiles/Permafrost/AuroraBrick.cs +++ b/Content/Tiles/Permafrost/AuroraBrick.cs @@ -1,3 +1,4 @@ +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems; using Terraria.DataStructures; using Terraria.ID; @@ -70,7 +71,7 @@ public override void PostDraw(int i, int j, SpriteBatch spriteBatch) } } - class AuroraBrickItem : QuickTileItem + class AuroraBrickItem : BaseTileItem { public override string Texture => "StarlightRiver/Assets/Tiles/Permafrost/AuroraBrickItem"; @@ -78,7 +79,7 @@ public AuroraBrickItem() : base("Aurora Brick", "Oooh... Preeetttyyy", "AuroraBr } [SLRDebug] - class AuroraBrickDoorItem : QuickTileItem + class AuroraBrickDoorItem : BaseTileItem { public override string Texture => AssetDirectory.Debug; diff --git a/Content/Tiles/Permafrost/AuroraBrickWall.cs b/Content/Tiles/Permafrost/AuroraBrickWall.cs index 1faeb416b..beab3c9d4 100644 --- a/Content/Tiles/Permafrost/AuroraBrickWall.cs +++ b/Content/Tiles/Permafrost/AuroraBrickWall.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Core.Systems; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Core.Systems; using Terraria.ID; using static Terraria.ModLoader.ModContent; @@ -20,7 +21,7 @@ public override bool CanExplode(int i, int j) } [SLRDebug] - class AuroraBrickWallItem : QuickWallItem + class AuroraBrickWallItem : BaseWallItem { public override string Texture => "StarlightRiver/Assets/Tiles/Permafrost/AuroraBrickWallItem"; diff --git a/Content/Tiles/Permafrost/AuroraBrickWallFriendly.cs b/Content/Tiles/Permafrost/AuroraBrickWallFriendly.cs index 661126e9e..81df41ef5 100644 --- a/Content/Tiles/Permafrost/AuroraBrickWallFriendly.cs +++ b/Content/Tiles/Permafrost/AuroraBrickWallFriendly.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using StarlightRiver.Content.Items.BaseTypes; +using Terraria.ID; using static Terraria.ModLoader.ModContent; namespace StarlightRiver.Content.Tiles.Permafrost @@ -13,7 +14,7 @@ public override void SetStaticDefaults() } } - class AuroraBrickWallFriendlyItem : QuickWallItem + class AuroraBrickWallFriendlyItem : BaseWallItem { public override string Texture => "StarlightRiver/Assets/Tiles/Permafrost/AuroraBrickWallItem"; diff --git a/Content/Tiles/Permafrost/AuroraPylon.cs b/Content/Tiles/Permafrost/AuroraPylon.cs index 2b742e0fc..1b8279036 100644 --- a/Content/Tiles/Permafrost/AuroraPylon.cs +++ b/Content/Tiles/Permafrost/AuroraPylon.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Biomes; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Content.Tiles.BaseTypes; using System; using System.Collections.Generic; @@ -37,7 +38,7 @@ public override void ModifyLight(int i, int j, ref float r, ref float g, ref flo } } - internal class AuroraPylonItem : QuickTileItem + internal class AuroraPylonItem : BaseTileItem { public AuroraPylonItem() : base("Aurora Pylon", "You shouldn't have this!", "AuroraPylon", 0, AssetDirectory.Debug, true, 0) { } } diff --git a/Content/Tiles/Permafrost/DoorBombShooter.cs b/Content/Tiles/Permafrost/DoorBombShooter.cs index a2bddca7d..dcf38afeb 100644 --- a/Content/Tiles/Permafrost/DoorBombShooter.cs +++ b/Content/Tiles/Permafrost/DoorBombShooter.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Bosses.SquidBoss; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.PixelationSystem; using StarlightRiver.Helpers; @@ -80,7 +81,7 @@ public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) } [SLRDebug] - class DoorBombShooterItem : QuickTileItem + class DoorBombShooterItem : BaseTileItem { public override string Texture => AssetDirectory.Debug; diff --git a/Content/Tiles/Permafrost/PermafrostIce.cs b/Content/Tiles/Permafrost/PermafrostIce.cs index 3cce43acd..3ee99d835 100644 --- a/Content/Tiles/Permafrost/PermafrostIce.cs +++ b/Content/Tiles/Permafrost/PermafrostIce.cs @@ -1,4 +1,5 @@ -using System; +using StarlightRiver.Content.Items.BaseTypes; +using System; using Terraria.DataStructures; using Terraria.ID; using static Terraria.ModLoader.ModContent; @@ -32,7 +33,7 @@ public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Tile } } - class PermafrostIceItem : QuickTileItem + class PermafrostIceItem : BaseTileItem { public override string Texture => "StarlightRiver/Assets/Tiles/Permafrost/PermafrostIceItem"; diff --git a/Content/Tiles/Permafrost/Touchstone.cs b/Content/Tiles/Permafrost/Touchstone.cs index b356b251c..e3c54ddc5 100644 --- a/Content/Tiles/Permafrost/Touchstone.cs +++ b/Content/Tiles/Permafrost/Touchstone.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework.Graphics; using StarlightRiver.Content.Abilities; using StarlightRiver.Content.Buffs; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Content.Packets; using StarlightRiver.Core.Loaders; using StarlightRiver.Core.Systems; @@ -187,7 +188,7 @@ public override void PostDraw(Color lightColor) } [SLRDebug] - class TouchstoneItem : QuickTileItem + class TouchstoneItem : BaseTileItem { public TouchstoneItem() : base("Touchstone", "A guiding light", "Touchstone", 3, AssetDirectory.PermafrostTile) { } } diff --git a/Content/Tiles/Permafrost/TouchstoneLootbox.cs b/Content/Tiles/Permafrost/TouchstoneLootbox.cs index 6f2c03885..c7af8ea82 100644 --- a/Content/Tiles/Permafrost/TouchstoneLootbox.cs +++ b/Content/Tiles/Permafrost/TouchstoneLootbox.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Content.Items.Permafrost; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Content.Items.Permafrost; using StarlightRiver.Core.Systems; using System.Collections.Generic; using Terraria.ID; @@ -42,7 +43,7 @@ public override void SafeSetDefaults() } [SLRDebug] - class TouchstoneLootboxItem : QuickTileItem + class TouchstoneLootboxItem : BaseTileItem { public TouchstoneLootboxItem() : base("Touchstone Chest Placer", "", "TouchstoneLootbox", 0, AssetDirectory.PermafrostTile) { } } diff --git a/Content/Tiles/Starlight/BlinkbrickWall.cs b/Content/Tiles/Starlight/BlinkbrickWall.cs index 4d79ef59b..c6d3f5d1e 100644 --- a/Content/Tiles/Starlight/BlinkbrickWall.cs +++ b/Content/Tiles/Starlight/BlinkbrickWall.cs @@ -1,4 +1,5 @@ -using System; +using StarlightRiver.Content.Items.BaseTypes; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -14,7 +15,7 @@ internal class BlinkbrickWall : ModWall public override void SetStaticDefaults() { this.QuickSetWall(DustID.Stone, SoundID.Tink.WithPitchOffset(-0.5f), ModContent.ItemType(), true, new Color(20, 25, 40)); } } - class BlinkbrickWallItem : QuickWallItem + class BlinkbrickWallItem : BaseWallItem { public BlinkbrickWallItem() : base("Blinkbrick Wall", "", ModContent.WallType(), ItemRarityID.White, AssetDirectory.StarlightTile) { } } diff --git a/Content/Tiles/Starlight/BrassPlatform.cs b/Content/Tiles/Starlight/BrassPlatform.cs index f195132d2..e866b74a9 100644 --- a/Content/Tiles/Starlight/BrassPlatform.cs +++ b/Content/Tiles/Starlight/BrassPlatform.cs @@ -1,4 +1,5 @@ -using System; +using StarlightRiver.Content.Items.BaseTypes; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -39,5 +40,5 @@ public override void SetStaticDefaults() } } - internal class BrassPlatformItem : QuickTileItem { public BrassPlatformItem() : base("Brass Platform", "", "BrassPlatform", 0, AssetDirectory.StarlightTile) { } } + internal class BrassPlatformItem : BaseTileItem { public BrassPlatformItem() : base("Brass Platform", "", "BrassPlatform", 0, AssetDirectory.StarlightTile) { } } } \ No newline at end of file diff --git a/Content/Tiles/Starlight/ChartGrateWall.cs b/Content/Tiles/Starlight/ChartGrateWall.cs index 75aa70f98..badaaef2e 100644 --- a/Content/Tiles/Starlight/ChartGrateWall.cs +++ b/Content/Tiles/Starlight/ChartGrateWall.cs @@ -1,4 +1,5 @@ -using Terraria.Graphics; +using StarlightRiver.Content.Items.BaseTypes; +using Terraria.Graphics; using Terraria.ID; namespace StarlightRiver.Content.Tiles.Starlight @@ -29,7 +30,7 @@ public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) } } - class ChartGrateWallItem : QuickWallItem + class ChartGrateWallItem : BaseWallItem { public override string Texture => AssetDirectory.StarlightTile + Name; diff --git a/Content/Tiles/Starlight/DreamingOnyx.cs b/Content/Tiles/Starlight/DreamingOnyx.cs index 4f7974f32..1f11bcf6c 100644 --- a/Content/Tiles/Starlight/DreamingOnyx.cs +++ b/Content/Tiles/Starlight/DreamingOnyx.cs @@ -1,4 +1,5 @@ using Mono.Cecil.Cil; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems; using System; using System.Collections.Generic; @@ -61,7 +62,7 @@ public override void PostDraw(int i, int j, SpriteBatch spriteBatch) } } - class DreamingOnyxItem : QuickTileItem + class DreamingOnyxItem : BaseTileItem { public override string Texture => AssetDirectory.StarlightTile + Name; diff --git a/Content/Tiles/Starlight/GlowingOracleGlass.cs b/Content/Tiles/Starlight/GlowingOracleGlass.cs index 8762428c3..b9a9953f9 100644 --- a/Content/Tiles/Starlight/GlowingOracleGlass.cs +++ b/Content/Tiles/Starlight/GlowingOracleGlass.cs @@ -1,4 +1,5 @@ using Mono.Cecil.Cil; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems; using System; using System.Collections.Generic; @@ -57,7 +58,7 @@ public override void PostDraw(int i, int j, SpriteBatch spriteBatch) } } - class OracleGlassItem : QuickTileItem + class OracleGlassItem : BaseTileItem { public override string Texture => AssetDirectory.StarlightTile + Name; diff --git a/Content/Tiles/Starlight/StarlightPylon.cs b/Content/Tiles/Starlight/StarlightPylon.cs index 56908a750..7699019dd 100644 --- a/Content/Tiles/Starlight/StarlightPylon.cs +++ b/Content/Tiles/Starlight/StarlightPylon.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Biomes; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Content.Packets; using StarlightRiver.Core.Systems.CutsceneSystem; using StarlightRiver.Core.Systems.DummyTileSystem; @@ -241,7 +242,7 @@ public override void Update() } } - public sealed class StarlightPylonItem : QuickTileItem + public sealed class StarlightPylonItem : BaseTileItem { public StarlightPylonItem() : base("Mysterious Pylon", "You shouldn't have this!", "StarlightPylon", 0, AssetDirectory.Debug, true, 0) { } } diff --git a/Content/Tiles/Trophies/AuroracleTrophy.cs b/Content/Tiles/Trophies/AuroracleTrophy.cs index 4392c5952..5d72d0035 100644 --- a/Content/Tiles/Trophies/AuroracleTrophy.cs +++ b/Content/Tiles/Trophies/AuroracleTrophy.cs @@ -1,4 +1,5 @@ -using System; +using StarlightRiver.Content.Items.BaseTypes; +using System; using static Terraria.ModLoader.ModContent; namespace StarlightRiver.Content.Tiles.Trophies @@ -46,7 +47,7 @@ public override void PostDraw(int i, int j, SpriteBatch spriteBatch) } } - class AuroracleTrophyItem : QuickTileItem + class AuroracleTrophyItem : BaseTileItem { public AuroracleTrophyItem() : base("Auroracle Trophy", "", "AuroracleTrophy", 1, AssetDirectory.TrophyTile) { } diff --git a/Content/Tiles/Trophies/CeirosTrophy.cs b/Content/Tiles/Trophies/CeirosTrophy.cs index c78cc4146..2b5d7fe61 100644 --- a/Content/Tiles/Trophies/CeirosTrophy.cs +++ b/Content/Tiles/Trophies/CeirosTrophy.cs @@ -1,4 +1,6 @@ -namespace StarlightRiver.Content.Tiles.Trophies +using StarlightRiver.Content.Items.BaseTypes; + +namespace StarlightRiver.Content.Tiles.Trophies { class CeirosTrophy : ModTile { @@ -10,7 +12,7 @@ public override void SetStaticDefaults() } } - class CeirosTrophyItem : QuickTileItem + class CeirosTrophyItem : BaseTileItem { public CeirosTrophyItem() : base("Ceiros Trophy", "", "CeirosTrophy", 1, AssetDirectory.TrophyTile) { } } diff --git a/Content/Tiles/Trophies/ThinkerTrophy.cs b/Content/Tiles/Trophies/ThinkerTrophy.cs index 004b40626..80e4d6dd6 100644 --- a/Content/Tiles/Trophies/ThinkerTrophy.cs +++ b/Content/Tiles/Trophies/ThinkerTrophy.cs @@ -1,4 +1,6 @@ -namespace StarlightRiver.Content.Tiles.Trophies +using StarlightRiver.Content.Items.BaseTypes; + +namespace StarlightRiver.Content.Tiles.Trophies { class ThinkerTrophy : ModTile { @@ -10,7 +12,7 @@ public override void SetStaticDefaults() } } - class ThinkerTrophyItem : QuickTileItem + class ThinkerTrophyItem : BaseTileItem { public ThinkerTrophyItem() : base("Thinker Trophy", "", "ThinkerTrophy", 1, AssetDirectory.TrophyTile) { } } diff --git a/Content/Tiles/Underground/CombatShrine.cs b/Content/Tiles/Underground/CombatShrine.cs index 7db7097c9..52c67da39 100644 --- a/Content/Tiles/Underground/CombatShrine.cs +++ b/Content/Tiles/Underground/CombatShrine.cs @@ -1,10 +1,11 @@ using Microsoft.Xna.Framework.Graphics; using NetEasy; -using StarlightRiver.Content.CustomHooks; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Content.Items.Misc; using StarlightRiver.Core.Loaders; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.DummyTileSystem; +using StarlightRiver.Core.Systems.NoBuildingSystem; using System; using System.Collections.Generic; using System.IO; @@ -36,7 +37,7 @@ public override string GetCustomKey() } [SLRDebug] - class CombatShrineItem : QuickTileItem + class CombatShrineItem : BaseTileItem { public CombatShrineItem() : base("Combat shrine placer", "{{Debug}} item", "CombatShrine") { } } @@ -91,7 +92,7 @@ public override void Update() if (state != SHRINE_STATE_IDLE)//this does not need a defeated check because of the above one { - ProtectionWorld.AddRegionBySource(new Point16(ParentX, ParentY), ArenaTile);//stop calling this and call RemoveRegionBySource() when shrine is completed + NoBuildSystem.AddRegionBySource(new Point16(ParentX, ParentY), ArenaTile);//stop calling this and call RemoveRegionBySource() when shrine is completed Dust.NewDustPerfect(Center + new Vector2(Main.rand.NextFloat(-24, 24), 28), ModContent.DustType(), Vector2.UnitY * -Main.rand.NextFloat(2), 0, new Color(255, 40 + Main.rand.Next(50), 75) * Windup, 0.2f); @@ -122,7 +123,7 @@ public override void Update() NPC.active = false; minions.Clear(); - ProtectionWorld.RemoveRegionBySource(new Point16(ParentX, ParentY)); + NoBuildSystem.RemoveRegionBySource(new Point16(ParentX, ParentY)); } return; @@ -143,7 +144,7 @@ public override void Update() timer = 0; waveTime = 0; SetFrame(2); - ProtectionWorld.RemoveRegionBySource(new Point16(ParentX, ParentY)); + NoBuildSystem.RemoveRegionBySource(new Point16(ParentX, ParentY)); } return; diff --git a/Content/Tiles/Underground/EvasionShrine.cs b/Content/Tiles/Underground/EvasionShrine.cs index a3774748b..35972ec54 100644 --- a/Content/Tiles/Underground/EvasionShrine.cs +++ b/Content/Tiles/Underground/EvasionShrine.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework.Graphics; using StarlightRiver.Content.Abilities; -using StarlightRiver.Content.CustomHooks; using StarlightRiver.Content.Items.Misc; using StarlightRiver.Content.Tiles.Underground.EvasionShrineBullets; using StarlightRiver.Core.Systems.DummyTileSystem; +using StarlightRiver.Core.Systems.NoBuildingSystem; using System; using System.Collections.Generic; using System.IO; @@ -99,7 +99,7 @@ public override void Update() if (state != SHRINE_STATE_IDLE) { - ProtectionWorld.AddRegionBySource(new Point16(ParentX, ParentY), ArenaTile);//stop calling this and call RemoveRegionBySource() when shrine is completed + NoBuildSystem.AddRegionBySource(new Point16(ParentX, ParentY), ArenaTile);//stop calling this and call RemoveRegionBySource() when shrine is completed Dust.NewDustPerfect(Center + new Vector2(Main.rand.NextFloat(-24, 24), 28), ModContent.DustType(), Vector2.UnitY * -Main.rand.NextFloat(2), 0, new Color(150, 30, 205) * Windup, 0.2f); @@ -132,7 +132,7 @@ public override void Update() SpawnReward(); state = SHRINE_STATE_DEFEATED; SetFrame(2); - ProtectionWorld.RemoveRegionBySource(new Point16(ParentX, ParentY)); + NoBuildSystem.RemoveRegionBySource(new Point16(ParentX, ParentY)); } return; @@ -159,7 +159,7 @@ public override void Update() { state = SHRINE_STATE_IDLE; attackOrder = null; - ProtectionWorld.RemoveRegionBySource(new Point16(ParentX, ParentY)); + NoBuildSystem.RemoveRegionBySource(new Point16(ParentX, ParentY)); } return; diff --git a/Content/Tiles/Underground/Glorch.cs b/Content/Tiles/Underground/Glorch.cs index 785141d39..d69e5005f 100644 --- a/Content/Tiles/Underground/Glorch.cs +++ b/Content/Tiles/Underground/Glorch.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Content.Items.Misc; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Content.Items.Misc; using StarlightRiver.Content.Items.Underground; using System; using System.Collections.Generic; @@ -111,7 +112,7 @@ private void Gloomify(On_LightingEngine.orig_ProcessBlur orig, LightingEngine se } } - public class GlorchItem : QuickTileItem + public class GlorchItem : BaseTileItem { public GlorchItem() : base("Glorch", "Does a lamp give off light... or suck up the dark?\nReduces light nearby", "Glorch", ItemRarityID.Blue, "StarlightRiver/Assets/Tiles/Underground/") { } diff --git a/Content/Tiles/Underground/HotspringFountain.cs b/Content/Tiles/Underground/HotspringFountain.cs index c6f3a926a..501fb9202 100644 --- a/Content/Tiles/Underground/HotspringFountain.cs +++ b/Content/Tiles/Underground/HotspringFountain.cs @@ -1,5 +1,6 @@ using StarlightRiver.Content.Abilities; using StarlightRiver.Content.Buffs; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems.DummyTileSystem; using System; using System.Linq; @@ -42,7 +43,7 @@ public override void AnimateTile(ref int frame, ref int frameCounter) } } - class HotspringFountainItem : QuickTileItem + class HotspringFountainItem : BaseTileItem { public override string Texture => AssetDirectory.Assets + "Tiles/Underground/HotspringFountainItem"; diff --git a/Content/Tiles/Underground/MagmiteShrine.cs b/Content/Tiles/Underground/MagmiteShrine.cs index 755826658..ea4514fc1 100644 --- a/Content/Tiles/Underground/MagmiteShrine.cs +++ b/Content/Tiles/Underground/MagmiteShrine.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Abilities; +using StarlightRiver.Content.Items.BaseTypes; using Terraria.DataStructures; using Terraria.Enums; using Terraria.ID; @@ -25,7 +26,7 @@ public override void ModifyLight(int i, int j, ref float r, ref float g, ref flo } } - class MagmiteShrineItem : QuickTileItem + class MagmiteShrineItem : BaseTileItem { public MagmiteShrineItem() : base("The Boi", "It's him!", "MagmiteShrine", 1, "StarlightRiver/Assets/Tiles/Underground/") { } } diff --git a/Content/Tiles/UndergroundTemple/DashBarrier.cs b/Content/Tiles/UndergroundTemple/DashBarrier.cs index 1bf8df3db..2254eac31 100644 --- a/Content/Tiles/UndergroundTemple/DashBarrier.cs +++ b/Content/Tiles/UndergroundTemple/DashBarrier.cs @@ -1,5 +1,6 @@ using StarlightRiver.Content.Abilities; using StarlightRiver.Content.Dusts; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.DummyTileSystem; using Terraria.ID; @@ -62,7 +63,7 @@ public override void Collision(Player Player) } [SLRDebug] - public class DashBarrierItem : QuickTileItem + public class DashBarrierItem : BaseTileItem { public DashBarrierItem() : base("Dash Barrier", "{{Debug}} Item", "DashBarrier", -12, AssetDirectory.UndergroundTempleTile) { } } diff --git a/Content/Tiles/UndergroundTemple/JarTall.cs b/Content/Tiles/UndergroundTemple/JarTall.cs index 0ded9f292..36f588edc 100644 --- a/Content/Tiles/UndergroundTemple/JarTall.cs +++ b/Content/Tiles/UndergroundTemple/JarTall.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Abilities; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Content.Items.Misc; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.DummyTileSystem; @@ -115,7 +116,7 @@ public override void PostDraw(Color lightColor) } [SLRDebug] - public class JarTallItem : QuickTileItem + public class JarTallItem : BaseTileItem { public override string Texture => AssetDirectory.Debug; diff --git a/Content/Tiles/UndergroundTemple/TempleChestSimple.cs b/Content/Tiles/UndergroundTemple/TempleChestSimple.cs index 0214b2c60..eccdef9c5 100644 --- a/Content/Tiles/UndergroundTemple/TempleChestSimple.cs +++ b/Content/Tiles/UndergroundTemple/TempleChestSimple.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Content.Items.Potions; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Content.Items.Potions; using StarlightRiver.Core.Systems; using System.Collections.Generic; using Terraria.ID; @@ -41,7 +42,7 @@ public override void SafeSetDefaults() } [SLRDebug] - class TempleChestPlacer : QuickTileItem + class TempleChestPlacer : BaseTileItem { public TempleChestPlacer() : base("Temple Chest Placer", "", "TempleChestSimple", 0, AssetDirectory.UndergroundTempleTile) { } } diff --git a/Content/Tiles/UndergroundTemple/TempleLootBubble.cs b/Content/Tiles/UndergroundTemple/TempleLootBubble.cs index a929a390c..7e5a22367 100644 --- a/Content/Tiles/UndergroundTemple/TempleLootBubble.cs +++ b/Content/Tiles/UndergroundTemple/TempleLootBubble.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Content.Items.UndergroundTemple; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Content.Items.UndergroundTemple; using StarlightRiver.Core.Systems; using System.Collections.Generic; using Terraria.ID; @@ -24,7 +25,7 @@ public override void SetStaticDefaults() } [SLRDebug] - class TestBubble : QuickTileItem + class TestBubble : BaseTileItem { public override string Texture => "StarlightRiver/Assets/Tiles/Bubble"; diff --git a/Content/Tiles/UndergroundTemple/TempleWalls.cs b/Content/Tiles/UndergroundTemple/TempleWalls.cs index c52ee6db4..22ce21b38 100644 --- a/Content/Tiles/UndergroundTemple/TempleWalls.cs +++ b/Content/Tiles/UndergroundTemple/TempleWalls.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using StarlightRiver.Content.Items.BaseTypes; +using Terraria.ID; using static Terraria.ModLoader.ModContent; namespace StarlightRiver.Content.Tiles.UndergroundTemple @@ -10,7 +11,7 @@ class TempleWall : ModWall public override void SetStaticDefaults() { this.QuickSetWall(DustID.Stone, SoundID.Dig, ItemType(), true, new Color(20, 20, 20)); } } - class TempleWallItem : QuickWallItem + class TempleWallItem : BaseWallItem { public TempleWallItem() : base("Ancient Temple Brick Wall", "", WallType(), ItemRarityID.White, AssetDirectory.UndergroundTempleTile) { } } @@ -22,7 +23,7 @@ class TempleWallBig : ModWall public override void SetStaticDefaults() { this.QuickSetWall(DustID.Stone, SoundID.Dig, ItemType(), true, new Color(20, 20, 20)); } } - class TempleWallBigItem : QuickWallItem + class TempleWallBigItem : BaseWallItem { public TempleWallBigItem() : base("Large Ancient Temple Brick Wall", "", WallType(), ItemRarityID.White, AssetDirectory.UndergroundTempleTile) { } } diff --git a/Content/Tiles/VerletBanner.cs b/Content/Tiles/VerletBanner.cs index 24e20a735..184d15610 100644 --- a/Content/Tiles/VerletBanner.cs +++ b/Content/Tiles/VerletBanner.cs @@ -1,3 +1,4 @@ +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Content.Physics; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.DummyTileSystem; @@ -21,7 +22,7 @@ public override void SetStaticDefaults() } [SLRDebug] - class VerletBannerItem : QuickTileItem + class VerletBannerItem : BaseTileItem { public VerletBannerItem() : base("Verlet banner", "{{Debug}} Item", "VerletBanner", 1, AssetDirectory.VitricTile, false) { } } diff --git a/Content/Tiles/Vitric/AncientSandstone.cs b/Content/Tiles/Vitric/AncientSandstone.cs index 201d707a6..3847e1ed6 100644 --- a/Content/Tiles/Vitric/AncientSandstone.cs +++ b/Content/Tiles/Vitric/AncientSandstone.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using StarlightRiver.Content.Items.BaseTypes; +using Terraria.ID; using Terraria.ObjectData; using static Terraria.ModLoader.ModContent; @@ -34,7 +35,7 @@ public override void SetStaticDefaults() } } - internal class AncientSandstonePlatformItem : QuickTileItem { public AncientSandstonePlatformItem() : base("Ancient Sandstone Platform", "", "AncientSandstonePlatform", 0, AssetDirectory.VitricTile) { } } + internal class AncientSandstonePlatformItem : BaseTileItem { public AncientSandstonePlatformItem() : base("Ancient Sandstone Platform", "", "AncientSandstonePlatform", 0, AssetDirectory.VitricTile) { } } internal class AncientSandstoneWall : ModWall { @@ -46,7 +47,7 @@ public override void SetStaticDefaults() } } - internal class AncientSandstoneWallItem : QuickWallItem + internal class AncientSandstoneWallItem : BaseWallItem { public AncientSandstoneWallItem() : base("Ancient Sandstone Wall", "", WallType(), 0, AssetDirectory.VitricTile) { } } @@ -61,7 +62,7 @@ public override void SetStaticDefaults() } } - internal class AncientSandstonePillarWallItem : QuickWallItem + internal class AncientSandstonePillarWallItem : BaseWallItem { public AncientSandstonePillarWallItem() : base("Ancient Sandstone Wall", "", WallType(), 0, AssetDirectory.VitricTile) { } } diff --git a/Content/Tiles/Vitric/AncientSandstoneLights.cs b/Content/Tiles/Vitric/AncientSandstoneLights.cs index cd0f30659..8a4edec07 100644 --- a/Content/Tiles/Vitric/AncientSandstoneLights.cs +++ b/Content/Tiles/Vitric/AncientSandstoneLights.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Biomes; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Helpers; using System; using Terraria.ID; @@ -6,7 +7,7 @@ namespace StarlightRiver.Content.Tiles.Vitric { - public class AncientSandstoneTorchItem : QuickTileItem + public class AncientSandstoneTorchItem : BaseTileItem { public AncientSandstoneTorchItem() : base("Ancient Vitric Illuminator", "It has an entrancing glow", "AncientSandstoneTorch", 0, AssetDirectory.VitricTile + "AncientSandstoneTorch", true) { } } diff --git a/Content/Tiles/Vitric/DestructableGlass.cs b/Content/Tiles/Vitric/DestructableGlass.cs index 8449f13de..3995d0f50 100644 --- a/Content/Tiles/Vitric/DestructableGlass.cs +++ b/Content/Tiles/Vitric/DestructableGlass.cs @@ -1,4 +1,5 @@ -using Terraria.DataStructures; +using StarlightRiver.Content.Items.BaseTypes; +using Terraria.DataStructures; using Terraria.ID; namespace StarlightRiver.Content.Tiles.Vitric @@ -70,7 +71,7 @@ public override void PostDraw(int i, int j, SpriteBatch spriteBatch) } } - internal class DestructableGlassItem : QuickTileItem + internal class DestructableGlassItem : BaseTileItem { public override string Texture => AssetDirectory.VitricTile + "VitricGlassItem"; diff --git a/Content/Tiles/Vitric/ForgeDoor.cs b/Content/Tiles/Vitric/ForgeDoor.cs index e4428e4c0..76ee55d77 100644 --- a/Content/Tiles/Vitric/ForgeDoor.cs +++ b/Content/Tiles/Vitric/ForgeDoor.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Core.Systems; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Core.Systems; using Terraria.ID; using static Terraria.ModLoader.ModContent; @@ -23,7 +24,7 @@ public override void NearbyEffects(int i, int j, bool closer) } [SLRDebug] - class ForgeDoorItem : QuickTileItem + class ForgeDoorItem : BaseTileItem { public ForgeDoorItem() : base("Forge Door", "{{Debug}} Item", "ForgeDoor", 1, AssetDirectory.Debug, true) { } } diff --git a/Content/Tiles/Vitric/ForgeInnerDoor.cs b/Content/Tiles/Vitric/ForgeInnerDoor.cs index d6682748d..5f57c30db 100644 --- a/Content/Tiles/Vitric/ForgeInnerDoor.cs +++ b/Content/Tiles/Vitric/ForgeInnerDoor.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Core.Systems; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Core.Systems; using System; using Terraria.ID; using static Terraria.ModLoader.ModContent; @@ -28,7 +29,7 @@ public override void PostDraw(int i, int j, SpriteBatch spriteBatch) } [SLRDebug] - class ForgeInnerDoorItem : QuickTileItem + class ForgeInnerDoorItem : BaseTileItem { public ForgeInnerDoorItem() : base("Forge Inner Door", "{{Debug}} Item", "ForgeInnerDoor", 1, AssetDirectory.Debug, true) { } } diff --git a/Content/Tiles/Vitric/RedBannerShort.cs b/Content/Tiles/Vitric/RedBannerShort.cs index 1e9641f29..72380e8d3 100644 --- a/Content/Tiles/Vitric/RedBannerShort.cs +++ b/Content/Tiles/Vitric/RedBannerShort.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Content.Physics; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Content.Physics; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.DummyTileSystem; using System; @@ -73,7 +74,7 @@ private void WindForce(int index)//wind } [SLRDebug] - class RedBannerShortItem : QuickTileItem + class RedBannerShortItem : BaseTileItem { public RedBannerShortItem() : base("Short Flowing Banner", "{{Debug}} Item", "RedBannerShort", 2, AssetDirectory.VitricTile, false) { } } diff --git a/Content/Tiles/Vitric/Temple/CrystalSlimeSpawner.cs b/Content/Tiles/Vitric/Temple/CrystalSlimeSpawner.cs index c5870cc73..fef93b2b3 100644 --- a/Content/Tiles/Vitric/Temple/CrystalSlimeSpawner.cs +++ b/Content/Tiles/Vitric/Temple/CrystalSlimeSpawner.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Content.NPCs.Vitric; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Content.NPCs.Vitric; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.DummyTileSystem; using System.Linq; @@ -19,7 +20,7 @@ public override void SetStaticDefaults() } [SLRDebug] - internal class CrystalSlimeSpawnerItem : QuickTileItem + internal class CrystalSlimeSpawnerItem : BaseTileItem { public CrystalSlimeSpawnerItem() : base("NPC Spawner", "", "CrystalSlimeSpawner", 1, AssetDirectory.VitricTile, false) { } } diff --git a/Content/Tiles/Vitric/Temple/Doors.cs b/Content/Tiles/Vitric/Temple/Doors.cs index 94174c9a2..dd8c2038f 100644 --- a/Content/Tiles/Vitric/Temple/Doors.cs +++ b/Content/Tiles/Vitric/Temple/Doors.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Abilities; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Content.Items.Vitric; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.CameraSystem; @@ -39,7 +40,7 @@ public override bool RightClick(int i, int j) } [SLRDebug] - class DoorVerticalItem : QuickTileItem + class DoorVerticalItem : BaseTileItem { public DoorVerticalItem() : base("Vertical Temple Door", "Temple Door, But what if it was vertical?", "DoorVertical", ItemRarityID.Blue, AssetDirectory.Debug, true) { } } @@ -75,7 +76,7 @@ public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) } [SLRDebug] - class DoorGearsItem : QuickTileItem + class DoorGearsItem : BaseTileItem { public DoorGearsItem() : base("Gear Puzzle Temple Door", "Temple Door, Opens if gear puzzle is solved", "DoorGears", ItemRarityID.Blue, AssetDirectory.Debug, true) { } } @@ -111,7 +112,7 @@ public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) } [SLRDebug] - class DoorLasersItem : QuickTileItem + class DoorLasersItem : BaseTileItem { public DoorLasersItem() : base("Laser Puzzle Temple Door", "Temple Door, Opens if laser puzzle is solved", "DoorLasers", ItemRarityID.Blue, AssetDirectory.Debug, true) { } } @@ -180,7 +181,7 @@ public override void PostDraw(Color lightColor) } [SLRDebug] - class DashableDoorItem : QuickTileItem + class DashableDoorItem : BaseTileItem { public DashableDoorItem() : base("DashableDoor", "{{Debug}} Item", "DashableDoor", 1, AssetDirectory.Debug, true) { } } diff --git a/Content/Tiles/Vitric/Temple/EntranceDoor.cs b/Content/Tiles/Vitric/Temple/EntranceDoor.cs index 290349c88..524c13fca 100644 --- a/Content/Tiles/Vitric/Temple/EntranceDoor.cs +++ b/Content/Tiles/Vitric/Temple/EntranceDoor.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Core.Systems; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Core.Systems; using Terraria.ID; using Terraria.ObjectData; using static Terraria.ModLoader.ModContent; @@ -55,7 +56,7 @@ public string GetHint() } [SLRDebug] - class EntranceDoorItem : QuickTileItem + class EntranceDoorItem : BaseTileItem { public override string Texture => AssetDirectory.Debug; diff --git a/Content/Tiles/Vitric/Temple/GearPuzzle/DynamicGear.cs b/Content/Tiles/Vitric/Temple/GearPuzzle/DynamicGear.cs index 10233445f..fcd293df7 100644 --- a/Content/Tiles/Vitric/Temple/GearPuzzle/DynamicGear.cs +++ b/Content/Tiles/Vitric/Temple/GearPuzzle/DynamicGear.cs @@ -1,5 +1,6 @@ using StarlightRiver.Content.Abilities; using StarlightRiver.Content.Biomes; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Content.Packets; using StarlightRiver.Core.Loaders; using StarlightRiver.Core.Systems; @@ -143,7 +144,7 @@ public override void PostDraw(Color lightColor) } [SLRDebug] - class GearTilePlacer : QuickTileItem + class GearTilePlacer : BaseTileItem { public GearTilePlacer() : base("Gear puzzle", "{{Debug}} Item", "DynamicGear", 8, AssetDirectory.VitricTile) { } } diff --git a/Content/Tiles/Vitric/Temple/GearPuzzle/GearPuzzleOrigin.cs b/Content/Tiles/Vitric/Temple/GearPuzzle/GearPuzzleOrigin.cs index e4e2ba50b..21369493d 100644 --- a/Content/Tiles/Vitric/Temple/GearPuzzle/GearPuzzleOrigin.cs +++ b/Content/Tiles/Vitric/Temple/GearPuzzle/GearPuzzleOrigin.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Biomes; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.DummyTileSystem; using System; @@ -65,7 +66,7 @@ public override void PostDraw(Color lightColor) } [SLRDebug] - class GearPuzzleOriginPlacer : QuickTileItem + class GearPuzzleOriginPlacer : BaseTileItem { public GearPuzzleOriginPlacer() : base("Gear puzzle origin", "{{Debug}} Item", "GearPuzzleOrigin", 8, AssetDirectory.VitricTile + "OriginGearBase", true) { } } diff --git a/Content/Tiles/Vitric/Temple/GearPuzzle/ObjectiveGear.cs b/Content/Tiles/Vitric/Temple/GearPuzzle/ObjectiveGear.cs index 122b78455..5d638b7de 100644 --- a/Content/Tiles/Vitric/Temple/GearPuzzle/ObjectiveGear.cs +++ b/Content/Tiles/Vitric/Temple/GearPuzzle/ObjectiveGear.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Core.Systems; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.DummyTileSystem; namespace StarlightRiver.Content.Tiles.Vitric.Temple.GearPuzzle @@ -49,7 +50,7 @@ public override void PostDraw(Color lightColor) } [SLRDebug] - class ObjectiveGearItem : QuickTileItem + class ObjectiveGearItem : BaseTileItem { public ObjectiveGearItem() : base("Gear puzzle Point", "{{Debug}} Item", "ObjectiveGear", 8, AssetDirectory.VitricTile + "GearPeg", true) { } } diff --git a/Content/Tiles/Vitric/Temple/LightActor.cs b/Content/Tiles/Vitric/Temple/LightActor.cs index ff86e7273..b76220344 100644 --- a/Content/Tiles/Vitric/Temple/LightActor.cs +++ b/Content/Tiles/Vitric/Temple/LightActor.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Biomes; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.DummyTileSystem; using System; @@ -47,7 +48,7 @@ public override bool RightClick(int i, int j) } [SLRDebug] - internal class LightActorItem : QuickTileItem + internal class LightActorItem : BaseTileItem { public override string Texture => AssetDirectory.Debug; diff --git a/Content/Tiles/Vitric/Temple/LightPuzzle/Lens.cs b/Content/Tiles/Vitric/Temple/LightPuzzle/Lens.cs index 1bb0f1284..489c5e7ea 100644 --- a/Content/Tiles/Vitric/Temple/LightPuzzle/Lens.cs +++ b/Content/Tiles/Vitric/Temple/LightPuzzle/Lens.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Core.Loaders; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Core.Loaders; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.DummyTileSystem; using StarlightRiver.Core.Systems.PixelationSystem; @@ -139,7 +140,7 @@ public override void PostDraw(Color lightColor) } [SLRDebug] - class LensItem : QuickTileItem + class LensItem : BaseTileItem { public LensItem() : base("Reflector Lens", "{{Debug}} Item", "Lens") { } } diff --git a/Content/Tiles/Vitric/Temple/LightPuzzle/Reflector.cs b/Content/Tiles/Vitric/Temple/LightPuzzle/Reflector.cs index 3328c54e0..c843bda62 100644 --- a/Content/Tiles/Vitric/Temple/LightPuzzle/Reflector.cs +++ b/Content/Tiles/Vitric/Temple/LightPuzzle/Reflector.cs @@ -1,5 +1,6 @@ using StarlightRiver.Content.Abilities; using StarlightRiver.Content.Biomes; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Content.Packets; using StarlightRiver.Content.Tiles.Vitric.Temple.GearPuzzle; using StarlightRiver.Core.Loaders; @@ -259,7 +260,7 @@ public override void SafeReceiveExtraAI(BinaryReader reader) } [SLRDebug] - class ReflectorItem : QuickTileItem + class ReflectorItem : BaseTileItem { public ReflectorItem() : base("Reflector", "{{Debug}} Item", "Reflector") { } } diff --git a/Content/Tiles/Vitric/Temple/LowWindBanner.cs b/Content/Tiles/Vitric/Temple/LowWindBanner.cs index 43138ff5f..d9f4761a0 100644 --- a/Content/Tiles/Vitric/Temple/LowWindBanner.cs +++ b/Content/Tiles/Vitric/Temple/LowWindBanner.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Content.Physics; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Content.Physics; using StarlightRiver.Core.Systems.DummyTileSystem; using StarlightRiver.Core.VerletGenerators; using Terraria.ID; @@ -18,7 +19,7 @@ public override void SetStaticDefaults() } } - class LowWindBannerItem : QuickTileItem + class LowWindBannerItem : BaseTileItem { public LowWindBannerItem() : base("Rectangular Flowing Banner", "", "LowWindBanner", 1, AssetDirectory.VitricTile, false) { } } diff --git a/Content/Tiles/Vitric/Temple/MainForge.cs b/Content/Tiles/Vitric/Temple/MainForge.cs index d341a21d1..7b00200e8 100644 --- a/Content/Tiles/Vitric/Temple/MainForge.cs +++ b/Content/Tiles/Vitric/Temple/MainForge.cs @@ -1,5 +1,6 @@ using StarlightRiver.Content.Abilities; using StarlightRiver.Content.Biomes; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.DummyTileSystem; using StarlightRiver.Core.Systems.LightingSystem; @@ -195,7 +196,7 @@ public float HammerFunction(float input) } [SLRDebug] - class MainForgeItem : QuickTileItem + class MainForgeItem : BaseTileItem { public override string Texture => AssetDirectory.Debug; diff --git a/Content/Tiles/Vitric/Temple/NPCSpawner.cs b/Content/Tiles/Vitric/Temple/NPCSpawner.cs index d87e5c522..debc77d88 100644 --- a/Content/Tiles/Vitric/Temple/NPCSpawner.cs +++ b/Content/Tiles/Vitric/Temple/NPCSpawner.cs @@ -1,5 +1,6 @@ using StarlightRiver.Content.Abilities; using StarlightRiver.Content.Abilities.ForbiddenWinds; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Content.NPCs.Vitric.Gauntlet; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.DummyTileSystem; @@ -22,7 +23,7 @@ public override void SetStaticDefaults() } [SLRDebug] - internal class NPCSpawnerItem : QuickTileItem + internal class NPCSpawnerItem : BaseTileItem { public NPCSpawnerItem() : base("NPC Spawner", "", "NPCSpawner", 1, AssetDirectory.VitricTile, false) { } } diff --git a/Content/Tiles/Vitric/Temple/OldCeirosShrine.cs b/Content/Tiles/Vitric/Temple/OldCeirosShrine.cs index fc927479e..9a8d3b5d5 100644 --- a/Content/Tiles/Vitric/Temple/OldCeirosShrine.cs +++ b/Content/Tiles/Vitric/Temple/OldCeirosShrine.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Biomes; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.DummyTileSystem; using System; @@ -132,7 +133,7 @@ public override void PostDraw(Color lightColor) } [SLRDebug] - class OldCeirosShrineItem : QuickTileItem + class OldCeirosShrineItem : BaseTileItem { public OldCeirosShrineItem() : base("Old Ceiros Shrine", "{{Debug}} Item", "OldCeirosShrine", 0) { } } diff --git a/Content/Tiles/Vitric/Temple/SoundPuzzle/SoundPuzzleDoor.cs b/Content/Tiles/Vitric/Temple/SoundPuzzle/SoundPuzzleDoor.cs index ca7c33b97..af3371834 100644 --- a/Content/Tiles/Vitric/Temple/SoundPuzzle/SoundPuzzleDoor.cs +++ b/Content/Tiles/Vitric/Temple/SoundPuzzle/SoundPuzzleDoor.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Core.Systems; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Core.Systems; using StarlightRiver.Helpers; using System; using System.Collections.Generic; @@ -40,7 +41,7 @@ public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) } [SLRDebug] - class SoundPuzzleDoorItem : QuickTileItem + class SoundPuzzleDoorItem : BaseTileItem { public SoundPuzzleDoorItem() : base("Sound Puzzle Temple Door", "Temple Door, Opens if sound puzzle is solved", "SoundPuzzleDoor", ItemRarityID.Blue, AssetDirectory.Debug, true) { } } diff --git a/Content/Tiles/Vitric/Temple/TempleCandle.cs b/Content/Tiles/Vitric/Temple/TempleCandle.cs index 77ac985c1..d1f987edd 100644 --- a/Content/Tiles/Vitric/Temple/TempleCandle.cs +++ b/Content/Tiles/Vitric/Temple/TempleCandle.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Biomes; +using StarlightRiver.Content.Items.BaseTypes; using Terraria.ID; namespace StarlightRiver.Content.Tiles.Vitric.Temple @@ -39,7 +40,7 @@ public override void HitWire(int i, int j) } } - public class TempleCandleItem : QuickTileItem + public class TempleCandleItem : BaseTileItem { public TempleCandleItem() : base("Temple Candle", "", "TempleCandle", ItemRarityID.White, "StarlightRiver/Assets/Tiles/Vitric/TempleDecoration/") { } } diff --git a/Content/Tiles/Vitric/Temple/TempleCandleCrystal.cs b/Content/Tiles/Vitric/Temple/TempleCandleCrystal.cs index 1e371ba95..3df7fa350 100644 --- a/Content/Tiles/Vitric/Temple/TempleCandleCrystal.cs +++ b/Content/Tiles/Vitric/Temple/TempleCandleCrystal.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Biomes; +using StarlightRiver.Content.Items.BaseTypes; using System; using Terraria.ID; @@ -49,7 +50,7 @@ public override void HitWire(int i, int j) } } - public class TempleCandleCrystalItem : QuickTileItem + public class TempleCandleCrystalItem : BaseTileItem { public TempleCandleCrystalItem() : base("Temple Crystal Candle", "", "TempleCandleCrystal", ItemRarityID.White, "StarlightRiver/Assets/Tiles/Vitric/TempleDecoration/") { } } diff --git a/Content/Tiles/Vitric/Temple/TempleCeirosFountain.cs b/Content/Tiles/Vitric/Temple/TempleCeirosFountain.cs index a07e12cb6..b41537b39 100644 --- a/Content/Tiles/Vitric/Temple/TempleCeirosFountain.cs +++ b/Content/Tiles/Vitric/Temple/TempleCeirosFountain.cs @@ -1,4 +1,5 @@ -using Terraria.DataStructures; +using StarlightRiver.Content.Items.BaseTypes; +using Terraria.DataStructures; using Terraria.Enums; using Terraria.ID; using Terraria.Localization; @@ -54,7 +55,7 @@ public override void AnimateTile(ref int frame, ref int frameCounter) } } - public class TempleCeirosFountainItem : QuickTileItem + public class TempleCeirosFountainItem : BaseTileItem { public TempleCeirosFountainItem() : base("Temple Sentinel Fountain", "", "TempleCeirosFountain", ItemRarityID.White, "StarlightRiver/Assets/Tiles/Vitric/TempleDecoration/") { } } diff --git a/Content/Tiles/Vitric/Temple/TempleWallCandle.cs b/Content/Tiles/Vitric/Temple/TempleWallCandle.cs index b638ad27f..1deba90ec 100644 --- a/Content/Tiles/Vitric/Temple/TempleWallCandle.cs +++ b/Content/Tiles/Vitric/Temple/TempleWallCandle.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Biomes; +using StarlightRiver.Content.Items.BaseTypes; using Terraria.DataStructures; using Terraria.Enums; using Terraria.ID; @@ -71,7 +72,7 @@ public override void AnimateTile(ref int frame, ref int frameCounter) } } - public class TempleWallCandleItem : QuickTileItem + public class TempleWallCandleItem : BaseTileItem { public TempleWallCandleItem() : base("Temple Wall Candle", "", "TempleWallCandle", ItemRarityID.White, "StarlightRiver/Assets/Tiles/Vitric/TempleDecoration/") { } } diff --git a/Content/Tiles/Vitric/Temple/TempleWindowSmall.cs b/Content/Tiles/Vitric/Temple/TempleWindowSmall.cs index b89292ffe..0c7df392b 100644 --- a/Content/Tiles/Vitric/Temple/TempleWindowSmall.cs +++ b/Content/Tiles/Vitric/Temple/TempleWindowSmall.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Biomes; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.DummyTileSystem; using StarlightRiver.Core.Systems.LightingSystem; @@ -76,7 +77,7 @@ public override void ModifyLight(int i, int j, ref float r, ref float g, ref flo } [SLRDebug] - class TallWindowItem : QuickTileItem + class TallWindowItem : BaseTileItem { public TallWindowItem() : base("Window Actor", "{{Debug}} Item", "TallWindow", 0, AssetDirectory.VitricTile + "WindsRoomOrnamentLeft", true) { } } @@ -92,7 +93,7 @@ class TallWindowLava : TallWindow } [SLRDebug] - class TallWindowLavaItem : QuickTileItem + class TallWindowLavaItem : BaseTileItem { public TallWindowLavaItem() : base("Lava Window Actor", "{{Debug}} Item", "TallWindowLava", 0, AssetDirectory.VitricTile + "WindsRoomOrnamentLeft", true) { } } @@ -126,7 +127,7 @@ class TallWindowCrystal : TallWindow } [SLRDebug] - class TallWindowCrystalItem : QuickTileItem + class TallWindowCrystalItem : BaseTileItem { public TallWindowCrystalItem() : base("Crystal Window Actor", "{{Debug}} Item", "TallWindowCrystal", 0, AssetDirectory.VitricTile + "WindsRoomOrnamentLeft", true) { } } diff --git a/Content/Tiles/Vitric/Temple/TutorialDoors.cs b/Content/Tiles/Vitric/Temple/TutorialDoors.cs index 24cf0fcdb..e1a6957da 100644 --- a/Content/Tiles/Vitric/Temple/TutorialDoors.cs +++ b/Content/Tiles/Vitric/Temple/TutorialDoors.cs @@ -1,5 +1,6 @@ using StarlightRiver.Content.Abilities; using StarlightRiver.Content.Abilities.ForbiddenWinds; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.CameraSystem; using StarlightRiver.Core.Systems.DummyTileSystem; @@ -75,7 +76,7 @@ public override void PostDraw(Color lightColor) } [SLRDebug] - class TutorialDoor1Item : QuickTileItem + class TutorialDoor1Item : BaseTileItem { public TutorialDoor1Item() : base("TutorialDoor1", "{{Debug}} Item", "TutorialDoor1", 1, AssetDirectory.Debug, true) { } } @@ -149,7 +150,7 @@ public override void PostDraw(Color lightColor) } [SLRDebug] - class TutorialDoor2Item : QuickTileItem + class TutorialDoor2Item : BaseTileItem { public TutorialDoor2Item() : base("TutorialDoor2", "{{Debug}} Item", "TutorialDoor2", 1, AssetDirectory.Debug, true) { } } diff --git a/Content/Tiles/Vitric/Temple/VitricPillarWall.cs b/Content/Tiles/Vitric/Temple/VitricPillarWall.cs index 4fb863060..2d5bd9027 100644 --- a/Content/Tiles/Vitric/Temple/VitricPillarWall.cs +++ b/Content/Tiles/Vitric/Temple/VitricPillarWall.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Biomes; +using StarlightRiver.Content.Items.BaseTypes; using System; using Terraria.ID; using static Terraria.ModLoader.ModContent; @@ -15,7 +16,7 @@ public override void SetStaticDefaults() } } - class VitricPillarWallItem : QuickTileItem + class VitricPillarWallItem : BaseTileItem { public override string Texture => AssetDirectory.VitricTile + "VitricPillarWallItem"; @@ -32,7 +33,7 @@ public override void SetStaticDefaults() } } - class VitricPillarWallShortItem : QuickTileItem + class VitricPillarWallShortItem : BaseTileItem { public override string Texture => AssetDirectory.VitricTile + "VitricPillarWallItem"; @@ -65,7 +66,7 @@ public override void PostDraw(int i, int j, SpriteBatch spriteBatch) } } - class VitricPillarWallLavaItem : QuickTileItem + class VitricPillarWallLavaItem : BaseTileItem { public override string Texture => AssetDirectory.VitricTile + "VitricPillarWallItem"; @@ -82,7 +83,7 @@ public override void SetStaticDefaults() } } - class VitricPillarWallCrystalItem : QuickTileItem + class VitricPillarWallCrystalItem : BaseTileItem { public override string Texture => AssetDirectory.VitricTile + "VitricPillarWallItem"; diff --git a/Content/Tiles/Vitric/Temple/VitricTempleWall.cs b/Content/Tiles/Vitric/Temple/VitricTempleWall.cs index da0cf7d3c..c2f389a51 100644 --- a/Content/Tiles/Vitric/Temple/VitricTempleWall.cs +++ b/Content/Tiles/Vitric/Temple/VitricTempleWall.cs @@ -1,3 +1,4 @@ +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems; using Terraria.Graphics; using Terraria.ID; @@ -52,7 +53,7 @@ public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) } [SLRDebug] - class VitricTempleWallItem : QuickWallItem + class VitricTempleWallItem : BaseWallItem { public override string Texture => AssetDirectory.VitricTile + "VitricTempleWallItem"; @@ -61,7 +62,7 @@ public VitricTempleWallItem() : base("Vitric Forge Brick Wall (Danger)", "{{Debu class VitricTempleWallSafe : VitricTempleWall { } - class VitricTempleWallSafeItem : QuickWallItem + class VitricTempleWallSafeItem : BaseWallItem { public override string Texture => AssetDirectory.VitricTile + "VitricTempleWallItem"; diff --git a/Content/Tiles/Vitric/Temple/WindsRoomActor.cs b/Content/Tiles/Vitric/Temple/WindsRoomActor.cs index 621b67c0c..f3e0ecb37 100644 --- a/Content/Tiles/Vitric/Temple/WindsRoomActor.cs +++ b/Content/Tiles/Vitric/Temple/WindsRoomActor.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Biomes; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.DummyTileSystem; using StarlightRiver.Core.Systems.LightingSystem; @@ -22,7 +23,7 @@ public override void SetStaticDefaults() } [SLRDebug] - class WindsRoomActorItem : QuickTileItem + class WindsRoomActorItem : BaseTileItem { public WindsRoomActorItem() : base("Winds Room Actor", "{{Debug}} Item", "WindsRoomActor", 0, AssetDirectory.VitricTile + "WindsRoomOrnamentLeft", true) { } } diff --git a/Content/Tiles/Vitric/VitricBannerSmall.cs b/Content/Tiles/Vitric/VitricBannerSmall.cs index b93a8f1ad..b8072aaaa 100644 --- a/Content/Tiles/Vitric/VitricBannerSmall.cs +++ b/Content/Tiles/Vitric/VitricBannerSmall.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Content.Physics; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Content.Physics; using StarlightRiver.Core.Systems.DummyTileSystem; using System; using Terraria.ID; @@ -71,7 +72,7 @@ private void WindForce(int index)//wind } } - class VitricBannerSmallItem : QuickTileItem + class VitricBannerSmallItem : BaseTileItem { public VitricBannerSmallItem() : base("Short Flowing Banner", "", "VitricBannerSmall", 2, AssetDirectory.VitricTile, false) { } } diff --git a/Content/Tiles/Vitric/VitricBossAltar.cs b/Content/Tiles/Vitric/VitricBossAltar.cs index 90b8efd70..a17e937c8 100644 --- a/Content/Tiles/Vitric/VitricBossAltar.cs +++ b/Content/Tiles/Vitric/VitricBossAltar.cs @@ -1,8 +1,8 @@ using StarlightRiver.Content.Abilities; using StarlightRiver.Content.Biomes; using StarlightRiver.Content.Bosses.VitricBoss; -using StarlightRiver.Content.CustomHooks; using StarlightRiver.Content.Dusts; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Content.Packets; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.CameraSystem; @@ -110,7 +110,7 @@ public void SpawnBoss(int i, int j, Player player) } [SLRDebug] - class VitricBossAltarItem : QuickTileItem + class VitricBossAltarItem : BaseTileItem { public VitricBossAltarItem() : base("Vitric Boss Altar Item", "{{{{Debug}}}} Item", "VitricBossAltar", 1, AssetDirectory.Debug, true) { } } @@ -334,12 +334,12 @@ public override void DrawBehindTiles() spriteBatch.Draw(texSkull, Center - Main.screenPosition, null, new Color(255, 100, 100) * (1 - Vector2.Distance(Main.LocalPlayer.Center, Center) / 200f), 0, texSkull.Size() / 2, 1, 0, 0); } - else if (parent.TileFrameX < 90 && ReflectionTarget.canUseTarget) + else if (parent.TileFrameX < 90 && BackgroundReflectionSystem.canUseTarget) { if (ShouldDrawReflection()) { - ReflectionTarget.DrawReflection(spriteBatch, screenPos: position - Main.screenPosition, normalMap: Assets.Tiles.Vitric.VitricBossAltarReflectionMap.Value, flatOffset: new Vector2(-0.0075f, 0.011f), tintColor: new Color(150, 150, 255, 200), offsetScale: 0.05f); - ReflectionTarget.isDrawReflectablesThisFrame = true; + BackgroundReflectionSystem.DrawReflection(spriteBatch, screenPos: position - Main.screenPosition, normalMap: Assets.Tiles.Vitric.VitricBossAltarReflectionMap.Value, flatOffset: new Vector2(-0.0075f, 0.011f), tintColor: new Color(150, 150, 255, 200), offsetScale: 0.05f); + BackgroundReflectionSystem.isDrawReflectablesThisFrame = true; } Texture2D glow = Assets.Tiles.Vitric.VitricBossAltarGlow.Value; diff --git a/Content/Tiles/Vitric/VitricCrystals.cs b/Content/Tiles/Vitric/VitricCrystals.cs index 1df0bcd9b..a8a46d835 100644 --- a/Content/Tiles/Vitric/VitricCrystals.cs +++ b/Content/Tiles/Vitric/VitricCrystals.cs @@ -1,7 +1,7 @@ using StarlightRiver.Content.Dusts; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.DummyTileSystem; -using StarlightRiver.Helpers; using System; using Terraria.GameContent; using Terraria.ID; @@ -9,7 +9,7 @@ namespace StarlightRiver.Content.Tiles.Vitric { - public abstract class WalkableCrystalItem : QuickTileItem + public abstract class WalkableCrystalItem : BaseTileItem { private bool held = false; diff --git a/Content/Tiles/Vitric/VitricFountain.cs b/Content/Tiles/Vitric/VitricFountain.cs index e9ccde57c..18bab5886 100644 --- a/Content/Tiles/Vitric/VitricFountain.cs +++ b/Content/Tiles/Vitric/VitricFountain.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Core.Loaders.TileLoading; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Core.Loaders.TileLoading; using StarlightRiver.Core.Systems; namespace StarlightRiver.Content.Tiles.Vitric @@ -9,7 +10,7 @@ public VitricFountain() : base("VitricFountainItem", AssetDirectory.VitricTile) } [SLRDebug] - internal class VitricFountainItem : QuickTileItem + internal class VitricFountainItem : BaseTileItem { public VitricFountainItem() : base("VitricFountainItem", "Vitric Fountain", "{{Debug}} Item", "VitricFountain", texturePath: AssetDirectory.VitricTile) { } } diff --git a/Content/Tiles/Vitric/VitricLargeFountain.cs b/Content/Tiles/Vitric/VitricLargeFountain.cs index 7bcebfd25..c7a42f2ed 100644 --- a/Content/Tiles/Vitric/VitricLargeFountain.cs +++ b/Content/Tiles/Vitric/VitricLargeFountain.cs @@ -1,4 +1,5 @@ -using StarlightRiver.Core.Loaders.TileLoading; +using StarlightRiver.Content.Items.BaseTypes; +using StarlightRiver.Core.Loaders.TileLoading; using StarlightRiver.Core.Systems; namespace StarlightRiver.Content.Tiles.Vitric @@ -9,7 +10,7 @@ internal class VitricLargeFountain : QuickFountain } [SLRDebug] - internal class VitricLargeFountainItem : QuickTileItem + internal class VitricLargeFountainItem : BaseTileItem { public VitricLargeFountainItem() : base("VitricLargeFountainItem", "Vitric Large Fountain", "{{Debug}} Item", "VitricLargeFountain", texturePath: AssetDirectory.VitricTile) { } } diff --git a/Content/Tiles/Vitric/VitricLootBox.cs b/Content/Tiles/Vitric/VitricLootBox.cs index e7d673cda..7c137cce0 100644 --- a/Content/Tiles/Vitric/VitricLootBox.cs +++ b/Content/Tiles/Vitric/VitricLootBox.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Dusts; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems; using System.Collections.Generic; using Terraria.ID; @@ -37,7 +38,7 @@ public override void SafeSetDefaults() } [SLRDebug] - class VitricLootBoxItem : QuickTileItem + class VitricLootBoxItem : BaseTileItem { public VitricLootBoxItem() : base("Vitric Loot Box Item", "", "VitricLootBox", 1, AssetDirectory.VitricTile, false) { } } diff --git a/Content/Tiles/Vitric/VitricOre.cs b/Content/Tiles/Vitric/VitricOre.cs index d4a2212cf..a3fefe8a5 100644 --- a/Content/Tiles/Vitric/VitricOre.cs +++ b/Content/Tiles/Vitric/VitricOre.cs @@ -1,5 +1,6 @@ using StarlightRiver.Content.Abilities; using StarlightRiver.Content.Dusts; +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems; using StarlightRiver.Core.Systems.DummyTileSystem; using StarlightRiver.Helpers; @@ -201,13 +202,13 @@ public override void PostDraw(Color lightColor) } [SLRDebug] - class VitricOreItem : QuickTileItem + class VitricOreItem : BaseTileItem { public VitricOreItem() : base("Vitric Ore Crystal Item", "", "VitricOre", 1, AssetDirectory.VitricTile, false) { } } [SLRDebug] - class VitricOreFloatItem : QuickTileItem + class VitricOreFloatItem : BaseTileItem { public VitricOreFloatItem() : base("Floating Vitric Ore Crystal Item", "", "VitricOreFloat", 1, AssetDirectory.VitricTile, false) { } } diff --git a/Content/Tiles/Vitric/VitricPylon.cs b/Content/Tiles/Vitric/VitricPylon.cs index 0a26bbf01..872133e9c 100644 --- a/Content/Tiles/Vitric/VitricPylon.cs +++ b/Content/Tiles/Vitric/VitricPylon.cs @@ -1,4 +1,5 @@ using ReLogic.Content; +using StarlightRiver.Content.Items.BaseTypes; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.ID; @@ -98,7 +99,7 @@ public override void DrawMapIcon(ref MapOverlayDrawContext context, ref string m public sealed class VitricPylonEntity : TEModdedPylon { } - public sealed class VitricPylonItem : QuickTileItem + public sealed class VitricPylonItem : BaseTileItem { public VitricPylonItem() : base("Vitric Pylon", "You shouldn't have this!", "VitricPylon", 0, AssetDirectory.Debug, true, 0) { } } diff --git a/Content/Tiles/Vitric/VitricRock.cs b/Content/Tiles/Vitric/VitricRock.cs index 22b96607b..e128bf985 100644 --- a/Content/Tiles/Vitric/VitricRock.cs +++ b/Content/Tiles/Vitric/VitricRock.cs @@ -1,4 +1,5 @@ -using Terraria.DataStructures; +using StarlightRiver.Content.Items.BaseTypes; +using Terraria.DataStructures; using Terraria.Enums; using Terraria.ID; using Terraria.ObjectData; @@ -6,7 +7,7 @@ namespace StarlightRiver.Content.Tiles.Vitric { - internal class VitricRockItem : QuickTileItem + internal class VitricRockItem : BaseTileItem { public VitricRockItem() : base("Vitric Rock", "", "VitricRock", 0, AssetDirectory.VitricTile) { } //public override void OnConsumeItem(Player Player) => Main.NewText(TileType()); diff --git a/Content/Tiles/Vitric/VitricSand.cs b/Content/Tiles/Vitric/VitricSand.cs index 0fd35a84f..a86a77a12 100644 --- a/Content/Tiles/Vitric/VitricSand.cs +++ b/Content/Tiles/Vitric/VitricSand.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using StarlightRiver.Content.Items.BaseTypes; +using Terraria.ID; using static Terraria.ModLoader.ModContent; namespace StarlightRiver.Content.Tiles.Vitric @@ -14,7 +15,7 @@ public override void SetStaticDefaults() } } - internal class VitricSandWallItem : QuickWallItem + internal class VitricSandWallItem : BaseWallItem { public VitricSandWallItem() : base("Vitric Sand Wall", "", WallType(), 0, AssetDirectory.VitricTile) { } } diff --git a/Content/Tiles/Vitric/VitricSpike.cs b/Content/Tiles/Vitric/VitricSpike.cs index ddfd00fa6..89fbecb8c 100644 --- a/Content/Tiles/Vitric/VitricSpike.cs +++ b/Content/Tiles/Vitric/VitricSpike.cs @@ -1,4 +1,5 @@ using StarlightRiver.Content.Abilities; +using StarlightRiver.Content.Items.BaseTypes; using Terraria.ID; using static Terraria.ModLoader.ModContent; @@ -75,7 +76,7 @@ public static void CollideWithSpikes(Entity entity, out int damage) } } - class VitricSpikeItem : QuickTileItem + class VitricSpikeItem : BaseTileItem { public VitricSpikeItem() : base("Vitric Spikes", "Ouch!", "VitricSpike", 0, AssetDirectory.VitricTile) { } } diff --git a/Content/Tiles/Vitric/VitricVases.cs b/Content/Tiles/Vitric/VitricVases.cs index e333b7ae6..8f25265b2 100644 --- a/Content/Tiles/Vitric/VitricVases.cs +++ b/Content/Tiles/Vitric/VitricVases.cs @@ -1,3 +1,4 @@ +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Core.Systems; using System; using Terraria.DataStructures; @@ -81,5 +82,5 @@ public override bool CanDrop(int i, int j) } [SLRDebug] - internal class VitricBreakableVaseItem : QuickTileItem { public VitricBreakableVaseItem() : base("VitricBreakableVaseItem", "Vitric Vase Placer", "{{Debug}} Item", "VitricBreakableVases", 2, AssetDirectory.VitricTile) { } } + internal class VitricBreakableVaseItem : BaseTileItem { public VitricBreakableVaseItem() : base("VitricBreakableVaseItem", "Vitric Vase Placer", "{{Debug}} Item", "VitricBreakableVases", 2, AssetDirectory.VitricTile) { } } } \ No newline at end of file diff --git a/Core/WalkableCrystal.cs b/Content/Tiles/Vitric/WalkableCrystal.cs similarity index 98% rename from Core/WalkableCrystal.cs rename to Content/Tiles/Vitric/WalkableCrystal.cs index 3fe9ed9c7..ed5f87c17 100644 --- a/Core/WalkableCrystal.cs +++ b/Content/Tiles/Vitric/WalkableCrystal.cs @@ -8,7 +8,7 @@ using Terraria.ID; using Terraria.ObjectData; -namespace StarlightRiver.Core +namespace StarlightRiver.Content.Tiles.Vitric { internal abstract class WalkableCrystal : DummyTile { diff --git a/Content/Tiles/VitricBanner.cs b/Content/Tiles/VitricBanner.cs index c2fa0336d..f5d3c9a6d 100644 --- a/Content/Tiles/VitricBanner.cs +++ b/Content/Tiles/VitricBanner.cs @@ -1,3 +1,4 @@ +using StarlightRiver.Content.Items.BaseTypes; using StarlightRiver.Content.Physics; using StarlightRiver.Core.Systems.DummyTileSystem; using StarlightRiver.Core.VerletGenerators; @@ -22,7 +23,7 @@ public override void SetStaticDefaults() } } - class VitricBannerItem : QuickTileItem + class VitricBannerItem : BaseTileItem { public VitricBannerItem() : base("Long Flowing Banner", "", "VitricBanner", 1, AssetDirectory.VitricTile, false) { } } diff --git a/Content/Waters/WaterAddons/HotspringAddon.cs b/Content/Waters/WaterAddons/HotspringAddon.cs index 0a6eed966..dd17e95ee 100644 --- a/Content/Waters/WaterAddons/HotspringAddon.cs +++ b/Content/Waters/WaterAddons/HotspringAddon.cs @@ -3,6 +3,7 @@ using StarlightRiver.Core.Loaders; using StarlightRiver.Core.Systems.DummyTileSystem; using StarlightRiver.Core.Systems.ScreenTargetSystem; +using StarlightRiver.Core.Systems.WaterAddonSystem; using System.Linq; using Terraria.Graphics.Effects; diff --git a/Content/WorldGeneration/GenerateVitric.cs b/Content/WorldGeneration/GenerateVitric.cs index c2783e61d..65acd55b7 100644 --- a/Content/WorldGeneration/GenerateVitric.cs +++ b/Content/WorldGeneration/GenerateVitric.cs @@ -1,6 +1,6 @@ -using StarlightRiver.Content.CustomHooks; -using StarlightRiver.Content.Tiles.Vitric; +using StarlightRiver.Content.Tiles.Vitric; using StarlightRiver.Content.Tiles.Vitric.Temple.GearPuzzle; +using StarlightRiver.Core.Systems.NoBuildingSystem; using StarlightRiver.Noise; using System; using System.Collections.Generic; @@ -46,7 +46,7 @@ public static void VitricGen(GenerationProgress progress, GameConfiguration conf //Basic biome information vitricBiome = new Rectangle(GenVars.UndergroundDesertLocation.X - 25, GenVars.UndergroundDesertLocation.Y + GenVars.UndergroundDesertLocation.Height / 2, GenVars.UndergroundDesertLocation.Width + 50, vitricHeight); //Boss arena protection - ProtectionWorld.ProtectedRegions.Add(VitricBossArena); + NoBuildSystem.protectedRegions.Add(VitricBossArena); int minCeilingDepth = (int)(vitricBiome.Y + vitricBiome.Height / 2 - 17f * Math.Log(SLOPE_OFFSET - 8)); //Various informational variables - not to be changed int maxCeilingDepth = minCeilingDepth + 7; @@ -563,7 +563,7 @@ private static void GenForge() Point16 dims = StructureHelper.API.MultiStructureGenerator.GetStructureDimensions("Structures/VitricForge", StarlightRiver.Instance, 0); - ProtectionWorld.ProtectedRegions.Add(new Rectangle(x, vitricBiome.Center.Y - 10, dims.X, dims.Y)); + NoBuildSystem.protectedRegions.Add(new Rectangle(x, vitricBiome.Center.Y - 10, dims.X, dims.Y)); NPC.NewNPC(new EntitySource_WorldGen(), (x + 80) * 16, (StarlightWorld.vitricBiome.Center.Y + 20) * 16, NPCType()); } diff --git a/Core/Holidays.cs b/Core/Holidays.cs deleted file mode 100644 index 72771b372..000000000 --- a/Core/Holidays.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; - -namespace StarlightRiver.Core -{ - class Holidays : IOrderedLoadable - { - public static bool AprilFirst = false; - public static bool Anniversary = false; - public static bool Halloween = false; - public static bool Christmas = false; - public static bool NewYears = false; - - public static bool AnySpecialEvent = false; - - public float Priority => 0.5f; - - public void Load() - { - AprilFirst = DateTime.Now.Month == 4 && DateTime.Now.Day == 1; - - Anniversary = DateTime.Now.Month == 8 && DateTime.Now.Day == 28; - - Halloween = DateTime.Now.Month == 10 && DateTime.Now.Day == 31; - - Christmas = DateTime.Now.Month == 12 && DateTime.Now.Day == 25; - - NewYears = DateTime.Now.Month == 12 && DateTime.Now.Day == 31; - - AnySpecialEvent = AprilFirst || Anniversary || Halloween || Christmas || NewYears; - } - - public void Unload() - { - - } - } -} \ No newline at end of file diff --git a/Core/ICustomInventorySound.cs b/Core/ICustomInventorySound.cs deleted file mode 100644 index 996ed81ae..000000000 --- a/Core/ICustomInventorySound.cs +++ /dev/null @@ -1,9 +0,0 @@ -using ReLogic.Utilities; - -namespace StarlightRiver.Core -{ - interface ICustomInventorySound - { - SlotId InventorySound(float pitch); - } -} \ No newline at end of file diff --git a/Core/IDrawAdditive.cs b/Core/IDrawAdditive.cs deleted file mode 100644 index 97d3ba137..000000000 --- a/Core/IDrawAdditive.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace StarlightRiver.Core -{ - interface IDrawAdditive - { - void DrawAdditive(SpriteBatch spriteBatch); - } -} \ No newline at end of file diff --git a/Core/IDynamicMapIcon.cs b/Core/IDynamicMapIcon.cs deleted file mode 100644 index 67a023ec9..000000000 --- a/Core/IDynamicMapIcon.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace StarlightRiver.Core -{ - internal interface IDynamicMapIcon - { - void DrawOnMap(SpriteBatch spriteBatch, Vector2 center, float scale, Color color); - } -} \ No newline at end of file diff --git a/Core/InworldItem.cs b/Core/InworldItem.cs deleted file mode 100644 index 33dfa37ae..000000000 --- a/Core/InworldItem.cs +++ /dev/null @@ -1,95 +0,0 @@ -using Terraria.DataStructures; - -namespace StarlightRiver.Core -{ - public abstract class InworldItem : ModItem - { - [CloneByReference] - public InworldItemNPC inWorldNPC; - - public NPC NPC => inWorldNPC?.NPC; - - public virtual bool VisibleInUI => true; - public virtual int NPCType => 0; - - public static NPC CreateItem(Vector2 pos) where T : InworldItem - { - var Item = new Item(); - Item.SetDefaults(ModContent.ItemType()); - var inworldItem = Item.ModItem as InworldItem; - - int index = NPC.NewNPC(new EntitySource_SpawnNPC(), (int)pos.X, (int)pos.Y, inworldItem.NPCType); - inworldItem.inWorldNPC = Main.npc[index].ModNPC as InworldItemNPC; - inworldItem.inWorldNPC.inWorldItem = inworldItem; - - return Main.npc[index]; - } - - public override void UpdateInventory(Player Player) - { - if (NPC is null) - Item.TurnToAir(); - - if (Player.HeldItem.type != Item.type) - inWorldNPC?.Release(true); - } - } - - public abstract class InworldItemNPC : ModNPC - { - public InworldItem inWorldItem; - public Player owner; - - public bool Held => owner != null; - - public Item Item => inWorldItem.Item; - - protected virtual void Pickup(Player Player) { } - - protected virtual void PutDown(Player Player) { } - - protected virtual void PutDownNatural(Player Player) { } - - public virtual bool CanPickup(Player Player) - { - return false; - } - - public void Release(bool natural) - { - if (natural) - PutDownNatural(owner); - else - PutDown(owner); - - owner.selectedItem = 9; - owner.inventory[58] = new Item(); - Main.mouseItem = owner.inventory[58]; - owner = null; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - if (CanPickup(target) && !Held && target.Hitbox.Intersects(NPC.Hitbox)) - { - target.inventory[58] = Item; - Main.mouseItem = Item; - target.selectedItem = 58; - - owner = target; - Pickup(target); - } - - return false; - } - - public override void PostAI() - { - if (inWorldItem is null) - NPC.active = false; - - if (Held && owner.HeldItem.type != Item.type) - Release(true); - } - } -} \ No newline at end of file diff --git a/Core/ItemBases.cs b/Core/ItemBases.cs deleted file mode 100644 index 698eedcaa..000000000 --- a/Core/ItemBases.cs +++ /dev/null @@ -1,296 +0,0 @@ -using StarlightRiver.Helpers; -using Terraria.GameContent; -using Terraria.ID; - -namespace StarlightRiver.Core -{ - public abstract class HeldItemProjectile : ModProjectile - { - private readonly float distance; - protected Vector2 direction = Vector2.Zero; - - public HeldItemProjectile(float distance = 1) - { - this.distance = distance; - } - - public sealed override void SetDefaults() - { - Projectile.hostile = false; - Projectile.friendly = false; - Projectile.width = 10; - Projectile.height = 10; - Projectile.aiStyle = -1; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - Projectile.alpha = 255; - Projectile.timeLeft = 9999; - - SafeSetDefaults(); - } - - public virtual void SafeSetDefaults() { } - - public sealed override bool PreAI() - { - AdjustDirection(); - Player Player = Main.player[Projectile.owner]; - Player.ChangeDir(Main.MouseWorld.X > Player.position.X ? 1 : -1); - Player.heldProj = Projectile.whoAmI; - Player.itemTime = 2; - Player.itemAnimation = 2; - Projectile.Center = Player.Center; - - if (!Player.channel) - Projectile.Kill(); - - return true; - } - - public sealed override bool PreDraw(ref Color lightColor) - { - SpriteEffects spriteEffect = SpriteEffects.None; - Vector2 offset = Vector2.Zero; - Texture2D tex = TextureAssets.Projectile[Projectile.type].Value; - - if (Main.player[Projectile.owner].direction != 1) - spriteEffect = SpriteEffects.FlipVertically; - - Vector2 pos = (Main.player[Projectile.owner].Center - Main.screenPosition + new Vector2(0, Main.player[Projectile.owner].gfxOffY)).Round() + offset + direction * distance; - Main.spriteBatch.Draw(tex, pos, null, lightColor, direction.ToRotation(), tex.Size() * 0.5f, Projectile.scale, spriteEffect, 0); - - return SafePreDraw(Main.spriteBatch, lightColor); - } - - public virtual bool SafePreDraw(SpriteBatch spriteBatch, Color lightColor) - { - return true; - } - - private void AdjustDirection(float deviation = 0f) - { - Player Player = Main.player[Projectile.owner]; - direction = Main.MouseWorld - (Player.Center - new Vector2(4, 4)) - new Vector2(0, Main.player[Projectile.owner].gfxOffY); - direction.Normalize(); - direction = direction.RotatedBy(deviation); - Player.itemRotation = direction.ToRotation(); - - if (Player.direction != 1) - Player.itemRotation -= 3.14f; - } - } - - public abstract class QuickCritterItem : ModItem - { - private readonly string itemName; - private readonly string itemTooltip; - private readonly int maxStack; - private readonly int value; - private readonly int rarity; - private readonly int npcID; - private readonly string texturePath; - private readonly bool pathHasName; - - public override string Texture => string.IsNullOrEmpty(texturePath) ? base.Texture : texturePath + (pathHasName ? string.Empty : Name); - - protected QuickCritterItem(string name, string tooltip, int value, int rare, int NPCType, string texturePath = null, bool pathHasName = false, int maxstack = 999) - { - itemName = name; - itemTooltip = tooltip; - maxStack = maxstack; - this.value = value; - rarity = rare; - this.texturePath = texturePath; - this.pathHasName = pathHasName; - npcID = NPCType; - } - - public override void SetStaticDefaults() - { - DisplayName.SetDefault(itemName); - Tooltip.SetDefault(itemTooltip); - } - - public override void SetDefaults() - { - Item.consumable = true; - - Item.noUseGraphic = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useTime = Item.useAnimation = 15; - Item.makeNPC = npcID; - - Item.width = 20; - Item.height = 20; - Item.maxStack = maxStack; - Item.value = value; - Item.rare = rarity; - } - } - - public abstract class QuickMaterial : ModItem - { - private readonly string name; - private readonly string tooltip; - private readonly int maxStack; - private readonly int value; - private readonly int rarity; - private readonly string texturePath; - private readonly bool pathHasName; - - public override string Texture => string.IsNullOrEmpty(texturePath) ? base.Texture : texturePath + (pathHasName ? string.Empty : Name); - - protected QuickMaterial(string name, string tooltip, int maxstack, int value, int rare, string texturePath = null, bool pathHasName = false) - { - this.name = name; - this.tooltip = tooltip; - maxStack = maxstack; - this.value = value; - rarity = rare; - this.texturePath = texturePath; - this.pathHasName = pathHasName; - } - - public override void SetStaticDefaults() - { - DisplayName.SetDefault(name); - Tooltip.SetDefault(tooltip); - } - - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.maxStack = maxStack; - Item.value = value; - Item.rare = rarity; - } - } - - public class QuickBannerItem : QuickTileItem - { - public QuickBannerItem(string placetype, string NPCDisplayName, string texturePath = null, int rare = ItemRarityID.Blue, int ItemValue = 1000) : //todo maybe: bool for tooltip - base(NPCDisplayName + " BannerItem", NPCDisplayName + " Banner", "Nearby Players get a bonus against: " + NPCDisplayName, placetype, rare, texturePath, false, ItemValue) - { } - - public override void SetDefaults() - { - base.SetDefaults(); - Item.maxStack = 99; - } - } - - public abstract class QuickTileItem : ModItem - { - public string internalName = ""; - public string itemName; - public string itemToolTip; - //private readonly int Tiletype; - private readonly string tileName; - private readonly int rarity; - private readonly string texturePath; - private readonly bool pathHasName; - private readonly int itemValue; - - public override string Name => internalName != "" ? internalName : base.Name; - - public override string Texture => string.IsNullOrEmpty(texturePath) ? AssetDirectory.Debug : texturePath + (pathHasName ? string.Empty : Name); - - public QuickTileItem() { } - - public QuickTileItem(string name, string tooltip, string placetype, int rare = ItemRarityID.White, string texturePath = null, bool pathHasName = false, int ItemValue = 0) - { - itemName = name; - itemToolTip = tooltip; - tileName = placetype; - rarity = rare; - this.texturePath = texturePath; - this.pathHasName = pathHasName; - itemValue = ItemValue; - } - - public QuickTileItem(string internalName, string name, string tooltip, string placetype, int rare = ItemRarityID.White, string texturePath = null, bool pathHasName = false, int ItemValue = 0) - { - this.internalName = internalName; - itemName = name; - itemToolTip = tooltip; - tileName = placetype; - rarity = rare; - this.texturePath = texturePath; - this.pathHasName = pathHasName; - itemValue = ItemValue; - } - - public virtual void SafeSetDefaults() { } - - public override void SetStaticDefaults() - { - DisplayName.SetDefault(itemName ?? "ERROR"); - Tooltip.SetDefault(itemToolTip ?? "Report me please!"); - } - - public override void SetDefaults() - { - if (tileName is null) - return; - - Item.width = 16; - Item.height = 16; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createTile = Mod.Find(tileName).Type; - Item.rare = rarity; - Item.value = itemValue; - SafeSetDefaults(); - } - } - - public abstract class QuickWallItem : ModItem - { - public string itemName; - public string itemToolTip; - private readonly int wallType; - private readonly int rarity; - private readonly string texturePath; - private readonly bool pathHasName; - - public override string Texture => string.IsNullOrEmpty(texturePath) ? base.Texture : texturePath + (pathHasName ? string.Empty : Name); - - protected QuickWallItem(string name, string tooltip, int placetype, int rare, string texturePath = null, bool pathHasName = false) - { - itemName = name; - itemToolTip = tooltip; - wallType = placetype; - rarity = rare; - this.texturePath = texturePath; - this.pathHasName = pathHasName; - } - - public override void SetStaticDefaults() - { - DisplayName.SetDefault(itemName); - Tooltip.SetDefault(itemToolTip); - } - - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.createWall = wallType; - Item.rare = rarity; - } - } -} \ No newline at end of file diff --git a/Core/LearnableRecipie.cs b/Core/LearnableRecipie.cs deleted file mode 100644 index d4372a268..000000000 --- a/Core/LearnableRecipie.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.Collections.Generic; -using Terraria.Localization; -using Terraria.ModLoader.IO; - -namespace StarlightRiver.Core -{ - class RecipeSystem : ModSystem - { - public static List knownRecipies = new(); - - public override void OnWorldLoad() - { - knownRecipies = new List(); - } - - public override void SaveWorldData(TagCompound tag) - { - tag["Recipies"] = knownRecipies; - } - - public override void LoadWorldData(TagCompound tag) - { - knownRecipies = (List)tag.GetList("Recipies"); - } - - public static void LearnRecipie(string key) - { - //this is set up in a way where the stored key should be the same as the display name, there is no real reason to differentiate as the entirety of the data stored is a string list. - if (!knownRecipies.Contains(key)) - { - knownRecipies.Add(key); - CombatText.NewText(Main.LocalPlayer.Hitbox, Color.Tan, "Learned Recipie: " + key); - } - } - - public static Condition GetCondition(Item result) - { - return new Condition(LocalizedText.Empty, () => RecipeSystem.knownRecipies.Contains(result.Name)); - } - } -} \ No newline at end of file diff --git a/Core/Loaders/AlchemySystemLoader.cs b/Core/Loaders/AlchemySystemLoader.cs deleted file mode 100644 index d4e1b8d58..000000000 --- a/Core/Loaders/AlchemySystemLoader.cs +++ /dev/null @@ -1,20 +0,0 @@ -using StarlightRiver.Content.Alchemy; - -namespace StarlightRiver.Core.Loaders -{ - public class AlchemySystemLoader : IOrderedLoadable - { - - public float Priority => 2.0f; - - public void Load() - { - AlchemyRecipeSystem.Load(); - } - - public void Unload() - { - AlchemyRecipeSystem.Unload(); - } - } -} \ No newline at end of file diff --git a/Core/Loaders/TileLoading/FurnitureLoader.cs b/Core/Loaders/TileLoading/FurnitureLoader.cs index 6d11d5225..829acfb1a 100644 --- a/Core/Loaders/TileLoading/FurnitureLoader.cs +++ b/Core/Loaders/TileLoading/FurnitureLoader.cs @@ -1,4 +1,5 @@ -using System; +using StarlightRiver.Content.Items.BaseTypes; +using System; using Terraria.DataStructures; using Terraria.Enums; using Terraria.GameContent.ObjectInteractions; @@ -70,7 +71,7 @@ private void Add(string typename, Furniture tile, Mod Mod, int craftingQuantity) } [Autoload(false)] - class GenericFurnitureItem : QuickTileItem + class GenericFurnitureItem : BaseTileItem { private readonly string name; private readonly int craftingQuantity; diff --git a/Core/Loaders/TileLoading/SimpleTileLoader.cs b/Core/Loaders/TileLoading/SimpleTileLoader.cs index 11801ecfa..acdef19da 100644 --- a/Core/Loaders/TileLoading/SimpleTileLoader.cs +++ b/Core/Loaders/TileLoading/SimpleTileLoader.cs @@ -1,4 +1,5 @@ -using Terraria.Audio; +using StarlightRiver.Content.Items.BaseTypes; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; @@ -103,7 +104,7 @@ public void PostLoadUnload() { } } [Autoload(false)] - public class LoaderTileItem : QuickTileItem + public class LoaderTileItem : BaseTileItem { public LoaderTileItem() { } public override bool CloneNewInstances => true; diff --git a/Core/Markdown.cs b/Core/Markdown.cs deleted file mode 100644 index 60170e659..000000000 --- a/Core/Markdown.cs +++ /dev/null @@ -1,273 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace StarlightRiver.Core -{ - static class Markdown - { - public static float GetHeight(string message, float scale, int wrapWidth) - { - SplitMessage(WrapMarkdownText(message, wrapWidth), out List messages, out List mods); - return (1 + messages.Count(n => n == "\n")) * Terraria.GameContent.FontAssets.MouseText.Value.MeasureString("A").Y * scale; - } - - public static float GetWidth(string message, float scale) - { - return Terraria.GameContent.FontAssets.MouseText.Value.MeasureString(NeuterString(message)).X * scale; - } - - public static void DrawMessage(SpriteBatch sb, Vector2 pos, string message, float scale, int wrapWidth = 0) - { - SplitMessage(wrapWidth > 0 ? WrapMarkdownText(message, wrapWidth) : message, out List messages, out List mods); - - float xOff = 0; - float yOff = 0; - - for (int k = 0; k < messages.Count; k++) - { - if (messages[k] == "\n") //special case for linebreak because im layzeee - { - yOff += Terraria.GameContent.FontAssets.MouseText.Value.MeasureString("A").Y * scale; - xOff = 0; - continue; - } - - DrawSubstring(sb, pos + new Vector2(xOff, yOff), scale, messages[k], mods[k]); - - Vector2 measure = Terraria.GameContent.FontAssets.MouseText.Value.MeasureString(messages[k]) * scale; - xOff += measure.X; - } - } - - private static void DrawSubstring(SpriteBatch sb, Vector2 pos, float scale, string message, string Mod) - { - ParseModifier(Mod, out Color color, out Vector2 offset, out Vector3 modScale); - //sb.DrawString(Terraria.GameContent.FontAssets.ItemStack.Value, message, pos + offset, color, 0, Vector2.Zero, scale, 0, 0); - Utils.DrawBorderString(sb, message, pos + offset, color, scale * modScale.X, modScale.Y, modScale.Z); - } - - private static void SplitMessage(string message, out List messages, out List mods) - { - var outputMessages = new List(); - var modifierMessages = new List(); - - string writeTo = ""; - - for (int k = 0; k < message.Length; k++) - { - char c = message[k]; - - if (k > 0 && c == '[') - { - //writeTo = tempModifier; - outputMessages.Add(writeTo); - writeTo = ""; - writeTo += c; - } - else if (c == ']') - { - writeTo += c; - modifierMessages.Add(writeTo); - writeTo = ""; - } - else - { - writeTo += c; - } - } - - outputMessages.Add(writeTo); - - messages = outputMessages; - mods = modifierMessages; - } - - private static void ParseModifier(string Mod, out Color color, out Vector2 offset, out Vector3 scale) - { - color = Color.White; - offset = Vector2.Zero; - scale = Vector3.UnitX; - - Mod = Mod.Replace("[", ""); - Mod = Mod.Replace("]", ""); - - if (Mod == "") - return; - - string[] mods = Mod.Split('<'); - - for (int k = 0; k < mods.Length; k++) - { - string subMod = mods[k].Replace(">", ""); - - if (subMod == "") - continue; - - string[] parts = subMod.Split(':'); - - string modName = parts[0]; - string param = parts[1]; - - if (modName == "color") - color = ParseAsColor(param); - - if (modName == "offset") - offset = ParseAsOffset(param); - - if (modName == "scale") - scale = ParseAsScale(param); - } - } - - private static Color ParseAsColor(string param) - { - string[] vars = param.Split(','); - return new Color(int.Parse(vars[0]), int.Parse(vars[1]), int.Parse(vars[2])); - } - - private static Vector2 ParseAsOffset(string param) - { - string[] vars = param.Split(','); - return new Vector2(float.Parse(vars[0]), float.Parse(vars[1])); - } - - private static Vector3 ParseAsScale(string param) - { - string[] vars = param.Split(','); - return new Vector3(float.Parse(vars[0]), float.Parse(vars[1]), float.Parse(vars[1])); - } - - public static string MakeVibratingText(string message, Color color) - { - string output = ""; - - for (int k = 0; k < message.Length; k++) - { - output += SetCharMarkdown(message[k], color, new Vector2(Main.rand.Next(-2, 2), Main.rand.Next(-2, 2)), new Vector3(Main.rand.NextFloat(0.8f, 1), 0, 0)); - } - - return output; - } - - public static string MakeSuaveText(string message) - { - string output = ""; - - for (int k = 0; k < message.Length; k++) - { - float sin = 0.8f + (float)Math.Sin(StarlightWorld.visualTimer + k) * 0.5f; - float sin2 = 0.8f + (float)Math.Sin(StarlightWorld.visualTimer + k + (float)Math.PI / 1.5f) * 0.5f; - float sin3 = 0.8f + (float)Math.Sin(StarlightWorld.visualTimer + k + (float)Math.PI / 1.5f * 2) * 0.5f; - var color = new Color(sin, sin2, sin3); - var off = new Vector2(0, 12 + (float)(Math.Sin(StarlightWorld.visualTimer * 2 + k / 2f) * 4)); - - float sin4 = 0.8f + (float)Math.Sin(StarlightWorld.visualTimer + k * 0.25f) * 0.2f; - var scale = new Vector3(sin4, 0.5f, 0.5f); - - output += SetCharMarkdown(message[k], color, off, scale); - } - - return output; - } - - public static string SetCharMarkdown(char character, Color color, Vector2 offset, Vector3 scale) - { - return - "[" + - "" + - "]" + - character; - } - - public static string NeuterString(string text) - { - string output = ""; - string[] parts = text.Replace("]", "[").Split('['); - - for (int k = 0; k < parts.Length; k += 2) - { - output += parts[k]; - } - - return output; - } - - public static string WrapMarkdownText(string text, int width) //this is kinda cancer, sorry folks - { - string output = ""; - string lastMod = ""; - string[] parts = text.Replace("]", "[").Split('['); - float totalWidth = 0; - - float singleCharWidthCache = 0; - int singleCharIndexCache = 0; - bool singleCharBroken = false; - - for (int k = 1; k < parts.Length; k++) - { - string segment = parts[k]; - - if (k % 2 == 1) //modifier - { - output += '[' + segment + ']'; - lastMod = '[' + segment + ']'; - } - else //text - { - string[] words = segment.Split(' '); - - if (words.Length == 1 && words[0].Length == 1) //special case for single characters - { - if (singleCharIndexCache == 0) - { - singleCharIndexCache = output.Length; - singleCharWidthCache = 0; - } - - float w = Terraria.GameContent.FontAssets.MouseText.Value.MeasureString(words[0]).X; - singleCharWidthCache += w; - - if (totalWidth + singleCharWidthCache + w > width && !singleCharBroken) - { - output = output.Insert(singleCharIndexCache, "[]\n" + lastMod); - singleCharBroken = true; - } - - output += words[0]; - continue; - } - else if (singleCharIndexCache != 0) //done reading single characters! reset for next time - { - if (singleCharBroken) - totalWidth = singleCharWidthCache; - else - totalWidth += singleCharWidthCache; - - singleCharIndexCache = 0; - singleCharWidthCache = 0; - singleCharBroken = false; - } - - for (int n = 0; n < words.Length; n++) - { - float w = Terraria.GameContent.FontAssets.MouseText.Value.MeasureString(words[n] + ' ').X; //duplicate the markdown signature if we have to newline, and add the newline as it's own seperate blank markdown so the draw method can identify it - - if (totalWidth + w > width) - { - totalWidth = w; - output += "[]\n" + lastMod + words[n] + ' '; - } - else - { - output += words[n] + ' '; - totalWidth += w; - } - } - } - } - - return output; - } - } -} \ No newline at end of file diff --git a/Core/StarlightPlayer.Events.cs b/Core/StarlightPlayer.Events.cs index 3fb388863..967a76d4d 100644 --- a/Core/StarlightPlayer.Events.cs +++ b/Core/StarlightPlayer.Events.cs @@ -283,6 +283,24 @@ public override void Load() MethodInfo ModifyPlayerHitNPCWithItemMethod = typeof(CombinedHooks).GetMethod("ModifyPlayerHitNPCWithItem", BindingFlags.Public | BindingFlags.Static); ModifyPlayerHitNPCWithItemHook = new Hook(ModifyPlayerHitNPCWithItemMethod, OnModifyPlayerHitNPCWithItem); + + if (!Main.dedServ) + On_PlayerDrawLayers.DrawPlayer_RenderAllLayers += PostDrawPlayerLayer; + } + + // Extra shim to insert our rendering events + private void PostDrawPlayerLayer(On_PlayerDrawLayers.orig_DrawPlayer_RenderAllLayers orig, ref PlayerDrawSet drawinfo) + { + Player drawPlayer = drawinfo.drawPlayer; + float shadow = drawinfo.shadow; + + if (!Main.gameMenu && shadow == 0) + drawPlayer.GetModPlayer().PreDraw(drawPlayer, Main.spriteBatch); + + orig(ref drawinfo); + + if (!Main.gameMenu && shadow == 0) + drawPlayer.GetModPlayer().PostDraw(drawPlayer, Main.spriteBatch); } public override void Unload() diff --git a/Content/CustomHooks/Visuals.ReflectionTarget.cs b/Core/Systems/BackgroundReflectionSystem.cs similarity index 93% rename from Content/CustomHooks/Visuals.ReflectionTarget.cs rename to Core/Systems/BackgroundReflectionSystem.cs index 27fb01c25..2e2e84a56 100644 --- a/Content/CustomHooks/Visuals.ReflectionTarget.cs +++ b/Core/Systems/BackgroundReflectionSystem.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework.Graphics; +using StarlightRiver.Content.Bosses.SquidBoss; using StarlightRiver.Content.Configs; using StarlightRiver.Core.Loaders; using StarlightRiver.Core.Systems.ScreenTargetSystem; @@ -10,9 +11,9 @@ using Terraria.Graphics.Shaders; using Terraria.ID; -namespace StarlightRiver.Content.CustomHooks +namespace StarlightRiver.Core.Systems { - class ReflectionTarget : HookGroup + class BackgroundReflectionSystem : ModSystem { //Drawing Player to Target. Should be safe. Excuse me if im duplicating something that alr exists :p public const string simpleReflectionShaderPath = "StarlightRiver:SimpleReflection"; @@ -72,7 +73,7 @@ private void SpecialDraww(On_Main.orig_CheckMonoliths orig) if (isDrawReflectablesThisFrame) { DrawReflectableEntities(Main.spriteBatch); - ReflectionTarget.isDrawReflectablesThisFrame = false; + isDrawReflectablesThisFrame = false; } GD.SetRenderTarget(null); @@ -145,10 +146,10 @@ private void DrawReflectableEntities(SpriteBatch sb) { Main.instance.DrawCachedNPCs(Main.instance.DrawCacheNPCsOverPlayers, false); - if (Main.LocalPlayer.InModBiome(ModContent.GetInstance())) + if (Main.LocalPlayer.InModBiome(ModContent.GetInstance())) { Main.spriteBatch.Begin(); - DrawUnderCathedralWater.DrawWater(); + ArenaActor.RenderArenaLayersInner(); Main.spriteBatch.End(); } } @@ -187,13 +188,13 @@ public void DrawWallReflectionLayer(On_Main.orig_DoDraw_WallsAndBlacks orig, Mai { orig(self); - if (ReflectionTarget.applyWallReflectionsThisFrame) + if (applyWallReflectionsThisFrame) { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, SamplerState.LinearClamp, default, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); DrawReflection(Main.spriteBatch, screenPos: Vector2.Zero, normalMap: reflectionNormalMapTarget.RenderTarget, flatOffset: new Vector2(-0.0075f, 0.016f), offsetScale: 0.05f, tintColor: Color.White, restartSpriteBatch: false); - ReflectionTarget.applyWallReflectionsThisFrame = false; + applyWallReflectionsThisFrame = false; Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); @@ -207,7 +208,7 @@ public static void DrawReflection(SpriteBatch spriteBatch, Vector2 screenPos, Te { ReflectionSubConfig reflectionConfig = ModContent.GetInstance().ReflectionConfig; - if (ReflectionTarget.canUseTarget && reflectionConfig.isReflectingAnything()) + if (canUseTarget && reflectionConfig.isReflectingAnything()) { if (restartSpriteBatch) @@ -218,7 +219,7 @@ public static void DrawReflection(SpriteBatch spriteBatch, Vector2 screenPos, Te var data = new DrawData(normalMap, screenPos, sourceRect, new Color(255, 255, 255, 0)); - Vector2 normalMapPos = new Vector2(screenPos.X / Target.RenderTarget.Width, screenPos.Y / Target.RenderTarget.Height); + var normalMapPos = new Vector2(screenPos.X / Target.RenderTarget.Width, screenPos.Y / Target.RenderTarget.Height); if (sourceRect != null) normalMapPos = new Vector2((screenPos.X - sourceRect.Value.Left) / Target.RenderTarget.Width, (screenPos.Y - sourceRect.Value.Top) / Target.RenderTarget.Height); @@ -283,8 +284,8 @@ public void drawGlassWallReflectionNormalMap(SpriteBatch spriteBatch) //not sure if tile.WallFrame* is the correct value if (tex != null) spriteBatch.Draw(TextureAssets.Wall[type].Value, pos - Main.screenPosition - new Vector2(8, 8), new Rectangle(tile.WallFrameX, tile.WallFrameY, 36, 36), new Color(128, 128, 255, 255)); - ReflectionTarget.isDrawReflectablesThisFrame = true; - ReflectionTarget.applyWallReflectionsThisFrame = true; + isDrawReflectablesThisFrame = true; + applyWallReflectionsThisFrame = true; } } } diff --git a/Core/Systems/BarrierSystem/PlayerRadarBarrierHook.cs b/Core/Systems/BarrierSystem/BarrierInterfaceSystem.cs similarity index 79% rename from Core/Systems/BarrierSystem/PlayerRadarBarrierHook.cs rename to Core/Systems/BarrierSystem/BarrierInterfaceSystem.cs index 82450ec36..629545cf9 100644 --- a/Core/Systems/BarrierSystem/PlayerRadarBarrierHook.cs +++ b/Core/Systems/BarrierSystem/BarrierInterfaceSystem.cs @@ -1,5 +1,6 @@ using Mono.Cecil.Cil; using MonoMod.Cil; +using StarlightRiver.Content.Abilities.Hint; using StarlightRiver.Content.CustomHooks; using System; using System.Reflection; @@ -7,7 +8,7 @@ namespace StarlightRiver.Core.Systems.BarrierSystem { - class PlayerRadarBarrierHook : HookGroup + class BarrierInterfaceSystem : ModSystem { public override void Load() { @@ -15,6 +16,12 @@ public override void Load() Terraria.GameContent.UI.IL_NewMultiplayerClosePlayersOverlay.PlayerOffScreenCache.DrawLifeBar += DrawAllyRadarBarrierIL; On_Main.DrawInterface_14_EntityHealthBars += DrawShieldForPlayers; On_Main.DrawInterface_39_MouseOver += drawShieldHoverText; + + if (Main.dedServ) + return; + + Terraria.GameContent.UI.ResourceSets.IL_ClassicPlayerResourcesDisplaySet.DrawLife += ShiftText; + Terraria.GameContent.UI.ResourceSets.On_CommonResourceBarMethods.DrawLifeMouseOver += DrawBarrierMouseOver; } private void DrawShieldForPlayers(On_Main.orig_DrawInterface_14_EntityHealthBars orig, Main self) @@ -136,6 +143,7 @@ private void DrawAllyRadarBarrierBar(Vector2 position, Player player) DrawBarrierBar(healthBarDrawPosition, bPlayer.barrier, bPlayer.maxBarrier, Color.White, 1.25f); } + /// /// Barrier overlay for enemy and ally health bars /// @@ -166,5 +174,51 @@ private void DrawBarrierBar(Vector2 position, int barrier, int maxBarrier, Color Main.spriteBatch.Draw(texLine, targetLine, sourceLine, color: color); } } + + /// + /// Replaces default health bar mouse over text with one that includes barrier text + /// + /// + private void DrawBarrierMouseOver(Terraria.GameContent.UI.ResourceSets.On_CommonResourceBarMethods.orig_DrawLifeMouseOver orig) + { + Player localPlayer = Main.LocalPlayer; + BarrierPlayer barrierPlayer = localPlayer.GetModPlayer(); + + if (barrierPlayer.maxBarrier <= 0) + { + orig.Invoke(); + } + else if (!Main.mouseText) + { + localPlayer.cursorItemIconEnabled = false; + string text = localPlayer.statLife + "/" + localPlayer.statLifeMax2; + text += "\n[c/64c8ff:" + barrierPlayer.barrier + "/" + barrierPlayer.maxBarrier + "]"; + Main.instance.MouseTextHackZoom(text); + Main.mouseText = true; + } + } + + private void ShiftText(ILContext il) + { + var c = new ILCursor(il); + + for (int k = 0; k < 2; k++) + { + c.TryGotoNext(n => n.MatchLdcI4(500)); + c.Index++; + c.EmitDelegate(StringConcat); + } + } + + private int StringConcat(int arg) + { + Player Player = Main.LocalPlayer; + BarrierPlayer sp = Player.GetModPlayer(); + + if (sp.barrier <= 0 && sp.maxBarrier <= 0) + return arg; + + return arg - (int)(Terraria.GameContent.FontAssets.MouseText.Value.MeasureString($" {sp.barrier}/{sp.maxBarrier}").X / 2) - 6; + } } } \ No newline at end of file diff --git a/Core/Systems/BarrierSystem/LifeUITextHook.cs b/Core/Systems/BarrierSystem/LifeUITextHook.cs deleted file mode 100644 index 1de15a2c7..000000000 --- a/Core/Systems/BarrierSystem/LifeUITextHook.cs +++ /dev/null @@ -1,64 +0,0 @@ -using MonoMod.Cil; -using StarlightRiver.Content.CustomHooks; - -namespace StarlightRiver.Core.Systems.BarrierSystem -{ - class LifeUITextHook : HookGroup - { - //Adjusts a few measurements for the vanilla health UI - public override void Load() - { - if (Main.dedServ) - return; - - Terraria.GameContent.UI.ResourceSets.IL_ClassicPlayerResourcesDisplaySet.DrawLife += ShiftText; - Terraria.GameContent.UI.ResourceSets.On_CommonResourceBarMethods.DrawLifeMouseOver += DrawBarrierMouseOver; - } - - /// - /// Replaces default health bar mouse over text with one that includes barrier text - /// - /// - private void DrawBarrierMouseOver(Terraria.GameContent.UI.ResourceSets.On_CommonResourceBarMethods.orig_DrawLifeMouseOver orig) - { - Player localPlayer = Main.LocalPlayer; - BarrierPlayer barrierPlayer = localPlayer.GetModPlayer(); - - if (barrierPlayer.maxBarrier <= 0) - { - orig.Invoke(); - } - else if (!Main.mouseText) - { - localPlayer.cursorItemIconEnabled = false; - string text = localPlayer.statLife + "/" + localPlayer.statLifeMax2; - text += "\n[c/64c8ff:" + barrierPlayer.barrier + "/" + barrierPlayer.maxBarrier + "]"; - Main.instance.MouseTextHackZoom(text); - Main.mouseText = true; - } - } - - private void ShiftText(ILContext il) - { - var c = new ILCursor(il); - - for (int k = 0; k < 2; k++) - { - c.TryGotoNext(n => n.MatchLdcI4(500)); - c.Index++; - c.EmitDelegate(StringConcat); - } - } - - private int StringConcat(int arg) - { - Player Player = Main.LocalPlayer; - BarrierPlayer sp = Player.GetModPlayer(); - - if (sp.barrier <= 0 && sp.maxBarrier <= 0) - return arg; - - return arg - (int)(Terraria.GameContent.FontAssets.MouseText.Value.MeasureString($" {sp.barrier}/{sp.maxBarrier}").X / 2) - 6; - } - } -} \ No newline at end of file diff --git a/Core/Systems/CutawaySystem/CutawayHandler.cs b/Core/Systems/CutawaySystem/CutawayHandler.cs index 585e7fa66..c66863445 100644 --- a/Core/Systems/CutawaySystem/CutawayHandler.cs +++ b/Core/Systems/CutawaySystem/CutawayHandler.cs @@ -1,5 +1,10 @@ using StarlightRiver.Content.Biomes; using StarlightRiver.Content.Tiles.Permafrost; +using StarlightRiver.Core.Loaders; +using StarlightRiver.Core.Systems.ScreenTargetSystem; +using System; +using System.Collections.Generic; +using System.Linq; using Terraria.DataStructures; namespace StarlightRiver.Core.Systems.CutawaySystem @@ -8,17 +13,47 @@ internal class CutawayHandler : ModSystem { public static bool created = false; + public static List cutaways; + + public static ScreenTarget cutawayTarget; + + private static Mod subLib; + public static Cutaway cathedralOverlay; public static Cutaway forgeOverlay; public static Cutaway templeOverlay; - //public static Cutaway observatoryOverlay; + + private static bool Inside => cutaways?.Any(n => n.fadeTime < 0.95f) ?? false; + + public static bool InSubworld => subLib?.Call("Current") != null; + + public override void Load() + { + if (Main.dedServ) + return; + + cutaways = new(); + cutawayTarget = new(DrawCutawayTarget, () => Inside, 1); + + ModLoader.TryGetMod("SubworldLibrary", out subLib); + + On_Main.DrawInfernoRings += DrawNegative; + On_Main.DrawDust += DrawPositive; + On_WorldGen.SaveAndQuit += ClearCutaways; + } + + public override void Unload() + { + cutaways = null; + cutawayTarget = null; + } public static void CreateCutaways() { - CutawayHook.cutaways.Clear(); + cutaways.Clear(); // Dont create in subworlds - if (CutawayHook.InSubworld) + if (InSubworld) return; // Auroracle temple overlay @@ -26,7 +61,7 @@ public static void CreateCutaways() { Inside = CheckForSquidArena }; - CutawayHook.NewCutaway(cathedralOverlay); + cutaways.Add(cathedralOverlay); // Glassweaver forge overlay forgeOverlay = new Cutaway(Assets.Overlay.ForgeOverlay, StarlightWorld.GlassweaverArena.TopLeft() + new Vector2(-2, 2) * 16) @@ -39,7 +74,7 @@ public static void CreateCutaways() return arena.Intersects(n.Hitbox); } }; - CutawayHook.NewCutaway(forgeOverlay); + cutaways.Add(forgeOverlay); // Vitric temple overlay Point16 dimensions = StructureHelper.API.Generator.GetStructureDimensions("Structures/VitricTempleNew", StarlightRiver.Instance); @@ -49,14 +84,7 @@ public static void CreateCutaways() { Inside = (n) => n.InModBiome() }; - CutawayHook.NewCutaway(templeOverlay); - - // Observatory overlay - /*observatoryOverlay = new Cutaway(Assets.Overlay.ObservatoryOverlay, ObservatorySystem.ObservatoryRoomWorld.TopLeft() + new Vector2(-9, 8) * 16) - { - Inside = (n) => ObservatorySystem.IsInMainStructure(n) - }; - CutawayHook.NewCutaway(observatoryOverlay);*/ + cutaways.Add(templeOverlay); } /// @@ -81,6 +109,64 @@ private static bool CheckForSquidArena(Player Player) return false; } + private void ClearCutaways(On_WorldGen.orig_SaveAndQuit orig, Action callback) + { + cutaways.Clear(); + orig(callback); + } + + private static void DrawCutawayTarget(SpriteBatch sb) + { + Main.graphics.GraphicsDevice.Clear(Color.Transparent); + + for (int k = 0; k < cutaways.Count; k++) + { + if (cutaways[k].fadeTime < 0.95f) + cutaways[k].Draw(1); + } + } + + private void DrawPositive(On_Main.orig_DrawDust orig, Main self) + { + if (!InSubworld) + { + for (int k = 0; k < cutaways.Count; k++) + cutaways[k].Draw(); + } + + orig(self); + } + + private void DrawNegative(On_Main.orig_DrawInfernoRings orig, Main self) + { + orig(self); + + if (StarlightRiver.debugMode || InSubworld) + return; + + if (Inside) + { + Cutaway activeCutaway = cutaways.FirstOrDefault(n => n.fadeTime < 0.95f); + + Effect effect = ShaderLoader.GetShader("Negative").Value; + + if (effect is null) + return; + + effect.Parameters["sampleTexture"].SetValue(cutawayTarget.RenderTarget); + effect.Parameters["uColor"].SetValue(Color.Black.ToVector3()); + effect.Parameters["opacity"].SetValue(1 - activeCutaway.fadeTime); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(default, default, Main.DefaultSamplerState, default, RasterizerState.CullNone, effect); + + Main.spriteBatch.Draw(cutawayTarget.RenderTarget, Vector2.Zero, Color.White); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(default, default, Main.DefaultSamplerState, default, RasterizerState.CullNone, default); + } + } + public override void PostUpdateEverything() { if (!Main.dedServ && !created) diff --git a/Core/Systems/CutawaySystem/CutawayHook.cs b/Core/Systems/CutawaySystem/CutawayHook.cs deleted file mode 100644 index dc605adbf..000000000 --- a/Core/Systems/CutawaySystem/CutawayHook.cs +++ /dev/null @@ -1,108 +0,0 @@ -using StarlightRiver.Content.CustomHooks; -using StarlightRiver.Core.Loaders; -using StarlightRiver.Core.Systems.ScreenTargetSystem; -using System; -using System.Collections.Generic; -using System.Linq; -using Terraria.Graphics.Effects; - -namespace StarlightRiver.Core.Systems.CutawaySystem -{ - public class CutawayHook : HookGroup - { - public static List cutaways; - - public static ScreenTarget cutawayTarget; - - // We track this so we can disable these in subworlds - private static Mod subLib; - - private static bool Inside => cutaways?.Any(n => n.fadeTime < 0.95f) ?? false; - - public static bool InSubworld => subLib?.Call("Current") != null; - - public override void Load() - { - if (Main.dedServ) - return; - - cutaways = new(); - cutawayTarget = new(DrawCutawayTarget, () => Inside, 1); - - ModLoader.TryGetMod("SubworldLibrary", out subLib); - - On_Main.DrawInfernoRings += DrawNegative; - On_Main.DrawDust += DrawPositive; - On_WorldGen.SaveAndQuit += ClearCutaways; - } - - public override void Unload() - { - cutaways = null; - cutawayTarget = null; - } - - private void ClearCutaways(On_WorldGen.orig_SaveAndQuit orig, Action callback) - { - cutaways.Clear(); - orig(callback); - } - - private void DrawPositive(On_Main.orig_DrawDust orig, Main self) - { - if (!InSubworld) - { - for (int k = 0; k < cutaways.Count; k++) - cutaways[k].Draw(); - } - - orig(self); - } - - private void DrawNegative(On_Main.orig_DrawInfernoRings orig, Main self) - { - orig(self); - - if (StarlightRiver.debugMode || InSubworld) - return; - - if (Inside) - { - Cutaway activeCutaway = cutaways.FirstOrDefault(n => n.fadeTime < 0.95f); - - Effect effect = ShaderLoader.GetShader("Negative").Value; - - if (effect is null) - return; - - effect.Parameters["sampleTexture"].SetValue(cutawayTarget.RenderTarget); - effect.Parameters["uColor"].SetValue(Color.Black.ToVector3()); - effect.Parameters["opacity"].SetValue(1 - activeCutaway.fadeTime); - - Main.spriteBatch.End(); - Main.spriteBatch.Begin(default, default, Main.DefaultSamplerState, default, RasterizerState.CullNone, effect); - - Main.spriteBatch.Draw(cutawayTarget.RenderTarget, Vector2.Zero, Color.White); - - Main.spriteBatch.End(); - Main.spriteBatch.Begin(default, default, Main.DefaultSamplerState, default, RasterizerState.CullNone, default); - } - } - - private static void DrawCutawayTarget(SpriteBatch sb) - { - Main.graphics.GraphicsDevice.Clear(Color.Transparent); - - for (int k = 0; k < cutaways.Count; k++) - { - if (cutaways[k].fadeTime < 0.95f) - cutaways[k].Draw(1); - } - } - - public static void NewCutaway(Cutaway cutaway) - { - cutaways.Add(cutaway); - } - } -} \ No newline at end of file diff --git a/Core/Systems/ForegroundSystem/Foreground.cs b/Core/Systems/ForegroundSystem/Foreground.cs index 5a79ec362..a488d6297 100644 --- a/Core/Systems/ForegroundSystem/Foreground.cs +++ b/Core/Systems/ForegroundSystem/Foreground.cs @@ -1,6 +1,6 @@ namespace StarlightRiver.Core.Systems.ForegroundSystem { - public abstract class Foreground + public abstract class Foreground : ModType { protected float opacity = 0; @@ -8,11 +8,6 @@ public abstract class Foreground public virtual bool OverUI => false; - public Foreground() - { - OnLoad(); - } - public void Render(SpriteBatch spriteBatch) { if (Visible || opacity > 0) @@ -31,29 +26,9 @@ public virtual void Draw(SpriteBatch spriteBatch, float opacity) { } public virtual void Reset() { } - public virtual void OnLoad() { } - - public virtual void Unload() { } - } - - public abstract class ParticleForeground : Foreground - { - public ParticleSystem ParticleSystem { get; set; } - - public ParticleForeground() - { - OnLoad(); - } - - public ParticleForeground(ParticleSystem system) + public sealed override void Register() { - ParticleSystem = system; - OnLoad(); - } - public override void Unload() - { - ParticleSystem = null; } } } \ No newline at end of file diff --git a/Core/Systems/ForegroundSystem/ForegroundHook.cs b/Core/Systems/ForegroundSystem/ForegroundHook.cs deleted file mode 100644 index e982fb883..000000000 --- a/Core/Systems/ForegroundSystem/ForegroundHook.cs +++ /dev/null @@ -1,58 +0,0 @@ -using StarlightRiver.Content.CustomHooks; - -namespace StarlightRiver.Core.Systems.ForegroundSystem -{ - class ForegroundHook : HookGroup - { - //just drawing, nothing to see here. - public override void Load() - { - if (Main.dedServ) - return; - - On_Main.DrawInterface += DrawForeground; - On_Main.DoUpdate += ResetForeground; - } - - public void DrawForeground(On_Main.orig_DrawInterface orig, Main self, GameTime gameTime) - { - Main.spriteBatch.Begin(default, default, SamplerState.PointClamp, default, default);//Main.spriteBatch.Begin() - - foreach (Foreground fg in ForegroundSystem.Foregrounds) //TODO: Perhaps create some sort of ActiveForeground list later? especially since we iterate twice for the over UI ones - { - if (fg != null && !fg.OverUI) - fg.Render(Main.spriteBatch); - } - - Main.spriteBatch.End(); - - orig(self, gameTime); - - Main.spriteBatch.Begin(default, default, SamplerState.PointClamp, default, default); - - foreach (Foreground fg in ForegroundSystem.Foregrounds) - { - if (fg != null && fg.OverUI) - fg.Render(Main.spriteBatch); - } - - Main.spriteBatch.End(); - } - - private void ResetForeground(On_Main.orig_DoUpdate orig, Main self, ref GameTime gameTime) - { - if (Main.gameMenu) - { - orig(self, ref gameTime); - return; - } - - foreach (Foreground fg in ForegroundSystem.Foregrounds) - { - fg?.Reset(); - } - - orig(self, ref gameTime); - } - } -} \ No newline at end of file diff --git a/Core/Systems/ForegroundSystem/ForegroundSystem.cs b/Core/Systems/ForegroundSystem/ForegroundSystem.cs index 29e4f62b0..c0ec5367b 100644 --- a/Core/Systems/ForegroundSystem/ForegroundSystem.cs +++ b/Core/Systems/ForegroundSystem/ForegroundSystem.cs @@ -4,37 +4,56 @@ namespace StarlightRiver.Core.Systems.ForegroundSystem { - class ForegroundSystem : IOrderedLoadable + class ForegroundSystem : ModSystem { - public static List Foregrounds; - - public float Priority => 1.0f; - - public static Foreground GetForeground() + public override void Load() { - return Foregrounds.First(n => n is T); + if (Main.dedServ) + return; + + On_Main.DrawInterface += DrawForeground; + On_Main.DoUpdate += ResetForeground; } - public void Load() + public void DrawForeground(On_Main.orig_DrawInterface orig, Main self, GameTime gameTime) { - if (Main.dedServ) - return; + Main.spriteBatch.Begin(default, default, SamplerState.PointClamp, default, default); + + foreach (Foreground fg in ModContent.GetContent()) + { + if (fg != null && !fg.OverUI) + fg.Render(Main.spriteBatch); + } - Foregrounds = new List(); + Main.spriteBatch.End(); - Mod Mod = StarlightRiver.Instance; + orig(self, gameTime); - foreach (Type t in Mod.Code.GetTypes()) + Main.spriteBatch.Begin(default, default, SamplerState.PointClamp, default, default); + + foreach (Foreground fg in ModContent.GetContent()) { - if (t.IsSubclassOf(typeof(Foreground)) && !t.IsAbstract) - Foregrounds.Add((Foreground)Activator.CreateInstance(t)); + if (fg != null && fg.OverUI) + fg.Render(Main.spriteBatch); } + + Main.spriteBatch.End(); } - public void Unload() + private void ResetForeground(On_Main.orig_DoUpdate orig, Main self, ref GameTime gameTime) { - Foregrounds?.ForEach(t => t.Unload()); - Foregrounds ??= null; + if (Main.gameMenu) + { + orig(self, ref gameTime); + return; + } + + foreach (Foreground fg in ModContent.GetContent()) + { + fg?.Reset(); + } + + orig(self, ref gameTime); } } } \ No newline at end of file diff --git a/Core/Systems/NoBuildingSystem/NoBuildGlobalItem.cs b/Core/Systems/NoBuildingSystem/NoBuildGlobalItem.cs new file mode 100644 index 000000000..e556250a0 --- /dev/null +++ b/Core/Systems/NoBuildingSystem/NoBuildGlobalItem.cs @@ -0,0 +1,211 @@ +using StarlightRiver.Content.Bosses.SquidBoss; +using StarlightRiver.Content.Tiles.Permafrost; +using StarlightRiver.Content; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.DataStructures; +using Terraria.ID; + +namespace StarlightRiver.Core.Systems.NoBuildingSystem +{ + public class NoBuildGlobalItem : GlobalItem + { + public static List blacklist = [ItemID.WaterBucket, + ItemID.LavaBucket, + ItemID.HoneyBucket, + ItemID.BottomlessBucket, + ItemID.Wrench, + ItemID.BlueWrench, + ItemID.GreenWrench, + ItemID.YellowWrench, + ItemID.MulticolorWrench, + ItemID.ActuationRod, + ItemID.Actuator, + ItemID.WireKite, + ItemID.WireCutter, + ItemID.WireBulb, + ItemID.Paintbrush, + ItemID.PaintRoller, + ItemID.PaintScraper, + ItemID.SpectrePaintbrush, + ItemID.SpectrePaintRoller, + ItemID.SpectrePaintScraper + ]; + + public static List whitelist = [ItemID.AcornAxe]; + + public override void Load() + { + On_Player.PickTile += DontPickInZone; + On_Player.PickWall += DontPickWallInZone; + On_WorldGen.PlaceTile += DontManuallyPlaceInZone; + On_WorldGen.PoundTile += DontPoundTile; + On_WorldGen.PlaceWire += DontPlaceWire; + On_WorldGen.PlaceWire2 += DontPlaceWire2; + On_WorldGen.PlaceWire3 += DontPlaceWire3; + On_WorldGen.PlaceWire4 += DontPlaceWire4; + On_WorldGen.PlaceActuator += DontPlaceActuator; + On_WorldGen.KillTile += DontExplodeAtRuntime; + On_Player.CheckForGoodTeleportationSpot += DontTeleport; + } + + private bool DontPoundTile(On_WorldGen.orig_PoundTile orig, int x, int y) + { + if (NoBuildSystem.IsTileProtected(x, y)) + { + FailFX(new Point16(x, y)); + return false; + } + + return orig(x, y); + } + + private bool DontPlaceWire(On_WorldGen.orig_PlaceWire orig, int x, int y) + { + if (NoBuildSystem.IsTileProtected(x, y)) + { + FailFX(new Point16(x, y)); + return false; + } + + return orig(x, y); + } + + private bool DontPlaceWire2(On_WorldGen.orig_PlaceWire2 orig, int x, int y) + { + if (NoBuildSystem.IsTileProtected(x, y)) + { + FailFX(new Point16(x, y)); + return false; + } + + return orig(x, y); + } + + private bool DontPlaceWire3(On_WorldGen.orig_PlaceWire3 orig, int x, int y) + { + if (NoBuildSystem.IsTileProtected(x, y)) + { + FailFX(new Point16(x, y)); + return false; + } + + return orig(x, y); + } + + private bool DontPlaceWire4(On_WorldGen.orig_PlaceWire4 orig, int x, int y) + { + if (NoBuildSystem.IsTileProtected(x, y)) + { + FailFX(new Point16(x, y)); + return false; + } + + return orig(x, y); + } + + private bool DontPlaceActuator(On_WorldGen.orig_PlaceActuator orig, int x, int y) + { + if (NoBuildSystem.IsTileProtected(x, y)) + { + FailFX(new Point16(x, y)); + return false; + } + + return orig(x, y); + } + + private void DontPickWallInZone(On_Player.orig_PickWall orig, Player self, int x, int y, int damage) + { + if (NoBuildSystem.IsTileProtected(x, y)) + { + FailFX(new Point16(x, y)); + return; + } + + orig(self, x, y, damage); + } + + private void DontPickInZone(On_Player.orig_PickTile orig, Player self, int x, int y, int pickPower) + { + if (NoBuildSystem.IsTileProtected(x, y)) + { + FailFX(new Point16(x, y)); + return; + } + + orig(self, x, y, pickPower); + } + + private bool DontManuallyPlaceInZone(On_WorldGen.orig_PlaceTile orig, int i, int j, int type, bool mute, bool forced, int plr, int style) + { + if (NoBuildSystem.IsTileProtected(i, j)) + { + FailFX(new Point16(i, j)); + return false; + } + + return orig(i, j, type, mute, forced, plr, style); + } + + private void DontExplodeAtRuntime(On_WorldGen.orig_KillTile orig, int i, int j, bool fail, bool effectOnly, bool noItem) + { + if (NoBuildSystem.IsTileProtected(i, j) && !WorldGen.generatingWorld) + { + // Disabling for now since this breaks dashables... we will need a better fix for bombs only later. + //FailFX(new Point16(i, j)); + //return; + } + + orig(i, j, fail, effectOnly, noItem); + } + + private Vector2 DontTeleport(On_Player.orig_CheckForGoodTeleportationSpot orig, Player self, ref bool canSpawn, int teleportStartX, int teleportRangeX, int teleportStartY, int teleportRangeY, Player.RandomTeleportationAttemptSettings settings) + { + Vector2 result = orig(self, ref canSpawn, teleportStartX, teleportRangeX, teleportStartY, teleportRangeY, settings); + + // If invalid spot, recurse untill a valid one is found + if (NoBuildSystem.IsTileProtected((int)result.X, (int)result.Y)) + { + settings.attemptsBeforeGivingUp--; + result = self.CheckForGoodTeleportationSpot(ref canSpawn, teleportStartX, teleportRangeX, teleportStartY, teleportRangeY, settings); + } + + return result; + } + + public override bool CanUseItem(Item Item, Player player) + { + if (player != Main.LocalPlayer) + return base.CanUseItem(Item, player); + + if (whitelist.Contains(Item.type)) + return base.CanUseItem(Item, player); + + if (Item.createTile != -1 || Item.createWall != -1 || blacklist.Contains(Item.type)) + { + Point16 targetPoint = Main.SmartCursorIsUsed ? new Point16(Main.SmartCursorX, Main.SmartCursorY) : new Point16(Player.tileTargetX, Player.tileTargetY); + + if (NoBuildSystem.IsTileProtected(targetPoint)) + { + //player.AddBuff(BuffID.Cursed, 10, false); + FailFX(targetPoint); + return false; + } + } + + return base.CanUseItem(Item, player); + } + + private void FailFX(Point16 pos) + { + Terraria.Audio.SoundEngine.PlaySound(SoundID.DD2_LightningBugZap, pos.ToVector2() * 16); + + for (int k = 0; k < 10; k++) + Dust.NewDust(pos.ToVector2() * 16, 16, 16, ModContent.DustType(), 0, 0, 0, Color.Red, 0.2f); + } + } +} diff --git a/Core/Systems/NoBuildingSystem/NoBuildGlobalProjectile.cs b/Core/Systems/NoBuildingSystem/NoBuildGlobalProjectile.cs new file mode 100644 index 000000000..979c2d533 --- /dev/null +++ b/Core/Systems/NoBuildingSystem/NoBuildGlobalProjectile.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.ID; + +namespace StarlightRiver.Core.Systems.NoBuildingSystem +{ + public class NoBuildGlobalProjectile : GlobalProjectile + { + public override bool AppliesToEntity(Projectile entity, bool lateInstantiation) + { + return entity.aiStyle == ProjAIStyleID.GraveMarker; + } + + public override void PostAI(Projectile Projectile) + { + foreach (Rectangle region in NoBuildSystem.protectedRegions) + { + if (region.Contains(new Point((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16))) + Projectile.active = false; + } + + foreach (Ref region in NoBuildSystem.RuntimeProtectedRegions) + { + if (region.Value.Contains(new Point((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16))) + Projectile.active = false; + } + } + } +} diff --git a/Core/Systems/NoBuildingSystem/NoBuildGlobalTile.cs b/Core/Systems/NoBuildingSystem/NoBuildGlobalTile.cs new file mode 100644 index 000000000..08babe03e --- /dev/null +++ b/Core/Systems/NoBuildingSystem/NoBuildGlobalTile.cs @@ -0,0 +1,22 @@ +using StarlightRiver.Content.Bosses.SquidBoss; +using StarlightRiver.Content.Tiles.Permafrost; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.ID; + +namespace StarlightRiver.Core.Systems.NoBuildingSystem +{ + class NoBuildGlobalTile : GlobalTile + { + public override bool CanExplode(int i, int j, int type) + { + if (NoBuildSystem.IsTileProtected(i, j)) + return false; + + return base.CanExplode(i, j, type); + } + } +} diff --git a/Core/Systems/NoBuildingSystem/NoBuildSystem.cs b/Core/Systems/NoBuildingSystem/NoBuildSystem.cs new file mode 100644 index 000000000..ea81faade --- /dev/null +++ b/Core/Systems/NoBuildingSystem/NoBuildSystem.cs @@ -0,0 +1,207 @@ +using StarlightRiver.Content.Bosses.SquidBoss; +using StarlightRiver.Content.Tiles.Permafrost; +using System.Collections.Generic; +using System.IO; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader.IO; + +namespace StarlightRiver.Core.Systems.NoBuildingSystem +{ + public class NoBuildSystem : ModSystem + { + /// + /// Regions which players shold not be able to modify in the world + /// + public static List protectedRegions = []; + + /// + /// Specific points in disallowed regions that the player should be given the ability to modify. + /// This should usually only be used for very small exceptions. + /// + public static List pointExceptions = []; + + /// + /// Collection of IDs for wall types that should not be buildable. + /// + public static bool[] noBuildWalls = WallID.Sets.Factory.CreateBoolSet(); + + private static readonly Dictionary> RuntimeRegionsByPoint = []; + public static readonly List> RuntimeProtectedRegions = []; + + public override void PostDrawTiles() + { + if (!StarlightRiver.debugMode) + return; + + Main.spriteBatch.Begin(default, default, SamplerState.PointWrap, default, Main.Rasterizer, default, Main.GameViewMatrix.TransformationMatrix); + + foreach (Rectangle rect in protectedRegions) + { + Texture2D tex = Assets.MagicPixel.Value; + var target = new Rectangle(rect.X * 16 - (int)Main.screenPosition.X, rect.Y * 16 - (int)Main.screenPosition.Y, rect.Width * 16, rect.Height * 16); + Main.spriteBatch.Draw(tex, target, Color.Red * 0.25f); + } + + foreach (Ref rectRef in RuntimeProtectedRegions) + { + Rectangle rect = rectRef.Value; + Texture2D tex = Assets.MagicPixel.Value; + var target = new Rectangle(rect.X * 16 - (int)Main.screenPosition.X, rect.Y * 16 - (int)Main.screenPosition.Y, rect.Width * 16, rect.Height * 16); + Main.spriteBatch.Draw(tex, target, Color.Blue * 0.25f); + } + + Main.spriteBatch.End(); + } + + /// + /// If a tile should have build protection applied or not at the given point + /// + /// + /// + /// + public static bool IsTileProtected(int x, int y) + { + return IsTileProtected(new Point16(x, y)); + } + + /// + /// If a tile should have build protection applied or not at the given point + /// + /// + /// + public static bool IsTileProtected(Point16 point) + { + if (Main.gameMenu || Main.dedServ) //shouldnt trigger while generating the world from the menu + return false; + + if (StarlightRiver.debugMode) + return false; + + if (pointExceptions.Contains(point)) + return false; + + if (BossRushSystem.BossRushSystem.isBossRush) + return true; + + Tile tile = Framing.GetTileSafely(point); + + if (tile.TileType == TileID.Tombstones) + return false; + + foreach (Rectangle region in protectedRegions) + { + if (region.Contains(point.ToPoint())) + return true; + } + + foreach (Ref region in RuntimeProtectedRegions) + { + if (region.Value.Contains(point.ToPoint())) + return true; + } + + if (noBuildWalls[tile.WallType]) + return true; + + return false; + } + + public override void PreWorldGen() + { + protectedRegions.Clear(); + RuntimeProtectedRegions.Clear(); + RuntimeRegionsByPoint.Clear(); + } + + public override void PreUpdateEntities() + { + pointExceptions.Clear(); + } + + public override void LoadWorldData(TagCompound tag) + { + protectedRegions.Clear(); + RuntimeProtectedRegions.Clear(); + RuntimeRegionsByPoint.Clear(); + + int length = tag.GetInt("RegionCount"); + + for (int k = 0; k < length; k++) + { + protectedRegions.Add(new Rectangle + ( + tag.GetInt("x" + k), + tag.GetInt("y" + k), + tag.GetInt("w" + k), + tag.GetInt("h" + k) + )); + } + } + + public override void SaveWorldData(TagCompound tag) + { + tag["RegionCount"] = protectedRegions.Count; + + for (int k = 0; k < protectedRegions.Count; k++) + { + Rectangle region = protectedRegions[k]; + tag.Add("x" + k, region.X); + tag.Add("y" + k, region.Y); + tag.Add("w" + k, region.Width); + tag.Add("h" + k, region.Height); + } + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(protectedRegions.Count); + + for (int i = 0; i < protectedRegions.Count; i++) + { + Rectangle region = protectedRegions[i]; + writer.Write(region.X); + writer.Write(region.Y); + writer.Write(region.Width); + writer.Write(region.Height); + } + } + + public override void NetReceive(BinaryReader reader) + { + protectedRegions.Clear(); + + int numRegions = reader.ReadInt32(); + + for (int i = 0; i < numRegions; i++) + { + protectedRegions.Add(new Rectangle + { + X = reader.ReadInt32(), + Y = reader.ReadInt32(), + Width = reader.ReadInt32(), + Height = reader.ReadInt32() + }); + } + } + + public static void AddRegionBySource(Point16 source, Rectangle region) + { + if (!RuntimeRegionsByPoint.ContainsKey(source)) + { + var refRect = new Ref(region); + RuntimeRegionsByPoint.Add(source, refRect); + RuntimeProtectedRegions.Add(refRect); + } + } + + public static void RemoveRegionBySource(Point16 source) + { + if (RuntimeRegionsByPoint.TryGetValue(source, out Ref refRect)) + { + RuntimeProtectedRegions.Remove(refRect); + RuntimeRegionsByPoint.Remove(source); + } + } + } +} \ No newline at end of file diff --git a/Content/CustomHooks/Visuals.PlayerTarget.cs b/Core/Systems/PlayerTargetSystem.cs similarity index 98% rename from Content/CustomHooks/Visuals.PlayerTarget.cs rename to Core/Systems/PlayerTargetSystem.cs index d23b2fa49..b144de8e0 100644 --- a/Content/CustomHooks/Visuals.PlayerTarget.cs +++ b/Core/Systems/PlayerTargetSystem.cs @@ -4,9 +4,9 @@ using System.Linq; using Terraria.DataStructures; -namespace StarlightRiver.Content.CustomHooks +namespace StarlightRiver.Core.Systems { - class PlayerTarget : HookGroup + class PlayerTargetSystem : ModSystem { //Drawing Player to Target. Should be safe. Excuse me if im duplicating something that alr exists :p public static RenderTarget2D Target; diff --git a/Core/Systems/WaterAddonSystem/WaterAddon.cs b/Core/Systems/WaterAddonSystem/WaterAddon.cs new file mode 100644 index 000000000..517a410c7 --- /dev/null +++ b/Core/Systems/WaterAddonSystem/WaterAddon.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StarlightRiver.Core.Systems.WaterAddonSystem +{ + public abstract class WaterAddon : ModType + { + public float Priority => 1f; + + /// + /// call Main.SpriteBatch.Begin with the parameters you want for the front of water. Primarily used for applying shaders + /// + public abstract void SpritebatchChange(); + /// + /// call Main.SpriteBatch.Begin with the parameters you want for the back of water. Primarily used for applying shaders + /// + public abstract void SpritebatchChangeBack(); + + public abstract bool Visible { get; } + + public abstract Texture2D BlockTexture(Texture2D normal, int x, int y); + + public sealed override void Register() + { + + } + } +} diff --git a/Content/CustomHooks/Visuals.WaterAddonHandler.cs b/Core/Systems/WaterAddonSystem/WaterAddonManager.cs similarity index 74% rename from Content/CustomHooks/Visuals.WaterAddonHandler.cs rename to Core/Systems/WaterAddonSystem/WaterAddonManager.cs index 26190432f..66e55188c 100644 --- a/Content/CustomHooks/Visuals.WaterAddonHandler.cs +++ b/Core/Systems/WaterAddonSystem/WaterAddonManager.cs @@ -1,45 +1,19 @@ using Mono.Cecil.Cil; using MonoMod.Cil; +using StarlightRiver.Content.CustomHooks; using System; using System.Collections.Generic; using System.Linq; +using System.Text; +using System.Threading.Tasks; using Terraria.ID; -namespace StarlightRiver.Content.CustomHooks +namespace StarlightRiver.Core.Systems.WaterAddonSystem { - public abstract class WaterAddon : IOrderedLoadable + class WaterAddonManager : ModSystem { - public float Priority => 1f; - - /// - /// call Main.SpriteBatch.Begin with the parameters you want for the front of water. Primarily used for applying shaders - /// - public abstract void SpritebatchChange(); - /// - /// call Main.SpriteBatch.Begin with the parameters you want for the back of water. Primarily used for applying shaders - /// - public abstract void SpritebatchChangeBack(); - - public abstract bool Visible { get; } - - public abstract Texture2D BlockTexture(Texture2D normal, int x, int y); - - public void Load() - { - WaterAddonHandler.addons.Add(this); - } - - public void Unload() { } - } - - class WaterAddonHandler : HookGroup - { - public static List addons = new(); - public static WaterAddon activeAddon; - public override float Priority => 1.1f; - public override void Load() { StarlightPlayer.PostUpdateEvent += UpdateActiveAddon; @@ -50,13 +24,12 @@ public override void Load() private void UpdateActiveAddon(Player Player) { - activeAddon = addons.FirstOrDefault(n => n.Visible); + activeAddon = ModContent.GetContent().FirstOrDefault(n => n.Visible); } public override void Unload() { - addons ??= null; - activeAddon ??= null; + activeAddon = null; } private void SwapBlockTexture(ILContext il) @@ -152,4 +125,4 @@ private void NewDraw() } } } -} \ No newline at end of file +} diff --git a/Helpers/WorldGenHelper.cs b/Helpers/WorldGenHelper.cs index f808e2737..84fb41e84 100644 --- a/Helpers/WorldGenHelper.cs +++ b/Helpers/WorldGenHelper.cs @@ -1,4 +1,4 @@ -using StarlightRiver.Content.CustomHooks; +using StarlightRiver.Core.Systems.NoBuildingSystem; using System; using System.Collections.Generic; using System.Linq; @@ -61,7 +61,7 @@ public static class WorldGenHelper public static bool IsRectangleSafe(Rectangle area, Func extraConstraints = null, bool extraConstraintsOnly = false) { //check against protected regions - if (ProtectionWorld.ProtectedRegions.Any(n => n.Intersects(area)) && !extraConstraintsOnly) + if (NoBuildSystem.protectedRegions.Any(n => n.Intersects(area)) && !extraConstraintsOnly) return false; //check against vanilla structure map