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

◆ AI_149_GolfBall()

void Terraria.Projectile.AI_149_GolfBall ( )
inlineprivate

Definition at line 19358 of file Projectile.cs.

19359 {
19360 //IL_002a: Unknown result type (might be due to invalid IL or missing references)
19361 //IL_002f: Unknown result type (might be due to invalid IL or missing references)
19362 //IL_016d: Unknown result type (might be due to invalid IL or missing references)
19363 //IL_017f: Unknown result type (might be due to invalid IL or missing references)
19364 //IL_01c8: Unknown result type (might be due to invalid IL or missing references)
19365 if (!npcProj && timeLeft < 10)
19366 {
19367 timeLeft = 10;
19368 }
19369 if (ai[1] == -1f)
19370 {
19371 Tile tileSafely = Framing.GetTileSafely(base.Bottom.ToTileCoordinates());
19372 if (!tileSafely.active() || tileSafely.type != 494)
19373 {
19374 ai[1] = 0f;
19375 netUpdate = true;
19376 }
19377 return;
19378 }
19380 if (ballStepResult.State == BallState.Resting)
19381 {
19382 damage = 0;
19383 if (Main.netMode == 1 && owner == Main.myPlayer && localAI[1] != (float)ballStepResult.State)
19384 {
19385 netUpdate = true;
19386 }
19387 }
19388 localAI[1] = (float)ballStepResult.State;
19389 rotation += localAI[0];
19390 if (velocity.Y != 0f && ballStepResult.State == BallState.Moving)
19391 {
19392 rotation += velocity.X * 0.1f + velocity.Y * 0.1f;
19393 }
19394 if (ballStepResult.State == BallState.Moving && owner == Main.myPlayer)
19395 {
19397 if ((!flag.HasValue || flag.Value) && localAI[1] != 0f)
19398 {
19399 Collision.SwitchTiles(position, width, height, oldPosition, 4);
19400 }
19401 }
19402 if (ballStepResult.State == BallState.Moving && Main.netMode == 2 && Main.player.IndexInRange(owner) && Main.player[owner].active)
19403 {
19404 RemoteClient.CheckSection(owner, position);
19405 }
19406 }
Vector2 oldPosition
Definition Entity.cs:35
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 BallStepResult StepGolfBall(Entity entity, ref float angularVelocity)
static ? bool[] ForcePlateDetection
If true for a given projectile type (F:Terraria.Projectile.type), then that projectile can trigger F:...
int owner
The index of the player who owns this projectile. In Multiplayer, Clients "own" projectiles that they...
int damage
This will always be set in Projectile.NewProjectile based on the weapons damage and player stat modif...
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...
bool npcProj
If true, this projectile was spawned by a friendly Town NPC.

References Terraria.Projectile.ai, Terraria.RemoteClient.CheckSection(), Terraria.Projectile.damage, Terraria.ID.ProjectileID.Sets.ForcePlateDetection, Terraria.Framing.GetTileSafely(), Terraria.Entity.height, Terraria.Projectile.localAI, Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.Projectile.netUpdate, Terraria.Projectile.npcProj, Terraria.Entity.oldPosition, Terraria.Projectile.owner, Terraria.Main.player, Terraria.Entity.position, Terraria.Projectile.rotation, Terraria.GameContent.Golf.GolfHelper.StepGolfBall(), Terraria.Collision.SwitchTiles(), Terraria.Projectile.timeLeft, Terraria.Entity.velocity, and Terraria.Entity.width.

+ Here is the call graph for this function: