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

◆ DoSpawnDust()

void Terraria.Mount.DoSpawnDust ( Player mountedPlayer,
bool isDismounting )
inlineprivate

Definition at line 5342 of file Mount.cs.

5343 {
5344 if (Main.netMode == 2)
5345 {
5346 return;
5347 }
5348 if (_type == 52)
5349 {
5350 for (int i = 0; i < 100; i++)
5351 {
5352 _ = _data.spawnDust;
5353 Dust dust = Dust.NewDustDirect(new Vector2(mountedPlayer.position.X - 20f, mountedPlayer.position.Y), mountedPlayer.width + 40, mountedPlayer.height, 267, 0f, 0f, 60, new Color(130, 60, 255, 70));
5354 dust.scale += (float)Main.rand.Next(-10, 21) * 0.01f;
5355 dust.noGravity = true;
5356 dust.velocity += mountedPlayer.velocity * 0.8f;
5357 dust.velocity *= Main.rand.NextFloat();
5358 dust.velocity.Y += 2f * Main.rand.NextFloatDirection();
5359 dust.noLight = true;
5360 if (Main.rand.Next(3) == 0)
5361 {
5362 Dust dust2 = Dust.CloneDust(dust);
5363 dust2.color = Color.White;
5364 dust2.scale *= 0.5f;
5365 dust2.alpha = 0;
5366 }
5367 }
5368 return;
5369 }
5371 if (_type == 23)
5372 {
5373 newColor = new Color(255, 255, 0, 255);
5374 }
5375 for (int j = 0; j < 100; j++)
5376 {
5377 if (MountID.Sets.Cart[_type])
5378 {
5379 if (j % 10 == 0)
5380 {
5381 int type = Main.rand.Next(61, 64);
5382 int num = Gore.NewGore(new Vector2(mountedPlayer.position.X - 20f, mountedPlayer.position.Y), Vector2.Zero, type);
5383 Main.gore[num].alpha = 100;
5384 Main.gore[num].velocity = Vector2.Transform(new Vector2(1f, 0f), Matrix.CreateRotationZ((float)(Main.rand.NextDouble() * 6.2831854820251465)));
5385 }
5386 continue;
5387 }
5388 int type2 = _data.spawnDust;
5389 float scale = 1f;
5390 int alpha = 0;
5391 if (_type == 40 || _type == 41 || _type == 42)
5392 {
5393 type2 = ((Main.rand.Next(2) != 0) ? 16 : 31);
5394 scale = 0.9f;
5395 alpha = 50;
5396 if (_type == 42)
5397 {
5398 type2 = 31;
5399 }
5400 if (_type == 41)
5401 {
5402 type2 = 16;
5403 }
5404 }
5405 int num2 = Dust.NewDust(new Vector2(mountedPlayer.position.X - 20f, mountedPlayer.position.Y), mountedPlayer.width + 40, mountedPlayer.height, type2, 0f, 0f, alpha, newColor, scale);
5406 Main.dust[num2].scale += (float)Main.rand.Next(-10, 21) * 0.01f;
5408 {
5409 Main.dust[num2].noGravity = true;
5410 }
5411 else if (Main.rand.Next(2) == 0)
5412 {
5413 Main.dust[num2].scale *= 1.3f;
5414 Main.dust[num2].noGravity = true;
5415 }
5416 else
5417 {
5418 Main.dust[num2].velocity *= 0.5f;
5419 }
5420 Main.dust[num2].velocity += mountedPlayer.velocity * 0.8f;
5421 if (_type == 40 || _type == 41 || _type == 42)
5422 {
5423 Main.dust[num2].velocity *= Main.rand.NextFloat();
5424 }
5425 }
5426 if (_type == 40 || _type == 41 || _type == 42)
5427 {
5428 for (int k = 0; k < 5; k++)
5429 {
5430 int type3 = Main.rand.Next(61, 64);
5431 if (_type == 41 || (_type == 40 && Main.rand.Next(2) == 0))
5432 {
5433 type3 = Main.rand.Next(11, 14);
5434 }
5435 int num3 = Gore.NewGore(new Vector2(mountedPlayer.position.X + (float)(mountedPlayer.direction * 8), mountedPlayer.position.Y + 20f), Vector2.Zero, type3);
5436 Main.gore[num3].alpha = 100;
5437 Main.gore[num3].velocity = Vector2.Transform(new Vector2(1f, 0f), Matrix.CreateRotationZ((float)(Main.rand.NextDouble() * 6.2831854820251465))) * 1.4f;
5438 }
5439 }
5440 if (_type == 23)
5441 {
5442 for (int l = 0; l < 4; l++)
5443 {
5444 int type4 = Main.rand.Next(61, 64);
5445 int num4 = Gore.NewGore(new Vector2(mountedPlayer.position.X - 20f, mountedPlayer.position.Y), Vector2.Zero, type4);
5446 Main.gore[num4].alpha = 100;
5447 Main.gore[num4].velocity = Vector2.Transform(new Vector2(1f, 0f), Matrix.CreateRotationZ((float)(Main.rand.NextDouble() * 6.2831854820251465)));
5448 }
5449 }
5450 }
static bool[] Cart
Definition MountID.cs:9
MountData _data
Definition Mount.cs:287
static Color Transparent
Definition Color.cs:76
static Matrix CreateRotationZ(float radians)
Definition Matrix.cs:746
static Vector2 Transform(Vector2 position, Matrix matrix)
Definition Vector2.cs:317

References Terraria.Mount._data, Terraria.Mount._type, Terraria.ID.MountID.Sets.Cart, Terraria.Dust.CloneDust(), Microsoft.Xna.Framework.Graphics.Color, Microsoft.Xna.Framework.Matrix.CreateRotationZ(), Terraria.Main.dust, Terraria.Main.gore, Terraria.Main.netMode, Terraria.Dust.NewDust(), Terraria.Dust.NewDustDirect(), Terraria.Gore.NewGore(), Terraria.Main.rand, Terraria.Mount.MountData.spawnDust, Terraria.Mount.MountData.spawnDustNoGravity, Microsoft.Xna.Framework.Vector2.Transform(), Microsoft.Xna.Framework.Color.Transparent, System.type, Microsoft.Xna.Framework.Graphics.Vector2, Microsoft.Xna.Framework.Color.White, and Microsoft.Xna.Framework.Vector2.Zero.

Referenced by Terraria.Mount.Dismount(), and Terraria.Mount.SetMount().