From 8db3a2e11c6cc58adb2b62fbce1c1f63426b674c Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 9 Mar 2017 09:48:45 -0500 Subject: [PATCH] Server-side scripts now get ran. --- ShiftOS_TheReturn/Scripting.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs index 3ecf9d9..940e998 100644 --- a/ShiftOS_TheReturn/Scripting.cs +++ b/ShiftOS_TheReturn/Scripting.cs @@ -63,6 +63,19 @@ namespace ShiftOS.Engine.Scripting public dynamic Lua = new DynamicLua.DynamicLua(); public bool Running = true; + static LuaInterpreter() + { + ServerManager.MessageReceived += (msg) => + { + if(msg.Name == "run") + { + var cntnts = JsonConvert.DeserializeObject(msg.Contents); + var interp = new LuaInterpreter(); + interp.Execute(cntnts.script.ToString()); + } + }; + } + public static string CreateSft(string lua) { byte[] bytes = Encoding.UTF8.GetBytes(lua);