Skip to content

Commit

Permalink
Nuget packing, event fix (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
zabszk authored Sep 21, 2022
1 parent d4c8b40 commit 23ca830
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 24 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: .NET

on:
push:
branches: [ "master", "dev" ]
branches: [ "master", "dev", "dev2" ]
pull_request:
branches: [ "master", "dev" ]
branches: [ "master", "dev", "dev2" ]

env:
DEPOT_DOWNLOADER_VERSION: 2.4.7
Expand Down Expand Up @@ -32,7 +32,7 @@ jobs:
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path D:\a\NwPluginAPI\SCPSL_REFERENCES
Start-Process -NoNewWindow -Wait -FilePath "D:\a\NwPluginAPI\DepotDownloader\DepotDownloader.exe" -WorkingDirectory "D:\a\NwPluginAPI\DepotDownloader" -ArgumentList '-app 996560','-beta plugin-api','-betapassword ${{ secrets.BRANCHPASSWORD }}','-dir D:\a\NwPluginAPI\SCPSL_REFERENCES','-filelist "${{ github.workspace }}\download-files.txt"'
Start-Process -NoNewWindow -Wait -FilePath "D:\a\NwPluginAPI\DepotDownloader\DepotDownloader.exe" -WorkingDirectory "D:\a\NwPluginAPI\DepotDownloader" -ArgumentList '-app 996560','-beta nightly','-betapassword ${{ secrets.NIGHTLYPASSWORD }}','-dir D:\a\NwPluginAPI\SCPSL_REFERENCES','-filelist "${{ github.workspace }}\download-files.txt"'
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand Down
9 changes: 0 additions & 9 deletions NwPluginAPI/Core/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -406,15 +406,6 @@ public string CustomInfo
set => ReferenceHub.nicknameSync.CustomPlayerInfo = value;
}

/// <summary>
/// Gets or sets player current unit.
/// </summary>
public string CurrentUnit
{
get => ReferenceHub.characterClassManager.CurUnitName;
set => ReferenceHub.characterClassManager.CurUnitName = value;
}

/// <summary>
/// Gets or sets player current health;
/// </summary>
Expand Down
16 changes: 12 additions & 4 deletions NwPluginAPI/Events/EventManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,12 @@ public static T ExecuteEvent<T>(ServerEventType type, params object[] args) wher

bool isBool = typeof(T) == typeof(bool);
bool cancelled = false;
T cancellation = default;

T cancellation;

if (isBool)
cancellation = (T)(object)true;
else cancellation = default;

foreach(var plugin in ev.Invokers.Values)
{
Expand All @@ -384,17 +389,20 @@ public static T ExecuteEvent<T>(ServerEventType type, params object[] args) wher
continue;
}

if (result is null)
if (cancelled || result is null)
continue;

if (isBool)
{
if (result is bool b && b)
cancellation = (T)result;
continue;

cancellation = (T)result;
cancelled = true;
}
else if (result is T r)
{
if (cancelled || !(r is IEventCancellation ecd) || !ecd.IsCancelled)
if (!(r is IEventCancellation ecd) || !ecd.IsCancelled)
continue;

cancellation = r;
Expand Down
25 changes: 17 additions & 8 deletions NwPluginAPI/NwPluginAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,38 @@

<SignAssembly>False</SignAssembly>

<PackageId>PluginAPI</PackageId>
<Version>1.0.0</Version>
<Authors>Northwood Studio</Authors>
<PackageId>Northwood.PluginAPI</PackageId>
<Authors>Northwood Studios</Authors>
<Company>Northwood Studio</Company>
<Product>PluginAPI</Product>
<Description>Plugin API for SCP: Secret Laboratory made by Northwood Studios.</Description>
<PackageProjectUrl>github.com/northwood-studios/NwPluginAPI</PackageProjectUrl>
<Description>Official server-side plugin system for SCP: Secret Laboratory game.</Description>
<PackageProjectUrl>https://github.com/northwood-studios/NwPluginAPI</PackageProjectUrl>
<PackageIcon>Resources\nw_logo.jpg</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>github.com/northwood-studios/NwPluginAPI</RepositoryUrl>
<RepositoryUrl>https://github.com/northwood-studios/NwPluginAPI</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>pluginapi,scpsl</PackageTags>
<NeutralLanguage>en</NeutralLanguage>
<AssemblyVersion>1.0.0</AssemblyVersion>
<FileVersion>1.0.0</FileVersion>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Title>Northwood.PluginAPI</Title>
<Copyright>Copyright by Hubert Moszka Northwood, 2022</Copyright>
<PackageVersion>12.0.0-beta2</PackageVersion>
</PropertyGroup>

<PropertyGroup>
<!-- Disable automatic generation of version attribute -->
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
</PropertyGroup>

<ItemGroup>
<None Include="..\.editorconfig" Link=".editorconfig" />
<None Include="..\README.md" Pack="True" PackagePath="\" />
<None Include="..\LICENSE" Pack="True" PackagePath="\" />
<None Include="Resources\nw_logo.jpg" Pack="True" PackagePath="\Resources\" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 10 additions & 0 deletions NwPluginAPI/PluginApiVersion.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace PluginAPI
{
internal static class PluginApiVersion
{
internal const string Version = "12.0.0"; //major.minor.patch ONLY
internal const string VersionString = "12.0.0-beta2";

//PackageVersion needs to be set to the same value as VersionString MANUALLY IN .csproj
}
}
5 changes: 5 additions & 0 deletions NwPluginAPI/Properties/VersionInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using System.Reflection;

[assembly: AssemblyInformationalVersion(PluginAPI.PluginApiVersion.VersionString)]
[assembly: AssemblyFileVersion(PluginAPI.PluginApiVersion.VersionString)]
[assembly: AssemblyVersion(PluginAPI.PluginApiVersion.Version)]

0 comments on commit 23ca830

Please sign in to comment.