tModLoader v0.11.8.9
A mod to make and play Terraria mods
Terraria.ModLoader.WallLoader Class Reference

This serves as the central class from which wall-related functions are supported and carried out. More...

+ Collaboration diagram for Terraria.ModLoader.WallLoader:

Static Public Member Functions

static void AnimateWalls ()
 
static bool CanExplode (int i, int j, int type)
 
static bool CreateDust (int i, int j, int type, ref int dustType)
 
static bool Drop (int i, int j, int type, ref int dropType)
 
static ModWall GetWall (int type)
 Gets the ModWall instance with the given type. If no ModWall with the given type exists, returns null. More...
 
static bool KillSound (int i, int j, int type)
 
static void KillWall (int i, int j, int type, ref bool fail)
 
static void ModifyLight (int i, int j, int type, ref float r, ref float g, ref float b)
 
static void NumDust (int i, int j, int type, bool fail, ref int numDust)
 
static void PlaceInWorld (int i, int j, Item item)
 
static void PostDraw (int i, int j, int type, SpriteBatch spriteBatch)
 
static bool PreDraw (int i, int j, int type, SpriteBatch spriteBatch)
 
static void RandomUpdate (int i, int j, int type)
 

Properties

static int WallCount [get]
 

Private Member Functions

delegate bool DelegateCreateDust (int i, int j, int type, ref int dustType)
 
delegate bool DelegateDrop (int i, int j, int type, ref int dropType)
 
delegate void DelegateKillWall (int i, int j, int type, ref bool fail)
 
delegate void DelegateModifyLight (int i, int j, int type, ref float r, ref float g, ref float b)
 
delegate void DelegateNumDust (int i, int j, int type, bool fail, ref int num)
 

Static Private Member Functions

static void Resize2DArray< T > (ref T[,] array, int newSize)
 

Static Private Attributes

static Func< int, int, int, bool >[] HookCanExplode
 
static DelegateCreateDust[] HookCreateDust
 
static DelegateDrop[] HookDrop
 
static Func< int, int, int, bool >[] HookKillSound
 
static DelegateKillWall[] HookKillWall
 
static DelegateModifyLight[] HookModifyLight
 
static DelegateNumDust[] HookNumDust
 
static Action< int, int, int, Item >[] HookPlaceInWorld
 
static Action< int, int, int, SpriteBatch >[] HookPostDraw
 
static Func< int, int, int, SpriteBatch, bool >[] HookPreDraw
 
static Action< int, int, int >[] HookRandomUpdate
 
static bool loaded = false
 
static int nextWall = WallID.Count
 

Detailed Description

This serves as the central class from which wall-related functions are supported and carried out.

Definition at line 13 of file WallLoader.cs.

Member Function Documentation

◆ AnimateWalls()

static void Terraria.ModLoader.WallLoader.AnimateWalls ( )
static

Definition at line 224 of file WallLoader.cs.

224 {
225 if (loaded) {
226 for (int i = 0; i < walls.Count; i++) {
227 ModWall modWall = walls[i];
228 modWall.AnimateWall(ref Main.wallFrame[modWall.Type], ref Main.wallFrameCounter[modWall.Type]);
229 }
230 }
231 }

References Terraria.ModLoader.ModWall.AnimateWall(), Terraria.ModLoader.WallLoader.loaded, and Terraria.ModLoader.ModWall.Type.

+ Here is the call graph for this function:

◆ CanExplode()

static bool Terraria.ModLoader.WallLoader.CanExplode ( int  i,
int  j,
int  type 
)
static

Definition at line 196 of file WallLoader.cs.

196 {
197 foreach (var hook in HookCanExplode) {
198 if (!hook(i, j, type)) {
199 return false;
200 }
201 }
202 return GetWall(type)?.CanExplode(i, j) ?? true;
203 }
virtual bool CanExplode(int i, int j)
Whether or not the wall at the given coordinates can be killed by an explosion (ie....
Definition: ModWall.cs:171
static Func< int, int, int, bool >[] HookCanExplode
Definition: WallLoader.cs:29
static ModWall GetWall(int type)
Gets the ModWall instance with the given type. If no ModWall with the given type exists,...
Definition: WallLoader.cs:50

References Terraria.ModLoader.ModWall.CanExplode(), Terraria.ModLoader.WallLoader.GetWall(), and Terraria.ModLoader.WallLoader.HookCanExplode.

+ Here is the call graph for this function:

◆ CreateDust()

static bool Terraria.ModLoader.WallLoader.CreateDust ( int  i,
int  j,
int  type,
ref int  dustType 
)
static

Definition at line 168 of file WallLoader.cs.

168 {
169 foreach (var hook in HookCreateDust) {
170 if (!hook(i, j, type, ref dustType)) {
171 return false;
172 }
173 }
174 return GetWall(type)?.CreateDust(i, j, ref dustType) ?? true;
175 }
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....
Definition: ModWall.cs:149
static DelegateCreateDust[] HookCreateDust
Definition: WallLoader.cs:24

References Terraria.ModLoader.ModWall.CreateDust(), Terraria.ModLoader.WallLoader.GetWall(), and Terraria.ModLoader.WallLoader.HookCreateDust.

+ Here is the call graph for this function:

◆ DelegateCreateDust()

delegate bool Terraria.ModLoader.WallLoader.DelegateCreateDust ( int  i,
int  j,
int  type,
ref int  dustType 
)
private

◆ DelegateDrop()

delegate bool Terraria.ModLoader.WallLoader.DelegateDrop ( int  i,
int  j,
int  type,
ref int  dropType 
)
private

◆ DelegateKillWall()

delegate void Terraria.ModLoader.WallLoader.DelegateKillWall ( int  i,
int  j,
int  type,
ref bool  fail 
)
private

◆ DelegateModifyLight()

delegate void Terraria.ModLoader.WallLoader.DelegateModifyLight ( int  i,
int  j,
int  type,
ref float  r,
ref float  g,
ref float  b 
)
private

◆ DelegateNumDust()

delegate void Terraria.ModLoader.WallLoader.DelegateNumDust ( int  i,
int  j,
int  type,
bool  fail,
ref int  num 
)
private

◆ Drop()

static bool Terraria.ModLoader.WallLoader.Drop ( int  i,
int  j,
int  type,
ref int  dropType 
)
static

Definition at line 178 of file WallLoader.cs.

178 {
179 foreach (var hook in HookDrop) {
180 if (!hook(i, j, type, ref dropType)) {
181 return false;
182 }
183 }
184 return GetWall(type)?.Drop(i, j, ref dropType) ?? true;
185 }
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...
Definition: ModWall.cs:157
static DelegateDrop[] HookDrop
Definition: WallLoader.cs:26

References Terraria.ModLoader.ModWall.Drop(), Terraria.ModLoader.WallLoader.GetWall(), and Terraria.ModLoader.WallLoader.HookDrop.

+ Here is the call graph for this function:

◆ GetWall()

static ModWall Terraria.ModLoader.WallLoader.GetWall ( int  type)
static

◆ KillSound()

static bool Terraria.ModLoader.WallLoader.KillSound ( int  i,
int  j,
int  type 
)
static

Definition at line 141 of file WallLoader.cs.

141 {
142 foreach (var hook in HookKillSound) {
143 if (!hook(i, j, type)) {
144 return false;
145 }
146 }
147 ModWall modWall = GetWall(type);
148 if (modWall != null) {
149 if (!modWall.KillSound(i, j)) {
150 return false;
151 }
152 Main.PlaySound(modWall.soundType, i * 16, j * 16, modWall.soundStyle);
153 return false;
154 }
155 return true;
156 }
static Func< int, int, int, bool >[] HookKillSound
Definition: WallLoader.cs:20

References Terraria.ModLoader.WallLoader.GetWall(), Terraria.ModLoader.WallLoader.HookKillSound, Terraria.ModLoader.ModWall.KillSound(), Terraria.ModLoader.ModWall.soundStyle, and Terraria.ModLoader.ModWall.soundType.

+ Here is the call graph for this function:

◆ KillWall()

static void Terraria.ModLoader.WallLoader.KillWall ( int  i,
int  j,
int  type,
ref bool  fail 
)
static

Definition at line 188 of file WallLoader.cs.

188 {
189 GetWall(type)?.KillWall(i, j, ref fail);
190
191 foreach (var hook in HookKillWall) {
192 hook(i, j, type, ref fail);
193 }
194 }
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...
Definition: ModWall.cs:165
static DelegateKillWall[] HookKillWall
Definition: WallLoader.cs:28

References Terraria.ModLoader.WallLoader.GetWall(), Terraria.ModLoader.WallLoader.HookKillWall, and Terraria.ModLoader.ModWall.KillWall().

+ Here is the call graph for this function:

◆ ModifyLight()

static void Terraria.ModLoader.WallLoader.ModifyLight ( int  i,
int  j,
int  type,
ref float  r,
ref float  g,
ref float  b 
)
static

Definition at line 206 of file WallLoader.cs.

206 {
207 GetWall(type)?.ModifyLight(i, j, ref r, ref g, ref b);
208
209 foreach (var hook in HookModifyLight) {
210 hook(i, j, type, ref r, ref g, ref b);
211 }
212 }
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...
Definition: ModWall.cs:185
static DelegateModifyLight[] HookModifyLight
Definition: WallLoader.cs:31

References Terraria.ModLoader.WallLoader.GetWall(), Terraria.ModLoader.WallLoader.HookModifyLight, and Terraria.ModLoader.ModWall.ModifyLight().

+ Here is the call graph for this function:

◆ NumDust()

static void Terraria.ModLoader.WallLoader.NumDust ( int  i,
int  j,
int  type,
bool  fail,
ref int  numDust 
)
static

Definition at line 159 of file WallLoader.cs.

159 {
160 GetWall(type)?.NumDust(i, j, fail, ref numDust);
161
162 foreach (var hook in HookNumDust) {
163 hook(i, j, type, fail, ref numDust);
164 }
165 }
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...
Definition: ModWall.cs:143
static DelegateNumDust[] HookNumDust
Definition: WallLoader.cs:22

References Terraria.ModLoader.WallLoader.GetWall(), Terraria.ModLoader.WallLoader.HookNumDust, and Terraria.ModLoader.ModWall.NumDust().

+ Here is the call graph for this function:

◆ PlaceInWorld()

static void Terraria.ModLoader.WallLoader.PlaceInWorld ( int  i,
int  j,
Item  item 
)
static

Definition at line 253 of file WallLoader.cs.

253 {
254 int type = item.createWall;
255 if (type < 0)
256 return;
257
258 foreach (var hook in HookPlaceInWorld) {
259 hook(i, j, type, item);
260 }
261
262 GetWall(type)?.PlaceInWorld(i, j, item);
263 }
virtual void PlaceInWorld(int i, int j, Item item)
Called after this wall is placed in the world by way of the item provided.
Definition: ModWall.cs:216
static Action< int, int, int, Item >[] HookPlaceInWorld
Definition: WallLoader.cs:35

References Terraria.ModLoader.WallLoader.GetWall(), Terraria.ModLoader.WallLoader.HookPlaceInWorld, and Terraria.ModLoader.ModWall.PlaceInWorld().

+ Here is the call graph for this function:

◆ PostDraw()

static void Terraria.ModLoader.WallLoader.PostDraw ( int  i,
int  j,
int  type,
SpriteBatch  spriteBatch 
)
static

Definition at line 245 of file WallLoader.cs.

245 {
246 GetWall(type)?.PostDraw(i, j, spriteBatch);
247
248 foreach (var hook in HookPostDraw) {
249 hook(i, j, type, spriteBatch);
250 }
251 }
virtual void PostDraw(int i, int j, SpriteBatch spriteBatch)
Allows you to draw things in front of the wall at the given coordinates.
Definition: ModWall.cs:210
static Action< int, int, int, SpriteBatch >[] HookPostDraw
Definition: WallLoader.cs:34

References Terraria.ModLoader.WallLoader.GetWall(), Terraria.ModLoader.WallLoader.HookPostDraw, and Terraria.ModLoader.ModWall.PostDraw().

+ Here is the call graph for this function:

◆ PreDraw()

static bool Terraria.ModLoader.WallLoader.PreDraw ( int  i,
int  j,
int  type,
SpriteBatch  spriteBatch 
)
static

Definition at line 235 of file WallLoader.cs.

235 {
236 foreach (var hook in HookPreDraw) {
237 if (!hook(i, j, type, spriteBatch)) {
238 return false;
239 }
240 }
241 return GetWall(type)?.PreDraw(i, j, spriteBatch) ?? true;
242 }
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...
Definition: ModWall.cs:203
static Func< int, int, int, SpriteBatch, bool >[] HookPreDraw
Definition: WallLoader.cs:33

References Terraria.ModLoader.WallLoader.GetWall(), Terraria.ModLoader.WallLoader.HookPreDraw, and Terraria.ModLoader.ModWall.PreDraw().

+ Here is the call graph for this function:

◆ RandomUpdate()

static void Terraria.ModLoader.WallLoader.RandomUpdate ( int  i,
int  j,
int  type 
)
static

Definition at line 216 of file WallLoader.cs.

216 {
217 GetWall(type)?.RandomUpdate(i, j);
218
219 foreach (var hook in HookRandomUpdate) {
220 hook(i, j, type);
221 }
222 }
virtual void RandomUpdate(int i, int j)
Called whenever the world randomly decides to update the tile containing this wall in a given tick....
Definition: ModWall.cs:191
static Action< int, int, int >[] HookRandomUpdate
Definition: WallLoader.cs:32

References Terraria.ModLoader.WallLoader.GetWall(), Terraria.ModLoader.WallLoader.HookRandomUpdate, and Terraria.ModLoader.ModWall.RandomUpdate().

+ Here is the call graph for this function:

◆ Resize2DArray< T >()

static void Terraria.ModLoader.WallLoader.Resize2DArray< T > ( ref T  array[,],
int  newSize 
)
staticprivate

Definition at line 54 of file WallLoader.cs.

54 {
55 int dim1 = array.GetLength(0);
56 int dim2 = array.GetLength(1);
57 T[,] newArray = new T[newSize, dim2];
58 for (int j = 0; j < newSize && j < dim1; j++) {
59 for (int k = 0; k < dim2; k++) {
60 newArray[j, k] = array[j, k];
61 }
62 }
63 array = newArray;
64 }

Member Data Documentation

◆ HookCanExplode

Func<int, int, int, bool> [] Terraria.ModLoader.WallLoader.HookCanExplode
staticprivate

Definition at line 29 of file WallLoader.cs.

Referenced by Terraria.ModLoader.WallLoader.CanExplode().

◆ HookCreateDust

DelegateCreateDust [] Terraria.ModLoader.WallLoader.HookCreateDust
staticprivate

Definition at line 24 of file WallLoader.cs.

Referenced by Terraria.ModLoader.WallLoader.CreateDust().

◆ HookDrop

DelegateDrop [] Terraria.ModLoader.WallLoader.HookDrop
staticprivate

Definition at line 26 of file WallLoader.cs.

Referenced by Terraria.ModLoader.WallLoader.Drop().

◆ HookKillSound

Func<int, int, int, bool> [] Terraria.ModLoader.WallLoader.HookKillSound
staticprivate

Definition at line 20 of file WallLoader.cs.

Referenced by Terraria.ModLoader.WallLoader.KillSound().

◆ HookKillWall

DelegateKillWall [] Terraria.ModLoader.WallLoader.HookKillWall
staticprivate

Definition at line 28 of file WallLoader.cs.

Referenced by Terraria.ModLoader.WallLoader.KillWall().

◆ HookModifyLight

DelegateModifyLight [] Terraria.ModLoader.WallLoader.HookModifyLight
staticprivate

Definition at line 31 of file WallLoader.cs.

Referenced by Terraria.ModLoader.WallLoader.ModifyLight().

◆ HookNumDust

DelegateNumDust [] Terraria.ModLoader.WallLoader.HookNumDust
staticprivate

Definition at line 22 of file WallLoader.cs.

Referenced by Terraria.ModLoader.WallLoader.NumDust().

◆ HookPlaceInWorld

Action<int, int, int, Item> [] Terraria.ModLoader.WallLoader.HookPlaceInWorld
staticprivate

Definition at line 35 of file WallLoader.cs.

Referenced by Terraria.ModLoader.WallLoader.PlaceInWorld().

◆ HookPostDraw

Action<int, int, int, SpriteBatch> [] Terraria.ModLoader.WallLoader.HookPostDraw
staticprivate

Definition at line 34 of file WallLoader.cs.

Referenced by Terraria.ModLoader.WallLoader.PostDraw().

◆ HookPreDraw

Func<int, int, int, SpriteBatch, bool> [] Terraria.ModLoader.WallLoader.HookPreDraw
staticprivate

Definition at line 33 of file WallLoader.cs.

Referenced by Terraria.ModLoader.WallLoader.PreDraw().

◆ HookRandomUpdate

Action<int, int, int> [] Terraria.ModLoader.WallLoader.HookRandomUpdate
staticprivate

Definition at line 32 of file WallLoader.cs.

Referenced by Terraria.ModLoader.WallLoader.RandomUpdate().

◆ loaded

bool Terraria.ModLoader.WallLoader.loaded = false
staticprivate

Definition at line 18 of file WallLoader.cs.

Referenced by Terraria.ModLoader.WallLoader.AnimateWalls().

◆ nextWall

int Terraria.ModLoader.WallLoader.nextWall = WallID.Count
staticprivate

Definition at line 15 of file WallLoader.cs.

Property Documentation

◆ WallCount

int Terraria.ModLoader.WallLoader.WallCount
staticget

Definition at line 45 of file WallLoader.cs.

Referenced by Terraria.ModLoader.WallLoader.GetWall().