Move StartInvasion() out of the TShock main class
This commit is contained in:
parent
5cd5bdaaa0
commit
3f22c52698
4 changed files with 26 additions and 24 deletions
|
|
@ -66,6 +66,7 @@ Putting this stuff down here so things don't conflict as often.
|
|||
* Added `GetDataHandlers.ProjectileKill` hook. (@hakusaro)
|
||||
* Removed `TShock.CheckProjectilePermission` and replaced it with `TSPlayer.HasProjectilePermission` and `TSPlayer.LacksProjectilePermission` respectively. (@hakusaro)
|
||||
* Added `TSPlayer` object to `GetDataHandlers.LiquidSetEventArgs`. (@hakusaro)
|
||||
* Removed `TShock.StartInvasion` for public use (moved to Utils and marked internal). (@hakusaro)
|
||||
|
||||
## TShock 4.3.25
|
||||
* Fixed a critical exploit in the Terraria protocol that could cause massive unpreventable world corruption as well as a number of other problems. Thanks to @bartico6 for reporting. Fixed by the efforts of @QuiCM, @hakusaro, and tips in the right directioon from @bartico6.
|
||||
|
|
|
|||
|
|
@ -2044,19 +2044,19 @@ namespace TShockAPI
|
|||
case "goblin":
|
||||
case "goblins":
|
||||
TSPlayer.All.SendInfoMessage("{0} has started a goblin army invasion.", args.Player.Name);
|
||||
TShock.StartInvasion(1);
|
||||
TShock.Utils.StartInvasion(1);
|
||||
break;
|
||||
|
||||
case "snowman":
|
||||
case "snowmen":
|
||||
TSPlayer.All.SendInfoMessage("{0} has started a snow legion invasion.", args.Player.Name);
|
||||
TShock.StartInvasion(2);
|
||||
TShock.Utils.StartInvasion(2);
|
||||
break;
|
||||
|
||||
case "pirate":
|
||||
case "pirates":
|
||||
TSPlayer.All.SendInfoMessage("{0} has started a pirate invasion.", args.Player.Name);
|
||||
TShock.StartInvasion(3);
|
||||
TShock.Utils.StartInvasion(3);
|
||||
break;
|
||||
|
||||
case "pumpkin":
|
||||
|
|
@ -2098,7 +2098,7 @@ namespace TShockAPI
|
|||
case "martian":
|
||||
case "martians":
|
||||
TSPlayer.All.SendInfoMessage("{0} has started a martian invasion.", args.Player.Name);
|
||||
TShock.StartInvasion(4);
|
||||
TShock.Utils.StartInvasion(4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1755,27 +1755,7 @@ namespace TShockAPI
|
|||
}
|
||||
|
||||
|
||||
/// <summary>StartInvasion - Starts an invasion on the server.</summary>
|
||||
/// <param name="type">type - The invasion type id.</param>
|
||||
//TODO: Why is this in TShock's main class?
|
||||
public static void StartInvasion(int type)
|
||||
{
|
||||
int invasionSize = 0;
|
||||
|
||||
if (Config.InfiniteInvasion)
|
||||
{
|
||||
invasionSize = 20000000;
|
||||
}
|
||||
else
|
||||
{
|
||||
invasionSize = 100 + (Config.InvasionMultiplier * Utils.ActivePlayers());
|
||||
}
|
||||
|
||||
// Note: This is a workaround to previously providing the size as a parameter in StartInvasion
|
||||
Main.invasionSize = invasionSize;
|
||||
|
||||
Main.StartInvasion(type);
|
||||
}
|
||||
|
||||
/// <summary>CheckRangePermission - Checks if a player has permission to modify a tile dependent on range checks.</summary>
|
||||
/// <param name="player">player - The TSPlayer object.</param>
|
||||
|
|
|
|||
|
|
@ -1457,6 +1457,27 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>Starts an invasion on the server.</summary>
|
||||
/// <param name="type">The invasion type id.</param>
|
||||
internal void StartInvasion(int type)
|
||||
{
|
||||
int invasionSize = 0;
|
||||
|
||||
if (TShock.Config.InfiniteInvasion)
|
||||
{
|
||||
invasionSize = 20000000;
|
||||
}
|
||||
else
|
||||
{
|
||||
invasionSize = 100 + (TShock.Config.InvasionMultiplier * ActivePlayers());
|
||||
}
|
||||
|
||||
// Note: This is a workaround to previously providing the size as a parameter in StartInvasion
|
||||
Main.invasionSize = invasionSize;
|
||||
|
||||
Main.StartInvasion(type);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that each stack in each chest is valid and not over the max stack count.</summary>
|
||||
internal void FixChestStacks()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue