Skip to content

Commit 04977af

Browse files
Merge pull request #1667 from ss14Starlight/starlight-dev
Starlight dev
2 parents 049549b + 096546e commit 04977af

2,862 files changed

Lines changed: 225124 additions & 101577 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424

2525
/Content.*/Forensics/ @ficcialfaint
2626

27+
/Content.*/Trigger/ @slarticodefast
28+
29+
/Content.*/Stunnable/ @Princess-Cheeseballs
30+
/Content.*/Nutrition/ @Princess-Cheeseballs
31+
2732
# SKREEEE
2833
/Content.*.Database/ @PJB3005 @DrSmugleaf
2934
/Content.Shared.Database/Log*.cs @PJB3005 @DrSmugleaf @crazybrain23

.github/workflows/publish-testing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
run: dotnet build Content.Packaging --configuration Release --no-restore /m
5151

5252
- name: Package server
53-
run: dotnet run --project Content.Packaging server --platform win-x64 --platform linux-x64 --platform osx-x64 --platform linux-arm64
53+
run: dotnet run --project Content.Packaging server --platform win-x64 --platform win-arm64 --platform linux-x64 --platform linux-arm64 --platform osx-x64 --platform osx-arm64
5454

5555
- name: Package client
5656
run: dotnet run --project Content.Packaging client --no-wipe-release

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
run: dotnet build Content.Packaging -c Release --no-restore /m
3939

4040
- name: Package server
41-
run: dotnet run --project Content.Packaging server --platform win-x64 --platform linux-x64 --platform osx-x64 --platform linux-arm64
41+
run: dotnet run --project Content.Packaging server --platform win-x64 --platform win-arm64 --platform linux-x64 --platform linux-arm64 --platform osx-x64 --platform osx-arm64
4242

4343
- name: Package client
4444
run: dotnet run --project Content.Packaging client --no-wipe-release

.github/workflows/test-packaging.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
run: dotnet build Content.Packaging --configuration Release --no-restore /m
6161

6262
- name: Package server
63-
run: dotnet run --project Content.Packaging server --platform win-x64 --platform linux-x64 --platform osx-x64 --platform linux-arm64
63+
run: dotnet run --project Content.Packaging server --platform win-x64 --platform win-arm64 --platform linux-x64 --platform linux-arm64 --platform osx-x64 --platform osx-arm64
6464

6565
- name: Package client
6666
run: dotnet run --project Content.Packaging client --no-wipe-release

.vscode/settings.json

Lines changed: 575 additions & 0 deletions
Large diffs are not rendered by default.

BuildChecker/git_helper.py

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
#!/usr/bin/env python3
2-
# Installs git hooks, updates them, updates submodules, that kind of thing.
2+
"""
3+
Installs git hooks, updates them, updates submodules, that kind of thing.
4+
"""
35

4-
import subprocess
5-
import sys
66
import os
77
import shutil
8+
import subprocess
9+
import sys
810
import time
911
from pathlib import Path
1012
from typing import List
1113

1214
SOLUTION_PATH = Path("..") / "SpaceStation14.sln"
1315
# If this doesn't match the saved version we overwrite them all.
14-
CURRENT_HOOKS_VERSION = "2"
16+
CURRENT_HOOKS_VERSION = "3"
1517
QUIET = len(sys.argv) == 2 and sys.argv[1] == "--quiet"
1618

1719

@@ -25,12 +27,10 @@ def run_command(command: List[str], capture: bool = False) -> subprocess.Complet
2527

2628
sys.stdout.flush()
2729

28-
completed = None
29-
3030
if capture:
31-
completed = subprocess.run(command, cwd="..", stdout=subprocess.PIPE)
31+
completed = subprocess.run(command, stdout=subprocess.PIPE, text=True)
3232
else:
33-
completed = subprocess.run(command, cwd="..")
33+
completed = subprocess.run(command)
3434

3535
if completed.returncode != 0:
3636
print("Error: command exited with code {}!".format(completed.returncode))
@@ -43,7 +43,7 @@ def update_submodules():
4343
Updates all submodules.
4444
"""
4545

46-
if ('GITHUB_ACTIONS' in os.environ):
46+
if 'GITHUB_ACTIONS' in os.environ:
4747
return
4848

4949
if os.path.isfile("DISABLE_SUBMODULE_AUTOUPDATE"):
@@ -76,22 +76,21 @@ def install_hooks():
7676
print("No hooks change detected.")
7777
return
7878

79-
with open("INSTALLED_HOOKS_VERSION", "w") as f:
80-
f.write(CURRENT_HOOKS_VERSION)
81-
8279
print("Hooks need updating.")
8380

84-
hooks_target_dir = Path("..")/".git"/"hooks"
81+
hooks_target_dir = Path(run_command(["git", "rev-parse", "--git-path", "hooks"], True).stdout.strip())
8582
hooks_source_dir = Path("hooks")
8683

8784
# Clear entire tree since we need to kill deleted files too.
88-
for filename in os.listdir(str(hooks_target_dir)):
89-
os.remove(str(hooks_target_dir/filename))
85+
for filename in os.listdir(hooks_target_dir):
86+
os.remove(hooks_target_dir / filename)
9087

91-
for filename in os.listdir(str(hooks_source_dir)):
88+
for filename in os.listdir(hooks_source_dir):
9289
print("Copying hook {}".format(filename))
93-
shutil.copy2(str(hooks_source_dir/filename),
94-
str(hooks_target_dir/filename))
90+
shutil.copy2(hooks_source_dir / filename, hooks_target_dir / filename)
91+
92+
with open("INSTALLED_HOOKS_VERSION", "w") as f:
93+
f.write(CURRENT_HOOKS_VERSION)
9594

9695

9796
def reset_solution():
@@ -107,8 +106,7 @@ def reset_solution():
107106

108107
def check_for_zip_download():
109108
# Check if .git exists,
110-
cur_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
111-
if not os.path.isdir(os.path.join(cur_dir, ".git")):
109+
if run_command(["git", "rev-parse"]).returncode != 0:
112110
print("It appears that you downloaded this repository directly from GitHub. (Using the .zip download option) \n"
113111
"When downloading straight from GitHub, it leaves out important information that git needs to function. "
114112
"Such as information to download the engine or even the ability to even be able to create contributions. \n"

BuildChecker/hooks/post-checkout

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/bin/bash
22

3-
gitroot=`git rev-parse --show-toplevel`
3+
gitroot=$(git rev-parse --show-toplevel)
44

5-
cd "$gitroot/BuildChecker"
5+
cd "$gitroot/BuildChecker" || exit
66

7-
if [[ `uname` == MINGW* || `uname` == CYGWIN* ]]; then
7+
if [[ $(uname) == MINGW* || $(uname) == CYGWIN* ]]; then
88
# Windows
99
py -3 git_helper.py --quiet
1010
else

BuildChecker/hooks/post-merge

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
22

33
# Just call post-checkout since it does the same thing.
4-
gitroot=`git rev-parse --show-toplevel`
5-
bash "$gitroot/.git/hooks/post-checkout"
4+
gitroot=$(git rev-parse --git-path hooks)
5+
bash "$gitroot/post-checkout"
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
using System.Threading.Tasks;
2+
using BenchmarkDotNet.Attributes;
3+
using BenchmarkDotNet.Diagnosers;
4+
using Content.IntegrationTests;
5+
using Content.IntegrationTests.Pair;
6+
using Content.Server.Atmos.Components;
7+
using Content.Server.Atmos.EntitySystems;
8+
using Content.Shared.Atmos.Components;
9+
using Content.Shared.CCVar;
10+
using Robust.Shared;
11+
using Robust.Shared.Analyzers;
12+
using Robust.Shared.Configuration;
13+
using Robust.Shared.GameObjects;
14+
using Robust.Shared.Map;
15+
using Robust.Shared.Map.Components;
16+
using Robust.Shared.Maths;
17+
using Robust.Shared.Prototypes;
18+
using Robust.Shared.Random;
19+
20+
namespace Content.Benchmarks;
21+
22+
/// <summary>
23+
/// Spawns N number of entities with a <see cref="DeltaPressureComponent"/> and
24+
/// simulates them for a number of ticks M.
25+
/// </summary>
26+
[Virtual]
27+
[GcServer(true)]
28+
//[MemoryDiagnoser]
29+
//[ThreadingDiagnoser]
30+
public class DeltaPressureBenchmark
31+
{
32+
/// <summary>
33+
/// Number of entities (windows, really) to spawn with a <see cref="DeltaPressureComponent"/>.
34+
/// </summary>
35+
[Params(1, 10, 100, 1000, 5000, 10000, 50000, 100000)]
36+
public int EntityCount;
37+
38+
/// <summary>
39+
/// Number of entities that each parallel processing job will handle.
40+
/// </summary>
41+
// [Params(1, 10, 100, 1000, 5000, 10000)] For testing how multithreading parameters affect performance (THESE TESTS TAKE 16+ HOURS TO RUN)
42+
[Params(10)]
43+
public int BatchSize;
44+
45+
/// <summary>
46+
/// Number of entities to process per iteration in the DeltaPressure
47+
/// processing loop.
48+
/// </summary>
49+
// [Params(100, 1000, 5000, 10000, 50000)]
50+
[Params(1000)]
51+
public int EntitiesPerIteration;
52+
53+
private readonly EntProtoId _windowProtoId = "Window";
54+
private readonly EntProtoId _wallProtoId = "WallPlastitaniumIndestructible";
55+
56+
private TestPair _pair = default!;
57+
private IEntityManager _entMan = default!;
58+
private SharedMapSystem _map = default!;
59+
private IRobustRandom _random = default!;
60+
private IConfigurationManager _cvar = default!;
61+
private ITileDefinitionManager _tileDefMan = default!;
62+
private AtmosphereSystem _atmospereSystem = default!;
63+
64+
private Entity<GridAtmosphereComponent, GasTileOverlayComponent, MapGridComponent, TransformComponent>
65+
_testEnt;
66+
67+
[GlobalSetup]
68+
public async Task SetupAsync()
69+
{
70+
ProgramShared.PathOffset = "../../../../";
71+
PoolManager.Startup();
72+
_pair = await PoolManager.GetServerClient();
73+
var server = _pair.Server;
74+
75+
var mapdata = await _pair.CreateTestMap();
76+
77+
_entMan = server.ResolveDependency<IEntityManager>();
78+
_map = _entMan.System<SharedMapSystem>();
79+
_random = server.ResolveDependency<IRobustRandom>();
80+
_cvar = server.ResolveDependency<IConfigurationManager>();
81+
_tileDefMan = server.ResolveDependency<ITileDefinitionManager>();
82+
_atmospereSystem = _entMan.System<AtmosphereSystem>();
83+
84+
_random.SetSeed(69420); // Randomness needs to be deterministic for benchmarking.
85+
86+
_cvar.SetCVar(CCVars.DeltaPressureParallelToProcessPerIteration, EntitiesPerIteration);
87+
_cvar.SetCVar(CCVars.DeltaPressureParallelBatchSize, BatchSize);
88+
89+
var plating = _tileDefMan["Plating"].TileId;
90+
91+
/*
92+
Basically, we want to have a 5-wide grid of tiles.
93+
Edges are walled, and the length of the grid is determined by N + 2.
94+
Windows should only touch the top and bottom walls, and each other.
95+
*/
96+
97+
var length = EntityCount + 2; // ensures we can spawn exactly N windows between side walls
98+
const int height = 5;
99+
100+
await server.WaitPost(() =>
101+
{
102+
// Fill required tiles (extend grid) with plating
103+
for (var x = 0; x < length; x++)
104+
{
105+
for (var y = 0; y < height; y++)
106+
{
107+
_map.SetTile(mapdata.Grid, mapdata.Grid, new Vector2i(x, y), new Tile(plating));
108+
}
109+
}
110+
111+
// Spawn perimeter walls and windows row in the middle (y = 2)
112+
const int midY = height / 2;
113+
for (var x = 0; x < length; x++)
114+
{
115+
for (var y = 0; y < height; y++)
116+
{
117+
var coords = new EntityCoordinates(mapdata.Grid, x + 0.5f, y + 0.5f);
118+
119+
var isPerimeter = x == 0 || x == length - 1 || y == 0 || y == height - 1;
120+
if (isPerimeter)
121+
{
122+
_entMan.SpawnEntity(_wallProtoId, coords);
123+
continue;
124+
}
125+
126+
// Spawn windows only on the middle row, spanning interior (excluding side walls)
127+
if (y == midY)
128+
{
129+
_entMan.SpawnEntity(_windowProtoId, coords);
130+
}
131+
}
132+
}
133+
});
134+
135+
// Next we run the fixgridatmos command to ensure that we have some air on our grid.
136+
// Wait a little bit as well.
137+
// TODO: Unhardcode command magic string when fixgridatmos is an actual command we can ref and not just
138+
// a stamp-on in AtmosphereSystem.
139+
await _pair.WaitCommand("fixgridatmos " + mapdata.Grid.Owner, 1);
140+
141+
var uid = mapdata.Grid.Owner;
142+
_testEnt = new Entity<GridAtmosphereComponent, GasTileOverlayComponent, MapGridComponent, TransformComponent>(
143+
uid,
144+
_entMan.GetComponent<GridAtmosphereComponent>(uid),
145+
_entMan.GetComponent<GasTileOverlayComponent>(uid),
146+
_entMan.GetComponent<MapGridComponent>(uid),
147+
_entMan.GetComponent<TransformComponent>(uid));
148+
}
149+
150+
[Benchmark]
151+
public async Task PerformFullProcess()
152+
{
153+
await _pair.Server.WaitPost(() =>
154+
{
155+
while (!_atmospereSystem.RunProcessingStage(_testEnt, AtmosphereProcessingState.DeltaPressure)) { }
156+
});
157+
}
158+
159+
[Benchmark]
160+
public async Task PerformSingleRunProcess()
161+
{
162+
await _pair.Server.WaitPost(() =>
163+
{
164+
_atmospereSystem.RunProcessingStage(_testEnt, AtmosphereProcessingState.DeltaPressure);
165+
});
166+
}
167+
168+
[GlobalCleanup]
169+
public async Task CleanupAsync()
170+
{
171+
await _pair.DisposeAsync();
172+
PoolManager.Shutdown();
173+
}
174+
}

Content.Benchmarks/MapLoadBenchmark.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public async Task Cleanup()
4747
PoolManager.Shutdown();
4848
}
4949

50-
public static readonly string[] MapsSource = { "Empty", "Saltern", "Box", "Bagel", "Dev", "CentComm", "Core", "TestTeg", "Packed", "Omega", "Reach", "Meta", "Marathon", "MeteorArena", "Fland", "Oasis", "Convex"};
50+
public static string[] MapsSource { get; } = { "Empty", "Saltern", "Box", "Bagel", "Dev", "CentComm", "Core", "TestTeg", "Packed", "Omega", "Reach", "Meta", "Marathon", "MeteorArena", "Fland", "Oasis", "Convex"};
5151

5252
[ParamsSource(nameof(MapsSource))]
5353
public string Map;

0 commit comments

Comments
 (0)