(Probably) fix invasions started by TShock being weird

TShock used to call the StartInvasion method in Main with a type
and a size, but then in some update it stopped taking a size. So
you have to change a field to change the size, but the problem is
that the field is reset when StartInavsion is called. This means
that any effort to manually change the size would have failed due
to the fact that the field is reset at the end. The order has been
changed to account for this.

In addition, the start size is now set, so the game can report
progress correctly on the current invasion.
This commit is contained in:
Lucas Nicodemus 2017-12-14 08:08:57 -07:00
parent 3f22c52698
commit 5f647f087c
2 changed files with 9 additions and 2 deletions

View file

@ -1465,6 +1465,7 @@ namespace TShockAPI
if (TShock.Config.InfiniteInvasion)
{
// Not really an infinite size
invasionSize = 20000000;
}
else
@ -1472,10 +1473,15 @@ namespace TShockAPI
invasionSize = 100 + (TShock.Config.InvasionMultiplier * ActivePlayers());
}
// Note: This is a workaround to previously providing the size as a parameter in StartInvasion
Main.invasionSize = invasionSize;
// Order matters
// StartInvasion will reset the invasion size
Main.StartInvasion(type);
// Note: This is a workaround to previously providing the size as a parameter in StartInvasion
// Have to set start size to report progress correctly
Main.invasionSizeStart = invasionSize;
Main.invasionSize = invasionSize;
}
/// <summary>Verifies that each stack in each chest is valid and not over the max stack count.</summary>