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

◆ Collision_WaterCollision()

bool Terraria.NPC.Collision_WaterCollision ( bool lava)
inlineprivate

Definition at line 110269 of file NPC.cs.

110270 {
110271 //IL_08ef: Unknown result type (might be due to invalid IL or missing references)
110272 //IL_08fa: Unknown result type (might be due to invalid IL or missing references)
110273 //IL_006e: Unknown result type (might be due to invalid IL or missing references)
110274 //IL_0f90: Unknown result type (might be due to invalid IL or missing references)
110275 //IL_0faf: Unknown result type (might be due to invalid IL or missing references)
110276 //IL_0fb5: Unknown result type (might be due to invalid IL or missing references)
110277 //IL_0781: Unknown result type (might be due to invalid IL or missing references)
110278 //IL_07a0: Unknown result type (might be due to invalid IL or missing references)
110279 //IL_07a6: Unknown result type (might be due to invalid IL or missing references)
110280 //IL_0c20: Unknown result type (might be due to invalid IL or missing references)
110281 //IL_0c42: Unknown result type (might be due to invalid IL or missing references)
110282 //IL_0c48: Unknown result type (might be due to invalid IL or missing references)
110283 //IL_0401: Unknown result type (might be due to invalid IL or missing references)
110284 //IL_0423: Unknown result type (might be due to invalid IL or missing references)
110285 //IL_0429: Unknown result type (might be due to invalid IL or missing references)
110286 //IL_09a7: Unknown result type (might be due to invalid IL or missing references)
110287 //IL_09c9: Unknown result type (might be due to invalid IL or missing references)
110288 //IL_09cf: Unknown result type (might be due to invalid IL or missing references)
110289 //IL_0194: Unknown result type (might be due to invalid IL or missing references)
110290 //IL_01b6: Unknown result type (might be due to invalid IL or missing references)
110291 //IL_01bc: Unknown result type (might be due to invalid IL or missing references)
110292 //IL_0dc8: Unknown result type (might be due to invalid IL or missing references)
110293 //IL_0dea: Unknown result type (might be due to invalid IL or missing references)
110294 //IL_0df0: Unknown result type (might be due to invalid IL or missing references)
110295 //IL_0a6c: Unknown result type (might be due to invalid IL or missing references)
110296 //IL_0a71: Unknown result type (might be due to invalid IL or missing references)
110297 //IL_0a8f: Unknown result type (might be due to invalid IL or missing references)
110298 //IL_0a94: Unknown result type (might be due to invalid IL or missing references)
110299 //IL_0ab2: Unknown result type (might be due to invalid IL or missing references)
110300 //IL_0ab7: Unknown result type (might be due to invalid IL or missing references)
110301 //IL_05a9: Unknown result type (might be due to invalid IL or missing references)
110302 //IL_05cb: Unknown result type (might be due to invalid IL or missing references)
110303 //IL_05d1: Unknown result type (might be due to invalid IL or missing references)
110304 //IL_0253: Unknown result type (might be due to invalid IL or missing references)
110305 //IL_0258: Unknown result type (might be due to invalid IL or missing references)
110306 //IL_0275: Unknown result type (might be due to invalid IL or missing references)
110307 //IL_027a: Unknown result type (might be due to invalid IL or missing references)
110308 //IL_0297: Unknown result type (might be due to invalid IL or missing references)
110309 //IL_029c: Unknown result type (might be due to invalid IL or missing references)
110310 //IL_0ad5: Unknown result type (might be due to invalid IL or missing references)
110311 //IL_0ada: Unknown result type (might be due to invalid IL or missing references)
110312 //IL_02b9: Unknown result type (might be due to invalid IL or missing references)
110313 //IL_02be: Unknown result type (might be due to invalid IL or missing references)
110314 bool flag = false;
110315 if (type == 72 || aiStyle == 21 || aiStyle == 67 || type == 376 || type == 579 || type == 541 || (aiStyle == 7 && ai[0] == 25f))
110316 {
110317 flag = false;
110318 wetCount = 0;
110319 lava = false;
110320 }
110321 else
110322 {
110323 flag = Collision.WetCollision(position, width, height);
110324 if (Collision.honey)
110325 {
110326 honeyWet = true;
110327 }
110328 if (Collision.shimmer)
110329 {
110330 shimmerWet = true;
110331 AddBuff(353, 100);
110332 }
110333 }
110334 if (aiStyle == 116)
110335 {
110336 wetCount = 10;
110337 }
110338 if (flag)
110339 {
110340 if (onFire && !lavaWet && Main.netMode != 1)
110341 {
110342 for (int i = 0; i < maxBuffs; i++)
110343 {
110344 if (buffType[i] == 24)
110345 {
110346 DelBuff(i);
110347 }
110348 }
110349 }
110350 if (!wet && wetCount == 0)
110351 {
110352 wetCount = 10;
110353 if (!lava)
110354 {
110355 if (shimmerWet)
110356 {
110357 if (type != 617 && type != 616 && type != 625)
110358 {
110359 for (int j = 0; j < 30; j++)
110360 {
110361 int num = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 308);
110362 Main.dust[num].velocity.Y -= 4f;
110363 Main.dust[num].velocity.X *= 2.5f;
110364 Main.dust[num].scale = 0.8f;
110365 Main.dust[num].noGravity = true;
110366 switch (Main.rand.Next(6))
110367 {
110368 case 0:
110369 Main.dust[num].color = new Color(255, 255, 210);
110370 break;
110371 case 1:
110372 Main.dust[num].color = new Color(190, 245, 255);
110373 break;
110374 case 2:
110375 Main.dust[num].color = new Color(255, 150, 255);
110376 break;
110377 default:
110378 Main.dust[num].color = new Color(190, 175, 255);
110379 break;
110380 }
110381 }
110382 if ((type != 376 && type != 579 && aiStyle != 1 && type != 1 && type != 16 && type != 147 && type != 59 && type != 300 && aiStyle != 39 && aiStyle != 68 && type != 362 && type != 364 && type != 361 && type != 445 && !noGravity) || type == 615)
110383 {
110384 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 4);
110385 }
110386 }
110387 }
110388 else if (honeyWet)
110389 {
110390 for (int k = 0; k < 10; k++)
110391 {
110392 int num4 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 152);
110393 Main.dust[num4].velocity.Y -= 1f;
110394 Main.dust[num4].velocity.X *= 2.5f;
110395 Main.dust[num4].scale = 1.3f;
110396 Main.dust[num4].alpha = 100;
110397 Main.dust[num4].noGravity = true;
110398 }
110399 if (aiStyle != 1 && type != 1 && type != 16 && type != 147 && type != 59 && type != 300 && aiStyle != 39 && !noGravity)
110400 {
110401 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
110402 }
110403 }
110404 else if (type != 617 && type != 616 && type != 625)
110405 {
110406 for (int l = 0; l < 30; l++)
110407 {
110408 int num5 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, Dust.dustWater());
110409 Main.dust[num5].velocity.Y -= 4f;
110410 Main.dust[num5].velocity.X *= 2.5f;
110411 Main.dust[num5].scale *= 0.8f;
110412 Main.dust[num5].alpha = 100;
110413 Main.dust[num5].noGravity = true;
110414 }
110415 if ((type != 376 && type != 579 && aiStyle != 1 && type != 1 && type != 16 && type != 147 && type != 59 && type != 300 && aiStyle != 39 && aiStyle != 68 && type != 362 && type != 364 && type != 361 && type != 445 && !noGravity) || type == 615)
110416 {
110417 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 0);
110418 }
110419 }
110420 }
110421 else
110422 {
110423 for (int m = 0; m < 10; m++)
110424 {
110425 int num6 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 35);
110426 Main.dust[num6].velocity.Y -= 1.5f;
110427 Main.dust[num6].velocity.X *= 2.5f;
110428 Main.dust[num6].scale = 1.3f;
110429 Main.dust[num6].alpha = 100;
110430 Main.dust[num6].noGravity = true;
110431 }
110432 if (aiStyle != 1 && type != 1 && type != 16 && type != 147 && type != 59 && type != 300 && aiStyle != 39 && !noGravity)
110433 {
110434 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
110435 }
110436 }
110437 }
110438 wet = true;
110439 }
110440 else if (wet)
110441 {
110442 velocity.X *= 0.5f;
110443 wet = false;
110444 if (type == 620 && GetTargetData().Center.Y < base.Center.Y)
110445 {
110446 velocity.Y -= 8f;
110447 }
110448 if (wetCount == 0)
110449 {
110450 wetCount = 10;
110451 if (!lavaWet)
110452 {
110453 if (shimmerWet)
110454 {
110455 if (type != 617 && type != 616 && type != 625)
110456 {
110457 for (int n = 0; n < 30; n++)
110458 {
110459 int num7 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 308);
110460 Main.dust[num7].velocity.Y -= 4f;
110461 Main.dust[num7].velocity.X *= 2.5f;
110462 Main.dust[num7].scale = 0.8f;
110463 Main.dust[num7].noGravity = true;
110464 switch (Main.rand.Next(6))
110465 {
110466 case 0:
110467 Main.dust[num7].color = new Color(255, 255, 210);
110468 break;
110469 case 1:
110470 Main.dust[num7].color = new Color(190, 245, 255);
110471 break;
110472 case 2:
110473 Main.dust[num7].color = new Color(255, 150, 255);
110474 break;
110475 default:
110476 Main.dust[num7].color = new Color(190, 175, 255);
110477 break;
110478 }
110479 }
110480 if ((type != 376 && type != 579 && aiStyle != 1 && type != 1 && type != 16 && type != 147 && type != 59 && type != 300 && aiStyle != 39 && aiStyle != 68 && type != 362 && type != 364 && type != 361 && type != 445 && !noGravity) || type == 615)
110481 {
110482 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 5);
110483 }
110484 }
110485 }
110486 else if (honeyWet)
110487 {
110488 for (int num8 = 0; num8 < 10; num8++)
110489 {
110490 int num9 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 152);
110491 Main.dust[num9].velocity.Y -= 1f;
110492 Main.dust[num9].velocity.X *= 2.5f;
110493 Main.dust[num9].scale = 1.3f;
110494 Main.dust[num9].alpha = 100;
110495 Main.dust[num9].noGravity = true;
110496 }
110497 if (aiStyle != 1 && type != 1 && type != 16 && type != 147 && type != 300 && type != 59 && aiStyle != 39 && !noGravity)
110498 {
110499 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
110500 }
110501 }
110502 else if (type != 617 && type != 616 && type != 625)
110503 {
110504 for (int num10 = 0; num10 < 30; num10++)
110505 {
110506 int num11 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, Dust.dustWater());
110507 Main.dust[num11].velocity.Y -= 4f;
110508 Main.dust[num11].velocity.X *= 2.5f;
110509 Main.dust[num11].scale *= 0.8f;
110510 Main.dust[num11].alpha = 100;
110511 Main.dust[num11].noGravity = true;
110512 }
110513 if ((type != 376 && type != 579 && aiStyle != 1 && type != 1 && type != 16 && type != 59 && type != 300 && aiStyle != 39 && aiStyle != 68 && type != 362 && type != 364 && type != 361 && type != 445 && !noGravity) || type == 615)
110514 {
110515 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 0);
110516 }
110517 }
110518 }
110519 else
110520 {
110521 for (int num2 = 0; num2 < 10; num2++)
110522 {
110523 int num3 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 35);
110524 Main.dust[num3].velocity.Y -= 1.5f;
110525 Main.dust[num3].velocity.X *= 2.5f;
110526 Main.dust[num3].scale = 1.3f;
110527 Main.dust[num3].alpha = 100;
110528 Main.dust[num3].noGravity = true;
110529 }
110530 if (aiStyle != 1 && type != 1 && type != 16 && type != 59 && type != 300 && aiStyle != 39 && !noGravity)
110531 {
110532 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
110533 }
110534 }
110535 }
110536 }
110537 return lava;
110538 }
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 ...
bool wet
The Entity is currently in water. Projectile: Affects movement speed and some projectiles die when ...
Definition Entity.cs:57
bool honeyWet
Definition Entity.cs:61
Vector2 Center
Definition Entity.cs:70
bool shimmerWet
Definition Entity.cs:59
Vector2 position
The position of this Entity in world coordinates.
Definition Entity.cs:28
byte wetCount
Definition Entity.cs:63
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 int maxBuffs
Definition NPC.cs:647
int aiStyle
Selects which vanilla code to use for the AI method. Vanilla NPC AI styles are enumerated in the T:Te...
Definition NPC.cs:1013
NPCAimedTarget GetTargetData(bool ignorePlayerTankPets=true)
Definition NPC.cs:1668
bool noGravity
If true, the npc will not be affected by gravity. Demon Eyes and other floating npc use this....
Definition NPC.cs:1122
float[] ai
An array with 4 slots used for any sort of data storage, which is occasionally synced from the server...
Definition NPC.cs:997
bool onFire
Definition NPC.cs:664
int type
The NPC ID of this NPC. The NPC ID is a unique number assigned to each NPC loaded into the game....
Definition NPC.cs:990
void DelBuff(int buffIndex)
Removes the buff at the provided index and shuffles the remaining buff indexes down to fill the gap....
Definition NPC.cs:106775
int[] buffType
Definition NPC.cs:649
void AddBuff(int type, int time, bool quiet=false)
Gives this NPC the provided buff. This accounts for if the NPC is immune to the buff....
Definition NPC.cs:106688

References Terraria.Main.dust, Terraria.Dust.dustWater(), Terraria.Collision.honey, Terraria.Main.netMode, Terraria.Dust.NewDust(), Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.rand, Terraria.Collision.shimmer, and Terraria.Collision.WetCollision().

+ Here is the call graph for this function: