aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn
diff options
context:
space:
mode:
Diffstat (limited to 'ShiftOS_TheReturn')
-rw-r--r--ShiftOS_TheReturn/AppLauncherDaemon.cs20
-rw-r--r--ShiftOS_TheReturn/KernelWatchdog.cs38
-rw-r--r--ShiftOS_TheReturn/Scripting.cs7
3 files changed, 58 insertions, 7 deletions
diff --git a/ShiftOS_TheReturn/AppLauncherDaemon.cs b/ShiftOS_TheReturn/AppLauncherDaemon.cs
index 7ef34c1..5e3bd72 100644
--- a/ShiftOS_TheReturn/AppLauncherDaemon.cs
+++ b/ShiftOS_TheReturn/AppLauncherDaemon.cs
@@ -66,12 +66,24 @@ namespace ShiftOS.Engine
{
foreach (var attr in type.GetCustomAttributes(false))
{
- if (attr is LauncherAttribute)
+ bool isAllowed = true;
+ if(attr is MultiplayerOnlyAttribute)
{
- var launch = attr as LauncherAttribute;
- if (launch.UpgradeInstalled)
+ if(KernelWatchdog.MudConnected == false)
{
- win.Add(new LauncherItem { DisplayData = launch, LaunchType = type });
+ isAllowed = false;
+
+ }
+ }
+ if (isAllowed == true)
+ {
+ if (attr is LauncherAttribute)
+ {
+ var launch = attr as LauncherAttribute;
+ if (launch.UpgradeInstalled)
+ {
+ win.Add(new LauncherItem { DisplayData = launch, LaunchType = type });
+ }
}
}
}
diff --git a/ShiftOS_TheReturn/KernelWatchdog.cs b/ShiftOS_TheReturn/KernelWatchdog.cs
index 1b59b25..e69c9ba 100644
--- a/ShiftOS_TheReturn/KernelWatchdog.cs
+++ b/ShiftOS_TheReturn/KernelWatchdog.cs
@@ -25,8 +25,44 @@ namespace ShiftOS.Engine
}
}
+ private static bool _mudConnected = true;
+
public static bool InKernelMode { get; private set; }
- public static bool MudConnected { get; set; }
+ public static bool MudConnected
+ {
+ get
+ {
+ return _mudConnected;
+ }
+ set
+ {
+ if(value == false)
+ {
+ foreach(var win in AppearanceManager.OpenForms)
+ {
+ foreach(var attr in win.ParentWindow.GetType().GetCustomAttributes(true))
+ {
+ if(attr is MultiplayerOnlyAttribute)
+ {
+ ConsoleEx.Bold = true;
+ ConsoleEx.Underline = false;
+ ConsoleEx.Italic = true;
+ ConsoleEx.ForegroundColor = ConsoleColor.Red;
+ Console.Write("Error:");
+ ConsoleEx.Bold = false;
+ ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow;
+ Console.WriteLine("Cannot disconnect from multi-user domain because an app that depends on it is open.");
+ TerminalBackend.PrintPrompt();
+ return;
+ }
+ }
+ }
+ }
+
+ _mudConnected = value;
+ Desktop.PopulateAppLauncher();
+ }
+ }
public static bool IsSafe(Type type)
{
diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs
index bb65dc7..6768efb 100644
--- a/ShiftOS_TheReturn/Scripting.cs
+++ b/ShiftOS_TheReturn/Scripting.cs
@@ -67,11 +67,14 @@ namespace ShiftOS.Engine.Scripting
{
ServerManager.MessageReceived += (msg) =>
{
- if(msg.Name == "run")
+ if (msg.Name == "run")
{
var cntnts = JsonConvert.DeserializeObject<dynamic>(msg.Contents);
var interp = new LuaInterpreter();
- interp.Execute(cntnts.script.ToString());
+ Desktop.InvokeOnWorkerThread(() =>
+ {
+ interp.Execute(cntnts.script.ToString());
+ });
}
};
}