Add WorldTileProvider to tshock config

This allows the tshock tile providers to be switched via the config instead of cli args via tsapi, for environments where the command line args cannot be changed.
This commit is contained in:
Luke 2022-11-12 07:28:26 +10:00
parent 5d84192624
commit 0f46b1255a
3 changed files with 18 additions and 0 deletions

View file

@ -55,6 +55,10 @@ namespace TShockAPI.Configuration
[Description("Allows stacks in chests to go beyond the stack limit during world loading.")]
public bool IgnoreChestStacksOnLoad = false;
/// <summary>Allows changing of the default world tile provider.</summary>
[Description("Allows changing of the default world tile provider.")]
public string WorldTileProvider = "default";
#endregion

View file

@ -383,6 +383,19 @@ namespace TShockAPI
if (Config.Settings.EnableGeoIP && File.Exists(geoippath))
Geo = new GeoIPCountry(geoippath);
// check if a custom tile provider is to be used
switch(Config.Settings.WorldTileProvider)
{
case "heaptile":
Log.ConsoleInfo(GetString($"Using {nameof(HeapTile)} for tile implementation"), TraceLevel.Info);
Main.tile = new TileProvider();
break;
case "constileation":
Log.ConsoleInfo(GetString($"Using {nameof(ConstileationProvider)} for tile implementation"), TraceLevel.Info);
Main.tile = new ConstileationProvider();
break;
}
Log.ConsoleInfo(GetString("TShock {0} ({1}) now running.", Version, VersionCodename));
ServerApi.Hooks.GamePostInitialize.Register(this, OnPostInit);

View file

@ -79,6 +79,7 @@ Use past tense when adding new entries; sign your name off when you add or chang
## Upcoming changes
* Your changes could be here!
* Added `WorldTileProvider` to the tshock config with values `default`, `constileation` or `heaptile`. This allows tile providers to be changed in environments where CLI args cannot be altered. See the documentation website for more info about these providers. (@SignatureBeef)
## TShock 5.1.2
* Added support for Terraria 1.4.4.8.1 via OTAPI 3.1.19. (@SignatureBeef)