Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into 276-spec-info
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Modules/SpectatorCamModeModule/Interfaces/ISpectatorCamModeService.cs
#	src/Modules/SpectatorCamModeModule/Services/SpectatorCamModeService.cs
#	src/Modules/SpectatorCamModeModule/Templates/Scripts/SpectatorMode.ms
#	src/Modules/SpectatorCamModeModule/Templates/SpectatorMode.mt
#	src/Modules/SpectatorTargetInfoModule/Controllers/SpectatorTargetInfoEventController.cs
#	src/Modules/SpectatorTargetInfoModule/Templates/Scripts/SpectatorTargetInfo.ms
#	src/Modules/SpectatorTargetInfoModule/Templates/SpectatorTargetInfo.mt
#	tests/Modules/SpectatorCamModeModule.Tests/Services/SpectatorCamModeServiceTests.cs
#	tests/Modules/SpectatorTargetInfoModule.Tests/Controllers/SpectatorTargetEventControllerTests.cs
#	tests/Modules/TeamChatModule.Tests/TeamChatModule.Tests.csproj
  • Loading branch information
araszka committed Sep 30, 2024
2 parents c9adf6e + 48b1567 commit 69ebdad
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 28 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ EvoSC/ext_plugins/*
docker-compose.yml
global.json
.env
nuget.config
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ It sets up a TM2020 dedicated server for you as well as all the required other s
version: "3.8"
services:
trackmania:
image: evotm/trackmania
image: evoesports/trackmania
ports:
- 2350:2350/udp
- 2350:2350/tcp
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
trackmania:
image: evotm/trackmania
image: evoesports/trackmania
restart: always
ports:
- 2350:2350/udp
Expand Down
52 changes: 28 additions & 24 deletions src/EvoSC.Modules/Util/SortedModuleCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,53 +33,57 @@ IEnumerator IEnumerable.GetEnumerator()

private List<T> GetSortedModules()
{
var dependencyGraph = MakeDependencyGraph();
EnsureDependenciesExists(dependencyGraph);
var graph = MakeDependencyGraph();
EnsureDependenciesExists(graph);

var sortedDependencies = new List<T>();

while (true)
{
string? selected = null;

foreach (var dependent in dependencyGraph)
bool found = false;
foreach (var node in graph)
{
if (dependent.Value.Count != 0)
if (node.Value.Count > 0)
{
continue;
}

sortedDependencies.Add(_modules[dependent.Key]);
RemoveDependent(dependencyGraph, dependent);

selected = dependent.Key;

sortedDependencies.Add(_modules[node.Key]);
RemoveNodeReferences(graph, node.Key);
found = true;
}

if (selected != null)
{
dependencyGraph.Remove(selected);
}
else
if (!found)
{
break;
}
}

DetectCycle(dependencyGraph);

if (graph.Count > 0)
{
throw new DependencyCycleException(graph);
}

return sortedDependencies;
}

private static void RemoveDependent(DependencyGraph dependencyGraph, KeyValuePair<string, IList<string>> dependent)
private static void RemoveNodeReferences(DependencyGraph graph, string nodeName)
{
foreach (var dependencies in dependencyGraph)
if (graph.ContainsKey(nodeName))
{
if (dependencies.Value.Contains(dependencies.Key))
graph.Remove(nodeName);
}

foreach (var node in graph)
{
if (node.Value.Contains(nodeName))
{
dependencies.Value.Remove(dependent.Key);
node.Value.Remove(nodeName);
}
}
}

private DependencyGraph MakeDependencyGraph()
{
var adjList = new Dictionary<string, IList<string>>();
Expand Down
1 change: 1 addition & 0 deletions src/Modules/MapsModule/MapsModule.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Hawf" Version="2.0.0" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.15.0.81779">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using EvoSC.Common.Controllers;
using EvoSC.Common.Controllers.Attributes;
using EvoSC.Common.Controllers.Context;
using EvoSC.Common.Events.Attributes;
using EvoSC.Common.Remote;
using EvoSC.Common.Remote.EventArgsModels;
using EvoSC.Modules.Official.SpectatorCamModeModule.Interfaces;

namespace EvoSC.Modules.Official.SpectatorCamModeModule.Controllers;

[Controller]
public class SpectatorCamModeEventController(ISpectatorCamModeService camModeService)
: EvoScController<EventControllerContext>
{
[Subscribe(ModeScriptEvent.EndRoundStart)]
public Task OnEndRoundStartAsync(object sender, RoundEventArgs eventArgs) =>
camModeService.HideCamModeWidgetAsync();

Check failure on line 17 in src/Modules/SpectatorCamModeModule/Controllers/SpectatorCamModeEventController.cs

View workflow job for this annotation

GitHub Actions / build_and_test

'ISpectatorCamModeService' does not contain a definition for 'HideCamModeWidgetAsync' and no accessible extension method 'HideCamModeWidgetAsync' accepting a first argument of type 'ISpectatorCamModeService' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 17 in src/Modules/SpectatorCamModeModule/Controllers/SpectatorCamModeEventController.cs

View workflow job for this annotation

GitHub Actions / build_and_test

'ISpectatorCamModeService' does not contain a definition for 'HideCamModeWidgetAsync' and no accessible extension method 'HideCamModeWidgetAsync' accepting a first argument of type 'ISpectatorCamModeService' could be found (are you missing a using directive or an assembly reference?)

[Subscribe(ModeScriptEvent.StartRoundStart)]
public Task OnStartRoundStartAsync(object sender, RoundEventArgs eventArgs) =>
camModeService.SendPersistentCamModeWidgetAsync();
}
4 changes: 2 additions & 2 deletions tests/Modules/FastestCp.Tests/FastestCp.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
</ItemGroup>

<ItemGroup>
<ContentWithTargetPath Include="**\*.xml">
<ContentWithTargetPath Include="Manialinks\*.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>%(RecursiveDir)\%(Filename)%(Extension)</TargetPath>
<TargetPath>Manialinks\%(Filename)%(Extension)</TargetPath>
</ContentWithTargetPath>
</ItemGroup>

Expand Down

0 comments on commit 69ebdad

Please sign in to comment.