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

◆ EmitDust()

static void Terraria.GameContent.Events.Sandstorm.EmitDust ( )
inlinestatic

Definition at line 175 of file Sandstorm.cs.

176 {
177 //IL_0147: Unknown result type (might be due to invalid IL or missing references)
178 //IL_014d: Unknown result type (might be due to invalid IL or missing references)
179 //IL_0152: Unknown result type (might be due to invalid IL or missing references)
180 //IL_0157: Unknown result type (might be due to invalid IL or missing references)
181 //IL_0173: Unknown result type (might be due to invalid IL or missing references)
182 //IL_01b7: Unknown result type (might be due to invalid IL or missing references)
183 //IL_01fe: Unknown result type (might be due to invalid IL or missing references)
184 //IL_024e: Unknown result type (might be due to invalid IL or missing references)
185 //IL_037a: Unknown result type (might be due to invalid IL or missing references)
186 //IL_0388: Unknown result type (might be due to invalid IL or missing references)
187 //IL_03b5: Unknown result type (might be due to invalid IL or missing references)
188 //IL_03b7: Unknown result type (might be due to invalid IL or missing references)
189 //IL_03b9: Unknown result type (might be due to invalid IL or missing references)
190 //IL_03be: Unknown result type (might be due to invalid IL or missing references)
191 //IL_03c0: Unknown result type (might be due to invalid IL or missing references)
192 //IL_03cd: Unknown result type (might be due to invalid IL or missing references)
193 //IL_042d: Unknown result type (might be due to invalid IL or missing references)
194 //IL_0445: Unknown result type (might be due to invalid IL or missing references)
195 //IL_044b: Unknown result type (might be due to invalid IL or missing references)
196 //IL_0501: Unknown result type (might be due to invalid IL or missing references)
197 //IL_0514: Unknown result type (might be due to invalid IL or missing references)
198 //IL_0519: Unknown result type (might be due to invalid IL or missing references)
199 //IL_0522: Unknown result type (might be due to invalid IL or missing references)
200 //IL_0527: Unknown result type (might be due to invalid IL or missing references)
201 //IL_052f: Unknown result type (might be due to invalid IL or missing references)
202 //IL_053c: Unknown result type (might be due to invalid IL or missing references)
203 //IL_0541: Unknown result type (might be due to invalid IL or missing references)
204 //IL_0549: Unknown result type (might be due to invalid IL or missing references)
205 //IL_0550: Unknown result type (might be due to invalid IL or missing references)
206 //IL_0555: Unknown result type (might be due to invalid IL or missing references)
207 //IL_0593: Unknown result type (might be due to invalid IL or missing references)
208 //IL_05a4: Unknown result type (might be due to invalid IL or missing references)
209 //IL_05ab: Unknown result type (might be due to invalid IL or missing references)
210 //IL_05b5: Unknown result type (might be due to invalid IL or missing references)
211 //IL_05ba: Unknown result type (might be due to invalid IL or missing references)
212 //IL_05bf: Unknown result type (might be due to invalid IL or missing references)
213 //IL_05c4: Unknown result type (might be due to invalid IL or missing references)
214 //IL_05c6: Unknown result type (might be due to invalid IL or missing references)
215 //IL_05d3: Unknown result type (might be due to invalid IL or missing references)
216 if (Main.gamePaused)
217 {
218 return;
219 }
220 int sandTileCount = Main.SceneMetrics.SandTileCount;
221 Player player = Main.player[Main.myPlayer];
223 HandleEffectAndSky(flag && Main.UseStormEffects);
224 if (sandTileCount < 100 || (double)player.position.Y > Main.worldSurface * 16.0 || player.ZoneBeach)
225 {
226 return;
227 }
228 int maxValue = 1;
229 if (!flag || Main.rand.Next(maxValue) != 0)
230 {
231 return;
232 }
233 int num = Math.Sign(Main.windSpeedCurrent);
234 float num8 = Math.Abs(Main.windSpeedCurrent);
235 if (num8 < 0.01f)
236 {
237 return;
238 }
239 float num9 = (float)num * MathHelper.Lerp(0.9f, 1f, num8);
240 float num10 = 2000f / (float)sandTileCount;
241 float value = 3f / num10;
242 value = MathHelper.Clamp(value, 0.77f, 1f);
243 int num11 = (int)num10;
244 float num12 = (float)Main.screenWidth / (float)Main.maxScreenW;
245 int num13 = (int)(1000f * num12);
246 float num14 = 20f * Severity;
247 float num15 = (float)num13 * (Main.gfxQuality * 0.5f + 0.5f) + (float)num13 * 0.1f - (float)Dust.SandStormCount;
248 if (num15 <= 0f)
249 {
250 return;
251 }
252 float num2 = (float)Main.screenWidth + 1000f;
253 float num3 = Main.screenHeight;
254 Vector2 vector = Main.screenPosition + player.velocity;
256 weightedRandom.Add(new Color(200, 160, 20, 180), Main.SceneMetrics.GetTileCount(53) + Main.SceneMetrics.GetTileCount(396) + Main.SceneMetrics.GetTileCount(397));
257 weightedRandom.Add(new Color(103, 98, 122, 180), Main.SceneMetrics.GetTileCount(112) + Main.SceneMetrics.GetTileCount(400) + Main.SceneMetrics.GetTileCount(398));
258 weightedRandom.Add(new Color(135, 43, 34, 180), Main.SceneMetrics.GetTileCount(234) + Main.SceneMetrics.GetTileCount(401) + Main.SceneMetrics.GetTileCount(399));
259 weightedRandom.Add(new Color(213, 196, 197, 180), Main.SceneMetrics.GetTileCount(116) + Main.SceneMetrics.GetTileCount(403) + Main.SceneMetrics.GetTileCount(402));
260 float num4 = MathHelper.Lerp(0.2f, 0.35f, Severity);
261 float num5 = MathHelper.Lerp(0.5f, 0.7f, Severity);
262 float amount = (value - 0.77f) / 0.23000002f;
263 int maxValue2 = (int)MathHelper.Lerp(1f, 10f, amount);
264 Vector2 position = default(Vector2);
265 for (int i = 0; (float)i < num14; i++)
266 {
267 if (Main.rand.Next(num11 / 4) != 0)
268 {
269 continue;
270 }
271 ((Vector2)(ref position))._002Ector(Main.rand.NextFloat() * num2 - 500f, Main.rand.NextFloat() * -50f);
272 if (Main.rand.Next(3) == 0 && num == 1)
273 {
274 position.X = Main.rand.Next(500) - 500;
275 }
276 else if (Main.rand.Next(3) == 0 && num == -1)
277 {
278 position.X = Main.rand.Next(500) + Main.screenWidth;
279 }
280 if (position.X < 0f || position.X > (float)Main.screenWidth)
281 {
282 position.Y += Main.rand.NextFloat() * num3 * 0.9f;
283 }
284 position += vector;
285 int num6 = (int)position.X / 16;
286 int num7 = (int)position.Y / 16;
287 if (!WorldGen.InWorld(num6, num7, 10) || Main.tile[num6, num7] == null)
288 {
289 continue;
290 }
291 Tile tile = Main.tile[num6, num7];
292 if (tile.wall != 0)
293 {
294 continue;
295 }
296 for (int j = 0; j < 1; j++)
297 {
298 Dust dust = Main.dust[Dust.NewDust(position, 10, 10, 268)];
299 dust.velocity.Y = 2f + Main.rand.NextFloat() * 0.2f;
300 dust.velocity.Y *= dust.scale;
301 dust.velocity.Y *= 0.35f;
302 dust.velocity.X = num9 * 5f + Main.rand.NextFloat() * 1f;
303 dust.velocity.X += num9 * num5 * 20f;
304 dust.fadeIn += num5 * 0.2f;
305 dust.velocity *= 1f + num4 * 0.5f;
306 dust.color = weightedRandom;
307 dust.velocity *= 1f + num4;
308 dust.velocity *= value;
309 dust.scale = 0.9f;
310 num15 -= 1f;
311 if (num15 <= 0f)
312 {
313 break;
314 }
315 if (Main.rand.Next(maxValue2) != 0)
316 {
317 j--;
318 position += Utils.RandomVector2(Main.rand, -10f, 10f) + dust.velocity * -1.1f;
319 num6 = (int)position.X / 16;
320 num7 = (int)position.Y / 16;
321 if (WorldGen.InWorld(num6, num7, 10) && Main.tile[num6, num7] != null)
322 {
323 tile = Main.tile[num6, num7];
324 _ = ref tile.wall;
325 }
326 }
327 }
328 if (num15 <= 0f)
329 {
330 break;
331 }
332 }
333 }
static void HandleEffectAndSky(bool toState)
Definition Sandstorm.cs:140

References Terraria.Main.dust, Terraria.Main.gamePaused, Terraria.Main.gfxQuality, Terraria.GameContent.Events.Sandstorm.HandleEffectAndSky(), Terraria.WorldGen.InWorld(), Terraria.Main.maxScreenW, Terraria.Main.myPlayer, Terraria.Dust.NewDust(), Terraria.Main.player, Terraria.Entity.position, Terraria.Main.rand, Terraria.Utils.RandomVector2(), Terraria.Dust.SandStormCount, Terraria.Dust.scale, Terraria.Main.SceneMetrics, Terraria.Main.screenHeight, Terraria.Main.screenWidth, Terraria.GameContent.Events.Sandstorm.Severity, Terraria.GameContent.Events.Sandstorm.ShouldSandstormDustPersist(), Terraria.Main.tile, Terraria.Main.UseStormEffects, Terraria.Entity.velocity, Terraria.Tile.wall, Terraria.Main.windSpeedCurrent, Terraria.Main.worldSurface, and Terraria.Player.ZoneBeach.

Referenced by Terraria.Main.DoUpdate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: