Files
CalamityModPublic/Walls/AstralGrassWall.cs
T
Altixal 4c24f6ddbf Tile map localization complete
- Consistent cage map colors to vanilla
- Consistent map entry with Thank You painting
- Removed map entry names from vines
- Removed map entry names from some common decorative blocks
- Cleaned up the other furnitures and item drops
2023-04-23 04:47:05 +07:00

46 lines
2.0 KiB
C#

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Walls
{
public class AstralGrassWall : ModWall
{
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()
{
// TODO -- Change this dust to be one more befitting Astral Grass.
DustType = DustID.Shadowflame;
WallID.Sets.Conversion.Grass[Type] = true;
AddMapEntry(new Color(60, 48, 64));
}
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 = ModContent.Request<Texture2D>("CalamityMod/Walls/AstralGrassWallLeaves").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 NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
}
}