Astral Grass Wall consistency changes

Natural walls no longer drop when broken
Player placed walls are now valid for housing

Also some texture caching stuff for other walls
This commit is contained in:
GinYuH committed 2024-08-21 19:04:50 -07:00
1 parent e4a232687e
commit ddcc4e7fc1
13 files changed
+74 -12

No files matched your search

+1 -1
View File
@@ -14,7 +14,7 @@ namespace CalamityMod.Items.Placeables.Walls
public override void SetDefaults()
{
Item.createWall = ModContent.WallType<WallTiles.AstralGrassWall>();
Item.createWall = ModContent.WallType<WallTiles.AstralGrassWallSafe>();
Item.useStyle = ItemUseStyleID.Swing;
Item.useTurn = true;
Item.useAnimation = 15;
+2 -1
View File
@@ -1,6 +1,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
@@ -25,7 +26,7 @@ namespace CalamityMod.Walls
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = ModContent.Request<Texture2D>("CalamityMod/Walls/AshenSlabWall").Value;
Texture2D sprite = TextureAssets.Wall[Type].Value;
Color lightColor = GetWallColour(i, j);
Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
zero -= new Vector2(8, 8);
+9 -1
View File
@@ -2,6 +2,7 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -9,6 +10,8 @@ namespace CalamityMod.Walls
{
public class AstralGrassWall : 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)
{
@@ -24,12 +27,17 @@ namespace CalamityMod.Walls
WallID.Sets.Conversion.Grass[Type] = true;
AddMapEntry(new Color(60, 48, 64));
if (!Main.dedServ)
{
leafTexture = ModContent.Request<Texture2D>("CalamityMod/Walls/AstralGrassWallLeaves");
}
}
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;
Texture2D tex = leafTexture.Value;
var rand = new Random(i + (j * 100000));
float offset = i * j % 6.28f + (float)rand.NextDouble() / 8f;
+44
View File
@@ -0,0 +1,44 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Walls
{
public class AstralGrassWallSafe : ModWall
{
public override string Texture => "CalamityMod/Walls/AstralGrassWall";
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 void SetStaticDefaults()
{
// TODO -- Change this dust to be one more befitting Astral Grass.
DustType = DustID.Shadowflame;
WallID.Sets.Conversion.Grass[Type] = true;
Main.wallHouse[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 = AstralGrassWall.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 NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
}
}
+2 -1
View File
@@ -2,6 +2,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.ModLoader;
namespace CalamityMod.Walls
@@ -24,7 +25,7 @@ namespace CalamityMod.Walls
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = ModContent.Request<Texture2D>("CalamityMod/Walls/AstralMonolithWall").Value;
Texture2D sprite = TextureAssets.Wall[Type].Value;
Color lightColor = GetWallColour(i, j);
Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
zero -= new Vector2(8, 8);
+2 -1
View File
@@ -1,6 +1,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
@@ -30,7 +31,7 @@ namespace CalamityMod.Walls
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = ModContent.Request<Texture2D>("CalamityMod/Walls/BrimstoneSlabWall").Value;
Texture2D sprite = TextureAssets.Wall[Type].Value;
Color lightColor = GetWallColour(i, j);
Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
zero -= new Vector2(8, 8);
+2 -1
View File
@@ -1,6 +1,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
@@ -25,7 +26,7 @@ namespace CalamityMod.Walls
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = ModContent.Request<Texture2D>("CalamityMod/Walls/CryonicBrickWall").Value;
Texture2D sprite = TextureAssets.Wall[Type].Value;
Color lightColor = GetWallColour(i, j);
Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
zero -= new Vector2(8, 8);
+2 -1
View File
@@ -1,6 +1,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
@@ -26,7 +27,7 @@ namespace CalamityMod.Walls
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = ModContent.Request<Texture2D>("CalamityMod/Walls/FloralWall").Value;
Texture2D sprite = TextureAssets.Wall[Type].Value;
Color lightColor = GetWallColour(i, j);
Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
zero -= new Vector2(8, 8);
+2 -1
View File
@@ -1,6 +1,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
@@ -26,7 +27,7 @@ namespace CalamityMod.Walls
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = ModContent.Request<Texture2D>("CalamityMod/Walls/PerennialBrickWall").Value;
Texture2D sprite = TextureAssets.Wall[Type].Value;
Color lightColor = GetWallColour(i, j);
Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
zero -= new Vector2(8, 8);
+2 -1
View File
@@ -2,6 +2,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.ModLoader;
namespace CalamityMod.Walls
@@ -25,7 +26,7 @@ namespace CalamityMod.Walls
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = ModContent.Request<Texture2D>("CalamityMod/Walls/ProfanedSlabWall").Value;
Texture2D sprite = TextureAssets.Wall[Type].Value;
Color lightColor = GetWallColour(i, j);
Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
zero -= new Vector2(8, 8);
+2 -1
View File
@@ -2,6 +2,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
@@ -27,7 +28,7 @@ namespace CalamityMod.Walls
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = ModContent.Request<Texture2D>("CalamityMod/Walls/RunicProfanedBrickWall").Value;
Texture2D sprite = TextureAssets.Wall[Type].Value;
Color lightColor = GetWallColour(i, j);
Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
zero -= new Vector2(8, 8);
+2 -1
View File
@@ -2,6 +2,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.ModLoader;
namespace CalamityMod.Walls
@@ -19,7 +20,7 @@ namespace CalamityMod.Walls
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = ModContent.Request<Texture2D>("CalamityMod/Walls/ScorchedBoneWall").Value;
Texture2D sprite = TextureAssets.Wall[Type].Value;
Color lightColor = GetWallColour(i, j);
Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
zero -= new Vector2(8, 8);
+2 -1
View File
@@ -1,6 +1,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
@@ -25,7 +26,7 @@ namespace CalamityMod.Walls
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = ModContent.Request<Texture2D>("CalamityMod/Walls/VoidstoneSlabWall").Value;
Texture2D sprite = TextureAssets.Wall[Type].Value;
Color lightColor = GetWallColour(i, j);
Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
zero -= new Vector2(8, 8);