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

◆ AI_010()

void Terraria.Projectile.AI_010 ( )
inlineprivate

Definition at line 62973 of file Projectile.cs.

62974 {
62975 //IL_00d5: Unknown result type (might be due to invalid IL or missing references)
62976 //IL_0101: Unknown result type (might be due to invalid IL or missing references)
62977 //IL_0107: Unknown result type (might be due to invalid IL or missing references)
62978 //IL_0045: Unknown result type (might be due to invalid IL or missing references)
62979 //IL_0071: Unknown result type (might be due to invalid IL or missing references)
62980 //IL_0077: Unknown result type (might be due to invalid IL or missing references)
62981 //IL_0254: Unknown result type (might be due to invalid IL or missing references)
62982 //IL_0280: Unknown result type (might be due to invalid IL or missing references)
62983 //IL_0286: Unknown result type (might be due to invalid IL or missing references)
62984 //IL_029c: Unknown result type (might be due to invalid IL or missing references)
62985 //IL_02a6: Unknown result type (might be due to invalid IL or missing references)
62986 //IL_02ab: Unknown result type (might be due to invalid IL or missing references)
62987 //IL_02ef: Unknown result type (might be due to invalid IL or missing references)
62988 //IL_030f: Unknown result type (might be due to invalid IL or missing references)
62989 //IL_0315: Unknown result type (might be due to invalid IL or missing references)
62990 //IL_037c: Unknown result type (might be due to invalid IL or missing references)
62991 //IL_039c: Unknown result type (might be due to invalid IL or missing references)
62992 //IL_03a2: Unknown result type (might be due to invalid IL or missing references)
62993 //IL_01a8: Unknown result type (might be due to invalid IL or missing references)
62994 //IL_01d3: Unknown result type (might be due to invalid IL or missing references)
62995 //IL_01d9: Unknown result type (might be due to invalid IL or missing references)
62996 //IL_01fd: Unknown result type (might be due to invalid IL or missing references)
62997 //IL_0203: Unknown result type (might be due to invalid IL or missing references)
62998 //IL_020d: Unknown result type (might be due to invalid IL or missing references)
62999 //IL_0212: Unknown result type (might be due to invalid IL or missing references)
63000 //IL_0217: Unknown result type (might be due to invalid IL or missing references)
63001 //IL_085b: Unknown result type (might be due to invalid IL or missing references)
63002 //IL_0876: Unknown result type (might be due to invalid IL or missing references)
63003 //IL_0409: Unknown result type (might be due to invalid IL or missing references)
63004 //IL_0429: Unknown result type (might be due to invalid IL or missing references)
63005 //IL_042f: Unknown result type (might be due to invalid IL or missing references)
63006 //IL_08b0: Unknown result type (might be due to invalid IL or missing references)
63007 //IL_048c: Unknown result type (might be due to invalid IL or missing references)
63008 //IL_04ac: Unknown result type (might be due to invalid IL or missing references)
63009 //IL_04b2: Unknown result type (might be due to invalid IL or missing references)
63010 //IL_0512: Unknown result type (might be due to invalid IL or missing references)
63011 //IL_0535: Unknown result type (might be due to invalid IL or missing references)
63012 //IL_053b: Unknown result type (might be due to invalid IL or missing references)
63013 //IL_05a8: Unknown result type (might be due to invalid IL or missing references)
63014 //IL_05c8: Unknown result type (might be due to invalid IL or missing references)
63015 //IL_05ce: Unknown result type (might be due to invalid IL or missing references)
63016 //IL_06e1: Unknown result type (might be due to invalid IL or missing references)
63017 //IL_0700: Unknown result type (might be due to invalid IL or missing references)
63018 //IL_0706: Unknown result type (might be due to invalid IL or missing references)
63019 //IL_062d: Unknown result type (might be due to invalid IL or missing references)
63020 //IL_065d: Unknown result type (might be due to invalid IL or missing references)
63021 //IL_0663: Unknown result type (might be due to invalid IL or missing references)
63022 //IL_0688: Unknown result type (might be due to invalid IL or missing references)
63023 //IL_0692: Unknown result type (might be due to invalid IL or missing references)
63024 //IL_0698: Unknown result type (might be due to invalid IL or missing references)
63025 //IL_06a2: Unknown result type (might be due to invalid IL or missing references)
63026 //IL_06a7: Unknown result type (might be due to invalid IL or missing references)
63027 //IL_06ac: Unknown result type (might be due to invalid IL or missing references)
63028 if (type == 31 && ai[0] != 2f)
63029 {
63030 if (Main.rand.Next(2) == 0)
63031 {
63032 int num = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 32, 0f, velocity.Y / 2f);
63033 Main.dust[num].velocity.X *= 0.4f;
63034 }
63035 }
63036 else if (type == 39)
63037 {
63038 if (Main.rand.Next(2) == 0)
63039 {
63040 int num9 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 38, 0f, velocity.Y / 2f);
63041 Main.dust[num9].velocity.X *= 0.4f;
63042 }
63043 }
63044 else if (type >= 411 && type <= 414)
63045 {
63046 if (Main.rand.Next(3) == 0)
63047 {
63048 int num10 = 9;
63049 if (type == 412 || type == 414)
63050 {
63051 num10 = 11;
63052 }
63053 if (type == 413)
63054 {
63055 num10 = 19;
63056 }
63057 int num11 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, num10, 0f, velocity.Y / 2f);
63058 Main.dust[num11].noGravity = true;
63059 Dust obj = Main.dust[num11];
63060 obj.velocity -= velocity * 0.5f;
63061 }
63062 }
63063 else if (type == 40)
63064 {
63065 if (Main.rand.Next(2) == 0)
63066 {
63067 int num12 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 36, 0f, velocity.Y / 2f);
63068 Dust obj2 = Main.dust[num12];
63069 obj2.velocity *= 0.4f;
63070 }
63071 }
63072 else if (type == 42 || type == 31)
63073 {
63074 if (Main.rand.Next(2) == 0)
63075 {
63076 int num13 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 32);
63077 Main.dust[num13].velocity.X *= 0.4f;
63078 }
63079 }
63080 else if (type == 56 || type == 65)
63081 {
63082 if (Main.rand.Next(2) == 0)
63083 {
63084 int num14 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 14);
63085 Main.dust[num14].velocity.X *= 0.4f;
63086 }
63087 }
63088 else if (type == 67 || type == 68)
63089 {
63090 if (Main.rand.Next(2) == 0)
63091 {
63092 int num15 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 51);
63093 Main.dust[num15].velocity.X *= 0.4f;
63094 }
63095 }
63096 else if (type == 71)
63097 {
63098 if (Main.rand.Next(2) == 0)
63099 {
63100 int num16 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 53);
63101 Main.dust[num16].velocity.X *= 0.4f;
63102 }
63103 }
63104 else if (type == 179)
63105 {
63106 if (Main.rand.Next(2) == 0)
63107 {
63108 int num2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 149);
63109 Main.dust[num2].velocity.X *= 0.4f;
63110 }
63111 }
63112 else if (type == 241 || type == 354)
63113 {
63114 if (Main.rand.Next(2) == 0)
63115 {
63116 int num3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 36);
63117 Main.dust[num3].velocity.X *= 0.4f;
63118 }
63119 }
63120 else if (type >= 736 && type <= 738)
63121 {
63122 if (Main.rand.Next(40) == 0)
63123 {
63124 int num4 = Dust.NewDust(position, width, height, type - 736 + 275);
63125 if (num4 >= 0)
63126 {
63127 Main.dust[num4].velocity = Main.dust[num4].velocity * 0.5f + velocity * 0.5f;
63128 }
63129 }
63130 }
63131 else if (type != 109 && Main.rand.Next(20) == 0)
63132 {
63133 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 0);
63134 }
63135 if (type >= 736 && type <= 738)
63136 {
63137 if (localAI[0] == 0f)
63138 {
63139 frame = Main.rand.Next(3);
63140 scale = 1f - (float)Main.rand.Next(30) * 0.01f;
63141 }
63142 localAI[0] += 1f;
63143 }
63144 tileCollide = true;
63145 localAI[1] = 0f;
63146 if (Main.myPlayer == owner && ai[0] == 0f)
63147 {
63148 tileCollide = false;
63149 if (Main.player[owner].channel && (type < 736 || type > 738) && type != 40)
63150 {
63151 localAI[1] = -1f;
63152 float num5 = 12f;
63153 Vector2 vector = default(Vector2);
63154 ((Vector2)(ref vector))._002Ector(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
63155 float num6 = (float)Main.mouseX + Main.screenPosition.X - vector.X;
63156 float num7 = (float)Main.mouseY + Main.screenPosition.Y - vector.Y;
63157 if (Main.player[owner].gravDir == -1f)
63158 {
63159 num7 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector.Y;
63160 }
63161 float num8 = (float)Math.Sqrt(num6 * num6 + num7 * num7);
63162 num8 = (float)Math.Sqrt(num6 * num6 + num7 * num7);
63163 if (num8 > num5)
63164 {
63165 num8 = num5 / num8;
63166 num6 *= num8;
63167 num7 *= num8;
63168 if (num6 != velocity.X || num7 != velocity.Y)
63169 {
63170 netUpdate = true;
63171 }
63172 velocity.X = num6;
63173 velocity.Y = num7;
63174 }
63175 else
63176 {
63177 if (num6 != velocity.X || num7 != velocity.Y)
63178 {
63179 netUpdate = true;
63180 }
63181 velocity.X = num6;
63182 velocity.Y = num7;
63183 }
63184 }
63185 else
63186 {
63187 ai[0] = 1f;
63188 netUpdate = true;
63189 }
63190 }
63191 if (ai[0] == 1f && type != 109)
63192 {
63193 if (type == 42 || type == 65 || type == 68 || type == 354)
63194 {
63195 ai[1] += 1f;
63196 if (ai[1] >= 60f)
63197 {
63198 ai[1] = 60f;
63199 velocity.Y += 0.2f;
63200 }
63201 }
63202 else
63203 {
63204 velocity.Y += 0.41f;
63205 }
63206 }
63207 else if (ai[0] == 2f && type != 109)
63208 {
63209 velocity.Y += 0.2f;
63210 if ((double)velocity.X < -0.04)
63211 {
63212 velocity.X += 0.04f;
63213 }
63214 else if ((double)velocity.X > 0.04)
63215 {
63216 velocity.X -= 0.04f;
63217 }
63218 else
63219 {
63220 velocity.X = 0f;
63221 }
63222 }
63223 if (owner == Main.myPlayer && tileCollide)
63224 {
63225 for (int i = (int)(position.X / 16f); i <= (int)((position.X + (float)width) / 16f); i++)
63226 {
63227 for (int j = (int)(position.Y / 16f); j <= (int)((position.Y + (float)height) / 16f); j++)
63228 {
63229 if (!WorldGen.InWorld(i, j))
63230 {
63231 continue;
63232 }
63233 Tile tile = Main.tile[i, j];
63234 if (tile == null || !tile.active())
63235 {
63236 continue;
63237 }
63238 if ((tile.type >= 185 && tile.type <= 187) || tile.type == 165 || tile.type == 12 || tile.type == 665 || tile.type == 639 || tile.type == 105 || tile.type == 178)
63239 {
63240 WorldGen.KillTile(i, j);
63241 }
63242 else if (tile.topSlope() && !TileID.Sets.Platforms[tile.type])
63243 {
63244 WorldGen.SlopeTile(i, j);
63245 if (Main.netMode != 0)
63246 {
63247 NetMessage.SendData(17, -1, -1, null, 14, i, j);
63248 }
63249 position.Y -= 16f;
63250 }
63251 }
63252 }
63253 }
63254 if (type >= 736 && type <= 738)
63255 {
63256 if (frame == 0)
63257 {
63258 rotation -= 0.1f;
63259 }
63260 else if (frame == 1)
63261 {
63262 rotation += 0.1f;
63263 }
63264 else
63265 {
63266 rotation += 0.15f;
63267 }
63268 if (velocity.Y > 10f)
63269 {
63270 velocity.Y = 10f;
63271 }
63272 }
63273 else
63274 {
63275 rotation += 0.1f;
63276 if (velocity.Y > 10f)
63277 {
63278 velocity.Y = 10f;
63279 }
63280 }
63281 }
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 bool[] Platforms
Definition TileID.cs:219
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....
int frame
The frame number in the spritesheet that this projectile will be drawn with. Assign in M:Terraria....
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:...
float rotation
Rotation of the projectile. Radians not Degrees. Use T:Microsoft.Xna.Framework.MathHelper if you want...
float scale
Scales how large the projectile will be drawn. Will also affect the hitbox (F:Terraria....

References Terraria.Tile.active(), Terraria.Main.dust, Terraria.WorldGen.InWorld(), Terraria.WorldGen.KillTile(), Terraria.Main.mouseX, Terraria.Main.mouseY, Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.Dust.NewDust(), Terraria.ID.TileID.Sets.Platforms, Terraria.Main.player, Terraria.Main.rand, Terraria.Main.screenHeight, Terraria.Main.screenPosition, Terraria.NetMessage.SendData(), Terraria.WorldGen.SlopeTile(), Terraria.Main.tile, Terraria.Tile.topSlope(), and Terraria.Tile.type.

+ Here is the call graph for this function: