Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major cleanup #615

Merged
merged 21 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
370 changes: 223 additions & 147 deletions .editorconfig

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions .github/workflows/build-winx64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0 # can't shallowly clone due to git versioning
Expand All @@ -33,17 +33,17 @@ jobs:

# Add dotnet to the PATH: https://github.com/actions/setup-dotnet
- name: Setup dotnet.exe
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: "6.0.x"
dotnet-version: "8.0.x"

# Build it
- name: Build the application
run: dotnet build -c ${{ matrix.configuration }}

# Upload it to the run results
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2.2.4
uses: actions/upload-artifact@v4
with:
# Artifact name
name: build-artifacts-${{ matrix.configuration }}
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0 # can't shallowly clone due to git versioning
Expand All @@ -23,7 +23,7 @@ jobs:
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}

- name: Setup Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: "14"

Expand All @@ -33,7 +33,7 @@ jobs:
echo "::set-output name=dir::$(npm config get cache)"

- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: npm-${{ hashFiles('package-lock.json') }}
Expand All @@ -51,9 +51,9 @@ jobs:

# Add dotnet to the PATH: https://github.com/actions/setup-dotnet
- name: Setup dotnet.exe
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: "6.0.x"
dotnet-version: "8.0.x"

# Build it
- name: Build the application
Expand All @@ -66,13 +66,13 @@ jobs:
run: node .github\scripts\thunderstore_bundle.js

# Upload the thunderstore artifact (in case automatic upload fails)
- uses: actions/upload-artifact@v2.2.4
- uses: actions/upload-artifact@v4
with:
name: nebula-thunderstore
path: ${{ env.DIST_RELEASE_FOLDER }}nebula-NebulaMultiplayerMod

# Upload the API thunderstore artifact (in case automatic upload fails)
- uses: actions/upload-artifact@v2.2.4
- uses: actions/upload-artifact@v4
with:
name: nebula-api-thunderstore
path: ${{ env.DIST_RELEASE_FOLDER }}nebula-NebulaMultiplayerModApi
Expand Down
116 changes: 58 additions & 58 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<DevEnvLoc>$(MSBuildThisFileDirectory)DevEnv.targets</DevEnvLoc>
</PropertyGroup>

<!-- This sets $(DSPGameDir) -->
<Import Project="$(DevEnvLoc)" Condition="Exists('$(DevEnvLoc)')" />

<PropertyGroup Label="Game Install Properties">
<DSPGameDir Condition="!Exists('$(DevEnvLoc)')">C:\Program Files (x86)\Steam\steamapps\common\Dyson Sphere Program\</DSPGameDir>
<DSPGameDir>$([MSBuild]::EnsureTrailingSlash('$(DSPGameDir)'))</DSPGameDir>
<PluginOutputDirectory>$(DSPGameDir)BepInEx\plugins\nebula-NebulaMultiplayerMod\</PluginOutputDirectory>
<PropSheetPath>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))</PropSheetPath>
<PluginOutputDirectory Condition="Exists('$(PropSheetPath).remoteBuild')">$(PropSheetPath)dist\release\nebula-NebulaMultiplayerMod\</PluginOutputDirectory>
</PropertyGroup>

<PropertyGroup Label="Common Properties">
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

<OutputPath Condition="Exists('$(DSPGameDir)') Or Exists('$(PropSheetPath).remoteBuild')">$(PluginOutputDirectory)</OutputPath>
<TargetFramework>net472</TargetFramework>
<LangVersion>latest</LangVersion>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<DefaultItemExcludes>$(DefaultItemExcludes);*.binlog</DefaultItemExcludes>

<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
<GitVersionBaseDirectory>$(MSBuildThisFileDirectory)</GitVersionBaseDirectory>
</PropertyGroup>

<PropertyGroup Label="API Properties" Condition=" '$(MSBuildProjectName)' == 'NebulaAPI' " >
<OutputPath Condition="Exists('$(DSPGameDir)') Or Exists('$(PropSheetPath).remoteBuild')">$(OutputPath)..\nebula-NebulaMultiplayerModApi</OutputPath>
</PropertyGroup>
<!-- Shared Items -->
<ItemGroup Label="NuGets">
<PackageReference Include="Microsoft.Unity.Analyzers" Version="1.*" PrivateAssets="all" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.*" PrivateAssets="all" />
</ItemGroup>

<ItemGroup Label="NuGetsMain" Condition=" '$(MSBuildProjectName)' != 'NebulaAPI' ">
<PackageReference Include="K4os.Compression.LZ4.Streams" Version="1.*" />
</ItemGroup>

<ItemGroup Label="Core">
<PackageReference Include="BepInEx.Core" Version="5.*" PrivateAssets="all" />
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" PrivateAssets="all" />
<PackageReference Include="DysonSphereProgram.GameLibs" Version="*-*" IncludeAssets="compile" PrivateAssets="all" />
<PackageReference Include="DysonSphereProgram.Modding.CommonAPI" Version="1.4.5" IncludeAssets="compile" PrivateAssets="all"
Condition=" '$(MSBuildProjectName)' != 'NebulaAPI' " />

</ItemGroup>

<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="all" />
</ItemGroup>
<PropertyGroup>
<DevEnvLoc>$(MSBuildThisFileDirectory)DevEnv.targets</DevEnvLoc>
</PropertyGroup>

<!-- This sets $(DSPGameDir) -->
<Import Project="$(DevEnvLoc)" Condition="Exists('$(DevEnvLoc)')"/>

<PropertyGroup Label="Game Install Properties">
<DSPGameDir Condition="!Exists('$(DevEnvLoc)')">C:\Program Files (x86)\Steam\steamapps\common\Dyson Sphere Program\</DSPGameDir>
<DSPGameDir>$([MSBuild]::EnsureTrailingSlash('$(DSPGameDir)'))</DSPGameDir>
<PluginOutputDirectory>$(DSPGameDir)BepInEx\plugins\nebula-NebulaMultiplayerMod\</PluginOutputDirectory>
<PropSheetPath>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))</PropSheetPath>
<PluginOutputDirectory Condition="Exists('$(PropSheetPath).remoteBuild')">$(PropSheetPath)dist\release\nebula-NebulaMultiplayerMod\</PluginOutputDirectory>
</PropertyGroup>

<PropertyGroup Label="Common Properties">
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

<OutputPath Condition="Exists('$(DSPGameDir)') Or Exists('$(PropSheetPath).remoteBuild')">$(PluginOutputDirectory)</OutputPath>
<TargetFramework>net472</TargetFramework>
<LangVersion>latest</LangVersion>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<DefaultItemExcludes>$(DefaultItemExcludes);*.binlog</DefaultItemExcludes>

<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
<GitVersionBaseDirectory>$(MSBuildThisFileDirectory)</GitVersionBaseDirectory>
</PropertyGroup>

<PropertyGroup Label="API Properties" Condition=" '$(MSBuildProjectName)' == 'NebulaAPI' ">
<OutputPath Condition="Exists('$(DSPGameDir)') Or Exists('$(PropSheetPath).remoteBuild')">$(OutputPath)..\nebula-NebulaMultiplayerModApi</OutputPath>
</PropertyGroup>

<!-- Shared Items -->
<ItemGroup Label="NuGets">
<PackageReference Include="Microsoft.Unity.Analyzers" Version="1.*" PrivateAssets="all"/>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.*" PrivateAssets="all"/>
</ItemGroup>

<ItemGroup Label="NuGetsMain" Condition=" '$(MSBuildProjectName)' != 'NebulaAPI' ">
<PackageReference Include="K4os.Compression.LZ4.Streams" Version="1.*"/>
</ItemGroup>

<ItemGroup Label="Core">
<PackageReference Include="BepInEx.Core" Version="5.*" PrivateAssets="all"/>
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" PrivateAssets="all"/>
<PackageReference Include="DysonSphereProgram.GameLibs" Version="*-*" IncludeAssets="compile" PrivateAssets="all"/>
<PackageReference Include="DysonSphereProgram.Modding.CommonAPI" Version="1.5.7" IncludeAssets="compile" PrivateAssets="all"
Condition=" '$(MSBuildProjectName)' != 'NebulaAPI' "/>

</ItemGroup>

<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all"/>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)SharedConfig.targets"/>
<Import Project="$(MSBuildThisFileDirectory)SharedConfig.targets"/>
</Project>
3 changes: 2 additions & 1 deletion NebulaAPI/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@

1.1.0:

- Float3 IPlayerData.MechaColor has been changed to Float4[] IPlayerData.MechaColors in line with changes introduced in DSP version 0.8.21.8562.
- Float3 IPlayerData.MechaColor has been changed to Float4[] IPlayerData.MechaColors in line with changes introduced in
DSP version 0.8.21.8562.
- Edited description.

1.0.0:
Expand Down
51 changes: 27 additions & 24 deletions NebulaAPI/DataStructures/CollectionExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
using System;
#region

using System;
using System.Collections;
using System.Threading;

namespace NebulaAPI
#endregion

namespace NebulaAPI.DataStructures;

public static class CollectionExtensions
{
public static class CollectionExtensions
public static Locker Lock(this ICollection collection)
{
public static Locker Lock(this ICollection collection)
{
return new Locker(collection.SyncRoot);
}

public static Locker GetLocked<T>(this T collection, out T result) where T : ICollection
{
result = collection;
return new Locker(collection.SyncRoot);
}
return new Locker(collection.SyncRoot);
}

public readonly struct Locker : IDisposable
public static Locker GetLocked<T>(this T collection, out T result) where T : ICollection
{
private readonly object lockObject;
result = collection;
return new Locker(collection.SyncRoot);
}
}

public Locker(object lockObject)
{
this.lockObject = lockObject;
public readonly struct Locker : IDisposable
{
private readonly object lockObject;

Monitor.Enter(lockObject);
}
public Locker(object lockObject)
{
this.lockObject = lockObject;

public void Dispose()
{
Monitor.Exit(lockObject);
}
Monitor.Enter(lockObject);
}

public void Dispose()
{
Monitor.Exit(lockObject);
}
}
35 changes: 35 additions & 0 deletions NebulaAPI/DataStructures/DataStructureExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#region

using UnityEngine;

#endregion

namespace NebulaAPI.DataStructures;

public static class DataStructureExtensions
{
public static Vector3 ToVector3(this Float3 value)
{
return new Vector3(value.x, value.y, value.z);
}

public static VectorLF3 ToVectorLF3(this Double3 value)
{
return new VectorLF3(value.x, value.y, value.z);
}

public static Float3 ToFloat3(this Vector3 value)
{
return new Float3(value.x, value.y, value.z);
}

public static Quaternion ToQuaternion(this Float4 value)
{
return new Quaternion(value.x, value.y, value.z, value.w);
}

public static Float4 ToFloat4(this Quaternion value)
{
return new Float4(value.x, value.y, value.z, value.w);
}
}
32 changes: 0 additions & 32 deletions NebulaAPI/DataStructures/DataStructureExtenstions.cs

This file was deleted.

Loading