Sunken Seaness (tiles)
This commit is contained in:
1 parent
f8c8b14db3
commit
34cd10142a
11 files changed
+446
-6
No files matched your search
@@ -0,0 +1,25 @@
|
||||
using CalamityMod.Items.Placeables.Walls;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Placeables
|
||||
{
|
||||
public class MediumSeaPrismCrystal : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Placeables";
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Item.ResearchUnlockCount = 15;
|
||||
ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType<SeaPrism>();
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.DefaultToPlaceableTile(ModContent.TileType<Tiles.SunkenSea.MediumSeaPrismCrystal>());
|
||||
Item.ammo = AmmoID.Sand;
|
||||
Item.notAmmo = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 626 B |
@@ -3857,3 +3857,8 @@ PyreMantleWall: {
|
||||
DisplayName: Pyre Mantle Wall
|
||||
Tooltip: ""
|
||||
}
|
||||
|
||||
MediumSeaPrismCrystal: {
|
||||
DisplayName: Medium Sea Prism Crystal
|
||||
Tooltip: ""
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
using System;
|
||||
using CalamityMod.Items.Placeables;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.Enums;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
namespace CalamityMod.Tiles.SunkenSea
|
||||
{
|
||||
public class MediumSeaPrismCrystal : ModTile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileLighted[Type] = true;
|
||||
Main.tileNoFail[Type] = true;
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
Main.tileObsidianKill[Type] = true;
|
||||
AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch);
|
||||
AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName<PrismShard>());
|
||||
HitSound = SoundID.Item27;
|
||||
DustType = 67;
|
||||
Main.tileSpelunker[Type] = true;
|
||||
MinPick = 55;
|
||||
|
||||
// Allow attaching sign to the ground
|
||||
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2);
|
||||
TileObjectData.newTile.StyleHorizontal = false;
|
||||
TileObjectData.newTile.Origin = new Point16(0, 0);
|
||||
TileObjectData.newTile.CoordinateHeights = new[] { 16, 16 };
|
||||
|
||||
// Allow attaching to a solid object that is to the right of the sign
|
||||
TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile);
|
||||
TileObjectData.newAlternate.Origin = new Point16(0, 0);
|
||||
TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0);
|
||||
TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty;
|
||||
TileObjectData.addAlternate(1);
|
||||
|
||||
// Allow hanging from ceilings
|
||||
TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile);
|
||||
TileObjectData.newAlternate.Origin = new Point16(0, 0);
|
||||
TileObjectData.newAlternate.AnchorLeft = AnchorData.Empty;
|
||||
TileObjectData.newAlternate.AnchorRight = AnchorData.Empty;
|
||||
TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0);
|
||||
TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty;
|
||||
TileObjectData.addAlternate(2);
|
||||
|
||||
// Allow attaching to a solid object that is to the left of the sign
|
||||
TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile);
|
||||
TileObjectData.newAlternate.Origin = new Point16(0, 0);
|
||||
TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0);
|
||||
TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty;
|
||||
TileObjectData.addAlternate(3);
|
||||
TileObjectData.addTile(Type);
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 3;
|
||||
}
|
||||
public override bool CanPlace(int i, int j)
|
||||
{
|
||||
return TileIsCapable(i, j + 1) || TileIsCapable(i, j - 1) || TileIsCapable(i + 1, j) || TileIsCapable(i - 1, j);
|
||||
}
|
||||
public static bool TileIsCapable(Tile tile)
|
||||
{
|
||||
return tile.HasTile && Main.tileSolid[tile.TileType] && !Main.tileSolidTop[tile.TileType] && tile.Slope == 0 && !tile.IsHalfBlock && !tile.IsActuated;
|
||||
}
|
||||
public static bool TileIsCapable(int i, int j)
|
||||
{
|
||||
if (WorldGen.InWorld(i, j, 20))
|
||||
{
|
||||
return TileIsCapable(Main.tile[i, j]);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
public bool ModifyFrames(int i, int j, bool randomize = false)
|
||||
{
|
||||
bool flag = true;
|
||||
if (TileIsCapable(i, j + 1)) //checks if below tile is active
|
||||
{
|
||||
Main.tile[i, j].TileFrameY = 0;
|
||||
}
|
||||
else if (TileIsCapable(i - 1, j)) //checks if left tile is active
|
||||
{
|
||||
Main.tile[i, j].TileFrameY = 54;
|
||||
}
|
||||
else if (TileIsCapable(i + 1, j)) //checks if right tile is active
|
||||
{
|
||||
Main.tile[i, j].TileFrameY = 36;
|
||||
}
|
||||
else if (TileIsCapable(i, j - 1)) //checks if above tile is active
|
||||
{
|
||||
Main.tile[i, j].TileFrameY = 18;
|
||||
}
|
||||
else
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
if (flag && randomize)
|
||||
{
|
||||
Main.tile[i, j].TileFrameX = (short)(WorldGen.genRand.Next(18) * 18);
|
||||
WorldGen.SquareTileFrame(i, j, true);
|
||||
NetMessage.SendTileSquare(-1, i, j, 2, TileChangeType.None);
|
||||
//NetMessage.SendData(17, -1, -1, null, 1, i, j, Type);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
public override void PlaceInWorld(int i, int j, Item item)
|
||||
{
|
||||
ModifyFrames(i, j, true);
|
||||
}
|
||||
|
||||
public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
|
||||
{
|
||||
var tile = Main.tile[i, j];
|
||||
bool lessLightDueToLowWater = tile.LiquidAmount > 50 && tile.LiquidType == LiquidID.Water;
|
||||
|
||||
//Blue
|
||||
Color blue = new Color(67, 187, 204);
|
||||
Color darkviolet = new Color(18, 67, 116);
|
||||
Color value = Color.Lerp(blue, darkviolet, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f);
|
||||
Color value1 = Color.Lerp(blue, darkviolet, (MathF.Sin((j - 10) / 50f + Main.GameUpdateCount * 0.064f + -i / 30f) + 1f) / 2f);
|
||||
r = lessLightDueToLowWater ? 0.27f : 0.36f;
|
||||
g = lessLightDueToLowWater ? 0.405f : 0.54f;
|
||||
b = lessLightDueToLowWater ? 0.405f : 0.54f;
|
||||
r *= (value.R + value1.R) / 300f;
|
||||
g *= (value.G + value1.G) / 300f;
|
||||
b *= (value.B + value1.B) / 300f;
|
||||
}
|
||||
public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak)
|
||||
{
|
||||
ModifyFrames(i, j);
|
||||
return true;
|
||||
}
|
||||
public void ModifyFrames(int i, int j)
|
||||
{
|
||||
Tile tile = Main.tile[i, j];
|
||||
int left = i;
|
||||
int top = j;
|
||||
if (tile.TileFrameX % 36 != 0)
|
||||
{
|
||||
left--;
|
||||
}
|
||||
if (tile.TileFrameY % 36 != 0)
|
||||
{
|
||||
top--;
|
||||
}
|
||||
//bool flag = true;
|
||||
if (TileIsCapable(left, top + 2) && TileIsCapable(left + 1, top + 2)) //checks if below tile is active
|
||||
{
|
||||
if (Main.tile[left, top].TileFrameY != 0)
|
||||
{
|
||||
Main.tile[left, top].TileFrameY = (short)(Main.tile[left, top].TileFrameY % 36);
|
||||
Main.tile[left + 1, top].TileFrameY = (short)(Main.tile[left + 1, top].TileFrameY % 36);
|
||||
Main.tile[left + 1, top + 1].TileFrameY = (short)(Main.tile[left + 1, top + 1].TileFrameY % 36);
|
||||
Main.tile[left, top + 1].TileFrameY = (short)(Main.tile[left, top + 1].TileFrameY % 36);
|
||||
}
|
||||
//else
|
||||
// flag = false;
|
||||
}
|
||||
else if (TileIsCapable(left - 1, top) && TileIsCapable(left - 1, top + 1)) //checks if left tile is active
|
||||
{
|
||||
if (Main.tile[left, top].TileFrameY != 108)
|
||||
{
|
||||
Main.tile[left, top].TileFrameY = (short)(Main.tile[left, top].TileFrameY % 36 + 108);
|
||||
Main.tile[left + 1, top].TileFrameY = (short)(Main.tile[left + 1, top].TileFrameY % 36 + 108);
|
||||
Main.tile[left + 1, top + 1].TileFrameY = (short)(Main.tile[left + 1, top + 1].TileFrameY % 36 + 108);
|
||||
Main.tile[left, top + 1].TileFrameY = (short)(Main.tile[left, top + 1].TileFrameY % 36 + 108);
|
||||
}
|
||||
//else
|
||||
// flag = false;
|
||||
}
|
||||
else if (TileIsCapable(left + 2, top) && TileIsCapable(left + 2, top + 1)) //checks if right tile is active
|
||||
{
|
||||
if (Main.tile[left, top].TileFrameY != 36)
|
||||
{
|
||||
Main.tile[left, top].TileFrameY = (short)(Main.tile[left, top].TileFrameY % 36 + 36);
|
||||
Main.tile[left + 1, top].TileFrameY = (short)(Main.tile[left + 1, top].TileFrameY % 36 + 36);
|
||||
Main.tile[left + 1, top + 1].TileFrameY = (short)(Main.tile[left + 1, top + 1].TileFrameY % 36 + 36);
|
||||
Main.tile[left, top + 1].TileFrameY = (short)(Main.tile[left, top + 1].TileFrameY % 36 + 36);
|
||||
}
|
||||
//else
|
||||
// flag = false;
|
||||
}
|
||||
else if (TileIsCapable(left, top - 1) && TileIsCapable(left + 1, top - 1)) //checks if above tile is active
|
||||
{
|
||||
if (Main.tile[left, top].TileFrameY != 72)
|
||||
{
|
||||
Main.tile[left, top].TileFrameY = (short)(Main.tile[left, top].TileFrameY % 36 + 72);
|
||||
Main.tile[left + 1, top].TileFrameY = (short)(Main.tile[left + 1, top].TileFrameY % 36 + 72);
|
||||
Main.tile[left + 1, top + 1].TileFrameY = (short)(Main.tile[left + 1, top + 1].TileFrameY % 36 + 72);
|
||||
Main.tile[left, top + 1].TileFrameY = (short)(Main.tile[left, top + 1].TileFrameY % 36 + 72);
|
||||
}
|
||||
//else
|
||||
// flag = false;
|
||||
}
|
||||
//else
|
||||
// flag = false;
|
||||
//if (flag)
|
||||
//{
|
||||
//WorldGen.TileFrame(i, j, true);
|
||||
//NetMessage.SendTileSquare(-1, i, j, 4, TileChangeType.None);
|
||||
//NetMessage.SendData(17, -1, -1, null, 1, i, j, Type);
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -18,7 +18,6 @@ namespace CalamityMod.Tiles.SunkenSea
|
||||
|
||||
CalamityUtils.MergeWithGeneral(Type);
|
||||
CalamityUtils.MergeWithDesert(Type);
|
||||
Main.tileShine2[Type] = true;
|
||||
|
||||
TileID.Sets.ChecksForMerge[Type] = true;
|
||||
DustType = 96;
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
using CalamityMod.Systems;
|
||||
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 PolypSand : ModTile
|
||||
{
|
||||
private int extraFrameHeight = 36;
|
||||
private int extraFrameWidth = 90;
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
TileID.Sets.GeneralPlacementTiles[Type] = false;
|
||||
@@ -35,10 +41,200 @@ 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 { }
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
#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, 0.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, 0.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, 0.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, 0.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, 0.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, 0.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, 0.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, 0.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, 0.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, 0.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, 0.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, 0.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, 0.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, 0.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, 0.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
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
@@ -9,13 +9,14 @@ namespace CalamityMod.Tiles.SunkenSea
|
||||
{
|
||||
public class SeaPrism : ModTile
|
||||
{
|
||||
private const short subsheetWidth = 450;
|
||||
private const short subsheetHeight = 198;
|
||||
private const short subsheetWidth = 468;
|
||||
private const short subsheetHeight = 90;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileSolid[Type] = true;
|
||||
Main.tileBlockLight[Type] = true;
|
||||
TileID.Sets.HasSlopeFrames[Type] = true;
|
||||
|
||||
CalamityUtils.MergeWithGeneral(Type);
|
||||
CalamityUtils.MergeWithDesert(Type);
|
||||
@@ -41,8 +42,10 @@ namespace CalamityMod.Tiles.SunkenSea
|
||||
public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset)
|
||||
{
|
||||
// (i & 0b0001) = (i % 2)
|
||||
frameXOffset = (i & 0b0001) * subsheetWidth;
|
||||
frameYOffset = (j & 0b0001) * subsheetHeight;
|
||||
//frameXOffset = (i & 0b0001) * subsheetWidth;
|
||||
//frameYOffset = (j & 0b0001) * subsheetHeight; No idea how to work with this for now I'll use the way I know
|
||||
frameXOffset = i % 8 * subsheetWidth;
|
||||
frameYOffset = j % 8 * subsheetHeight;
|
||||
}
|
||||
public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
|
||||
{
|
||||
@@ -61,7 +64,7 @@ namespace CalamityMod.Tiles.SunkenSea
|
||||
|
||||
public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak)
|
||||
{
|
||||
return TileFramingSystem.BrimstoneFraming(i, j, resetFrame);
|
||||
return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 407 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
Reference in new issue
Block a user