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

◆ UpdateNPC_CritterSounds()

void Terraria.NPC.UpdateNPC_CritterSounds ( )
inlineprivate

Definition at line 88944 of file NPC.cs.

88945 {
88946 if (Main.netMode == 2)
88947 {
88948 return;
88949 }
88950 if (type == 611 && !Main.dayTime && Main.rand.Next(700) == 0)
88951 {
88952 SoundEngine.PlaySound(46, (int)position.X, (int)position.Y);
88953 }
88954 if (type >= 602 && type <= 603 && Main.dayTime && Main.rand.Next(1200) == 0)
88955 {
88956 SoundEngine.PlaySound(44, (int)position.X, (int)position.Y);
88957 }
88958 if (type >= 362 && type <= 365)
88959 {
88960 if (Main.dayTime && Main.rand.Next(200) == 0)
88961 {
88962 SoundEngine.PlaySound(30, (int)position.X, (int)position.Y);
88963 }
88964 }
88965 else if (type == 361 || type == 445 || type == 687)
88966 {
88967 if ((double)Math.Abs(velocity.X) < 0.5 && (!Main.dayTime || (double)position.Y > Main.worldSurface * 16.0) && Main.rand.Next(200) == 0)
88968 {
88969 SoundEngine.PlaySound(31, (int)position.X, (int)position.Y);
88970 }
88971 }
88972 else if (type == 74 || type == 297 || type == 298 || type == 442 || type == 671 || type == 672 || type == 673 || type == 674 || type == 675)
88973 {
88974 if (!Main.dayTime || !(Main.time < 18000.0))
88975 {
88976 return;
88977 }
88978 int maxValue = 400;
88979 if (Main.rand.Next(maxValue) != 0)
88980 {
88981 return;
88982 }
88983 if (type == 74)
88984 {
88985 if (Main.rand.Next(3) != 0)
88986 {
88987 SoundEngine.PlaySound(32, (int)position.X, (int)position.Y, 14);
88988 }
88989 else
88990 {
88991 SoundEngine.PlaySound(32, (int)position.X, (int)position.Y, 18);
88992 }
88993 }
88994 if (type == 297)
88995 {
88996 SoundEngine.PlaySound(32, (int)position.X, (int)position.Y, 16);
88997 }
88998 if (type == 298)
88999 {
89000 if (Main.rand.Next(3) != 0)
89001 {
89002 SoundEngine.PlaySound(32, (int)position.X, (int)position.Y, 17);
89003 }
89004 else
89005 {
89006 SoundEngine.PlaySound(32, (int)position.X, (int)position.Y, 19);
89007 }
89008 }
89009 if (type == 674 || type == 675)
89010 {
89011 SoundEngine.PlaySound(67, (int)position.X, (int)position.Y);
89012 }
89013 if (type == 671 || type == 672)
89014 {
89015 SoundEngine.PlaySound(68, (int)position.X, (int)position.Y);
89016 }
89017 if (type == 673)
89018 {
89019 SoundEngine.PlaySound(69, (int)position.X, (int)position.Y);
89020 }
89021 if (type == 442)
89022 {
89023 switch (Main.rand.Next(5))
89024 {
89025 case 0:
89026 SoundEngine.PlaySound(32, (int)position.X, (int)position.Y, 16);
89027 break;
89028 case 1:
89029 SoundEngine.PlaySound(32, (int)position.X, (int)position.Y, 17);
89030 break;
89031 case 2:
89032 SoundEngine.PlaySound(32, (int)position.X, (int)position.Y, 19);
89033 break;
89034 case 3:
89035 SoundEngine.PlaySound(32, (int)position.X, (int)position.Y, 14);
89036 break;
89037 default:
89038 SoundEngine.PlaySound(32, (int)position.X, (int)position.Y, 18);
89039 break;
89040 }
89041 }
89042 }
89043 else if ((type == 300 || type == 447 || type == 610) && Main.rand.Next(1800) == 0)
89044 {
89045 SoundEngine.PlaySound(33, (int)position.X, (int)position.Y);
89046 }
89047 }
static double Abs(double value)
static void PlaySound(int type, Vector2 position, int style=1)
Vector2 velocity
Definition Entity.cs:16
Vector2 position
Definition Entity.cs:14
int type
Definition NPC.cs:445

References System.Math.Abs(), Terraria.Main.dayTime, Terraria.Main.netMode, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.rand, Terraria.Main.time, System.type, and Terraria.Main.worldSurface.