This commit is contained in:
mountaindrew10 committed 2023-01-12 16:43:12 -06:00
commit f0da3756bd
16 files changed
+373 -47

No files matched your search

Binary file not shown.

Before

Width:  |  Height:  |  Size: 921 B

After

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 999 B

After

Width:  |  Height:  |  Size: 840 B

+36
View File
@@ -0,0 +1,36 @@
using CalamityMod.Items.Placeables.Walls;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables
{
public class BrimstoneSlab : ModItem
{
public override void SetStaticDefaults()
{
SacrificeTotal = 100;
}
public override void SetDefaults()
{
Item.width = 12;
Item.height = 12;
Item.maxStack = 999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.createTile = ModContent.TileType<Tiles.Crags.BrimstoneSlab>();
}
public override void AddRecipes()
{
CreateRecipe(25).
AddIngredient(ModContent.ItemType<BrimstoneSlab>()).
AddTile(TileID.HeavyWorkBench).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

@@ -0,0 +1,33 @@
using Terraria.ModLoader;
using WallTiles = CalamityMod.Walls;
using Terraria.ID;
namespace CalamityMod.Items.Placeables.Walls
{
public class BrimstoneSlabWall : ModItem
{
public override void SetStaticDefaults()
{
SacrificeTotal = 400;
}
public override void SetDefaults()
{
Item.width = 12;
Item.height = 12;
Item.maxStack = 999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 7;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.createWall = ModContent.WallType<WallTiles.BrimstoneSlabWall>();
}
public override void AddRecipes()
{
CreateRecipe(4).AddIngredient(ModContent.ItemType<BrimstoneSlab>()).AddTile(TileID.WorkBenches).Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

+10
View File
@@ -9,7 +9,11 @@ namespace CalamityMod.Tiles.Abyss
{
public class AbyssGravel : ModTile
{
int subsheetHeight = 270;
int subsheetWidth = 288;
public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/AbyssGravelMine", 3);
public override void SetStaticDefaults()
{
Main.tileSolid[Type] = true;
@@ -37,6 +41,12 @@ namespace CalamityMod.Tiles.Abyss
num = fail ? 1 : 3;
}
public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset)
{
frameXOffset = i % 1 * subsheetWidth; //the 1 should be 2, but it looks weird right now, should be looked into later
frameYOffset = j % 1 * subsheetHeight;
}
public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak)
{
TileFraming.CustomMergeFrame(i, j, Type, TileID.Dirt);
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 21 KiB

+53
View File
@@ -0,0 +1,53 @@
using CalamityMod.Tiles.Crags;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
namespace CalamityMod.Tiles.Crags
{
public class BrimstoneSlab : ModTile
{
private int sheetWidth = 450;
private int sheetHeight = 270;
public override void SetStaticDefaults()
{
Main.tileSolid[Type] = true;
Main.tileBlockLight[Type] = true;
CalamityUtils.MergeWithGeneral(Type);
CalamityUtils.MergeWithHell(Type);
ItemDrop = ModContent.ItemType<Items.Placeables.BrimstoneSlab>();
ModTranslation name = CreateMapEntryName();
name.SetDefault("Brimstone Slab");
AddMapEntry(new Color(79, 55, 70), name);
MineResist = 3f;
MinPick = 100;
HitSound = SoundID.Tink;
DustType = 235;
}
public override bool CanExplode(int i, int j)
{
return false;
}
public override void NumDust(int i, int j, bool fail, ref int num)
{
num = fail ? 1 : 3;
}
public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset)
{
frameXOffset = i % 2 * sheetWidth;
frameYOffset = j % 2 * sheetHeight;
}
public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak)
{
return TileFraming.BrimstoneFraming(i, j, resetFrame);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

+113 -2
View File
@@ -1,6 +1,10 @@
using System.Linq;
using Terraria;
using Terraria;
using Terraria.ID;
using Terraria.DataStructures;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Linq;
namespace CalamityMod
{
@@ -69,4 +73,111 @@ namespace CalamityMod
Liquid.worldGenTilesIgnoreWater(false);
}
}
//tile runner, probably useful for caves and probably other useful stuff?
public class TileRunner
{
public Vector2 pos;
public Vector2 speed;
public Point16 hRange;
public Point16 vRange;
public double strength;
public double str;
public int steps;
public int stepsLeft;
public ushort type;
public bool addTile;
public bool overRide;
public TileRunner(Vector2 pos, Vector2 speed, Point16 hRange, Point16 vRange, double strength, int steps, ushort type, bool addTile, bool overRide)
{
this.pos = pos;
if (speed.X == 0 && speed.Y == 0)
{
this.speed = new Vector2(WorldGen.genRand.Next(hRange.X, hRange.Y + 1) * 0.1f, WorldGen.genRand.Next(vRange.X, vRange.Y + 1) * 0.1f);
}
else
{
this.speed = speed;
}
this.hRange = hRange;
this.vRange = vRange;
this.strength = strength;
str = strength;
this.steps = steps;
stepsLeft = steps;
this.type = type;
this.addTile = addTile;
this.overRide = overRide;
}
public void Start()
{
while (str > 0 && stepsLeft > 0)
{
str = strength * (double)stepsLeft / steps;
int a = (int)Math.Max(pos.X - str * 0.5, 1);
int b = (int)Math.Min(pos.X + str * 0.5, Main.maxTilesX - 1);
int c = (int)Math.Max(pos.Y - str * 0.5, 1);
int d = (int)Math.Min(pos.Y + str * 0.5, Main.maxTilesY - 1);
for (int i = a; i < b; i++)
{
for (int j = c; j < d; j++)
{
if (Math.Abs(i - pos.X) + Math.Abs(j - pos.Y) >= strength * StrengthRange())
{
continue;
}
ChangeTile(Main.tile[i, j]);
}
}
str += 50;
while (str > 50)
{
pos += speed;
stepsLeft--;
str -= 50;
speed.X += WorldGen.genRand.Next(hRange.X, hRange.Y + 1) * 0.05f;
speed.Y += WorldGen.genRand.Next(vRange.X, vRange.Y + 1) * 0.05f;
}
speed = Vector2.Clamp(speed, new Vector2(-1, -1), new Vector2(1, 1));
}
}
public virtual void ChangeTile(Tile tile)
{
if (!addTile)
{
tile.HasTile = false;
}
else
{
tile.TileType = type;
}
}
public virtual double StrengthRange()
{
return 0.5 + WorldGen.genRand.Next(-10, 11) * 0.0075;
}
}
//probably might be useful to have for later, just places clumps of water
class WaterTileRunner : TileRunner
{
public WaterTileRunner(Vector2 pos, Vector2 speed, Point16 hRange, Point16 vRange, double strength, int steps, ushort type, bool addTile, bool overRide) : base(pos, speed, hRange, vRange, strength, steps, type, addTile, overRide)
{
}
public override void ChangeTile(Tile tile)
{
tile.HasTile = false;
tile.LiquidType = LiquidID.Water;
tile.LiquidAmount = 255;
}
}
}
+78
View File
@@ -0,0 +1,78 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Walls
{
public class BrimstoneSlabWall : ModWall
{
public override void SetStaticDefaults()
{
Main.wallHouse[Type] = true;
ItemDrop = ModContent.ItemType<Items.Placeables.Walls.BrimstoneSlabWall>();
AddMapEntry(new Color(24, 16, 29));
}
public override bool CreateDust(int i, int j, ref int type)
{
Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f);
Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f);
return false;
}
public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = ModContent.Request<Texture2D>("CalamityMod/Walls/BrimstoneSlabWall").Value;
Color lightColor = GetWallColour(i, j);
Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
zero -= new Vector2(8, 8);
Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero;
int[] sheetOffset = CreatePattern(i, j);
spriteBatch.Draw
(
sprite,
drawOffset,
new Rectangle(sheetOffset[0] + Main.tile[i, j].WallFrameX, sheetOffset[1] + Main.tile[i, j].WallFrameY, 32, 32),
lightColor,
0,
new Vector2(0f, 0f),
1,
SpriteEffects.None,
0f
);
return false;
}
private int[] CreatePattern(int i, int j)
{
int[] sheetOffset = new int[2] { i % 2, j % 2 };
sheetOffset[0] = sheetOffset[0] * 468;
sheetOffset[1] = sheetOffset[1] * 180;
return sheetOffset;
}
private Color GetWallColour(int i, int j)
{
int colType = Main.tile[i, j].WallColor;
Color paintCol = WorldGen.paintColor(colType);
if (colType < 13)
{
paintCol.R = (byte)((paintCol.R / 2f) + 128);
paintCol.G = (byte)((paintCol.G / 2f) + 128);
paintCol.B = (byte)((paintCol.B / 2f) + 128);
}
if (colType == 29)
{
paintCol = Color.Black;
}
Color col = Lighting.GetColor(i, j);
col.R = (byte)(paintCol.R / 255f * col.R);
col.G = (byte)(paintCol.G / 255f * col.G);
col.B = (byte)(paintCol.B / 255f * col.B);
return col;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

+19 -7
View File
@@ -1,4 +1,5 @@
using CalamityMod.Tiles.SunkenSea;
using CalamityMod.Walls;
using CalamityMod.Items.DraedonMisc;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Weapons.Melee;
@@ -29,20 +30,27 @@ namespace CalamityMod.World
if (tile.LiquidType == LiquidID.Lava && careAboutLava)
return true;
if (tile.TileType == TileID.BlueDungeonBrick ||
tile.TileType == TileID.GreenDungeonBrick ||
tile.TileType == TileID.PinkDungeonBrick)
tile.TileType == TileID.GreenDungeonBrick ||
tile.TileType == TileID.PinkDungeonBrick)
{
return true;
}
if (tile.TileType == TileID.LihzahrdBrick ||
tile.WallType == WallID.LihzahrdBrickUnsafe)
tile.WallType == WallID.LihzahrdBrickUnsafe)
{
return true;
}
if (tile.TileType == TileID.Crimstone ||
tile.WallType == WallID.CrimstoneUnsafe ||
tile.TileType == TileID.Ebonstone ||
tile.WallType == WallID.EbonstoneUnsafe)
tile.WallType == WallID.CrimstoneUnsafe ||
tile.TileType == TileID.Ebonstone ||
tile.WallType == WallID.EbonstoneUnsafe)
{
return true;
}
if (tile.TileType == ModContent.TileType<Navystone>() ||
tile.TileType == ModContent.TileType<EutrophicSand>() ||
tile.WallType == ModContent.WallType<NavystoneWall>() ||
tile.WallType == ModContent.WallType<EutrophicSandWall>())
{
return true;
}
@@ -381,6 +389,9 @@ namespace CalamityMod.World
placementPoint = new Point(placementPositionX, placementPositionY);
Vector2 schematicSize = new Vector2(schematic.GetLength(0), schematic.GetLength(1));
int xCheckArea = 25;
/*
//Disabled this specifically for the sunken sea lab, not sure if it's even needed since the lab now always places based on where the sunken sea is
//this seems to work fine, but i dont want to delete it just in case
bool shouldAvoidArea = false;
float totalTiles = (schematicSize.X + xCheckArea * 2) * schematicSize.Y;
@@ -394,7 +405,8 @@ namespace CalamityMod.World
}
}
tries++;
if (!shouldAvoidArea && structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y)))
*/
if (/*!shouldAvoidArea &&*/ structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y)))
break;
}
while (tries < 50000);
+31 -38
View File
@@ -7,6 +7,7 @@ using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.WorldBuilding;
using Terraria.DataStructures;
namespace CalamityMod.World
{
@@ -246,7 +247,6 @@ namespace CalamityMod.World
if (num10 > 4.5f) //Adjust num10 for all cases if you want different tile frequencies; higher is less frequent, lower is more frequent
{
tile.ClearEverything();
//tile.WallType = (ushort)ModContent.WallType<NavystoneWall>();
tile.LiquidAmount = 192;
if (num4 % 5 == 2)
{
@@ -303,41 +303,6 @@ namespace CalamityMod.World
}
}
//seperate loop for biome polish and stuff
for (int i = -20; i < totalWidth + 20; i++)
{
for (int j = start.X + 50; j < Main.maxTilesY - 200; j++)
{
int x = i + start.X;
int y = j + start.Y;
/*
//randomly place navystone chunks on top of exposed sand
if (WorldGen.genRand.Next(50) == 0 && tile.HasTile && tile.TileType == ModContent.TileType<EutrophicSand>() && !tileAbove.HasTile)
{
//todo: change this to be more natural and not a circle, maybe use WorldGen.TileRunner?
BasicCircle(x, y, WorldGen.genRand.Next(3, 12), ModContent.TileType<Navystone>());
}
*/
//randomly kill walls so that the background can show through in some places
if (WorldGen.genRand.Next(50) == 0)
{
//TODO: continue this tomorrow
int radius = (int)(((float)WorldGen.genRand.Next(8, 20)));
float outerRadius = WorldGen.genRand.Next(40, 56) * 0.01f;
ShapeData holeShape = new ShapeData();
WorldUtils.Gen(new Point(x, y), new Shapes.Circle((int)((float)radius * (outerRadius * 0.3f))), Actions.Chain(new GenAction[] //Smallest is 1
{
new Modifiers.Blotches(2, 0.3).Output(holeShape),
new Actions.ClearWall(true), //Clear center
new Actions.SetLiquid(0, 255)
}));
}
}
}
//final cleanup loop
for (int i = -20; i < totalWidth + 20; i++)
{
@@ -347,6 +312,10 @@ namespace CalamityMod.World
int y = j + start.Y;
Tile tile = Main.tile[x, y];
Tile tileUp = Main.tile[x, y - 1];
Tile tileDown = Main.tile[x, y + 1];
Tile tileLeft = Main.tile[x - 1, y];
Tile tileRight = Main.tile[x + 1, y];
//lava BEGONE
if (tile.WallType == ModContent.WallType<NavystoneWall>() || tile.WallType == ModContent.WallType<EutrophicSandWall>())
@@ -363,6 +332,30 @@ namespace CalamityMod.World
WorldGen.KillTile(x, y);
}
}
//place extra caves throughout the biome for variance
if (WorldGen.genRand.Next(1000) == 0 && tile != null && tile.HasTile &&
(tile.TileType == ModContent.TileType<Navystone>() || tile.TileType == ModContent.TileType<EutrophicSand>()))
{
TileRunner runner = new TileRunner(new Vector2(x, y), new Vector2(0, 5), new Point16(-35, 35),
new Point16(-35, 35), 15f, Main.rand.Next(25, 50), 0, false, true);
runner.Start();
}
//kill any random floating tiles
if ((tile.TileType == ModContent.TileType<Navystone>() || tile.TileType == ModContent.TileType<EutrophicSand>()) &&
!tileUp.HasTile && !tileDown.HasTile && !tileLeft.HasTile && !tileRight.HasTile)
{
WorldGen.KillTile(x, y);
}
//kill any random clumps of navystone without eutrophic sand around them
if (tile.TileType == ModContent.TileType<Navystone>() && tileUp.TileType != ModContent.TileType<EutrophicSand>() &&
tileDown.TileType != ModContent.TileType<EutrophicSand>() && tileLeft.TileType != ModContent.TileType<EutrophicSand>() &&
tileRight.TileType != ModContent.TileType<EutrophicSand>())
{
WorldGen.KillTile(x, y);
}
}
}
}
@@ -626,11 +619,11 @@ namespace CalamityMod.World
{
PlaceTit(num5, num6 + 1, (ushort)ModContent.TileType<SunkenSeaStalactite>());
}
if (WorldGen.genRand.Next(6) == 0)
if (WorldGen.genRand.Next(7) == 0)
{
WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType<BrainCoral>(), true, false, -1, 0);
}
if (WorldGen.genRand.Next(5) == 0)
if (WorldGen.genRand.Next(10) == 0)
{
WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType<SmallBrainCoral>(), true, false, -1, 0);
}