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

◆ Update()

void Terraria.GameContent.Ambience.AmbienceServer.Update ( )
inline

Definition at line 96 of file AmbienceServer.cs.

97 {
100 {
101 _updatesUntilNextAttempt -= Main.dayRate;
102 return;
103 }
106 where pair.Value()
107 select pair.Key;
108 if (source.Count((SkyEntityType type) => true) == 0)
109 {
110 return;
111 }
113 if (player == null)
114 {
115 return;
116 }
118 int num = source2.Count((SkyEntityType type) => true);
119 if (num == 0 || Main.rand.Next(5) < 3)
120 {
122 num = source2.Count((SkyEntityType type) => true);
123 }
124 if (num != 0)
125 {
126 SkyEntityType type2 = source2.ElementAt(Main.rand.Next(num));
127 SpawnForPlayer(player, type2);
128 }
129 }
static void FindPlayerThatCanSeeBackgroundAmbience(out Player player)
bool IsPlayerAtRightHeightForType(SkyEntityType type, Player plr)
readonly Dictionary< SkyEntityType, Func< Player, bool > > _secondarySpawnConditionsPerPlayer
readonly Dictionary< SkyEntityType, Func< bool > > _spawnConditions
void SpawnForPlayer(Player player, SkyEntityType type)

References Terraria.GameContent.Ambience.AmbienceServer._secondarySpawnConditionsPerPlayer, Terraria.GameContent.Ambience.AmbienceServer._spawnConditions, Terraria.GameContent.Ambience.AmbienceServer._updatesUntilNextAttempt, System.Collections.Generic.Dictionary< TKey, TValue >.ContainsKey(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, Terraria.Main.dayRate, Terraria.GameContent.Ambience.AmbienceServer.FindPlayerThatCanSeeBackgroundAmbience(), Terraria.GameContent.Ambience.AmbienceServer.IsPlayerAtRightHeightForType(), Terraria.Main.rand, Terraria.GameContent.Ambience.AmbienceServer.ResetSpawnTime(), System.Linq.source, Terraria.GameContent.Ambience.AmbienceServer.SpawnForcedEntities(), Terraria.GameContent.Ambience.AmbienceServer.SpawnForPlayer(), and System.type.

Referenced by Terraria.Main.DoUpdate().