Add a /wind command for changing the wind speed
This commit is contained in:
parent
dcaac6365c
commit
af3f5ef954
2 changed files with 29 additions and 15 deletions
|
|
@ -466,6 +466,10 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
HelpText = "Sets the world time."
|
HelpText = "Sets the world time."
|
||||||
});
|
});
|
||||||
|
add(new Command(Permissions.wind, Wind, "wind")
|
||||||
|
{
|
||||||
|
HelpText = "Changes the wind speed."
|
||||||
|
});
|
||||||
add(new Command(Permissions.worldinfo, WorldInfo, "world")
|
add(new Command(Permissions.worldinfo, WorldInfo, "world")
|
||||||
{
|
{
|
||||||
HelpText = "Shows information about the current world."
|
HelpText = "Shows information about the current world."
|
||||||
|
|
@ -656,21 +660,6 @@ namespace TShockAPI
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static char GetEscape(char c)
|
|
||||||
{
|
|
||||||
switch (c)
|
|
||||||
{
|
|
||||||
case '\\':
|
|
||||||
return '\\';
|
|
||||||
case '"':
|
|
||||||
return '"';
|
|
||||||
case 't':
|
|
||||||
return '\t';
|
|
||||||
default:
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool IsWhiteSpace(char c)
|
private static bool IsWhiteSpace(char c)
|
||||||
{
|
{
|
||||||
return c == ' ' || c == '\t' || c == '\n';
|
return c == ' ' || c == '\t' || c == '\n';
|
||||||
|
|
@ -3221,6 +3210,28 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void Wind(CommandArgs args)
|
||||||
|
{
|
||||||
|
if (args.Parameters.Count != 1)
|
||||||
|
{
|
||||||
|
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /wind <speed>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float speed;
|
||||||
|
if (!float.TryParse(args.Parameters[0], out speed))
|
||||||
|
{
|
||||||
|
args.Player.SendErrorMessage("Invalid wind speed!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Main.windSpeed = speed;
|
||||||
|
Main.windSpeedSet = speed;
|
||||||
|
Main.windSpeedSpeed = 0f;
|
||||||
|
TSPlayer.All.SendData(PacketTypes.WorldInfo);
|
||||||
|
TSPlayer.All.SendInfoMessage("{0} changed the wind speed to {1}.", args.Player.Name, speed);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion Time/PvpFun Commands
|
#endregion Time/PvpFun Commands
|
||||||
|
|
||||||
#region Region Commands
|
#region Region Commands
|
||||||
|
|
|
||||||
|
|
@ -284,6 +284,9 @@ namespace TShockAPI
|
||||||
[Description("User can turn on or off the rain.")]
|
[Description("User can turn on or off the rain.")]
|
||||||
public static readonly string rain = "tshock.world.rain";
|
public static readonly string rain = "tshock.world.rain";
|
||||||
|
|
||||||
|
[Description("User can modify the wind.")]
|
||||||
|
public static readonly string wind = "tshock.world.wind";
|
||||||
|
|
||||||
// Non-grouped
|
// Non-grouped
|
||||||
|
|
||||||
[Description("User can clear items or projectiles.")]
|
[Description("User can clear items or projectiles.")]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue