Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ SpawnFartCloud()

static void Terraria.DelegateMethods.Minecart.SpawnFartCloud ( Player Player,
Vector2 Position,
int Width,
int Height,
bool useDelay = true )
inlinestatic

Definition at line 193 of file DelegateMethods.cs.

194 {
195 if (useDelay)
196 {
197 if (Player.fartKartCloudDelay > 0)
198 {
199 return;
200 }
201 Player.fartKartCloudDelay = 20;
202 }
203 float num = 10f;
204 float y = -4f;
205 Vector2 vector = Position + new Vector2(Width / 2 - 18, Height - 16);
206 Vector2 vector2 = Player.velocity * 0.1f;
207 if (vector2.Length() > 2f)
208 {
209 vector2 = vector2.SafeNormalize(Vector2.Zero) * 2f;
210 }
211 int num2 = Gore.NewGore(vector + new Vector2(0f, y), Vector2.Zero, Main.rand.Next(435, 438));
212 Main.gore[num2].velocity *= 0.2f;
213 Main.gore[num2].velocity += vector2;
214 Main.gore[num2].velocity.Y *= 0.75f;
215 num2 = Gore.NewGore(vector + new Vector2(0f - num, y), Vector2.Zero, Main.rand.Next(435, 438));
216 Main.gore[num2].velocity *= 0.2f;
217 Main.gore[num2].velocity += vector2;
218 Main.gore[num2].velocity.Y *= 0.75f;
219 num2 = Gore.NewGore(vector + new Vector2(num, y), Vector2.Zero, Main.rand.Next(435, 438));
220 Main.gore[num2].velocity *= 0.2f;
221 Main.gore[num2].velocity += vector2;
222 Main.gore[num2].velocity.Y *= 0.75f;
223 if (Player.mount.Active && Player.mount.Type == 53)
224 {
225 Vector2 vector3 = Position + new Vector2(Width / 2, Height + 10);
226 float num3 = 30f;
227 float num4 = -16f;
228 for (int i = 0; i < 15; i++)
229 {
230 Dust dust = Dust.NewDustPerfect(vector3 + new Vector2(0f - num3 + num3 * 2f * Main.rand.NextFloat(), num4 * Main.rand.NextFloat()), 107, Vector2.Zero, 100, Color.Lerp(new Color(64, 220, 96), Color.White, Main.rand.NextFloat() * 0.3f), 0.6f);
231 dust.velocity *= (float)Main.rand.Next(15, 51) * 0.01f;
232 dust.velocity.X *= (float)Main.rand.Next(25, 101) * 0.01f;
233 dust.velocity.Y -= (float)Main.rand.Next(15, 31) * 0.1f;
234 dust.velocity += vector2;
235 dust.velocity.Y *= 0.75f;
236 dust.fadeIn = 0.2f + Main.rand.NextFloat() * 0.1f;
237 dust.noGravity = Main.rand.Next(3) == 0;
238 dust.noLightEmittence = true;
239 }
240 }
241 }
static Color Lerp(Color value1, Color value2, float amount)
Definition Color.cs:491

References Terraria.Mount.Active, Terraria.Player.fartKartCloudDelay, Terraria.Main.gore, Microsoft.Xna.Framework.Vector2.Length(), Microsoft.Xna.Framework.Color.Lerp(), Terraria.Player.mount, Terraria.Dust.NewDustPerfect(), Terraria.Gore.NewGore(), Terraria.Main.rand, Terraria.Mount.Type, Microsoft.Xna.Framework.Color.White, and Microsoft.Xna.Framework.Vector2.Zero.

Referenced by Terraria.DelegateMethods.Minecart.BumperSoundFart(), Terraria.DelegateMethods.Minecart.JumpingSoundFart(), and Terraria.DelegateMethods.Minecart.LandingSoundFart().