Roxcalibur shrine (#994)

Shrine has two schematic variants.
This commit is contained in:
Shade authored and GitHub committed 2025-02-02 14:50:32 -05:00
1 parent 4ada0a8fbf
commit 4c42b50970
8 files changed
+116 -46

No files matched your search

+7
View File
@@ -61,6 +61,11 @@ namespace CalamityMod.Schematics
internal const string SurfaceShrineKey = "Surface Shrine";
internal const string SurfaceShrineFilename = "Schematics/Shrine_Surface.csch";
internal const string RoxcaliburShrineKey1 = "Roxcalibur Shrine 1";
internal const string RoxcaliburShrine1Filename = "Schematics/Shrine_Roxcalibur_ShrineVariant.csch";
internal const string RoxcaliburShrineKey2 = "Roxcalibur Shrine 2";
internal const string RoxcaliburShrine2Filename = "Schematics/Shrine_Roxcalibur_TorchVariant.csch";
internal const string VernalKey = "Vernal Pass";
internal const string VernalFilename = "Schematics/VernalPass.csch";
@@ -120,6 +125,8 @@ namespace CalamityMod.Schematics
[MarbleShrineKey] = CalamitySchematicIO.LoadSchematic(MarbleShrineFilename),
[MushroomShrineKey] = CalamitySchematicIO.LoadSchematic(MushroomShrineFilename),
[SurfaceShrineKey] = CalamitySchematicIO.LoadSchematic(SurfaceShrineFilename),
[RoxcaliburShrineKey1] = CalamitySchematicIO.LoadSchematic(RoxcaliburShrine1Filename),
[RoxcaliburShrineKey2] = CalamitySchematicIO.LoadSchematic(RoxcaliburShrine2Filename),
[VernalKey] = CalamitySchematicIO.LoadSchematic(VernalFilename),
Binary file not shown.
Binary file not shown.
+4 -8
View File
@@ -25,7 +25,7 @@ namespace CalamityMod.Systems
public override void PreWorldGen()
{
Abyss.TotalPlacedIslandsSoFar = 0;
roxShrinePlaced = false;
//roxShrinePlaced = false;
// This will only be applied at world-gen time to new worlds.
// Old worlds will never receive this marker naturally.
@@ -263,6 +263,9 @@ namespace CalamityMod.Systems
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.SurfaceShrine").Value;
UndergroundShrines.PlaceSurfaceShrine(GenVars.structures);
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.Roxcalibur").Value;
UndergroundShrines.PlaceRoxShrine(GenVars.structures);
}));
// Aerialite
@@ -336,13 +339,6 @@ namespace CalamityMod.Systems
SulphurousSea.SulphurSeaGenerationAfterAbyss();
}));
// Roxcalibur
tasks.Insert(++currentFinalIndex, new PassLegacy("Roxcalibur", (progress, config) =>
{
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.Roxcalibur").Value;
MiscWorldgenRoutines.PlaceRoxShrine();
}));
// No Traps/GFB Auric Land Mines
if (Main.noTrapsWorld)
{
+39 -1
View File
@@ -1,10 +1,10 @@
using CalamityMod.Items.Weapons.Melee;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using Terraria.ObjectData;
@@ -17,6 +17,17 @@ namespace CalamityMod.Tiles
Main.tileFrameImportant[Type] = true;
Main.tileNoAttach[Type] = true;
Main.tileSpelunker[Type] = true;
Main.tileLighted[Type] = true;
//Explicitly declared that its immune to liquids and obsidian
Main.tileLavaDeath[Type] = false;
Main.tileWaterDeath[Type] = false;
Main.tileObsidianKill[Type] = false;
Main.tileOreFinderPriority[Type] = 910;
//Astral Ore is 900, the main reason Im using it as a reference is due to being the highest HM ore and since Catalyst generates Astral ore deeper.
//Wont conflict with Metanova (Catalyst), Uelibloom, or any other higher tier ores - Shade
TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4);
TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 18 };
@@ -26,6 +37,33 @@ namespace CalamityMod.Tiles
TileID.Sets.DisableSmartCursor[Type] = true;
RegisterItemDrop(ModContent.ItemType<Roxcalibur>());
FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType<Roxcalibur>(), Type, 0);
DustType = DustID.Lava;
}
public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
{
r = 1.64f;
g = 0.25f;
b = 1.89f;
}
public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData)
{
Tile tile = Main.tile[i, j];
if (tile.TileFrameY == 18 && tile.TileFrameX < 54)
{
CalamityUtils.DrawFlameSparks(DustID.ShadowbeamStaff, 5, i, j);
}
}
public override bool CreateDust(int i, int j, ref int type)
{
type = !WorldGen.genRand.NextBool(3) ? DustID.ShadowbeamStaff : DustID.Lava;
return true;
}
public override void NumDust(int i, int j, bool fail, ref int num)
{
num = fail ? 5 : 50;
}
}
}
-2
View File
@@ -67,8 +67,6 @@ namespace CalamityMod.World
// Shrines
public static int[] SChestX = new int[10];
public static int[] SChestY = new int[10];
/// <summary> Used to determine if the Roxcalibur shrine has been placed in the world. </summary>
public static bool roxShrinePlaced = false;
/// <summary> Used to check if the world has generated Luminite planetoids from Moon Lord's defeat. </summary>
public static bool HasGeneratedLuminitePlanetoids = false;
-35
View File
@@ -144,41 +144,6 @@ namespace CalamityMod.World
}
#endregion
#region Place Rox Shrine
public static void PlaceRoxShrine()
{
while (!CalamityWorld.roxShrinePlaced)
{
CalamityWorld.roxShrinePlaced = true;
for (int x = 0; x < Main.maxTilesX; x++)
{
for (int y = 0; y < Main.maxTilesY; y++)
{
if (Main.tile[x, y] != null && Main.tile[x, y].TileType == TileID.LargePiles)
{
if ((Main.tile[x, y].TileFrameX == 18 && Main.tile[x, y].TileFrameY == 0) || (Main.tile[x, y].TileFrameX == 45 && Main.tile[x, y].TileFrameY == 0))
{
if (WorldGen.genRand.NextBool(3))
{
for (int dx = -1; dx < 2; dx++)
{
for (int dy = -1; dy < 2; dy++)
Main.tile[x + dx, y + dy].Get<TileWallWireStateData>().HasTile = false;
}
WorldGen.PlaceTile(x, y + 1, ModContent.TileType<RoxTile>());
return;
}
else
CalamityWorld.roxShrinePlaced = false;
}
}
}
}
}
}
#endregion
#region Chasm Generator
public static void ChasmGenerator(int i, int j, int steps, bool ocean = false)
{
+66
View File
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Mounts;
using CalamityMod.Items.Placeables.Furniture;
@@ -11,6 +12,8 @@ using CalamityMod.Items.SummonItems;
using CalamityMod.Items.Weapons.Magic;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Schematics;
using CalamityMod.Tiles;
using CalamityMod.Tiles.Crags;
using CalamityMod.Tiles.DraedonStructures;
using CalamityMod.Tiles.FurnitureVoid;
using CalamityMod.Tiles.SunkenSea;
@@ -876,6 +879,69 @@ namespace CalamityMod.World
}
#endregion
#region Roxcalibur Shrine
public static void PlaceRoxShrine(StructureMap structures)
{
int tries = 0;
string mapKey = Main.rand.NextBool() ? RoxcaliburShrineKey1 : RoxcaliburShrineKey2;
do
{
int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.15f), (int)(Main.maxTilesX * 0.85f));
// Ensure that the shrine doesn't generate too close to the center of the world
do
{
placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.15f), (int)(Main.maxTilesX * 0.85f));
}
while (placementPositionX > (int)(Main.maxTilesX * 0.4f) && placementPositionX < (int)(Main.maxTilesX * 0.6f));
int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.75f), Main.UnderworldLayer-50); //Lava layer
Point placementPoint = new Point(placementPositionX, placementPositionY);
Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1));
int extraArea = 0;
int yExtraArea = 10;
bool canGenerateInLocation = true;
for (int x = placementPoint.X - extraArea; x < placementPoint.X + schematicSize.X + extraArea; x++)
{
for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y + yExtraArea; y++)
{
Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y);
//Avoid shacks, jungle and mushroom biomes
if (tile.TileType == TileID.WoodBlock || tile.TileType == TileID.Mud || tile.TileType == ModContent.TileType<VernalSoil>())
canGenerateInLocation = false;
//Try to not be in a place with lava on the top half or above the shrine
if (ShouldAvoidLocation(new Point(x, y-20), true))
canGenerateInLocation = false;
//Check for the rest of the structure
if (ShouldAvoidLocation(new Point(x, y), false))
canGenerateInLocation = false;
}
}
if ((!canGenerateInLocation || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) && !Main.remixWorld)
{
tries++;
}
else
{
bool _ = false;
//added those first things so it stops complaining, there's no easter bunny, there's no tooth fairy and there is no chest
PlaceSchematic<Action<Chest>>(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _);
//Do not get eaten by other structures or Fargo's instabridge
CalamityUtils.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4);
break;
}
} while (tries <= 100000);
CalamityMod.Instance.Logger.Debug("Rox Shrine failed to generate");
}
#endregion
#region Abyss Shrine
public static void PlaceAbyssShrine(int chestLeftX, int chestTopY)
{