1 using Microsoft.Xna.Framework;
2 using Microsoft.Xna.Framework.Graphics;
4 using System.Collections.Generic;
38 internal string texture;
42 public int soundType = 0;
46 public int soundStyle = 1;
50 public int dustType = 0;
59 public void AddMapEntry(Color color, LocalizedText name = null) {
60 if (!MapLoader.initialized) {
61 MapEntry entry =
new MapEntry(color, name);
62 if (!MapLoader.wallEntries.Keys.Contains(Type)) {
63 MapLoader.wallEntries[Type] =
new List<MapEntry>();
65 MapLoader.wallEntries[Type].Add(entry);
75 if (
string.IsNullOrEmpty(key)) {
78 return mod.GetOrCreateTranslation(
string.Format(
"Mods.{0}.MapObject.{1}", mod.Name, key));
85 if (!MapLoader.initialized) {
86 MapEntry entry =
new MapEntry(color, name);
87 if (!MapLoader.wallEntries.Keys.Contains(Type)) {
88 MapLoader.wallEntries[Type] =
new List<MapEntry>();
90 MapLoader.wallEntries[Type].Add(entry);
97 public void AddMapEntry(Color color, LocalizedText name, Func<string, int, int, string> nameFunc) {
98 if (!MapLoader.initialized) {
99 MapEntry entry =
new MapEntry(color, name, nameFunc);
100 if (!MapLoader.wallEntries.Keys.Contains(Type)) {
101 MapLoader.wallEntries[Type] =
new List<MapEntry>();
103 MapLoader.wallEntries[Type].Add(entry);
111 if (!MapLoader.initialized) {
112 MapEntry entry =
new MapEntry(color, name, nameFunc);
113 if (!MapLoader.wallEntries.Keys.Contains(Type)) {
114 MapLoader.wallEntries[Type] =
new List<MapEntry>();
116 MapLoader.wallEntries[Type].Add(entry);
123 public virtual bool Autoload(ref
string name, ref
string texture) {
124 return mod.Properties.Autoload;
143 public virtual void NumDust(
int i,
int j,
bool fail, ref
int num) {
157 public virtual bool Drop(
int i,
int j, ref
int type) {
165 public virtual void KillWall(
int i,
int j, ref
bool fail) {
185 public virtual void ModifyLight(
int i,
int j, ref
float r, ref
float g, ref
float b) {
197 public virtual void AnimateWall(ref byte frame, ref byte frameCounter) {
203 public virtual bool PreDraw(
int i,
int j, SpriteBatch spriteBatch) {
210 public virtual void PostDraw(
int i,
int j, SpriteBatch spriteBatch) {
virtual void KillWall(int i, int j, ref bool fail)
Allows you to determine what happens when the tile at the given coordinates is killed or hit with a h...
virtual void PlaceInWorld(int i, int j, Item item)
Called after this wall is placed in the world by way of the item provided.
ModTranslation CreateMapEntryName(string key=null)
Creates a ModTranslation object that you can use in AddMapEntry.
virtual void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
Allows you to determine how much light this wall emits. This can also let you light up the block in f...
void AddMapEntry(Color color, LocalizedText name=null)
Adds an entry to the minimap for this wall with the given color and display name. This should be call...
virtual bool CanExplode(int i, int j)
Whether or not the wall at the given coordinates can be killed by an explosion (ie. bombs). Returns true by default; return false to stop an explosion from destroying it.
virtual void RandomUpdate(int i, int j)
Called whenever the world randomly decides to update the tile containing this wall in a given tick...
virtual bool KillSound(int i, int j)
Allows you to customize which sound you want to play when the wall at the given coordinates is hit...
virtual bool CreateDust(int i, int j, ref int type)
Allows you to modify the default type of dust created when the wall at the given coordinates is hit...
virtual bool Autoload(ref string name, ref string texture)
Allows you to modify the name and texture path of this wall when it is autoloaded. Return true to autoload this wall. When a wall is autoloaded, that means you do not need to manually call Mod.AddWall. By default returns the mod's autoload property.
virtual bool PreDraw(int i, int j, SpriteBatch spriteBatch)
Allows you to draw things behind the wall at the given coordinates. Return false to stop the game fro...
This class represents a type of wall that can be added by a mod. Only one instance of this class will...
virtual void NumDust(int i, int j, bool fail, ref int num)
Allows you to change how many dust particles are created when the wall at the given coordinates is hi...
void AddMapEntry(Color color, ModTranslation name, Func< string, int, int, string > nameFunc)
Adds an entry to the minimap for this wall with the given color, default display name, and display name function. The parameters for the function are the default display name, x-coordinate, and y-coordinate. This should be called in SetDefaults.
virtual ushort GetMapOption(int i, int j)
Allows you to choose which minimap entry the wall at the given coordinates will use. 0 is the first entry added by AddMapEntry, 1 is the second entry, etc. Returns 0 by default.
virtual void PostDraw(int i, int j, SpriteBatch spriteBatch)
Allows you to draw things in front of the wall at the given coordinates.
Mod is an abstract class that you will override. It serves as a central place from which the mod's co...
void AddMapEntry(Color color, ModTranslation name)
Adds an entry to the minimap for this wall with the given color and display name. This should be call...
void AddMapEntry(Color color, LocalizedText name, Func< string, int, int, string > nameFunc)
Adds an entry to the minimap for this wall with the given color, default display name, and display name function. The parameters for the function are the default display name, x-coordinate, and y-coordinate. This should be called in SetDefaults.
virtual void SetDefaults()
Allows you to set the properties of this wall. Many properties are stored as arrays throughout Terrar...
virtual void AnimateWall(ref byte frame, ref byte frameCounter)
Allows you to animate your wall. Use frameCounter to keep track of how long the current frame has bee...
virtual bool Drop(int i, int j, ref int type)
Allows you to customize which items the wall at the given coordinates drops. Return false to stop the...