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

◆ ai

float [] Terraria.Projectile.ai = new float[maxAI]

An array with 3 slots used for any sort of data storage, which is occasionally synced to the server. Each vanilla T:Terraria.ID.ProjAIStyleID uses these slots for different purposes. Set F:Terraria.Projectile.netUpdate to true during AI methods to manually sync. The advantage of using these 3 floats is that they are synced automatically. Using fields in your P:Terraria.Projectile.ModProjectile class will work just the same, but they might need to be synced via M:Terraria.ModLoader.ModProjectile.SendExtraAI(System.IO.BinaryWriter) and M:Terraria.ModLoader.ModProjectile.ReceiveExtraAI(System.IO.BinaryReader) if necessary.
Clever use of Reference return valuesas seen in ExampleLightPetProjectile.cscan be used to reuse the ai array entries with readable names.
Defaults to the values passed into M:Terraria.Projectile.NewProjectile(Terraria.DataStructures.IEntitySource,System.Single,System.Single,System.Single,System.Single,System.Int32,System.Int32,System.Single,System.Int32,System.Single,System.Single,System.Single), usually [0, 0, 0].

Definition at line 180 of file Projectile.cs.

Referenced by Terraria.Projectile.AI_007_GrapplingHooks(), Terraria.NPC.AI_007_TownEntities(), Terraria.Projectile.AI_149_GolfBall(), Terraria.Projectile.AI_152_SuperStarSlash(), Terraria.Projectile.AutomaticallyChangesDirection(), Terraria.Projectile.BombsHurtPlayers(), Terraria.Projectile.Colliding(), Terraria.Projectile.Damage(), Terraria.Projectile.FishingCheck(), Terraria.Player.FreeUpPetsAndMinions(), Terraria.MessageBuffer.GetData(), Terraria.Projectile.GetFairyQueenWeaponsColor(), Terraria.Player.GetGrapplingForces(), Terraria.GameContent.Golf.GolfState.GetLastHitBall(), Terraria.Projectile.HandleMovement(), Terraria.Player.ItemCheck_CheckFishingBobber_PullBobber(), Terraria.Player.ItemCheck_CheckFishingBobbers(), Terraria.Player.ItemCheck_Shoot(), Terraria.Player.MoonLeechRope(), Terraria.Projectile.NewProjectile(), Terraria.Projectile.ProjectileFixDesperation(), Terraria.GameContent.PortalHelper.RemoveIntersectingPortals(), Terraria.GameContent.PortalHelper.RemoveMyOldPortal(), Terraria.NetMessage.SendData(), Terraria.Projectile.SetDefaults(), Terraria.Projectile.Shimmer(), Terraria.Projectile.StatusNPC(), Terraria.Cinematics.DSTFilm.StopBeforeCliff(), Terraria.GameContent.PortalHelper.TryGoingThroughPortals(), Terraria.Projectile.Update(), Terraria.GameContent.PortalHelper.UpdatePortalPoints(), and Terraria.Projectile.UpdatePosition().