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

◆ UpdateNPC_CastLights()

void Terraria.NPC.UpdateNPC_CastLights ( )
inlineprivate

Definition at line 89049 of file NPC.cs.

89050 {
89051 if ((type >= 442 && type <= 448) || type == 539 || type == 592 || type == 593 || type == 601 || type == 605 || type == 627)
89052 {
89054 Color color = Lighting.GetColor((int)base.Center.X / 16, (int)base.Center.Y / 16);
89055 if (color.R > 20 || color.B > 20 || color.G > 20)
89056 {
89057 int num = color.R;
89058 if (color.G > num)
89059 {
89060 num = color.G;
89061 }
89062 if (color.B > num)
89063 {
89064 num = color.B;
89065 }
89066 num /= 30;
89067 if (Main.rand.Next(300) < num)
89068 {
89069 int num2 = Dust.NewDust(position, width, height, 43, 0f, 0f, 254, new Color(255, 255, 0), 0.5f);
89070 Main.dust[num2].velocity *= 0f;
89071 }
89072 }
89074 }
89075 if (type == 160)
89076 {
89077 float num3 = (float)Main.rand.Next(28, 42) * 0.005f;
89078 num3 += (float)(270 - Main.mouseTextColor) / 500f;
89079 float num4 = 0.1f;
89080 float num5 = 0.3f + num3 / 2f;
89081 float num6 = 0.6f + num3;
89082 if (townNpcVariationIndex == 1)
89083 {
89084 float num7 = num4;
89085 num4 = num6;
89086 num6 = num7;
89087 }
89088 float num8 = 0.35f;
89089 num4 *= num8;
89090 num5 *= num8;
89091 num6 *= num8;
89092 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, num4, num5, num6);
89093 }
89094 if ((type >= 254 && type <= 261) || type == 634 || type == 635)
89095 {
89096 float num9 = (float)Main.rand.Next(28, 42) * 0.005f;
89097 num9 += (float)(270 - Main.mouseTextColor) / 500f;
89098 float num10 = 0.1f;
89099 float num11 = 0.3f + num9 / 2f;
89100 float num12 = 0.6f + num9;
89101 float num13 = 0.35f;
89102 if (type == 634)
89103 {
89104 num13 = 0.65f;
89105 }
89106 num10 *= num13;
89107 num11 *= num13;
89108 num12 *= num13;
89109 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, num10, num11, num12);
89110 }
89111 if (type == 209)
89112 {
89113 float num14 = (float)Main.rand.Next(28, 42) * 0.005f;
89114 num14 += (float)(270 - Main.mouseTextColor) / 500f;
89115 float num15 = 0.1f;
89116 float num16 = 0.3f + num14 / 2f;
89117 float num17 = 0.4f + num14 / 2f;
89118 float num18 = 0.35f;
89119 num15 *= num18;
89120 num16 *= num18;
89121 num17 *= num18;
89122 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, num15, num16, num17);
89123 if (ai[0] == 12f)
89124 {
89125 Lighting.AddLight(base.Top, 0.3f, 0.1f, 0.1f);
89126 }
89127 }
89128 if (type == 44)
89129 {
89130 Lighting.AddLight((int)(position.X + (float)(width / 2)) / 16, (int)(position.Y + 4f) / 16, 0.9f, 0.75f, 0.5f);
89131 }
89132 }
Vector2 position
Definition Entity.cs:14
Vector2 netOffset
Definition NPC.cs:103
int townNpcVariationIndex
Definition NPC.cs:101
float[] ai
Definition NPC.cs:447
int type
Definition NPC.cs:445
Color color
Definition NPC.cs:487

References Terraria.Lighting.AddLight(), Microsoft.Xna.Framework.Color.B, Microsoft.Xna.Framework.Graphics.Color, Terraria.Main.dust, Microsoft.Xna.Framework.Color.G, Terraria.Lighting.GetColor(), Terraria.Main.mouseTextColor, Terraria.Dust.NewDust(), Microsoft.Xna.Framework.Color.R, Terraria.Main.rand, and System.type.