Files
CalamityModPublic/Tiles/Ores/ChaoticOre.cs
T
Andrew Marheine bdbfa05877 1 - All the changelog stuff on main.
2 - Certain ores can no longer be bombed because they had old bomb resist code that makes no sense anymore.
3 - Bumbledoge mount nerf.
4 - Terra Arrows have had their aistyle removed so they no longer behave like normal arrows.
2020-10-28 20:36:52 -05:00

119 lines
4.3 KiB
C#

using CalamityMod.Projectiles.Environment;
using CalamityMod.Tiles.Abyss;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Tiles.Ores
{
public class ChaoticOre : ModTile
{
public override void SetDefaults()
{
Main.tileLighted[Type] = true;
Main.tileSolid[Type] = true;
Main.tileBlockLight[Type] = true;
Main.tileValue[Type] = 850;
CalamityUtils.MergeWithGeneral(Type);
CalamityUtils.MergeWithAbyss(Type);
dustType = 105;
drop = ModContent.ItemType<Items.Placeables.Ores.ChaoticOre>();
ModTranslation name = CreateMapEntryName();
name.SetDefault("Scoria Ore");
AddMapEntry(new Color(255, 0, 0), name);
mineResist = 4f;
minPick = 210;
soundType = SoundID.Tink;
}
public override void NearbyEffects(int i, int j, bool closer)
{
if (!closer && j < Main.maxTilesY - 205)
{
if (Main.tile[i, j].liquid <= 0)
{
Main.tile[i, j].liquid = 255;
Main.tile[i, j].lava(false);
}
}
if (Main.gamePaused)
{
return;
}
if (closer && Main.rand.NextBool(300))
{
int tileLocationY = j + 1;
if (Main.tile[i, tileLocationY] != null)
{
if (!Main.tile[i, tileLocationY].active())
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
Projectile.NewProjectile((float)(i * 16 + 16), (float)(tileLocationY * 16 + 16), 0f, 0.1f, ModContent.ProjectileType<LavaChunk>(), 25, 2f, Main.myPlayer, 0f, 0f);
}
}
}
}
}
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 ModifyLight(int i, int j, ref float r, ref float g, ref float b)
{
r = 0.04f;
g = 0.00f;
b = 0.00f;
}
public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak)
{
TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType<AbyssGravel>(), false, false, false, false, resetFrame);
return false;
}
public override void PostDraw(int i, int j, SpriteBatch spriteBatch)
{
int xPos = Main.tile[i, j].frameX;
int yPos = Main.tile[i, j].frameY;
Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/Ores/ChaoticOreGlow");
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, new Color(50, 50, 50, 50));
Tile trackTile = Main.tile[i, j];
double num6 = Main.time * 0.08;
if (!trackTile.halfBrick() && trackTile.slope() == 0)
{
Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
}
else if (trackTile.halfBrick())
{
Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
}
}
private Color GetDrawColour(int i, int j, Color colour)
{
int colType = Main.tile[i, j].color();
Color paintCol = WorldGen.paintColor(colType);
if (colType >= 13 && colType <= 24)
{
colour.R = (byte)(paintCol.R / 255f * colour.R);
colour.G = (byte)(paintCol.G / 255f * colour.G);
colour.B = (byte)(paintCol.B / 255f * colour.B);
}
return colour;
}
}
}