User:4e696e6a6f795844/Sandbox3

Wind is a mechanism in Terraria which influences the movement of various objects, as well as the occurance of Windy Days.

Wind speed ranges between 0 to 40 mph. The wind can blow from either the west or east. Informational accessories such as the Weather Radio show the direction the wind is blowing from, not towards (so for example, "25 mph W" means that the wind is blowing 25 mph from the west).

Wind primarily affects things that have no effect on gameplay, such as cloud movement speeds, blizzard and sandstorm background effects, and the animations of the surface of water and trees. However, it occasionally plays a part in how the game plays, such as its effects on Detonating Bubbles and its effects on players afflicted with Mighty Wind. The UFO Mount summoned by the Cosmic Car Key also seems to be slightly pushed by wind, but it is unnoticeable unless firing a weapon that bounces at a corner for a long period of time.

The Windy Day event occurs when the wind speed is 20 mph or higher, and ends when wind speed decreases below 17 mph.

The Weather Radio, Fish Finder, PDA, and Cell Phone all list the wind speed in the upper right corner of the screen.

Functionality
There are two core values in the code that control wind speed: windSpeedCurrent and windSpeedTarget. The speed at which windSpeedCurrent changes is determined by the following formula:

speed = |windSpeedTarget/50 * (1 + rain intensity * 5/9) - windSpeedCurrent/50| * 0.0015;

where windSpeedTarget and windSpeedCurrent are in the mph used by the game. The game stores both values as float values, where < 0 is eastward wind, and > 0 is westward wind. When a world is created, it will generate with winds up to but not exceeding 20mph, and a variable windCounter is set to prevent changes for the next 15 - 45 seconds. After this period is over, there are a series of random chances that the wind will increase or decrease by up to a certain amount which occurs on loop every 15 - 45 seconds (a "gust").

A second counter (extremeWindCounter) that can impact wind decreases by one each time a gust occurs. It is both reset on world generation and when an "extreme gust" occurs. When an extreme gust occurs, the target wind speed will dictate how many more extreme gusts it will take for another extreme gust to occur.

Finally, if a gust has flipped the direction of the wind, there is a 66% chance that the target wind speed will flip its direction back to the original direction it was facing in. After all these steps, the target wind speed is capped to 40 mph.

Scrapped Projectile Physics
In the game code, there is a boolean Main.windPhysics that triggers a feature where projectiles would be affected by wind. As it is disabled, there is no such feature in the game currently. Below is a detailed description of the feature's effects.

Notably, this feature would attempt to disable wind effects on the north pole, however it is unknown if this was to prevent conflict with existing code or to remove the feature outright.

all projectiles below, when on the surface, and not stuck in tiles or behind walls, will be affected by wind. This occurs only if they are moving against the current wind direction, or if their x velocity is less than wind mph * 0.36. will change their x velocity wind mph * 0.002 pixels per tick, or wind mph * 0.12 pixels per second.

Their x velocity in this state cannot exceed 16, but this limit is never reached as the max possible wind speed, 40mph, can only push projectiles up to 14.4 pixels per tick (without friction).

mph * 0.36

A second if statement can be found in the code that never triggers, nor would do anything in-game if triggered. It is presumably a leftover from testing this feature. if (Main.windPhysics) { ref x = ref base.velocity.X;	x += Main.windSpeedCurrent * Main.windPhysicsStrength; }

projectiles immune to wind physics: Space Gun 20 Water bolt 27 Retinazer's Eye Laser 83 Gastropod Lasers 84 Laser Rifle Lasers 88 Destroyer Lasers 100 Frost Staff 359 Frost Brand 119 Gem Staff Projectiles 121-126 Ice Elemental projectiles 128 Frost Hydra Frost Blast 309 Rune Wizard Rune Blasts 129 Ice Golem Frost Beam 257 Golem's Fireball/ Eye Beam 258-259 Giant Cursed Skull projectile 299 Shadowflame Hex Doll projectiles 496 Skeleton Sniper Sniper Bullet 302 Scourge of the Corruptor projectiles 306 Blizzard Staff Projectiles 337 North Pole Snowflakes 344 North Pole Spear 343 North Pole Spear 342 Ice Queen's Frost Wave 348 Ice Queen's Frost Shard 349 Mini Retina Lazer from Optic Staff 389 Brain Scrambling Bolt (Brain Scrambler's) 436 Gigazapper's Spearhead 437 Laser Machinegun 439 Maritain Saucer Lasers 449 Maritain Walker laser ray 592 Electrospehere missle (electrosphere launcher) 442 Charged Blaster Orb (Charged Blaster Cannon) 459 Moon Lord's Phantasmal Bolt 462 Lunatic Cultist Fireball/Shadow Fireball 467-468 Twinkle 538 Nebula Floater's Nebula Laser 576 Storm Diver's Vortex Laser 577 Nurse Syringes 583-584 Flying Dutchman Blowup Smoke 594 MoonLord Blowup Smoke 622 Amber Staff Amber Bolt 597 Portal Gun's Portal Bolt 601 Nebula ARcanum 617 Nebula Arcanum explosion shot 619 ^^ shot shard 620 ^^ subshot 618 Nebula Blaze 634-635 Luminite Arrow Trail 640 Luminite Arrow 639 Lunar Flare 645 Sky Fracture 660 Onyx Blaster Onyx 661 Dark Mage's Dark Energy 675 Flying Dragon's Hearty Slash projectile 684 Sky Dragon's Fury alt shot 709 Ancient Doom's Prophecy's End 593 Scutlix Laser (Scutlix Mount) 606 Storm Spear Shot (732) Thunder Zapper projectile 731

^^^ immune to wind physics

DO USE WIND PHYSICS Magical Harp notes Crystal shards from crystal bullets/the magic weapon Icy merman blast 177 Crystal Serpent Charges (521-522) Beach Ball Flares Firework Rockets 167-170 Fireworks Box Rockets All Rope Coils Bunny CAnnon's Explosive Bunnies Bubble Gun Bubbles Nail Gun Nails Bladetongue Ichor Splash Spore Sac Spore Gas Wooden Arrow1 Flaming Arrow2 Unholy Arrow4 Jester's Arrows5 Bullet14 Meteor Shots36 Harpy Harpy Feathers38 Hellfire Arrows41 Blowpipe Seeds51 Hornet STingers55 since i can use {getprojinfo} stopping names and just using nums this is alot 81 82 91 98 103 117 120 158 159 160 161 172 174 176 178 180 184 195 207 225 242 246 248 259 265 267 270 275 276 278 279 282 283 284 285 286 287 289 311 312 323 325 336 337 345 350 355 357 374 376 389 408 424 425 426 440 ??? not 439?? need to check this again 469 472 474 477 478 479 484 485 495 498 507 508 532 572 581 585 587 605 616 638 662 685 671 676 680 682 686 706 710 711 712 719 763 772 811 814 819 837 876 920 921 926 937 3 21 48 54 69 70 621 93 162 166 240 249 300 304 318 330 347 370 371 471 497 501 504 510 520 599 861 868 869 909 936 15 95 96 253 502 17 31 39 40 42 56 65 67 68 71 109 179 241 354 411 412 413 414 736 737 738 812 24 50 53 183 185 196 261 277 326 327 328 346? 352 378 400 401 402 450 473 480 483 515 538 870 928 776-801 803-810 28 29 30 37 75 102 108 133 134 135 136 137 138 139 140 141 142 143 144 164 303 338 339 340 341 397 470 516 517 519 588 637 681 773 862 863 903 904 905 906 910 911 930 43 201 202 203 204 205 527 528 529 530 531

--- Wind is a mechanism in Terraria which influences the movement of various objects.

Wind speed ranges between 0 to 40 mph, and wind can blow from either the west or east. Informational accessories such as the Weather Radio show the direction the wind is blowing from, not towards (so for example, "25 mph W" means that the wind is blowing 25 mph from the west).

Wind primarily affects things that have no effect on gameplay, such as cloud movement speeds, blizzard and sandstorm background effects, and the animations of the surface of water and trees. However, it occasionally plays a part in how the game plays, such as its effects on Detonating Bubbles and its effects on players afflicted with Mighty Wind. The UFO Mount summoned by the Cosmic Car Key also seems to be slightly pushed by wind, but it is unnoticeable unless firing a weapon that bounces at a corner for a long period of time.

The Weather Radio, Fish Finder, PDA, and Cell Phone all list the wind speed in the upper right corner of the screen.

Effects
Each tick✅ the w

--old There are two base values the game uses when determining windspeed, "windSpeed" and "windSpeedSet". windSpeedSet is a value set to determine what value windSpeed should gradually change to, but both values are used intermittently throughout the code to affect certain objects. The game takes the following steps to determine windSpeed:


 * If windSpeed is not already equal to windSpeedSet, move it closer by .001
 * Change windSpeedSpeed by a value from -.001 to .001 (-.002 to .002 when night)
 * Cap windSpeedSpeed to -.002 or .002
 * Change windSpeedTemp by windSpeedSpeed (windSpeedSpeed x 2 if raining)
 * Cap windSpeedTemp by
 * Set windSpeedSet to windSpeedTemp
 * Loop

Overall this means that there are stronger wind speeds when it is nighttime and/or raining. However, as sandstorms do not count as rain, sandstorms do not actually cause increased wind speeds. Also notable is that more clouds in the sky means higher potential for higher wind speeds, whether it is raining or not.

Wind affects the following: