74 lines
3.1 KiB
C#
74 lines
3.1 KiB
C#
using CalamityMod.Items.Placeables.DraedonStructures;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using Terraria;
|
|
using Terraria.Enums;
|
|
using Terraria.ModLoader;
|
|
using Terraria.ObjectData;
|
|
|
|
namespace CalamityMod.Tiles.DraedonStructures
|
|
{
|
|
public class LaboratoryServer : ModTile
|
|
{
|
|
public override void SetDefaults()
|
|
{
|
|
Main.tileLighted[Type] = true;
|
|
Main.tileFrameImportant[Type] = true;
|
|
Main.tileNoAttach[Type] = true;
|
|
Main.tileLavaDeath[Type] = false;
|
|
Main.tileWaterDeath[Type] = false;
|
|
TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX);
|
|
TileObjectData.newTile.Height = 4;
|
|
TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16, 16 };
|
|
TileObjectData.newTile.StyleWrapLimit = 2;
|
|
TileObjectData.newTile.StyleMultiplier = 2;
|
|
TileObjectData.newTile.StyleHorizontal = true;
|
|
TileObjectData.newTile.LavaDeath = false;
|
|
|
|
TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight;
|
|
|
|
TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile);
|
|
TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft;
|
|
TileObjectData.addAlternate(1);
|
|
|
|
TileObjectData.addTile(Type);
|
|
ModTranslation name = CreateMapEntryName();
|
|
name.SetDefault("Server");
|
|
AddMapEntry(new Color(82, 67, 66), name);
|
|
}
|
|
|
|
public override bool CanExplode(int i, int j) => false;
|
|
|
|
public override bool CreateDust(int i, int j, ref int type)
|
|
{
|
|
Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 182);
|
|
return false;
|
|
}
|
|
|
|
public override void NumDust(int i, int j, bool fail, ref int num)
|
|
{
|
|
num = fail ? 1 : 3;
|
|
}
|
|
|
|
public override void KillMultiTile(int i, int j, int frameX, int frameY)
|
|
{
|
|
Item.NewItem(i * 16, j * 16, 32, 32, ModContent.ItemType<LaboratoryServerItem>());
|
|
}
|
|
|
|
public override void PostDraw(int i, int j, SpriteBatch spriteBatch)
|
|
{
|
|
int xFrameOffset = Main.tile[i, j].frameX;
|
|
int yFrameOffset = Main.tile[i, j].frameY;
|
|
Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonStructures/LaboratoryServerGlow");
|
|
Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
|
|
Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest;
|
|
Color drawColour = Color.White;
|
|
Tile trackTile = Main.tile[i, j];
|
|
if (!trackTile.halfBrick() && trackTile.slope() == 0)
|
|
spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
|
|
else if (trackTile.halfBrick())
|
|
spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
|
|
}
|
|
}
|
|
}
|