Sunken Sea stuff
No files matched your search
@@ -0,0 +1,25 @@
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using WallTiles = CalamityMod.Walls;
|
||||
|
||||
namespace CalamityMod.Items.Placeables.Walls
|
||||
{
|
||||
public class EutrophicGlassWall : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Placeables";
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Item.ResearchUnlockCount = 400;
|
||||
}
|
||||
|
||||
public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType<WallTiles.EutrophicGlassWall>());
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe(4).
|
||||
AddIngredient<SunkenSea.EutrophicGlass>().
|
||||
AddTile(TileID.WorkBenches).
|
||||
Register();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 235 B |
@@ -4053,3 +4053,8 @@ BranchCoral: {
|
||||
DisplayName: Branch Coral
|
||||
Tooltip: ""
|
||||
}
|
||||
|
||||
EutrophicGlassWall: {
|
||||
DisplayName: Eutrophic Glass Wall
|
||||
Tooltip: ""
|
||||
}
|
||||
@@ -29,9 +29,9 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient
|
||||
}
|
||||
public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
|
||||
{
|
||||
r = 62f / 400f;
|
||||
g = 89f / 400f;
|
||||
b = 171f / 400f;
|
||||
r = 56f / 400f;
|
||||
g = 164f / 400f;
|
||||
b = 180f / 400f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,9 +39,9 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient
|
||||
{
|
||||
public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
|
||||
{
|
||||
r = 62f / 400f;
|
||||
g = 89f / 400f;
|
||||
b = 171f / 400f;
|
||||
r = 56f / 400f;
|
||||
g = 164f / 400f;
|
||||
b = 180f / 400f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,9 +49,9 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient
|
||||
{
|
||||
public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
|
||||
{
|
||||
r = 62f / 400f;
|
||||
g = 89f / 400f;
|
||||
b = 171f / 400f;
|
||||
r = 56f / 400f;
|
||||
g = 164f / 400f;
|
||||
b = 180f / 400f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 886 B After Width: | Height: | Size: 505 B |
|
Before Width: | Height: | Size: 761 B After Width: | Height: | Size: 783 B |
|
Before Width: | Height: | Size: 721 B After Width: | Height: | Size: 715 B |
@@ -32,9 +32,9 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient
|
||||
}
|
||||
public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
|
||||
{
|
||||
r = 62f / 400f;
|
||||
g = 89f / 400f;
|
||||
b = 171f / 400f;
|
||||
r = 56f / 400f;
|
||||
g = 164f / 400f;
|
||||
b = 180f / 400f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,9 +61,9 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient
|
||||
}
|
||||
public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
|
||||
{
|
||||
r = 62f / 400f;
|
||||
g = 89f / 400f;
|
||||
b = 171f / 400f;
|
||||
r = 56f / 400f;
|
||||
g = 164f / 400f;
|
||||
b = 180f / 400f;
|
||||
}
|
||||
}
|
||||
public class TallDigitateCoral3 : ModTile
|
||||
@@ -89,9 +89,9 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient
|
||||
}
|
||||
public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
|
||||
{
|
||||
r = 62f / 400f;
|
||||
g = 89f / 400f;
|
||||
b = 171f / 400f;
|
||||
r = 56f / 400f;
|
||||
g = 164f / 400f;
|
||||
b = 180f / 400f;
|
||||
}
|
||||
}
|
||||
public class TallDigitateCoral4 : ModTile
|
||||
@@ -117,9 +117,9 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient
|
||||
}
|
||||
public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
|
||||
{
|
||||
r = 62f / 400f;
|
||||
g = 89f / 400f;
|
||||
b = 171f / 400f;
|
||||
r = 56f / 400f;
|
||||
g = 164f / 400f;
|
||||
b = 180f / 400f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 982 B After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -42,18 +42,18 @@ namespace CalamityMod.Tiles.SunkenSea
|
||||
{
|
||||
num = fail ? 1 : 3;
|
||||
}
|
||||
public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData)
|
||||
{
|
||||
if (Main.tile[i - 1, j - 1].TileType != Type || Main.tile[i, j - 1].TileType != Type || Main.tile[i + 1, j - 1].TileType != Type ||
|
||||
Main.tile[i - 1, j - 2].TileType != Type || Main.tile[i, j - 2].TileType != Type || Main.tile[i + 1, j - 2].TileType != Type)
|
||||
{
|
||||
try
|
||||
{
|
||||
Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
//public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData)
|
||||
//{
|
||||
// if (Main.tile[i - 1, j - 1].TileType != Type || Main.tile[i, j - 1].TileType != Type || Main.tile[i + 1, j - 1].TileType != Type ||
|
||||
// Main.tile[i - 1, j - 2].TileType != Type || Main.tile[i, j - 2].TileType != Type || Main.tile[i + 1, j - 2].TileType != Type)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j);
|
||||
// }
|
||||
// catch { }
|
||||
// }
|
||||
//}
|
||||
private Color GetDrawColour(int i, int j)
|
||||
{
|
||||
int colType = Main.tile[i, j].TileColor;
|
||||
@@ -74,189 +74,191 @@ namespace CalamityMod.Tiles.SunkenSea
|
||||
col.B = (byte)(paintCol.B / 255f * col.B);
|
||||
return col;
|
||||
}
|
||||
public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch)
|
||||
{
|
||||
Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
|
||||
Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero;
|
||||
Color drawColour = GetDrawColour(i, j);
|
||||
Texture2D leaves = ModContent.Request<Texture2D>("CalamityMod/Tiles/SunkenSea/ScarletSeaGrass").Value;
|
||||
//public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch)
|
||||
//{
|
||||
// Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
|
||||
// Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero;
|
||||
// Color drawColour = GetDrawColour(i, j);
|
||||
// Texture2D leaves = ModContent.Request<Texture2D>("CalamityMod/Tiles/SunkenSea/ScarletSeaGrass").Value;
|
||||
|
||||
DrawExtraTop(i, j, leaves, drawOffset, drawColour);
|
||||
DrawExtraWallEnds(i, j, leaves, drawOffset, drawColour);
|
||||
DrawExtraDrapes(i, j, leaves, drawOffset, drawColour);
|
||||
}
|
||||
// DrawExtraTop(i, j, leaves, drawOffset, drawColour);
|
||||
// DrawExtraWallEnds(i, j, leaves, drawOffset, drawColour);
|
||||
// DrawExtraDrapes(i, j, leaves, drawOffset, drawColour);
|
||||
//}
|
||||
|
||||
public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak)
|
||||
{
|
||||
return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame);
|
||||
}
|
||||
public override void RandomUpdate(int i, int j)
|
||||
{
|
||||
Tile tile = Main.tile[i, j];
|
||||
Tile up = Main.tile[i, j - 1];
|
||||
Tile up2 = Main.tile[i, j - 2];
|
||||
//public override void RandomUpdate(int i, int j)
|
||||
//{
|
||||
// Tile tile = Main.tile[i, j];
|
||||
// Tile up = Main.tile[i, j - 1];
|
||||
// Tile up2 = Main.tile[i, j - 2];
|
||||
|
||||
// Place LongScarletSeagrass
|
||||
if (WorldGen.genRand.NextBool(1) && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock)
|
||||
{
|
||||
up.TileType = (ushort)ModContent.TileType<LongScarletSeagrass>();
|
||||
up.HasTile = true;
|
||||
up.TileFrameY = 0;
|
||||
// // Place LongScarletSeagrass
|
||||
// if (WorldGen.genRand.NextBool(1) && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock)
|
||||
// {
|
||||
// up.TileType = (ushort)ModContent.TileType<LongScarletSeagrass>();
|
||||
// up.HasTile = true;
|
||||
// up.TileFrameY = 0;
|
||||
|
||||
// 16 different frames, choose a random one
|
||||
up.TileFrameX = (short)(WorldGen.genRand.Next(16) * 18);
|
||||
WorldGen.SquareTileFrame(i, j - 1, true);
|
||||
// // 16 different frames, choose a random one
|
||||
// up.TileFrameX = (short)(WorldGen.genRand.Next(16) * 18);
|
||||
// WorldGen.SquareTileFrame(i, j - 1, true);
|
||||
|
||||
if (Main.dedServ)
|
||||
NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None);
|
||||
}
|
||||
}
|
||||
|
||||
#region 'Extra Drapes' Drawing
|
||||
private void DrawExtraTop(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour)
|
||||
{
|
||||
/*
|
||||
If the tile directly above this tile is not otherworldly stone, or if it is, there is air to both sides of that tile, draw the Extra surface
|
||||
*/
|
||||
if (
|
||||
CheckTile(Type, false, 0, 1, i, j) ||
|
||||
(CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, true, -1, 0, i, j))
|
||||
)
|
||||
{
|
||||
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
|
||||
DrawExtraOverhang(i, j, extras, drawOffset, drawColour);
|
||||
}
|
||||
}
|
||||
private bool CheckTile(int type, bool equal, int x, int y, int i, int j)
|
||||
{
|
||||
//Subtract y so that y is vertical for ease of readability
|
||||
return Main.tile[i + x, j - y].TileType == type == equal;
|
||||
}
|
||||
private void DrawExtraWallEnds(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour)
|
||||
{
|
||||
/*
|
||||
Ending the Extra when a wall is reached
|
||||
*/
|
||||
|
||||
//Left
|
||||
if (
|
||||
CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) &&
|
||||
(CheckTile(Type, true, -1, 1, i, j) || CheckTile(Type, false, -1, 0, i, j))
|
||||
)
|
||||
{
|
||||
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
//Right
|
||||
if (
|
||||
CheckTile(Type, true, -1, 0, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) &&
|
||||
(CheckTile(Type, true, 1, 1, i, j) || CheckTile(Type, false, 1, 0, i, j))
|
||||
)
|
||||
{
|
||||
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
private void DrawExtraOverhang(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour)
|
||||
{
|
||||
/*
|
||||
Called from DrawExtraTop(). Ending the Extra when the edge of the tile is reached
|
||||
*/
|
||||
|
||||
//Left
|
||||
if (
|
||||
CheckTile(Type, false, -1, 0, i, j)
|
||||
)
|
||||
{
|
||||
Main.spriteBatch.Draw(extras, drawOffset + new Vector2(-16f, 0f), new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i, j), GetExtraPattern(i - 1), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.Draw(extras, drawOffset + new Vector2(-16f, 16f), new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i, j), GetExtraPattern(i - 1) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
//Right
|
||||
if (
|
||||
CheckTile(Type, false, 1, 0, i, j)
|
||||
)
|
||||
{
|
||||
Main.spriteBatch.Draw(extras, drawOffset + new Vector2(16f, 0f), new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i, j), GetExtraPattern(i + 1), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.Draw(extras, drawOffset + new Vector2(16f, 16f), new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i, j), GetExtraPattern(i + 1) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
private void DrawExtraDrapes(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour)
|
||||
{
|
||||
/*
|
||||
Hanging 'drapes' of the extra element
|
||||
*/
|
||||
|
||||
//Base
|
||||
if (
|
||||
(CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j)) ||
|
||||
(CheckTile(Type, true, 0, 2, i, j) && CheckTile(Type, false, 1, 2, i, j) && CheckTile(Type, false, -1, 2, i, j) && CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, true, -1, 1, i, j))
|
||||
)
|
||||
{
|
||||
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
//Left Wall
|
||||
if (
|
||||
CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, false, 1, 2, i, j) && CheckTile(Type, true, 0, 2, i, j) &&
|
||||
(CheckTile(Type, true, -1, 2, i, j) || CheckTile(Type, false, -1, 1, i, j))
|
||||
)
|
||||
{
|
||||
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
//Right Wall
|
||||
if (
|
||||
CheckTile(Type, true, -1, 1, i, j) && CheckTile(Type, false, -1, 2, i, j) && CheckTile(Type, true, 0, 2, i, j) &&
|
||||
(CheckTile(Type, true, 1, 2, i, j) || CheckTile(Type, false, 1, 1, i, j))
|
||||
)
|
||||
{
|
||||
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
//Left Overhang
|
||||
if (
|
||||
CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, false, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j) && CheckTile(Type, false, 1, 2, i, j)
|
||||
)
|
||||
{
|
||||
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i + 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
//Right Overhang
|
||||
if (
|
||||
CheckTile(Type, true, -1, 1, i, j) && CheckTile(Type, false, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j) && CheckTile(Type, false, -1, 2, i, j)
|
||||
)
|
||||
{
|
||||
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i - 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
private int GetExtraState(string type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case "middle":
|
||||
return 36;
|
||||
case "overhangLeft":
|
||||
return 18;
|
||||
case "overhangRight":
|
||||
return 54;
|
||||
case "wallEndLeft":
|
||||
return 0;
|
||||
case "wallEndRight":
|
||||
return 72;
|
||||
default:
|
||||
Main.NewText(type.ToString() + " is not a valid Extra sheet state");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private int GetExtraPattern(int i)
|
||||
{
|
||||
return i % 3 * extraFrameHeight;
|
||||
}
|
||||
|
||||
private int GetExtraVariant(int i, int j)
|
||||
{
|
||||
return Main.tile[i, j].TileFrameNumber * extraFrameWidth;
|
||||
}
|
||||
// if (Main.dedServ)
|
||||
// NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
// #region 'Extra Drapes' Drawing
|
||||
// private void DrawExtraTop(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour)
|
||||
// {
|
||||
// /*
|
||||
// If the tile directly above this tile is not otherworldly stone, or if it is, there is air to both sides of that tile, draw the Extra surface
|
||||
// */
|
||||
// if (
|
||||
// CheckTile(Type, false, 0, 1, i, j) ||
|
||||
// (CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, true, -1, 0, i, j))
|
||||
// )
|
||||
// {
|
||||
// Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
// Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
|
||||
// DrawExtraOverhang(i, j, extras, drawOffset, drawColour);
|
||||
// }
|
||||
// }
|
||||
// private bool CheckTile(int type, bool equal, int x, int y, int i, int j)
|
||||
// {
|
||||
// //Subtract y so that y is vertical for ease of readability
|
||||
// return Main.tile[i + x, j - y].TileType == type == equal;
|
||||
// }
|
||||
// private void DrawExtraWallEnds(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour)
|
||||
// {
|
||||
// /*
|
||||
// Ending the Extra when a wall is reached
|
||||
// */
|
||||
|
||||
// //Left
|
||||
// if (
|
||||
// CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) &&
|
||||
// (CheckTile(Type, true, -1, 1, i, j) || CheckTile(Type, false, -1, 0, i, j))
|
||||
// )
|
||||
// {
|
||||
// Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
// Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
// }
|
||||
// //Right
|
||||
// if (
|
||||
// CheckTile(Type, true, -1, 0, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) &&
|
||||
// (CheckTile(Type, true, 1, 1, i, j) || CheckTile(Type, false, 1, 0, i, j))
|
||||
// )
|
||||
// {
|
||||
// Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
// Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
// }
|
||||
// }
|
||||
// private void DrawExtraOverhang(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour)
|
||||
// {
|
||||
// /*
|
||||
// Called from DrawExtraTop(). Ending the Extra when the edge of the tile is reached
|
||||
// */
|
||||
|
||||
// //Left
|
||||
// if (
|
||||
// CheckTile(Type, false, -1, 0, i, j)
|
||||
// )
|
||||
// {
|
||||
// Main.spriteBatch.Draw(extras, drawOffset + new Vector2(-16f, 0f), new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i, j), GetExtraPattern(i - 1), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
// Main.spriteBatch.Draw(extras, drawOffset + new Vector2(-16f, 16f), new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i, j), GetExtraPattern(i - 1) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
// }
|
||||
// //Right
|
||||
// if (
|
||||
// CheckTile(Type, false, 1, 0, i, j)
|
||||
// )
|
||||
// {
|
||||
// Main.spriteBatch.Draw(extras, drawOffset + new Vector2(16f, 0f), new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i, j), GetExtraPattern(i + 1), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
// Main.spriteBatch.Draw(extras, drawOffset + new Vector2(16f, 16f), new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i, j), GetExtraPattern(i + 1) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
// }
|
||||
// }
|
||||
// private void DrawExtraDrapes(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour)
|
||||
// {
|
||||
// /*
|
||||
// Hanging 'drapes' of the extra element
|
||||
// */
|
||||
|
||||
// //Base
|
||||
// if (
|
||||
// (CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j)) ||
|
||||
// (CheckTile(Type, true, 0, 2, i, j) && CheckTile(Type, false, 1, 2, i, j) && CheckTile(Type, false, -1, 2, i, j) && CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, true, -1, 1, i, j))
|
||||
// )
|
||||
// {
|
||||
// Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
// }
|
||||
// //Left Wall
|
||||
// if (
|
||||
// CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, false, 1, 2, i, j) && CheckTile(Type, true, 0, 2, i, j) &&
|
||||
// (CheckTile(Type, true, -1, 2, i, j) || CheckTile(Type, false, -1, 1, i, j))
|
||||
// )
|
||||
// {
|
||||
// Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
// }
|
||||
// //Right Wall
|
||||
// if (
|
||||
// CheckTile(Type, true, -1, 1, i, j) && CheckTile(Type, false, -1, 2, i, j) && CheckTile(Type, true, 0, 2, i, j) &&
|
||||
// (CheckTile(Type, true, 1, 2, i, j) || CheckTile(Type, false, 1, 1, i, j))
|
||||
// )
|
||||
// {
|
||||
// Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
// }
|
||||
// //Left Overhang
|
||||
// if (
|
||||
// CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, false, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j) && CheckTile(Type, false, 1, 2, i, j)
|
||||
// )
|
||||
// {
|
||||
// Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i + 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
// }
|
||||
// //Right Overhang
|
||||
// if (
|
||||
// CheckTile(Type, true, -1, 1, i, j) && CheckTile(Type, false, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j) && CheckTile(Type, false, -1, 2, i, j)
|
||||
// )
|
||||
// {
|
||||
// Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i - 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
// }
|
||||
// }
|
||||
|
||||
// private int GetExtraState(string type)
|
||||
// {
|
||||
// switch (type)
|
||||
// {
|
||||
// case "middle":
|
||||
// return 36;
|
||||
// case "overhangLeft":
|
||||
// return 18;
|
||||
// case "overhangRight":
|
||||
// return 54;
|
||||
// case "wallEndLeft":
|
||||
// return 0;
|
||||
// case "wallEndRight":
|
||||
// return 72;
|
||||
// default:
|
||||
// Main.NewText(type.ToString() + " is not a valid Extra sheet state");
|
||||
// return 0;
|
||||
// }
|
||||
// }
|
||||
|
||||
// private int GetExtraPattern(int i)
|
||||
// {
|
||||
// return i % 3 * extraFrameHeight;
|
||||
// }
|
||||
|
||||
// private int GetExtraVariant(int i, int j)
|
||||
// {
|
||||
// return Main.tile[i, j].TileFrameNumber * extraFrameWidth;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//#endregion
|
||||
@@ -0,0 +1,275 @@
|
||||
using System;
|
||||
using CalamityMod.Systems;
|
||||
using CalamityMod.Tiles.Abyss.AbyssAmbient;
|
||||
using CalamityMod.Tiles.SunkenSea.Ambient;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
|
||||
|
||||
namespace CalamityMod.Tiles.SunkenSea
|
||||
{
|
||||
public class ScarletSeaGrassTile : ModTile
|
||||
{
|
||||
private int extraFrameHeight = 36;
|
||||
private int extraFrameWidth = 90;
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
TileID.Sets.GeneralPlacementTiles[Type] = false;
|
||||
|
||||
Main.tileSolid[Type] = true;
|
||||
Main.tileBlockLight[Type] = false;
|
||||
|
||||
CalamityUtils.MergeWithGeneral(Type);
|
||||
CalamityUtils.MergeWithDesert(Type);
|
||||
|
||||
TileID.Sets.HasSlopeFrames[Type] = true;
|
||||
TileID.Sets.ChecksForMerge[Type] = true;
|
||||
TileID.Sets.CanBeDugByShovel[Type] = true;
|
||||
|
||||
DustType = 147;
|
||||
AddMapEntry(new Color(187, 43, 44));
|
||||
|
||||
this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge");
|
||||
this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge");
|
||||
this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge");
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 3;
|
||||
}
|
||||
public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData)
|
||||
{
|
||||
if (Main.tile[i - 1, j - 1].TileType != Type || Main.tile[i, j - 1].TileType != Type || Main.tile[i + 1, j - 1].TileType != Type ||
|
||||
Main.tile[i - 1, j - 2].TileType != Type || Main.tile[i, j - 2].TileType != Type || Main.tile[i + 1, j - 2].TileType != Type)
|
||||
{
|
||||
try
|
||||
{
|
||||
Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
private Color GetDrawColour(int i, int j)
|
||||
{
|
||||
int colType = Main.tile[i, j].TileColor;
|
||||
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;
|
||||
}
|
||||
public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch)
|
||||
{
|
||||
Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
|
||||
Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero;
|
||||
Color drawColour = GetDrawColour(i, j);
|
||||
Texture2D leaves = ModContent.Request<Texture2D>("CalamityMod/Tiles/SunkenSea/ScarletSeaGrass").Value;
|
||||
|
||||
DrawExtraTop(i, j, leaves, drawOffset, drawColour);
|
||||
DrawExtraWallEnds(i, j, leaves, drawOffset, drawColour);
|
||||
DrawExtraDrapes(i, j, leaves, drawOffset, drawColour);
|
||||
}
|
||||
|
||||
public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak)
|
||||
{
|
||||
return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame);
|
||||
}
|
||||
public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
|
||||
{
|
||||
float brightness = 0.7f;
|
||||
brightness *= (float)MathF.Sin(-j / 40f + Main.GameUpdateCount * 0.01f + i);
|
||||
brightness += 0.5f;
|
||||
r = 187f / 255f;
|
||||
g = 43f / 255f;
|
||||
b = 44f / 255f;
|
||||
r *= brightness;
|
||||
g *= brightness;
|
||||
b *= brightness;
|
||||
}
|
||||
public override void RandomUpdate(int i, int j)
|
||||
{
|
||||
Tile tile = Main.tile[i, j];
|
||||
Tile up = Main.tile[i, j - 1];
|
||||
Tile up2 = Main.tile[i, j - 2];
|
||||
|
||||
// Place LongScarletSeagrass
|
||||
if (WorldGen.genRand.NextBool(1) && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock)
|
||||
{
|
||||
up.TileType = (ushort)ModContent.TileType<LongScarletSeagrass>();
|
||||
up.HasTile = true;
|
||||
up.TileFrameY = 0;
|
||||
|
||||
// 16 different frames, choose a random one
|
||||
up.TileFrameX = (short)(WorldGen.genRand.Next(16) * 18);
|
||||
WorldGen.SquareTileFrame(i, j - 1, true);
|
||||
|
||||
if (Main.dedServ)
|
||||
NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None);
|
||||
}
|
||||
}
|
||||
|
||||
#region 'Extra Drapes' Drawing
|
||||
private void DrawExtraTop(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour)
|
||||
{
|
||||
/*
|
||||
If the tile directly above this tile is not otherworldly stone, or if it is, there is air to both sides of that tile, draw the Extra surface
|
||||
*/
|
||||
if (
|
||||
CheckTile(Type, false, 0, 1, i, j) ||
|
||||
(CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, true, -1, 0, i, j))
|
||||
)
|
||||
{
|
||||
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
|
||||
DrawExtraOverhang(i, j, extras, drawOffset, drawColour);
|
||||
}
|
||||
}
|
||||
private bool CheckTile(int type, bool equal, int x, int y, int i, int j)
|
||||
{
|
||||
//Subtract y so that y is vertical for ease of readability
|
||||
return Main.tile[i + x, j - y].TileType == type == equal;
|
||||
}
|
||||
private void DrawExtraWallEnds(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour)
|
||||
{
|
||||
/*
|
||||
Ending the Extra when a wall is reached
|
||||
*/
|
||||
|
||||
//Left
|
||||
if (
|
||||
CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) &&
|
||||
(CheckTile(Type, true, -1, 1, i, j) || CheckTile(Type, false, -1, 0, i, j))
|
||||
)
|
||||
{
|
||||
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
//Right
|
||||
if (
|
||||
CheckTile(Type, true, -1, 0, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) &&
|
||||
(CheckTile(Type, true, 1, 1, i, j) || CheckTile(Type, false, 1, 0, i, j))
|
||||
)
|
||||
{
|
||||
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
private void DrawExtraOverhang(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour)
|
||||
{
|
||||
/*
|
||||
Called from DrawExtraTop(). Ending the Extra when the edge of the tile is reached
|
||||
*/
|
||||
|
||||
//Left
|
||||
if (
|
||||
CheckTile(Type, false, -1, 0, i, j)
|
||||
)
|
||||
{
|
||||
Main.spriteBatch.Draw(extras, drawOffset + new Vector2(-16f, 0f), new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i, j), GetExtraPattern(i - 1), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.Draw(extras, drawOffset + new Vector2(-16f, 16f), new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i, j), GetExtraPattern(i - 1) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
//Right
|
||||
if (
|
||||
CheckTile(Type, false, 1, 0, i, j)
|
||||
)
|
||||
{
|
||||
Main.spriteBatch.Draw(extras, drawOffset + new Vector2(16f, 0f), new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i, j), GetExtraPattern(i + 1), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.Draw(extras, drawOffset + new Vector2(16f, 16f), new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i, j), GetExtraPattern(i + 1) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
private void DrawExtraDrapes(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour)
|
||||
{
|
||||
/*
|
||||
Hanging 'drapes' of the extra element
|
||||
*/
|
||||
|
||||
//Base
|
||||
if (
|
||||
(CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j)) ||
|
||||
(CheckTile(Type, true, 0, 2, i, j) && CheckTile(Type, false, 1, 2, i, j) && CheckTile(Type, false, -1, 2, i, j) && CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, true, -1, 1, i, j))
|
||||
)
|
||||
{
|
||||
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
//Left Wall
|
||||
if (
|
||||
CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, false, 1, 2, i, j) && CheckTile(Type, true, 0, 2, i, j) &&
|
||||
(CheckTile(Type, true, -1, 2, i, j) || CheckTile(Type, false, -1, 1, i, j))
|
||||
)
|
||||
{
|
||||
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
//Right Wall
|
||||
if (
|
||||
CheckTile(Type, true, -1, 1, i, j) && CheckTile(Type, false, -1, 2, i, j) && CheckTile(Type, true, 0, 2, i, j) &&
|
||||
(CheckTile(Type, true, 1, 2, i, j) || CheckTile(Type, false, 1, 1, i, j))
|
||||
)
|
||||
{
|
||||
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
//Left Overhang
|
||||
if (
|
||||
CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, false, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j) && CheckTile(Type, false, 1, 2, i, j)
|
||||
)
|
||||
{
|
||||
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i + 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
//Right Overhang
|
||||
if (
|
||||
CheckTile(Type, true, -1, 1, i, j) && CheckTile(Type, false, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j) && CheckTile(Type, false, -1, 2, i, j)
|
||||
)
|
||||
{
|
||||
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i - 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
private int GetExtraState(string type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case "middle":
|
||||
return 36;
|
||||
case "overhangLeft":
|
||||
return 18;
|
||||
case "overhangRight":
|
||||
return 54;
|
||||
case "wallEndLeft":
|
||||
return 0;
|
||||
case "wallEndRight":
|
||||
return 72;
|
||||
default:
|
||||
Main.NewText(type.ToString() + " is not a valid Extra sheet state");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private int GetExtraPattern(int i)
|
||||
{
|
||||
return i % 3 * extraFrameHeight;
|
||||
}
|
||||
|
||||
private int GetExtraVariant(int i, int j)
|
||||
{
|
||||
return Main.tile[i, j].TileFrameNumber * extraFrameWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
After Width: | Height: | Size: 7.9 KiB |
@@ -0,0 +1,34 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace CalamityMod.Walls
|
||||
{
|
||||
public class EutrophicGlassWall : MultiVariantModWall
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.wallHouse[Type] = true;
|
||||
Main.BackgroundEnabled = true;
|
||||
Main.wallLight[Type] = true;
|
||||
|
||||
AddMapEntry(new Color(23, 39, 48));
|
||||
}
|
||||
|
||||
public override bool CreateDust(int i, int j, ref int type)
|
||||
{
|
||||
Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Chlorophyte, 0f, 0f, 1, new Color(255, 255, 255), 1f);
|
||||
Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
|
||||
|
||||
public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset)
|
||||
{
|
||||
|
||||
frameYOffset = (j % 10) * 180;
|
||||
frameXOffset = (i % 10) * 468;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 391 KiB |
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Walls
|
||||
{
|
||||
public class PlantyMushWall : ModWall
|
||||
{
|
||||
public static Asset<Texture2D> leafTexture = null;
|
||||
|
||||
public static Vector2 TileAdj => (Lighting.Mode == Terraria.Graphics.Light.LightMode.Retro || Lighting.Mode == Terraria.Graphics.Light.LightMode.Trippy) ? Vector2.Zero : Vector2.One * 12;
|
||||
/*public override bool Autoload(ref string name, ref string texture)
|
||||
{
|
||||
mod.AddWall("AstralGrassWallUnsafe", this, texture);
|
||||
return base.Autoload(ref name, ref texture);
|
||||
}*/
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DustType = DustID.Grass;
|
||||
AddMapEntry(new Color(54, 72, 9));
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
leafTexture = ModContent.Request<Texture2D>("CalamityMod/Walls/PlantyMushWallLeaves");
|
||||
}
|
||||
}
|
||||
public override void PostDraw(int i, int j, SpriteBatch spriteBatch)
|
||||
{
|
||||
if (i > Main.screenPosition.X / 16 && i < Main.screenPosition.X / 16 + Main.screenWidth / 16 && j > Main.screenPosition.Y / 16 && j < Main.screenPosition.Y / 16 + Main.screenHeight / 16)
|
||||
{
|
||||
Texture2D tex = leafTexture.Value;
|
||||
var rand = new Random(i + (j * 100000));
|
||||
|
||||
float offset = i * j % 6.28f + (float)rand.NextDouble() / 8f;
|
||||
float sin = (float)Math.Sin(Main.GameUpdateCount / 45f + offset);
|
||||
|
||||
spriteBatch.Draw(tex, (new Vector2(i + 0.5f, j + 0.5f) + TileAdj) * 16 + new Vector2(1, 0.5f) * sin * 2.2f - Main.screenPosition,
|
||||
new Rectangle(rand.Next(4) * 26, 0, 24, 24), Lighting.GetColor(i, j), offset + sin * 0.09f, new Vector2(12, 12), 1 + sin / 14f, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public override void RandomUpdate(int i, int j)
|
||||
{
|
||||
if (Main.tile[i, j].LiquidAmount <= 0 && j < Main.maxTilesY - 205)
|
||||
{
|
||||
Main.tile[i, j].LiquidAmount = 255;
|
||||
Main.tile[i, j].Get<LiquidData>().LiquidType = LiquidID.Water;
|
||||
}
|
||||
}
|
||||
|
||||
public override void KillWall(int i, int j, ref bool fail) => fail = true;
|
||||
|
||||
public override bool CanExplode(int i, int j) => false;
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 8.0 KiB |
|
Before Width: | Height: | Size: 714 B After Width: | Height: | Size: 579 B |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 732 B After Width: | Height: | Size: 560 B |
|
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 227 B |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 1.3 KiB |
@@ -289,7 +289,7 @@ namespace CalamityMod.World
|
||||
if (WorldGen.genRand.NextBool(2))
|
||||
{
|
||||
tile.TileType = (ushort)ModContent.TileType<AbyssGravel>();
|
||||
tile.WallType = (ushort)ModContent.WallType<AbyssGravelWall>();
|
||||
tile.WallType = (ushort)ModContent.WallType<PlantyMushWall>();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -307,7 +307,7 @@ namespace CalamityMod.World
|
||||
else
|
||||
{
|
||||
tile.TileType = (ushort)ModContent.TileType<AbyssGravel>();
|
||||
tile.WallType = (ushort)ModContent.WallType<AbyssGravelWall>();
|
||||
tile.WallType = (ushort)ModContent.WallType<PlantyMushWall>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -751,11 +751,35 @@ namespace CalamityMod.World
|
||||
|
||||
if (canPlaceSand)
|
||||
{
|
||||
PlaceSand(X, Y, 5, ModContent.TileType<PolypSand>());
|
||||
PlaceSand(X, Y, 4, ModContent.TileType<PolypSand>());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) =>
|
||||
{
|
||||
for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 20; Y <= origin.Y + verticalRadius + 20; Y++)
|
||||
{
|
||||
if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y > origin.Y))
|
||||
{
|
||||
bool canPlaceGrass = false;
|
||||
|
||||
//place sand clumps on top of exposed limestone
|
||||
if (Main.tile[X, Y].TileType == ModContent.TileType<PolypSand>() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile &&
|
||||
!Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile)
|
||||
{
|
||||
canPlaceGrass = true;
|
||||
}
|
||||
|
||||
if (canPlaceGrass)
|
||||
{
|
||||
PlaceSand(X, Y, 0, ModContent.TileType<ScarletSeaGrassTile>());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//cleanup again
|
||||
ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) =>
|
||||
@@ -1413,7 +1437,7 @@ namespace CalamityMod.World
|
||||
WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 6);
|
||||
}
|
||||
}
|
||||
if (Main.tile[X, Y].TileType == ModContent.TileType<PolypSand>())
|
||||
if (Main.tile[X, Y].TileType == ModContent.TileType<ScarletSeaGrassTile>())
|
||||
{
|
||||
//BranchCoralsOnSand
|
||||
if (WorldGen.genRand.NextBool(15))
|
||||
|
||||