Okay, I don't know if anyone is reading this in 2020 but I was trying to figure this out for like 2 days... I finally got something that I'm satisfied with. To be completely honest, about 75% is copied and pasted from various mods or other forums, so I don't understand all of it. There also may be a WAYYYY easier way to do this, so don't just read this and accept it as law. I am always looking to learn, so if anyone can do this better, please show me!
The override of the Update(Dust dust) method will occur somewhere in the extended ModDust file. (Most likely "YourDustNameHere.cs", and beneath the overridden OnSpawn.)
The comments below are all my own basic explanations of what each line does. Keep in mind the Update method is called continuously why dust particles are active, and then stops once dust.active is set to a value of false.
Notice the two lines in the middle without comments. These were a little more complicated, and have to do with the brightness and color of the emitted light. The first of those two lines creates a float value called 'light' that gets smaller with each call of the Update method because the scale of the dust particle is also getting smaller with every call. The second light tells the light to be added at the position of the dust particle, and then gives the instructions for the color and brightness. Each of the three parenthesis group includes an rgb value multiplied by 0.01 (in this case, 255, 255, 255), a float constant (0.5), and the diminishing 'light' value from the previous line. The rgb value obviously determines the color, but the larger the number is, the brighter it is. (Hence my multiplying each value by 0.01 and then 0.5.) Feel free to mess around with these numbers however you want! Hint: a little goes a long way, try using 255, 255, and 255 directly in the code instead of 2.55, 2.55, 2.55 and see what happens.
I hope this helps!
public override bool Update(Dust dust)
{
dust.position += dust.velocity; // Moves the dust particle
dust.rotation += dust.velocity.X * 0.15f; // Rotates the dust particle so it doesn't move in the same direction every time
dust.scale *= 0.95f; // Makes the dust particle smaller by scaling it down to 95%
float light = 0.35f * dust.scale;
Lighting.AddLight(dust.position, (2.55f * 0.5f * light), (2.55f * 0.5f * light), (2.55f * 0.5f * light));
if (dust.scale < 0.5f) // checks to see if the size of the dust particle is smaller than specified scale limit (0.5f) in this case
{
dust.active = false; // if size of dust particle IS smaller than specified scale limit, the dust will disappear
}
return false;
}