Skip to content

Commit

Permalink
Apply patch from #3018
Browse files Browse the repository at this point in the history
This applies #3018 as a patch per @punchready because they deleted the head repository so that we can't merge it and none of the git objects have valid refs anymore on the command line and we can't merge it on the gui.
  • Loading branch information
hakusaro committed Jan 25, 2025
1 parent 2952762 commit b984ff8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions TShockAPI/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4622,21 +4622,22 @@ private static void Wind(CommandArgs args)
{
if (args.Parameters.Count != 1)
{
args.Player.SendErrorMessage(GetString("Invalid syntax. Proper syntax: {0}wind <speed>.", Specifier));
args.Player.SendErrorMessage(GetString("Invalid syntax. Proper syntax: {0}wind <speed in mph>.", Specifier));
return;
}

int speed;
if (!int.TryParse(args.Parameters[0], out speed) || speed * 100 < 0)
float mph;
if (!float.TryParse(args.Parameters[0], out mph) || mph is < -40f or > 40f)
{
args.Player.SendErrorMessage(GetString("Invalid wind speed."));
args.Player.SendErrorMessage(GetString("Invalid wind speed (must be between -40 and 40)."));
return;
}

float speed = mph / 50f; // -40 to 40 mph -> -0.8 to 0.8
Main.windSpeedCurrent = speed;
Main.windSpeedTarget = speed;
TSPlayer.All.SendData(PacketTypes.WorldInfo);
TSPlayer.All.SendInfoMessage(GetString("{0} changed the wind speed to {1}.", args.Player.Name, speed));
TSPlayer.All.SendInfoMessage(GetString("{0} changed the wind speed to {1}mph.", args.Player.Name, mph));
}

#endregion Time/PvpFun Commands
Expand Down
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Use past tense when adding new entries; sign your name off when you add or chang
* Changed the use of `Player.active` to `TSPlayer.Active` for consistency. (@sgkoishi, #2939)
* Fix typo in config for IP bans. (@redchess64)
* Fixed unable to transfer long response body for REST API. (@sgkoishi, #2925)
* Fixed the `/wind` command not being very helpful. (@punchready)

## TShock 5.2.1
* Updated `TSPlayer.GodMode`. (@AgaSpace)
Expand Down

0 comments on commit b984ff8

Please sign in to comment.