Terraria ModLoader  0.10.1.5
A framework for Terraria mods
Terraria.ModLoader.ModDust Class Reference

This class represents a type of dust that is added by a mod. Only one instance of this class will ever exist for each type of dust you add. More...

+ Collaboration diagram for Terraria.ModLoader.ModDust:

Public Member Functions

virtual bool Autoload (ref string name, ref string texture)
 Allows you to automatically add a type of dust without having to use Mod.AddDust. By default returns the mod's Autoload property. Return true to automatically add the dust. Name will be initialized to the dust's class name, and Texture will be initialized to the dust's namespace and overriding class name with periods replaced with slashes. The name parameter determines the internal name and the texture parameter determines the texture path. More...
 
virtual Color GetAlpha (Dust dust, Color lightColor)
 Allows you to override the color this dust will draw in. Return null to draw it in the normal light color; returns null by default. Note that the dust.noLight field makes the dust ignore lighting and draw in full brightness, and can be set in OnSpawn instead of having to return Color.White here. More...
 
virtual bool MidUpdate (Dust dust)
 Allows you to add behavior to this dust on top of the default dust behavior. Return true if you're applying your own behavior; return false to make the dust slow down by itself. Normally you will want this to return true. More...
 
virtual void OnSpawn (Dust dust)
 Allows you to modify a dust's fields when it is created. More...
 
virtual void SetDefaults ()
 Allows you to set this ModDust's updateType field and modify the Terraria.GameContent.ChildSafety.SafeDust array. More...
 
virtual bool Update (Dust dust)
 Allows you to customize how you want this type of dust to behave. Return true to allow for vanilla dust updating to also take place; will return true by default. Normally you will want this to return false. More...
 

Static Public Member Functions

static ModDust GetDust (int type)
 Gets the ModDust instance with the given type. Returns null if no ModDust with the given type exists. More...
 

Public Attributes

int updateType = -1
 Allows you to choose a type of dust for this type of dust to copy the behavior of. Defaults to -1, which means that no behavior is copied. More...
 

Properties

Mod mod [get, set]
 The mod that added this type of dust. More...
 
string Name [get, set]
 The internal name of this type of dust. More...
 
Texture2D Texture [get, set]
 The sprite sheet that this type of dust uses. Normally a sprite sheet will consist of a vertical alignment of three 10 x 10 pixel squares, each one containing a possible look for the dust. More...
 
int Type [get, set]
 The ID of this type of dust. More...
 

Static Private Attributes

static int nextDust = DustID.Count
 

Detailed Description

This class represents a type of dust that is added by a mod. Only one instance of this class will ever exist for each type of dust you add.

Definition at line 13 of file ModDust.cs.

Member Function Documentation

virtual bool Terraria.ModLoader.ModDust.Autoload ( ref string  name,
ref string  texture 
)
virtual

Allows you to automatically add a type of dust without having to use Mod.AddDust. By default returns the mod's Autoload property. Return true to automatically add the dust. Name will be initialized to the dust's class name, and Texture will be initialized to the dust's namespace and overriding class name with periods replaced with slashes. The name parameter determines the internal name and the texture parameter determines the texture path.

Definition at line 118 of file ModDust.cs.

Referenced by Terraria.ModLoader.Mod.AutoloadDust().

118  {
119  return mod.Properties.Autoload;
120  }
Mod mod
The mod that added this type of dust.
Definition: ModDust.cs:39
ModProperties Properties
Definition: Mod.cs:49
bool Autoload
Whether or not this mod will autoload content by default. Autoloading content means you do not need t...

+ Here is the caller graph for this function:

virtual Color Terraria.ModLoader.ModDust.GetAlpha ( Dust  dust,
Color  lightColor 
)
virtual

Allows you to override the color this dust will draw in. Return null to draw it in the normal light color; returns null by default. Note that the dust.noLight field makes the dust ignore lighting and draw in full brightness, and can be set in OnSpawn instead of having to return Color.White here.

Definition at line 164 of file ModDust.cs.

164  {
165  return null;
166  }
static ModDust Terraria.ModLoader.ModDust.GetDust ( int  type)
static

Gets the ModDust instance with the given type. Returns null if no ModDust with the given type exists.

Definition at line 57 of file ModDust.cs.

References Terraria.ModLoader.ModDust.OnSpawn(), and Terraria.ModLoader.ModDust.updateType.

57  {
58  return type >= DustID.Count && type < DustCount ? dusts[type - DustID.Count] : null;
59  }

+ Here is the call graph for this function:

virtual bool Terraria.ModLoader.ModDust.MidUpdate ( Dust  dust)
virtual

Allows you to add behavior to this dust on top of the default dust behavior. Return true if you're applying your own behavior; return false to make the dust slow down by itself. Normally you will want this to return true.

Definition at line 147 of file ModDust.cs.

147  {
148  return false;
149  }
virtual void Terraria.ModLoader.ModDust.OnSpawn ( Dust  dust)
virtual

Allows you to modify a dust's fields when it is created.

Definition at line 131 of file ModDust.cs.

Referenced by Terraria.ModLoader.ModDust.GetDust().

131  {
132  }

+ Here is the caller graph for this function:

virtual void Terraria.ModLoader.ModDust.SetDefaults ( )
virtual

Allows you to set this ModDust's updateType field and modify the Terraria.GameContent.ChildSafety.SafeDust array.

Definition at line 125 of file ModDust.cs.

Referenced by Terraria.ModLoader.Mod.LoadEffect().

125  {
126  }

+ Here is the caller graph for this function:

virtual bool Terraria.ModLoader.ModDust.Update ( Dust  dust)
virtual

Allows you to customize how you want this type of dust to behave. Return true to allow for vanilla dust updating to also take place; will return true by default. Normally you will want this to return false.

Definition at line 140 of file ModDust.cs.

140  {
141  return true;
142  }

Member Data Documentation

int Terraria.ModLoader.ModDust.nextDust = DustID.Count
staticprivate

Definition at line 15 of file ModDust.cs.

int Terraria.ModLoader.ModDust.updateType = -1

Allows you to choose a type of dust for this type of dust to copy the behavior of. Defaults to -1, which means that no behavior is copied.

Definition at line 18 of file ModDust.cs.

Referenced by Terraria.ModLoader.ModDust.GetDust().

Property Documentation

Mod Terraria.ModLoader.ModDust.mod
getset

The mod that added this type of dust.

Definition at line 39 of file ModDust.cs.

Referenced by Terraria.ModLoader.Mod.AddDust(), and Terraria.ModLoader.Mod.AutoloadDust().

string Terraria.ModLoader.ModDust.Name
getset

The internal name of this type of dust.

Definition at line 23 of file ModDust.cs.

Referenced by Terraria.ModLoader.Mod.AddDust().

Texture2D Terraria.ModLoader.ModDust.Texture
getset

The sprite sheet that this type of dust uses. Normally a sprite sheet will consist of a vertical alignment of three 10 x 10 pixel squares, each one containing a possible look for the dust.

Definition at line 31 of file ModDust.cs.

Referenced by Terraria.ModLoader.Mod.AddDust().

int Terraria.ModLoader.ModDust.Type
getset

The ID of this type of dust.

Definition at line 47 of file ModDust.cs.

Referenced by Terraria.ModLoader.Mod.AddDust().