-Added many entries into "Localization/en-US/Tiles.hjson" **Note: "Localization/en-US/Mods.CalamityMod.hjson" currently has duplicates for some Map Entries. -Added Utilities/LocalizationUtils.cs , contains a few helper methods for getting Localized Text instances. -Updated many Tiles to utilize existing localization values. **Note: Some tiles may now have altered names, due to their Tile names not matching with their item names previously. (Most notably, Altar of the Accursed) -Updated Pylons to re-use the text entry from their Item
76 lines
2.8 KiB
C#
76 lines
2.8 KiB
C#
using CalamityMod.Dusts;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using Terraria;
|
|
using Terraria.DataStructures;
|
|
using Terraria.Enums;
|
|
using Terraria.GameContent.Metadata;
|
|
using Terraria.ID;
|
|
using Terraria.Localization;
|
|
using Terraria.ModLoader;
|
|
using Terraria.ObjectData;
|
|
|
|
namespace CalamityMod.Tiles.Astral
|
|
{
|
|
public class AstralTreeSapling : ModTile
|
|
{
|
|
//All of this code is taken directly from Example Mod.
|
|
//Cheers Blushie
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
Main.tileFrameImportant[Type] = true;
|
|
Main.tileNoAttach[Type] = true;
|
|
Main.tileLavaDeath[Type] = true;
|
|
TileID.Sets.CommonSapling[Type] = true;
|
|
TileID.Sets.TreeSapling[Type] = true;
|
|
TileID.Sets.SwaysInWindBasic[Type] = true;
|
|
TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]);
|
|
TileObjectData.newTile.Width = 1;
|
|
TileObjectData.newTile.Height = 2;
|
|
TileObjectData.newTile.Origin = new Point16(0, 1);
|
|
TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0);
|
|
TileObjectData.newTile.UsesCustomCanPlace = true;
|
|
TileObjectData.newTile.CoordinateHeights = new[] { 16, 18 };
|
|
TileObjectData.newTile.CoordinateWidth = 16;
|
|
TileObjectData.newTile.CoordinatePadding = 2;
|
|
TileObjectData.newTile.AnchorValidTiles = new[] { ModContent.TileType<AstralGrass>() };
|
|
TileObjectData.newTile.StyleHorizontal = true;
|
|
TileObjectData.newTile.DrawFlipHorizontal = true;
|
|
TileObjectData.newTile.WaterPlacement = LiquidPlacement.NotAllowed;
|
|
TileObjectData.newTile.LavaDeath = true;
|
|
TileObjectData.newTile.RandomStyleRange = 3;
|
|
TileObjectData.addTile(Type);
|
|
AddMapEntry(new Color(200, 200, 200), Language.GetText("MapObject.Sapling"));
|
|
DustType = ModContent.DustType<AstralBasic>();
|
|
AdjTiles = new int[] { TileID.Saplings };
|
|
}
|
|
|
|
public override void NumDust(int i, int j, bool fail, ref int num)
|
|
{
|
|
num = fail ? 1 : 3;
|
|
}
|
|
|
|
public override void RandomUpdate(int i, int j)
|
|
{
|
|
if (WorldGen.genRand.Next(20) == 0)
|
|
{
|
|
bool isPlayerNear = WorldGen.PlayerLOS(i, j);
|
|
bool success = WorldGen.GrowTree(i, j);
|
|
if (success && isPlayerNear)
|
|
{
|
|
WorldGen.TreeGrowFXCheck(i, j);
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void SetSpriteEffects(int i, int j, ref SpriteEffects effects)
|
|
{
|
|
if (i % 2 == 1)
|
|
{
|
|
effects = SpriteEffects.FlipHorizontally;
|
|
}
|
|
}
|
|
}
|
|
}
|