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

◆ AI_061_FishingBobber()

void Terraria.Projectile.AI_061_FishingBobber ( )
inlineprivate

Definition at line 57005 of file Projectile.cs.

57006 {
57007 //IL_0326: Unknown result type (might be due to invalid IL or missing references)
57008 //IL_0345: Unknown result type (might be due to invalid IL or missing references)
57009 //IL_011e: Unknown result type (might be due to invalid IL or missing references)
57010 //IL_0447: Unknown result type (might be due to invalid IL or missing references)
57011 //IL_046b: Unknown result type (might be due to invalid IL or missing references)
57012 //IL_01d7: Unknown result type (might be due to invalid IL or missing references)
57013 //IL_01f6: Unknown result type (might be due to invalid IL or missing references)
57014 //IL_02b9: Unknown result type (might be due to invalid IL or missing references)
57015 //IL_02be: Unknown result type (might be due to invalid IL or missing references)
57016 //IL_02c3: Unknown result type (might be due to invalid IL or missing references)
57017 //IL_052f: Unknown result type (might be due to invalid IL or missing references)
57018 //IL_0543: Unknown result type (might be due to invalid IL or missing references)
57019 //IL_0563: Unknown result type (might be due to invalid IL or missing references)
57020 //IL_05e6: Unknown result type (might be due to invalid IL or missing references)
57021 //IL_05a8: Unknown result type (might be due to invalid IL or missing references)
57022 //IL_05cb: Unknown result type (might be due to invalid IL or missing references)
57023 Player player = Main.player[owner];
57024 bool flag = type >= 986 && type <= 993;
57025 timeLeft = 60;
57026 bool flag2 = false;
57027 if (player.inventory[player.selectedItem].fishingPole == 0 || player.CCed || player.noItems)
57028 {
57029 flag2 = true;
57030 }
57031 else if (player.inventory[player.selectedItem].shoot != type && !flag)
57032 {
57033 flag2 = true;
57034 }
57035 else if (player.pulley)
57036 {
57037 flag2 = true;
57038 }
57039 else if (player.dead)
57040 {
57041 flag2 = true;
57042 }
57043 if (flag2)
57044 {
57045 Kill();
57046 return;
57047 }
57048 if (ai[1] > 0f && localAI[1] != 0f)
57049 {
57050 localAI[1] = 0f;
57051 if (!lavaWet && !honeyWet)
57052 {
57054 }
57055 }
57056 if (ai[0] >= 1f)
57057 {
57058 if (ai[0] == 2f)
57059 {
57060 ai[0] += 1f;
57062 if (!lavaWet && !honeyWet)
57063 {
57065 }
57066 }
57067 if (localAI[0] < 100f)
57068 {
57069 localAI[0] += 1f;
57070 }
57071 if (frameCounter == 0)
57072 {
57073 frameCounter = 1;
57075 }
57076 tileCollide = false;
57077 int num = 10;
57078 Vector2 vector = default(Vector2);
57079 ((Vector2)(ref vector))._002Ector(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
57080 float num3 = player.position.X + (float)(player.width / 2) - vector.X;
57081 float num4 = player.position.Y + (float)(player.height / 2) - vector.Y;
57082 float num5 = (float)Math.Sqrt(num3 * num3 + num4 * num4);
57083 if (num5 > 3000f)
57084 {
57085 Kill();
57086 }
57087 num5 = 15.9f / num5;
57088 num3 *= num5;
57089 num4 *= num5;
57090 velocity.X = (velocity.X * (float)(num - 1) + num3) / (float)num;
57091 velocity.Y = (velocity.Y * (float)(num - 1) + num4) / (float)num;
57092 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
57093 if (Main.myPlayer == owner)
57094 {
57095 Rectangle hitbox = base.Hitbox;
57096 if (((Rectangle)(ref hitbox)).Intersects(player.Hitbox))
57097 {
57098 Kill();
57099 }
57100 }
57101 return;
57102 }
57103 bool flag3 = false;
57104 Vector2 vector2 = default(Vector2);
57105 ((Vector2)(ref vector2))._002Ector(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
57106 float num6 = player.position.X + (float)(player.width / 2) - vector2.X;
57107 float num7 = player.position.Y + (float)(player.height / 2) - vector2.Y;
57108 rotation = (float)Math.Atan2(num7, num6) + 1.57f;
57109 if ((float)Math.Sqrt(num6 * num6 + num7 * num7) > 900f)
57110 {
57111 ai[0] = 1f;
57112 }
57113 if (wet)
57114 {
57115 if (shimmerWet)
57116 {
57117 if (Main.myPlayer == owner)
57118 {
57119 Main.player[owner].AddBuff(353, 60);
57120 }
57121 if (localAI[2] == 0f)
57122 {
57123 localAI[2] = 1f;
57124 SoundEngine.PlaySound(19, (int)Main.player[owner].position.X, (int)Main.player[owner].position.Y, 2);
57125 }
57126 }
57127 rotation = 0f;
57128 velocity.X *= 0.9f;
57129 int num8 = (int)(base.Center.X + (float)((width / 2 + 8) * direction)) / 16;
57130 int num9 = (int)(base.Center.Y / 16f);
57131 _ = position.Y / 16f;
57132 int num10 = (int)((position.Y + (float)height) / 16f);
57133 if (Main.tile[num8, num9] == null)
57134 {
57135 Main.tile[num8, num9] = default(Tile);
57136 }
57137 if (Main.tile[num8, num10] == null)
57138 {
57139 Main.tile[num8, num10] = default(Tile);
57140 }
57141 if (velocity.Y > 0f)
57142 {
57143 velocity.Y *= 0.5f;
57144 }
57145 num8 = (int)(base.Center.X / 16f);
57146 num9 = (int)(base.Center.Y / 16f);
57148 if (base.Center.Y > num2)
57149 {
57150 velocity.Y -= 0.1f;
57151 if (velocity.Y < -8f)
57152 {
57153 velocity.Y = -8f;
57154 }
57155 if (base.Center.Y + velocity.Y < num2)
57156 {
57157 velocity.Y = num2 - base.Center.Y;
57158 }
57159 }
57160 else
57161 {
57162 velocity.Y = num2 - base.Center.Y;
57163 }
57164 if ((double)velocity.Y >= -0.01 && (double)velocity.Y <= 0.01)
57165 {
57166 flag3 = true;
57167 }
57168 }
57169 else
57170 {
57171 if (velocity.Y == 0f)
57172 {
57173 velocity.X *= 0.95f;
57174 }
57175 velocity.X *= 0.98f;
57176 velocity.Y += 0.2f;
57177 if (velocity.Y > 15.9f)
57178 {
57179 velocity.Y = 15.9f;
57180 }
57181 }
57182 if (Main.myPlayer == owner && player.GetFishingConditions().BaitItemType == 2673)
57183 {
57184 player.displayedFishingInfo = Language.GetTextValue("GameUI.FishingWarning");
57185 }
57186 if (ai[1] != 0f)
57187 {
57188 flag3 = true;
57189 }
57190 if (!flag3)
57191 {
57192 return;
57193 }
57194 if (ai[1] == 0f && Main.myPlayer == owner)
57195 {
57196 int finalFishingLevel = player.GetFishingConditions().FinalFishingLevel;
57197 if (Main.rand.Next(300) < finalFishingLevel)
57198 {
57199 localAI[1] += Main.rand.Next(1, 3);
57200 }
57201 localAI[1] += finalFishingLevel / 30;
57202 localAI[1] += Main.rand.Next(1, 3);
57203 if (Main.rand.Next(60) == 0)
57204 {
57205 localAI[1] += 60f;
57206 }
57207 if (localAI[1] > 660f)
57208 {
57209 localAI[1] = 0f;
57210 FishingCheck();
57211 }
57212 }
57213 else if (ai[1] < 0f)
57214 {
57215 if (velocity.Y == 0f || (honeyWet && Math.Abs(velocity.Y) <= 0.01f))
57216 {
57217 velocity.Y = (float)Main.rand.Next(100, 500) * 0.015f;
57218 velocity.X = (float)Main.rand.Next(-100, 101) * 0.015f;
57219 wet = false;
57220 lavaWet = false;
57221 honeyWet = false;
57222 }
57223 ai[1] += Main.rand.Next(1, 5);
57224 if (ai[1] >= 0f)
57225 {
57226 ai[1] = 0f;
57227 localAI[1] = 0f;
57228 netUpdate = true;
57229 }
57230 }
57231 }
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 ...
bool wet
The Entity is currently in water. Projectile: Affects movement speed and some projectiles die when ...
Definition Entity.cs:57
bool honeyWet
Definition Entity.cs:61
bool shimmerWet
Definition Entity.cs:59
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
Vector2 position
The position of this Entity in world coordinates.
Definition Entity.cs:28
int width
The width of this Entity's hitbox, in pixels.
Definition Entity.cs:46
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51
static readonly SoundStyle Item17
Definition SoundID.cs:711
static string GetTextValue(string key)
Retrieves the text value for a specified localization key. The text returned will be for the currentl...
Definition Language.cs:35
Contains methods to access or retrieve localization values. The Localization Guideteaches more about ...
Definition Language.cs:12
float AI_061_FishingBobber_GetWaterLine(int X, int Y)
void AI_061_FishingBobber_DoASplash()
int owner
The index of the player who owns this projectile. In Multiplayer, Clients "own" projectiles that they...
float[] ai
An array with 3 slots used for any sort of data storage, which is occasionally synced to the server....
bool netUpdate
Set manually to true in M:Terraria.ModLoader.ModProjectile.AI once to make it sync its current F:Terr...
float[] localAI
Acts like F:Terraria.Projectile.ai, but does not sync to the server. Many vanilla T:Terraria....
void ReduceRemainingChumsInPool()
int type
The Projectile ID of this projectile. The Projectile ID is a unique number assigned to each Projectil...
bool tileCollide
If true, the projectile will collide with tiles, usually bouncing or killing the tile depending on M:...
int timeLeft
Time in ticks before this projectile will naturally despawn. Each update timeLeft is decreased by 1...
float rotation
Rotation of the projectile. Radians not Degrees. Use T:Microsoft.Xna.Framework.MathHelper if you want...
int frameCounter
Used as a timer to decide when to change F:Terraria.Projectile.frame. Defaults to 0.

References Terraria.DataStructures.PlayerFishingConditions.BaitItemType, Terraria.Player.CCed, Terraria.Player.dead, Terraria.DataStructures.PlayerFishingConditions.FinalFishingLevel, Terraria.Item.fishingPole, Terraria.Player.GetFishingConditions(), Terraria.Localization.Language.GetTextValue(), Terraria.Entity.height, Terraria.Entity.Hitbox, Terraria.Player.inventory, Terraria.ID.SoundID.Item17, Terraria.Main.myPlayer, Terraria.Player.noItems, Terraria.Main.player, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Player.pulley, Terraria.Main.rand, Terraria.Player.selectedItem, Terraria.Item.shoot, Terraria.Main.tile, and Terraria.Entity.width.

+ Here is the call graph for this function: