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

◆ OnStarted()

override void Terraria.ModLoader.FartInAJarJump.OnStarted ( Player player,
ref bool playSound )
inlinevirtual

This hook runs when the player uses this jump via pressing the jump key
Effects that should appear when the jump starts can be spawned here.
For example, the Cloud in a Bottle's initial puff of smoke is spawned here.

To make the jump re-usable, set P:Terraria.DataStructures.ExtraJumpState.Available to true

Parameters
playerThe player performing the jump
playSoundWhether the poof sound should play. Set this parameter to false if you want to play a different sound.

Reimplemented from Terraria.ModLoader.ExtraJump.

Definition at line 14 of file FartInAJarJump.cs.

15 {
16 //IL_001f: Unknown result type (might be due to invalid IL or missing references)
17 //IL_005c: Unknown result type (might be due to invalid IL or missing references)
18 //IL_0096: Unknown result type (might be due to invalid IL or missing references)
19 //IL_009c: Unknown result type (might be due to invalid IL or missing references)
20 //IL_0158: Unknown result type (might be due to invalid IL or missing references)
21 //IL_017f: Unknown result type (might be due to invalid IL or missing references)
22 //IL_023c: Unknown result type (might be due to invalid IL or missing references)
23 //IL_0263: Unknown result type (might be due to invalid IL or missing references)
24 //IL_0328: Unknown result type (might be due to invalid IL or missing references)
25 //IL_034f: Unknown result type (might be due to invalid IL or missing references)
26 int num7 = player.height;
27 if (player.gravDir == -1f)
28 {
29 num7 = 0;
30 }
31 playSound = false;
32 SoundEngine.PlaySound(in SoundID.Item16, player.position);
33 for (int i = 0; i < 10; i++)
34 {
35 int num8 = Dust.NewDust(new Vector2(player.position.X - 34f, player.position.Y + (float)num7 - 16f), 102, 32, 188, (0f - player.velocity.X) * 0.5f, player.velocity.Y * 0.5f, 100, default(Color), 1.5f);
36 Main.dust[num8].velocity.X = Main.dust[num8].velocity.X * 0.5f - player.velocity.X * 0.1f;
37 Main.dust[num8].velocity.Y = Main.dust[num8].velocity.Y * 0.5f - player.velocity.Y * 0.3f;
38 }
39 int num9 = Gore.NewGore(new Vector2(player.position.X + (float)(player.width / 2) - 16f, player.position.Y + (float)num7 - 16f), new Vector2(0f - player.velocity.X, 0f - player.velocity.Y), Main.rand.Next(435, 438));
40 Main.gore[num9].velocity.X = Main.gore[num9].velocity.X * 0.1f - player.velocity.X * 0.1f;
41 Main.gore[num9].velocity.Y = Main.gore[num9].velocity.Y * 0.1f - player.velocity.Y * 0.05f;
42 num9 = Gore.NewGore(new Vector2(player.position.X - 36f, player.position.Y + (float)num7 - 16f), new Vector2(0f - player.velocity.X, 0f - player.velocity.Y), Main.rand.Next(435, 438));
43 Main.gore[num9].velocity.X = Main.gore[num9].velocity.X * 0.1f - player.velocity.X * 0.1f;
44 Main.gore[num9].velocity.Y = Main.gore[num9].velocity.Y * 0.1f - player.velocity.Y * 0.05f;
45 num9 = Gore.NewGore(new Vector2(player.position.X + (float)player.width + 4f, player.position.Y + (float)num7 - 16f), new Vector2(0f - player.velocity.X, 0f - player.velocity.Y), Main.rand.Next(435, 438));
46 Main.gore[num9].velocity.X = Main.gore[num9].velocity.X * 0.1f - player.velocity.X * 0.1f;
47 Main.gore[num9].velocity.Y = Main.gore[num9].velocity.Y * 0.1f - player.velocity.Y * 0.05f;
48 }
static SlotId PlaySound(in SoundStyle? style, Vector2? position=null, SoundUpdateCallback? updateCallback=null)
Attempts to play a sound style with the provided sound style (if it's not null), and returns a valid ...
static readonly SoundStyle Item16
Definition SoundID.cs:709

References Terraria.Main.dust, Terraria.Main.gore, Terraria.Player.gravDir, Terraria.Entity.height, Terraria.ID.SoundID.Item16, Terraria.Dust.NewDust(), Terraria.Gore.NewGore(), Terraria.Audio.SoundEngine.PlaySound(), Terraria.Entity.position, Terraria.Main.rand, Terraria.Entity.velocity, and Terraria.Entity.width.

+ Here is the call graph for this function: