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

◆ Shimmer()

void Terraria.Projectile.Shimmer ( )
inlineprivate

Definition at line 21277 of file Projectile.cs.

21278 {
21279 //IL_0201: Unknown result type (might be due to invalid IL or missing references)
21280 //IL_03bd: Unknown result type (might be due to invalid IL or missing references)
21281 //IL_06d0: Unknown result type (might be due to invalid IL or missing references)
21282 //IL_06de: Unknown result type (might be due to invalid IL or missing references)
21283 //IL_0719: Unknown result type (might be due to invalid IL or missing references)
21284 //IL_071e: Unknown result type (might be due to invalid IL or missing references)
21285 if (hostile || (aiStyle == 99 && ai[0] == -1f) || (aiStyle == 15 && (ai[0] == 2f || ai[0] == 4f)))
21286 {
21287 return;
21288 }
21289 if (type == 502)
21290 {
21291 velocity.Y -= 0.4f;
21292 timeLeft -= 5;
21293 }
21294 else if (type == 469 || type == 181)
21295 {
21296 velocity.Y -= 0.2f;
21297 if (type == 469 && velocity.Y < 0f)
21298 {
21299 Kill();
21300 }
21301 }
21302 else if (type == 819 || type == 117 || type == 474 || type == 225 || type == 103 || type == 2 || type == 82 || type == 120 || type == 172 || type == 41 || type == 91 || type == 278 || type == 5 || type == 639 || type == 631 || type == 495 || type == 4 || type == 282 || type == 1 || type == 81)
21303 {
21304 velocity.Y -= 0.4f;
21305 }
21306 else if (aiStyle == 1 || aiStyle == 16 || aiStyle == 40)
21307 {
21308 int num = (int)(base.Center.X / 16f);
21309 int num2 = (int)(position.Y / 16f);
21310 if (WorldGen.InWorld(num, num2) && Main.tile[num, num2] != null && Main.tile[num, num2].liquid == byte.MaxValue && Main.tile[num, num2].shimmer() && WorldGen.InWorld(num, num2 - 1) && Main.tile[num, num2 - 1] != null && Main.tile[num, num2 - 1].liquid > 0 && Main.tile[num, num2 - 1].shimmer())
21311 {
21312 Kill();
21313 }
21314 else if (velocity.Y > 0f)
21315 {
21316 velocity.Y *= -1f;
21317 netUpdate = true;
21318 if (timeLeft > 600)
21319 {
21320 timeLeft = 600;
21321 }
21322 timeLeft -= 60;
21323 shimmerWet = false;
21324 wet = false;
21325 }
21326 }
21327 else if (aiStyle == 5 || aiStyle == 8 || aiStyle == 21 || aiStyle == 28 || aiStyle == 29 || aiStyle == 33 || aiStyle == 36 || aiStyle == 47 || aiStyle == 93 || aiStyle == 115 || aiStyle == 151 || aiStyle == 152)
21328 {
21329 int num3 = (int)(base.Center.X / 16f);
21330 int num4 = (int)(position.Y / 16f);
21331 if (WorldGen.InWorld(num3, num4) && Main.tile[num3, num4] != null && Main.tile[num3, num4].liquid == byte.MaxValue && Main.tile[num3, num4].shimmer() && WorldGen.InWorld(num3, num4 - 1) && Main.tile[num3, num4 - 1] != null && Main.tile[num3, num4 - 1].liquid > 0 && Main.tile[num3, num4 - 1].shimmer())
21332 {
21333 Kill();
21334 }
21335 else if (velocity.Y > 0f)
21336 {
21337 velocity.Y *= -1f;
21338 netUpdate = true;
21339 shimmerWet = false;
21340 wet = false;
21341 }
21342 }
21343 else if (aiStyle == 15)
21344 {
21345 if (velocity.Y > 0f)
21346 {
21347 velocity.Y *= -1f;
21348 netUpdate = true;
21349 }
21350 velocity.Y -= 0.4f;
21351 if (velocity.Y < -8f)
21352 {
21353 velocity.Y = -8f;
21354 }
21355 }
21356 else if (aiStyle == 99)
21357 {
21358 if (velocity.Y > 0f)
21359 {
21360 velocity.Y *= -1f;
21361 netUpdate = true;
21362 shimmerWet = false;
21363 wet = false;
21364 }
21365 if (velocity.Y > -8f)
21366 {
21367 velocity.Y = -8f;
21368 }
21369 }
21370 else if (aiStyle == 7 || aiStyle == 9 || aiStyle == 13 || aiStyle == 35 || aiStyle == 53 || aiStyle == 130 || aiStyle == 134 || aiStyle == 137 || aiStyle == 138 || aiStyle == 149 || aiStyle == 160)
21371 {
21372 Kill();
21373 }
21374 else if (aiStyle == 2)
21375 {
21376 velocity.Y -= 0.7f;
21377 if (type == 936 && !NPC.unlockedSlimeRainbowSpawn && velocity.Y < 0f)
21378 {
21379 if (timeLeft > 5)
21380 {
21381 timeLeft = 5;
21382 }
21383 if (Main.netMode != 1)
21384 {
21385 NPC.unlockedSlimeRainbowSpawn = true;
21386 NetMessage.SendData(7);
21387 int num5 = NPC.NewNPC(GetNPCSource_FromThis(), (int)base.Center.X + 4, (int)base.Center.Y, 681);
21388 NPC obj = Main.npc[num5];
21389 obj.velocity = velocity;
21390 obj.netUpdate = true;
21391 WorldGen.CheckAchievement_RealEstateAndTownSlimes();
21392 }
21393 }
21394 else
21395 {
21396 timeLeft -= 20;
21397 }
21398 }
21399 else if (aiStyle == 14 || aiStyle == 16)
21400 {
21401 if (timeLeft > 3000)
21402 {
21403 timeLeft -= 60;
21404 }
21405 velocity.Y -= 0.5f;
21406 }
21407 else if (aiStyle == 25 || aiStyle == 17)
21408 {
21409 if (velocity.Y > 10f)
21410 {
21411 velocity.Y *= 0.97f;
21412 }
21413 velocity.Y -= 0.7f;
21414 if (velocity.Y < -10f)
21415 {
21416 velocity.Y = -10f;
21417 }
21418 }
21419 }
bool wet
The Entity is currently in water. Projectile: Affects movement speed and some projectiles die when ...
Definition Entity.cs:57
bool shimmerWet
Definition Entity.cs:59
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 aiStyle
Selects which vanilla code to use for the AI method. Vanilla projectile AI styles are enumerated in t...
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...
int type
The Projectile ID of this projectile. The Projectile ID is a unique number assigned to each Projectil...
int timeLeft
Time in ticks before this projectile will naturally despawn. Each update timeLeft is decreased by 1...
bool hostile
If True, this projectile will hurt players and friendly NPCs (F:Terraria.NPC.friendly) Defaults to ...
IEntitySource GetNPCSource_FromThis()

References Terraria.Projectile.ai, Terraria.Projectile.aiStyle, Terraria.WorldGen.CheckAchievement_RealEstateAndTownSlimes(), Terraria.Projectile.GetNPCSource_FromThis(), Terraria.Projectile.hostile, Terraria.WorldGen.InWorld(), Terraria.Projectile.Kill(), Terraria.Main.netMode, Terraria.Projectile.netUpdate, Terraria.NPC.NewNPC(), Terraria.Main.npc, Terraria.Entity.position, Terraria.NetMessage.SendData(), Terraria.Entity.shimmerWet, Terraria.Main.tile, Terraria.Projectile.timeLeft, Terraria.Projectile.type, Terraria.NPC.unlockedSlimeRainbowSpawn, Terraria.Entity.velocity, and Terraria.Entity.wet.

Referenced by Terraria.Projectile.Update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: