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

◆ UpdateNPC_CastLights()

void Terraria.NPC.UpdateNPC_CastLights ( )
inlineprivate

Definition at line 109390 of file NPC.cs.

109391 {
109392 //IL_006d: Unknown result type (might be due to invalid IL or missing references)
109393 //IL_0073: Unknown result type (might be due to invalid IL or missing references)
109394 //IL_0078: Unknown result type (might be due to invalid IL or missing references)
109395 //IL_007d: Unknown result type (might be due to invalid IL or missing references)
109396 //IL_0083: Unknown result type (might be due to invalid IL or missing references)
109397 //IL_0092: Unknown result type (might be due to invalid IL or missing references)
109398 //IL_00a0: Unknown result type (might be due to invalid IL or missing references)
109399 //IL_00a5: Unknown result type (might be due to invalid IL or missing references)
109400 //IL_0169: Unknown result type (might be due to invalid IL or missing references)
109401 //IL_016f: Unknown result type (might be due to invalid IL or missing references)
109402 //IL_0174: Unknown result type (might be due to invalid IL or missing references)
109403 //IL_0179: Unknown result type (might be due to invalid IL or missing references)
109404 //IL_010e: Unknown result type (might be due to invalid IL or missing references)
109405 //IL_013b: Unknown result type (might be due to invalid IL or missing references)
109406 //IL_0153: Unknown result type (might be due to invalid IL or missing references)
109407 //IL_015d: Unknown result type (might be due to invalid IL or missing references)
109408 //IL_0162: Unknown result type (might be due to invalid IL or missing references)
109409 //IL_0206: Unknown result type (might be due to invalid IL or missing references)
109410 //IL_0215: Unknown result type (might be due to invalid IL or missing references)
109411 //IL_02e5: Unknown result type (might be due to invalid IL or missing references)
109412 //IL_02f4: Unknown result type (might be due to invalid IL or missing references)
109413 //IL_038f: Unknown result type (might be due to invalid IL or missing references)
109414 //IL_039e: Unknown result type (might be due to invalid IL or missing references)
109415 //IL_03c7: Unknown result type (might be due to invalid IL or missing references)
109416 if ((type >= 442 && type <= 448) || type == 539 || type == 592 || type == 593 || type == 601 || type == 605 || type == 627)
109417 {
109418 position += netOffset;
109419 Color color = Lighting.GetColor((int)base.Center.X / 16, (int)base.Center.Y / 16);
109420 if (((Color)(ref color)).R > 20 || ((Color)(ref color)).B > 20 || ((Color)(ref color)).G > 20)
109421 {
109422 int num = ((Color)(ref color)).R;
109423 if (((Color)(ref color)).G > num)
109424 {
109425 num = ((Color)(ref color)).G;
109426 }
109427 if (((Color)(ref color)).B > num)
109428 {
109429 num = ((Color)(ref color)).B;
109430 }
109431 num /= 30;
109432 if (Main.rand.Next(300) < num)
109433 {
109434 int num11 = Dust.NewDust(position, width, height, 43, 0f, 0f, 254, new Color(255, 255, 0), 0.5f);
109435 Dust obj = Main.dust[num11];
109436 obj.velocity *= 0f;
109437 }
109438 }
109439 position -= netOffset;
109440 }
109441 if (type == 160)
109442 {
109443 float num12 = (float)Main.rand.Next(28, 42) * 0.005f;
109444 num12 += (float)(270 - Main.mouseTextColor) / 500f;
109445 float num13 = 0.1f;
109446 float num14 = 0.3f + num12 / 2f;
109447 float num15 = 0.6f + num12;
109448 if (townNpcVariationIndex == 1)
109449 {
109450 float num18 = num13;
109451 num13 = num15;
109452 num15 = num18;
109453 }
109454 float num16 = 0.35f;
109455 num13 *= num16;
109456 num14 *= num16;
109457 num15 *= num16;
109458 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, num13, num14, num15);
109459 }
109460 if ((type >= 254 && type <= 261) || type == 634 || type == 635)
109461 {
109462 float num17 = (float)Main.rand.Next(28, 42) * 0.005f;
109463 num17 += (float)(270 - Main.mouseTextColor) / 500f;
109464 float num2 = 0.1f;
109465 float num3 = 0.3f + num17 / 2f;
109466 float num4 = 0.6f + num17;
109467 float num5 = 0.35f;
109468 if (type == 634)
109469 {
109470 num5 = 0.65f;
109471 }
109472 num2 *= num5;
109473 num3 *= num5;
109474 num4 *= num5;
109475 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, num2, num3, num4);
109476 }
109477 if (type == 209)
109478 {
109479 float num6 = (float)Main.rand.Next(28, 42) * 0.005f;
109480 num6 += (float)(270 - Main.mouseTextColor) / 500f;
109481 float num7 = 0.1f;
109482 float num8 = 0.3f + num6 / 2f;
109483 float num9 = 0.4f + num6 / 2f;
109484 float num10 = 0.35f;
109485 num7 *= num10;
109486 num8 *= num10;
109487 num9 *= num10;
109488 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, num7, num8, num9);
109489 if (ai[0] == 12f)
109490 {
109491 Lighting.AddLight(base.Top, 0.3f, 0.1f, 0.1f);
109492 }
109493 }
109494 if (type == 44)
109495 {
109496 Lighting.AddLight((int)(position.X + (float)(width / 2)) / 16, (int)(position.Y + 4f) / 16, 0.9f, 0.75f, 0.5f);
109497 }
109498 }
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
Vector2 netOffset
Definition NPC.cs:502
int townNpcVariationIndex
Definition NPC.cs:500
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
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
Color color
Definition NPC.cs:1085

References Terraria.Lighting.AddLight(), Terraria.Main.dust, Terraria.Lighting.GetColor(), Terraria.Main.mouseTextColor, Terraria.Dust.NewDust(), and Terraria.Main.rand.

+ Here is the call graph for this function: