tModLoader Dust Problem

RoboticTea

Terrarian
I'm trying to create a custom dust but for some reason it's not affected by gravity anyone knows why ?

using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;

namespace Nope.Dusts
{
public class DustCustom : ModDust
{
public override void OnSpawn(Dust dust)
{
dust.color = new Color(255, 50, 255);
dust.alpha = 1;
dust.scale = 1.13f;
dust.velocity *= 0.1f;
dust.noGravity = false;
dust.noLight = false;
}

public override bool Update(Dust dust)
{
dust.position += dust.velocity;
dust.rotation += dust.velocity.X * 0.0f;
dust.scale *= 0.99f;
float light = 0.1f * dust.scale;
Lighting.AddLight(dust.position, light, light, light);
if (dust.scale < 0.1f)
{
dust.active = false;
}
return false;
}
}
}
 
Since you are returning false in Update, the vanilla gravity code won't run.

I'd suggest just adding gravity yourself: dust.velocity.Y += .1f;
 
Add this to your code (before the dust.position line):
Code:
dust.velocity.Y * 0.5f;
dust.velocity.Y += 1f;
Because when gravity doesn't work (which I think might have something to do with returning false), just simulate it yourself.

EDIT: Ninja'd.
 
Thanks the worked :3 just one last question how do you make it not go through blocks ?
(you people are amazing thank you)
 
Back
Top Bottom