Define CVars in a central location.
Instead of a bunch of RegisterCVar<> calls, it's now similar to Key Functions.
This commit is contained in:
66
Content.Benchmarks/DynamicTreeBenchmark.cs
Normal file
66
Content.Benchmarks/DynamicTreeBenchmark.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics;
|
||||
|
||||
namespace Content.Benchmarks
|
||||
{
|
||||
[SimpleJob, MemoryDiagnoser]
|
||||
public class DynamicTreeBenchmark
|
||||
{
|
||||
private static readonly Box2[] aabbs1 =
|
||||
{
|
||||
((Box2) default).Enlarged(1), //2x2 square
|
||||
((Box2) default).Enlarged(2), //4x4 square
|
||||
new Box2(-3, 3, -3, 3), // point off to the bottom left
|
||||
new Box2(-3, -3, -3, -3), // point off to the top left
|
||||
new Box2(3, 3, 3, 3), // point off to the bottom right
|
||||
new Box2(3, -3, 3, -3), // point off to the top right
|
||||
((Box2) default).Enlarged(1), //2x2 square
|
||||
((Box2) default).Enlarged(2), //4x4 square
|
||||
((Box2) default).Enlarged(1), //2x2 square
|
||||
((Box2) default).Enlarged(2), //4x4 square
|
||||
((Box2) default).Enlarged(1), //2x2 square
|
||||
((Box2) default).Enlarged(2), //4x4 square
|
||||
((Box2) default).Enlarged(1), //2x2 square
|
||||
((Box2) default).Enlarged(2), //4x4 square
|
||||
((Box2) default).Enlarged(3), //6x6 square
|
||||
new Box2(-3, 3, -3, 3), // point off to the bottom left
|
||||
new Box2(-3, -3, -3, -3), // point off to the top left
|
||||
new Box2(3, 3, 3, 3), // point off to the bottom right
|
||||
new Box2(3, -3, 3, -3), // point off to the top right
|
||||
};
|
||||
|
||||
private B2DynamicTree<int> _b2Tree;
|
||||
private DynamicTree<int> _tree;
|
||||
|
||||
[GlobalSetup]
|
||||
public void Setup()
|
||||
{
|
||||
_b2Tree = new B2DynamicTree<int>();
|
||||
_tree = new DynamicTree<int>((in int value) => aabbs1[value], capacity: 16);
|
||||
|
||||
for (var i = 0; i < aabbs1.Length; i++)
|
||||
{
|
||||
var aabb = aabbs1[i];
|
||||
_b2Tree.CreateProxy(aabb, i);
|
||||
_tree.Add(i);
|
||||
}
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
public void BenchB2()
|
||||
{
|
||||
object state = null;
|
||||
_b2Tree.Query(ref state, (ref object _, DynamicTree.Proxy __) => true, new Box2(-1, -1, 1, 1));
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
public void BenchQ()
|
||||
{
|
||||
foreach (var _ in _tree.QueryAabb(new Box2(-1, -1, 1, 1), true))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Server.Mobs;
|
||||
using Content.Server.Mobs.Roles;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared;
|
||||
using Content.Shared.Chat;
|
||||
using Content.Shared.Network.NetMessages;
|
||||
using Content.Shared.Preferences;
|
||||
@@ -128,13 +129,6 @@ namespace Content.Server.GameTicking
|
||||
|
||||
DebugTools.Assert(!_initialized);
|
||||
|
||||
_configurationManager.RegisterCVar("game.lobbyenabled", false, CVar.ARCHIVE);
|
||||
_configurationManager.RegisterCVar("game.lobbyduration", 20, CVar.ARCHIVE);
|
||||
_configurationManager.RegisterCVar("game.defaultpreset", "Suspicion", CVar.ARCHIVE);
|
||||
_configurationManager.RegisterCVar("game.fallbackpreset", "Sandbox", CVar.ARCHIVE);
|
||||
|
||||
_configurationManager.RegisterCVar("game.enablewin", true, CVar.CHEAT);
|
||||
|
||||
PresetSuspicion.RegisterCVars(_configurationManager);
|
||||
|
||||
_netManager.RegisterNetMessage<MsgTickerJoinLobby>(nameof(MsgTickerJoinLobby));
|
||||
@@ -147,7 +141,7 @@ namespace Content.Server.GameTicking
|
||||
_netManager.RegisterNetMessage<MsgRequestWindowAttention>(nameof(MsgRequestWindowAttention));
|
||||
_netManager.RegisterNetMessage<MsgTickerLateJoinStatus>(nameof(MsgTickerLateJoinStatus));
|
||||
|
||||
SetStartPreset(_configurationManager.GetCVar<string>("game.defaultpreset"));
|
||||
SetStartPreset(_configurationManager.GetCVar(CCVars.GameLobbyDefaultPreset));
|
||||
|
||||
RestartRound();
|
||||
|
||||
|
||||
25
Content.Shared/CCVars.cs
Normal file
25
Content.Shared/CCVars.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Robust.Shared;
|
||||
using Robust.Shared.Configuration;
|
||||
|
||||
namespace Content.Shared
|
||||
{
|
||||
// ReSharper disable once InconsistentNaming
|
||||
[CVarDefs]
|
||||
public sealed class CCVars : CVars
|
||||
{
|
||||
public static readonly CVarDef<bool>
|
||||
GameLobbyEnabled = CVarDef.Create("game.lobbyenabled", false, CVar.ARCHIVE);
|
||||
|
||||
public static readonly CVarDef<int>
|
||||
GameLobbyDuration = CVarDef.Create("game.lobbyduration", 20, CVar.ARCHIVE);
|
||||
|
||||
public static readonly CVarDef<string>
|
||||
GameLobbyDefaultPreset = CVarDef.Create("game.defaultpreset", "Suspicion", CVar.ARCHIVE);
|
||||
|
||||
public static readonly CVarDef<string>
|
||||
GameLobbyFallbackPreset = CVarDef.Create("game.fallbackpreset", "Sandbox", CVar.ARCHIVE);
|
||||
|
||||
public static readonly CVarDef<bool>
|
||||
GameLobbyEnableWin = CVarDef.Create("game.enablewin", true, CVar.ARCHIVE);
|
||||
}
|
||||
}
|
||||
39
auth.ps1
Executable file
39
auth.ps1
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
# Old version
|
||||
<#
|
||||
# Constants
|
||||
$loginToken = "kSiBszXoB5hOQBAMBC//f2YcxD76Ec36rlKy+f8sjhY="
|
||||
$authServer = "http://localhost:5000/"
|
||||
$localServer = "http://localhost:1212/"
|
||||
$userName = "PJB"
|
||||
|
||||
$authUrl = $authServer + "api/session/getToken"
|
||||
$localUrl = $localServer + "info"
|
||||
|
||||
$pubKey = Invoke-WebRequest $localUrl |
|
||||
select -exp Content |
|
||||
ConvertFrom-Json |
|
||||
select -exp auth |
|
||||
select -exp public_key
|
||||
|
||||
$postData = @{"ServerPublicKey"=$pubkey} | ConvertTo-Json
|
||||
|
||||
$token = Invoke-WebRequest $authUrl `
|
||||
-Method Post -Body $postData `
|
||||
-Headers @{"Authorization"="SS14Auth $loginToken"} `
|
||||
-ContentType "application/json" |
|
||||
select -exp Content
|
||||
|
||||
echo $token
|
||||
|
||||
bin/Content.Client/Content.Client --launcher --username $userName `
|
||||
--cvar "auth.token=$token" `
|
||||
--cvar "auth.serverpubkey=$pubKey"
|
||||
#>
|
||||
|
||||
$loginToken = "kSiBszXoB5hOQBAMBC//f2YcxD76Ec36rlKy+f8sjhY="
|
||||
$authServer = "http://localhost:5000/"
|
||||
$userName = "PJB"
|
||||
$userId = "957ebebb-1a06-4a6e-b8ae-f76d98d01adf"
|
||||
|
||||
Reference in New Issue
Block a user