You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Set a stat on the developer console which can be displayed on-screen",
2543
+
Parameter.Create("name","Name of the stat"),
2544
+
Parameter.Create("expression","The C# expression to evaluate"),
2545
+
(name,expression)=>
2546
+
{
2547
+
if(name==null||expression==null)
2548
+
{
2549
+
DevConsole.LogError("Parameters cannot be null.");
2550
+
return;
2551
+
}
2552
+
2553
+
if(!expression.EndsWith(";"))
2554
+
{
2555
+
expression+=";";
2556
+
}
2557
+
2558
+
_stats[name]=expression;
2559
+
DevConsole.LogSuccess($"Successfully set {name} as a developer console stat.");
2560
+
}
2561
+
));
2562
+
2563
+
AddCommand(Command.Create<string>(
2564
+
"stats_evaluate",
2565
+
"stats_eval",
2566
+
"Evaluate one of the developer console stats",
2567
+
Parameter.Create("name","Name of the stat"),
2568
+
name =>
2569
+
{
2570
+
if(!_stats.ContainsKey(name))
2571
+
{
2572
+
DevConsole.LogError($"Could not find {name}. Use {GetCommand("stats_display").GetFormattedName()} to display a list of all developer console stats.");
2573
+
return;
2574
+
}
2575
+
2576
+
RunCommand($"cs_evaluate {_stats[name]}");
2577
+
}
2578
+
));
2579
+
2580
+
AddCommand(Command.Create<string>(
2581
+
"stats_remove",
2582
+
"",
2583
+
"Remove a stat from the developer console",
2584
+
Parameter.Create("name","Name of the stat"),
2585
+
name =>
2586
+
{
2587
+
if(!_stats.Remove(name))
2588
+
{
2589
+
DevConsole.LogError($"Could not remove {name}. Use {GetCommand("stats_display").GetFormattedName()} to display a list of all developer console stats.");
2590
+
return;
2591
+
}
2592
+
2593
+
_hiddenStats.Remove(name);
2594
+
_cachedStats.Remove(name);
2595
+
DevConsole.LogSuccess($"Successfully removed {name} from the developer console stats.");
2596
+
}
2597
+
));
2598
+
2599
+
AddCommand(Command.Create<string,bool?>(
2600
+
"stats_toggle",
2601
+
"",
2602
+
"Set whether a particular developer console stat should be displayed or not",
2603
+
Parameter.Create("name","Name of the stat"),
2604
+
Parameter.Create("display",""),
2605
+
(name,b)=>
2606
+
{
2607
+
if(!_stats.ContainsKey(name))
2608
+
{
2609
+
DevConsole.LogError($"Could not find {name}. Use {GetCommand("stats_display").GetFormattedName()} to display a list of all developer console stats.");
2610
+
return;
2611
+
}
2612
+
2613
+
// Flip
2614
+
if(!b.HasValue)
2615
+
{
2616
+
b=_hiddenStats.Contains(name);
2617
+
}
2618
+
2619
+
if(b.Value)
2620
+
{
2621
+
_hiddenStats.Remove(name);
2622
+
}
2623
+
else
2624
+
{
2625
+
_hiddenStats.Add(name);
2626
+
}
2627
+
2628
+
DevConsole.LogSuccess($"{(b.Value?"Enabled":"Disabled")} the on-screen developer console stats display for {name}.");
0 commit comments