source: TFP-WebServer/MapRendering/src/Commands/EnableRendering.cs@ 457

Last change on this file since 457 was 453, checked in by alloc, 16 months ago

21.1.9 release, updated Sessions handler to be more flexible

File size: 1.1 KB
Line 
1using System.Collections.Generic;
2using JetBrains.Annotations;
3
4namespace MapRendering.Commands {
5 [UsedImplicitly]
6 public class EnableRendering : ConsoleCmdAbstract {
7 protected override string getDescription () {
8 return "Disable live map rendering";
9 }
10
11 protected override string getHelp () {
12 return @"
13 |Usage:
14 | 1. enablerendering
15 | 2. enablerendering <0/1>
16 |1. Show current state of renderer
17 |2. Disable/enable renderer
18 |NOTE: This command can only turn the renderer off, it can not turn it on if it is not enabled in the serverconfig!
19 ".Unindent ();
20 }
21
22 protected override string[] getCommands () {
23 return new[] {"enablerendering"};
24 }
25
26 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) {
27 if (_params.Count != 1) {
28 SdtdConsole.Instance.Output (
29 $"Current state: {MapRenderer.Enabled && MapRenderer.renderingEnabled}{(!MapRenderer.Enabled ? " (disabled by serverconfig!)" : "")}");
30 return;
31 }
32
33 MapRenderer.renderingEnabled = _params [0].Equals ("1");
34 SdtdConsole.Instance.Output ($"Set live map rendering to {_params [0].Equals ("1")}");
35 }
36 }
37}
Note: See TracBrowser for help on using the repository browser.