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

◆ AI_195_JimsDrone()

void Terraria.Projectile.AI_195_JimsDrone ( )
inlineprivate

Definition at line 41849 of file Projectile.cs.

41850 {
41851 //IL_02af: Unknown result type (might be due to invalid IL or missing references)
41852 //IL_0266: Unknown result type (might be due to invalid IL or missing references)
41853 //IL_03d0: Unknown result type (might be due to invalid IL or missing references)
41854 //IL_03d5: Unknown result type (might be due to invalid IL or missing references)
41855 //IL_03ed: Unknown result type (might be due to invalid IL or missing references)
41856 //IL_03f2: Unknown result type (might be due to invalid IL or missing references)
41857 //IL_03f9: Unknown result type (might be due to invalid IL or missing references)
41858 //IL_03fe: Unknown result type (might be due to invalid IL or missing references)
41859 //IL_0403: Unknown result type (might be due to invalid IL or missing references)
41860 //IL_0342: Unknown result type (might be due to invalid IL or missing references)
41861 //IL_0347: Unknown result type (might be due to invalid IL or missing references)
41862 //IL_034b: Unknown result type (might be due to invalid IL or missing references)
41863 //IL_0350: Unknown result type (might be due to invalid IL or missing references)
41864 //IL_0357: Unknown result type (might be due to invalid IL or missing references)
41865 //IL_035c: Unknown result type (might be due to invalid IL or missing references)
41866 //IL_0361: Unknown result type (might be due to invalid IL or missing references)
41867 //IL_0486: Unknown result type (might be due to invalid IL or missing references)
41868 //IL_048b: Unknown result type (might be due to invalid IL or missing references)
41869 //IL_0495: Unknown result type (might be due to invalid IL or missing references)
41870 //IL_0465: Unknown result type (might be due to invalid IL or missing references)
41871 //IL_047b: Unknown result type (might be due to invalid IL or missing references)
41872 //IL_0480: Unknown result type (might be due to invalid IL or missing references)
41873 //IL_04ae: Unknown result type (might be due to invalid IL or missing references)
41874 //IL_04b3: Unknown result type (might be due to invalid IL or missing references)
41875 //IL_04dc: Unknown result type (might be due to invalid IL or missing references)
41876 //IL_04de: Unknown result type (might be due to invalid IL or missing references)
41877 //IL_04e3: Unknown result type (might be due to invalid IL or missing references)
41878 //IL_04e8: Unknown result type (might be due to invalid IL or missing references)
41879 //IL_04ed: Unknown result type (might be due to invalid IL or missing references)
41880 //IL_04fe: Unknown result type (might be due to invalid IL or missing references)
41881 //IL_0503: Unknown result type (might be due to invalid IL or missing references)
41882 //IL_0507: Unknown result type (might be due to invalid IL or missing references)
41883 //IL_0511: Unknown result type (might be due to invalid IL or missing references)
41884 //IL_0513: Unknown result type (might be due to invalid IL or missing references)
41885 //IL_0630: Unknown result type (might be due to invalid IL or missing references)
41886 //IL_054e: Unknown result type (might be due to invalid IL or missing references)
41887 //IL_0557: Unknown result type (might be due to invalid IL or missing references)
41888 //IL_055c: Unknown result type (might be due to invalid IL or missing references)
41889 //IL_0575: Unknown result type (might be due to invalid IL or missing references)
41890 //IL_057a: Unknown result type (might be due to invalid IL or missing references)
41891 //IL_058e: Unknown result type (might be due to invalid IL or missing references)
41892 //IL_0598: Unknown result type (might be due to invalid IL or missing references)
41893 //IL_059d: Unknown result type (might be due to invalid IL or missing references)
41894 //IL_059f: Unknown result type (might be due to invalid IL or missing references)
41895 //IL_05d0: Unknown result type (might be due to invalid IL or missing references)
41896 //IL_05db: Unknown result type (might be due to invalid IL or missing references)
41897 //IL_05e1: Unknown result type (might be due to invalid IL or missing references)
41898 Player player = Main.player[owner];
41899 bool flag = false;
41900 if (player.dead)
41901 {
41902 flag = true;
41903 }
41904 if (owner == Main.myPlayer)
41905 {
41906 if (position.Y - (float)height <= (float)(16 * Main.offScreenRange / 2))
41907 {
41908 Kill();
41909 return;
41910 }
41911 if (player.HeldItem.type != 5451)
41912 {
41913 flag = true;
41914 }
41915 bool flag2 = player.gravDir == -1f;
41916 BitsByte bitsByte = (byte)0;
41917 Player.DirectionalInputSyncCache localInputCache = player.LocalInputCache;
41918 bitsByte[0] = localInputCache.controlLeft ^ flag2;
41919 bitsByte[1] = localInputCache.controlRight ^ flag2;
41920 bitsByte[2] = localInputCache.controlUp;
41921 bitsByte[3] = localInputCache.controlDown;
41922 float num = (int)(byte)bitsByte;
41923 if (ai[0] != num)
41924 {
41925 ai[0] = num;
41926 netUpdate = true;
41927 }
41928 Main.DroneCameraTracker.Track(this);
41929 }
41930 if (flag)
41931 {
41932 Kill();
41933 return;
41934 }
41935 BitsByte bitsByte2 = (byte)ai[0];
41936 rotation = ai[1];
41937 bool flag3 = bitsByte2[0];
41938 bool flag4 = bitsByte2[1];
41939 bool flag5 = bitsByte2[2];
41940 _ = bitsByte2[3];
41941 localAI[0] += 1f;
41942 if (!flag3 && !flag4)
41943 {
41944 localAI[0] = 0f;
41945 }
41946 bool flag6 = velocity.Y == 0f;
41947 int num3 = 0;
41948 if (!flag6)
41949 {
41950 num3 = 10;
41951 }
41952 if (flag5)
41953 {
41954 num3 = 100;
41955 }
41956 localAI[1] = MathHelper.Lerp(localAI[1], (float)num3, 0.2f);
41957 float num4 = Utils.Remap(localAI[0], 0f, 5f, 0f, 1f) * Utils.Remap(localAI[0], 5f, 15f, 1f, 0f);
41958 float num5 = Utils.Clamp(MathHelper.Max(Utils.Remap(localAI[1], 0f, 100f, 0f, 25f), num4 * 12f), 0f, 100f);
41960 if (activeSound == null && num5 != 0f)
41961 {
41964 }
41965 if (activeSound != null)
41966 {
41967 activeSound.Volume = num5;
41968 activeSound.Position = base.Center;
41969 activeSound.Pitch = Utils.Clamp(Utils.Remap(localAI[1], 0f, 100f, -1f, 1f) + num4, -1f, 1f);
41970 }
41971 float num6 = 0.15f;
41972 if (flag6)
41973 {
41974 rotation = MathHelper.WrapAngle(rotation) * 0.7f;
41975 velocity.X *= 0.97f;
41976 if (flag5)
41977 {
41978 Vector2 vector = (rotation - (float)Math.PI / 2f).ToRotationVector2();
41979 velocity += vector * 0.5f;
41980 num6 = 0.05f;
41981 }
41982 }
41983 else
41984 {
41985 float num7 = (float)Math.PI / 15f;
41986 num7 = Utils.Remap(localAI[0], 0f, 10f, num7 * 0.1f, num7);
41987 int num8 = flag4.ToInt() - flag3.ToInt();
41988 rotation += (float)num8 * num7;
41989 if (flag5)
41990 {
41991 Vector2 vector2 = (rotation - (float)Math.PI / 2f).ToRotationVector2();
41992 velocity.X *= 0.97f;
41993 velocity += vector2 * 0.5f;
41994 }
41995 }
41996 velocity.Y += num6;
41997 ai[1] = rotation;
41998 if (!flag5 && velocity.Y > 12f)
41999 {
42000 velocity.Y *= 0.95f;
42001 }
42002 if (((Vector2)(ref velocity)).Length() > 16f)
42003 {
42004 velocity *= 16f / ((Vector2)(ref velocity)).Length();
42005 }
42006 Lighting.AddLight(base.Center, Vector3.One * 0.3f);
42007 timeLeft = 2;
42008 if (!flag6)
42009 {
42010 Vector2 vector3 = position;
42011 float num9 = 0f;
42012 int num10 = 3;
42013 int num2 = 16 * num10;
42014 Vector2 vector4 = default(Vector2);
42015 for (int i = 0; i < num10; i++)
42016 {
42017 ((Vector2)(ref vector4))._002Ector(0f, 16f);
42018 Vector2 vector5 = Collision.TileCollision(vector3 + vector4 * (float)i, vector4, width, height);
42019 num9 += vector5.Y;
42020 if (vector5 != vector4)
42021 {
42022 break;
42023 }
42024 }
42025 if (num9 != (float)num2)
42026 {
42027 for (int j = 0; j < 2; j++)
42028 {
42029 if (!(Main.rand.NextFloat() < 0.66f))
42030 {
42031 Vector2 val = vector3 + new Vector2(0f, num9) + new Vector2((float)width / 2f, (float)height);
42032 Vector2 value = Main.rand.NextVector2CircularEdge(2.5f, 1f) * 0.5f;
42033 if (value.Y > 0f)
42034 {
42035 value.Y *= -1f;
42036 }
42037 Dust.NewDustPerfect(val, (Main.rand.Next(2) == 0) ? 31 : 16, value, 127);
42038 }
42039 }
42040 }
42041 }
42042 if (Main.netMode == 2 && Main.player.IndexInRange(owner) && Main.player[owner].active)
42043 {
42044 RemoteClient.CheckSection(owner, position);
42045 }
42046 }
static SlotId PlayTrackedLoopedSound(in SoundStyle style, Vector2 position, Func< bool >? loopingCondition=null)
static ? ActiveSound GetActiveSound(SlotId slotId)
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 JimsDrone
Definition SoundID.cs:261
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 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...

References Terraria.Lighting.AddLight(), Terraria.RemoteClient.CheckSection(), Terraria.Player.dead, Terraria.Main.DroneCameraTracker, Terraria.Audio.SoundEngine.GetActiveSound(), Terraria.Player.HeldItem, Terraria.Audio.ProjectileAudioTracker.IsActiveAndInGame(), Terraria.ID.SoundID.JimsDrone, Terraria.Player.LocalInputCache, Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.Dust.NewDustPerfect(), Terraria.Main.offScreenRange, Terraria.Main.player, Terraria.Audio.SoundEngine.PlayTrackedLoopedSound(), Terraria.Main.rand, Terraria.Utils.Remap(), Terraria.Collision.TileCollision(), and Terraria.Item.type.

+ Here is the call graph for this function: