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

◆ AI_150_GolfClubHelper()

void Terraria.Projectile.AI_150_GolfClubHelper ( )
inlineprivate

Definition at line 55116 of file Projectile.cs.

55117 {
55118 //IL_003a: Unknown result type (might be due to invalid IL or missing references)
55119 //IL_0049: Unknown result type (might be due to invalid IL or missing references)
55120 //IL_004e: Unknown result type (might be due to invalid IL or missing references)
55121 //IL_0053: Unknown result type (might be due to invalid IL or missing references)
55122 //IL_008d: Unknown result type (might be due to invalid IL or missing references)
55123 //IL_0092: Unknown result type (might be due to invalid IL or missing references)
55124 //IL_010b: Unknown result type (might be due to invalid IL or missing references)
55125 //IL_00dd: Unknown result type (might be due to invalid IL or missing references)
55126 //IL_030e: Unknown result type (might be due to invalid IL or missing references)
55127 //IL_0313: Unknown result type (might be due to invalid IL or missing references)
55128 //IL_03d8: Unknown result type (might be due to invalid IL or missing references)
55129 //IL_03de: Unknown result type (might be due to invalid IL or missing references)
55130 //IL_0374: Unknown result type (might be due to invalid IL or missing references)
55131 //IL_0379: Unknown result type (might be due to invalid IL or missing references)
55132 //IL_037b: Unknown result type (might be due to invalid IL or missing references)
55133 //IL_037e: Unknown result type (might be due to invalid IL or missing references)
55134 //IL_012e: Unknown result type (might be due to invalid IL or missing references)
55135 //IL_0135: Unknown result type (might be due to invalid IL or missing references)
55136 //IL_013a: Unknown result type (might be due to invalid IL or missing references)
55137 //IL_013f: Unknown result type (might be due to invalid IL or missing references)
55138 //IL_0419: Unknown result type (might be due to invalid IL or missing references)
55139 //IL_041e: Unknown result type (might be due to invalid IL or missing references)
55140 //IL_03eb: Unknown result type (might be due to invalid IL or missing references)
55141 //IL_03f6: Unknown result type (might be due to invalid IL or missing references)
55142 //IL_0392: Unknown result type (might be due to invalid IL or missing references)
55143 //IL_0197: Unknown result type (might be due to invalid IL or missing references)
55144 //IL_01a9: Unknown result type (might be due to invalid IL or missing references)
55145 //IL_01b3: Unknown result type (might be due to invalid IL or missing references)
55146 //IL_01c1: Unknown result type (might be due to invalid IL or missing references)
55147 //IL_01c7: Unknown result type (might be due to invalid IL or missing references)
55148 //IL_0224: Unknown result type (might be due to invalid IL or missing references)
55149 //IL_01f3: Unknown result type (might be due to invalid IL or missing references)
55150 //IL_01fd: Unknown result type (might be due to invalid IL or missing references)
55151 //IL_0202: Unknown result type (might be due to invalid IL or missing references)
55152 //IL_024c: Unknown result type (might be due to invalid IL or missing references)
55153 //IL_024e: Unknown result type (might be due to invalid IL or missing references)
55154 //IL_025a: Unknown result type (might be due to invalid IL or missing references)
55155 //IL_025f: Unknown result type (might be due to invalid IL or missing references)
55156 //IL_0263: Unknown result type (might be due to invalid IL or missing references)
55157 Player player = Main.player[owner];
55158 if (!player.active)
55159 {
55160 Kill();
55161 return;
55162 }
55163 if (player.gravDir == -1f)
55164 {
55165 player.SetDummyItemTime(0);
55166 Kill();
55167 return;
55168 }
55169 bool flag = false;
55170 Rectangle rectangle = Utils.CenteredRectangle(player.Center, new Vector2(500f, 500f));
55171 for (int i = 0; i < 1000; i++)
55172 {
55173 Projectile projectile = Main.projectile[i];
55174 if (projectile.active && projectile.owner == Main.myPlayer && ProjectileID.Sets.IsAGolfBall[projectile.type] && ((Rectangle)(ref rectangle)).Contains(projectile.Center.ToPoint()))
55175 {
55176 flag = true;
55177 break;
55178 }
55179 }
55180 if (!flag && owner == Main.myPlayer && ai[0] == 0f)
55181 {
55182 player.TryPlacingAGolfBallNearANearbyTee(Main.player[owner].Center);
55183 }
55184 if (!player.channel && ai[0] == 0f)
55185 {
55186 SoundEngine.PlaySound(in SoundID.Item1, player.Center);
55187 for (int j = 0; j < 1000; j++)
55188 {
55189 Projectile projectile2 = Main.projectile[j];
55190 Vector2 shotVector = Main.MouseWorld - projectile2.Center;
55192 {
55193 continue;
55194 }
55195 float num = Main.rand.NextFloatDirection();
55196 for (float num2 = 0f; num2 < 1f; num2 += 0.1f)
55197 {
55198 Dust dust = Dust.NewDustPerfect(projectile2.Center, 31, ((float)Math.PI * 2f * num2 + num).ToRotationVector2() * 0.8f, 127);
55199 dust.fadeIn = 0f;
55200 if (num2 % 0.2f == 0f)
55201 {
55202 dust.velocity *= 0.4f;
55203 }
55204 }
55206 if (owner == Main.myPlayer)
55207 {
55209 Vector2 vector = Vector2.Normalize(shotVector) * shotStrength.AbsoluteStrength;
55210 GolfHelper.HitGolfBall(projectile2, vector, shotStrength.RoughLandResistance);
55211 NetMessage.SendData(27, -1, -1, null, j);
55212 }
55213 }
55214 ai[0] = 1f;
55215 ai[1] = 0f;
55216 netUpdate = true;
55217 }
55218 if (ai[0] == 1f)
55219 {
55220 ai[1] += 1f;
55221 float num3 = player.HeldItem.useAnimation + 30;
55222 if (ai[1] >= num3)
55223 {
55224 Kill();
55225 return;
55226 }
55227 velocity = Vector2.Zero;
55228 player.ChangeDir(direction);
55229 player.heldProj = whoAmI;
55230 int num4 = player.HeldItem.useAnimation - (int)ai[1];
55231 if (num4 < 2)
55232 {
55233 num4 = 2;
55234 }
55235 player.SetDummyItemTime(num4);
55236 }
55237 if (ai[0] != 0f)
55238 {
55239 return;
55240 }
55241 if (owner == Main.myPlayer)
55242 {
55243 Vector2 mouseWorld = Main.MouseWorld;
55244 if (mouseWorld != base.Center)
55245 {
55246 netUpdate = true;
55247 base.Center = mouseWorld;
55248 }
55249 if (Main.mouseRight && Main.mouseRightRelease)
55250 {
55251 Kill();
55252 player.mouseInterface = true;
55253 Main.blockMouse = true;
55254 player.SetItemTime(0);
55255 player.itemAnimation = 0;
55256 player.itemAnimationMax = 0;
55257 player.reuseDelay = 0;
55258 return;
55259 }
55260 }
55261 if (position != oldPosition)
55262 {
55263 if (base.Center.X - player.Center.X > 0f)
55264 {
55265 direction = 1;
55266 }
55267 else
55268 {
55269 direction = -1;
55270 }
55271 }
55272 velocity = Vector2.Zero;
55273 player.ChangeDir(direction);
55274 player.heldProj = whoAmI;
55275 ai[1] += 1f;
55276 int num5 = player.HeldItem.useAnimation * 4;
55277 if (ai[1] > (float)(num5 * 3))
55278 {
55279 ai[1] = num5;
55280 }
55281 int num6 = player.HeldItem.useAnimation + Math.Min(num5, (int)ai[1]);
55282 if (num6 < 2)
55283 {
55284 num6 = 2;
55285 }
55286 player.SetDummyItemTime(num6);
55287 }
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 ...
Vector2 oldPosition
Definition Entity.cs:35
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
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
static void HitGolfBall(Entity entity, Vector2 velocity, float roughLandResistance)
static bool ValidateShot(Entity golfBall, Player player, ref Vector2 shotVector)
static ShotStrength CalculateShotStrength(Vector2 shotVector, ClubProperties clubProperties)
static bool[] IsAGolfBall
If true for a given projectile type (F:Terraria.Projectile.type), then that projectile is a kind of g...
static readonly SoundStyle Item1
Definition SoundID.cs:679
static readonly SoundStyle Item126
Definition SoundID.cs:929
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...

References Terraria.Entity.active, Terraria.GameContent.Golf.GolfHelper.CalculateShotStrength(), Terraria.Entity.Center, Terraria.Utils.CenteredRectangle(), Terraria.Player.ChangeDir(), Terraria.Player.channel, Terraria.Player.gravDir, Terraria.GameContent.Golf.GolfHelper.HitGolfBall(), Terraria.ID.ProjectileID.Sets.IsAGolfBall, Terraria.ID.SoundID.Item1, Terraria.ID.SoundID.Item126, Terraria.Main.mouseRight, Terraria.Main.mouseRightRelease, Terraria.Main.MouseWorld, Terraria.Main.myPlayer, Terraria.Dust.NewDustPerfect(), Terraria.Projectile.owner, Terraria.Main.player, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.projectile, Terraria.Main.rand, Terraria.NetMessage.SendData(), Terraria.Player.SetDummyItemTime(), Terraria.Player.SetItemTime(), Terraria.Player.TryPlacingAGolfBallNearANearbyTee(), Terraria.Projectile.type, and Terraria.GameContent.Golf.GolfHelper.ValidateShot().

+ Here is the call graph for this function: