diff --git a/TShockAPI/LuaSystem/LuaLoader.cs b/TShockAPI/LuaSystem/LuaLoader.cs new file mode 100644 index 00000000..ca8c20f4 --- /dev/null +++ b/TShockAPI/LuaSystem/LuaLoader.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using LuaInterface; + +namespace TShockAPI.LuaSystem +{ + public class LuaLoader + { + private Lua Lua = null; + public string LuaPath = ""; + public LuaLoader(string path) + { + Lua = new Lua(); + LuaPath = path; + SendLuaDebugMsg("Lua 5.1 (serverside) initialized."); + } + + public void LoadServerAutoruns() + { + foreach (string s in Directory.GetFiles(Path.Combine(LuaPath, "autorun"))) + { + Lua.DoFile(s); + SendLuaDebugMsg("Loaded file: " + s); + } + } + + public void SendLuaDebugMsg(string s) + { + ConsoleColor previousColor = Console.ForegroundColor; + Console.ForegroundColor = ConsoleColor.Cyan; + Console.WriteLine("Lua: " + s); + Console.ForegroundColor = previousColor; + } + } +} diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs index 6ccd4fac..05b4b6aa 100644 --- a/TShockAPI/Properties/AssemblyInfo.cs +++ b/TShockAPI/Properties/AssemblyInfo.cs @@ -48,5 +48,5 @@ using System.Runtime.InteropServices; // Build Number // MMdd of the build -[assembly: AssemblyVersion("3.4.2.0102")] -[assembly: AssemblyFileVersion("3.4.2.0102")] \ No newline at end of file +[assembly: AssemblyVersion("3.4.2.0103")] +[assembly: AssemblyFileVersion("3.4.2.0103")] \ No newline at end of file diff --git a/TShockAPI/StatTracker.cs b/TShockAPI/StatTracker.cs index 27ede224..353c8f19 100644 --- a/TShockAPI/StatTracker.cs +++ b/TShockAPI/StatTracker.cs @@ -86,7 +86,7 @@ namespace TShockAPI Environment.OSVersion + "&mono=" + Main.runningMono + "&port=" + Netplay.serverPort + "&plcount=" + TShock.Utils.ActivePlayers()); } - Log.ConsoleInfo("Stat Tracker: " + response + "\n"); + Log.ConsoleInfo("Stat Tracker: " + response); } catch (Exception e) { diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 7a7dbb5a..7f8571cf 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -31,6 +31,7 @@ using MaxMind; using Mono.Data.Sqlite; using MySql.Data.MySqlClient; using Rests; +using TShockAPI.LuaSystem; using Terraria; using TShockAPI.DB; using TShockAPI.Net; @@ -64,6 +65,7 @@ namespace TShockAPI public static RestManager RestManager; public static Utils Utils = new Utils(); public static StatTracker StatTracker = new StatTracker(); + public static LuaLoader LuaLoader; /// /// Called after TShock is initialized. Useful for plugins that needs hooks before tshock but also depend on tshock being loaded. @@ -418,8 +420,8 @@ namespace TShockAPI RestApi.Start(); StatTracker.CheckIn(); - FixChestStacks(); + LuaLoader = new LuaLoader(Path.Combine(".", "lua")); } private void FixChestStacks() diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj index 461cff5e..25220392 100644 --- a/TShockAPI/TShockAPI.csproj +++ b/TShockAPI/TShockAPI.csproj @@ -53,6 +53,9 @@ ..\HttpBins\HttpServer.dll + + ..\LuaBins\LuaInterface.dll + ..\SqlBins\Mono.Data.Sqlite.dll @@ -107,6 +110,7 @@ + @@ -187,7 +191,7 @@ - +