Skip to content

Commit

Permalink
Fixed issue with Game.Instance. Prepared API for nuget
Browse files Browse the repository at this point in the history
  • Loading branch information
gurrenm3 committed Apr 11, 2022
1 parent 74cd40d commit 6bfd56a
Show file tree
Hide file tree
Showing 7 changed files with 1,454 additions and 20 deletions.
674 changes: 674 additions & 0 deletions NoMansSky.Api.Shared/LICENSE

Large diffs are not rendered by default.

43 changes: 41 additions & 2 deletions NoMansSky.Api.Shared/NoMansSky.Api.Shared.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,53 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<RootNamespace>NoMansSky.Api</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Title>NoMansSky.Api.Shared</Title>
<PackageId>Gurrenm3.$(AssemblyName)</PackageId>
<Authors>Gurrenm3</Authors>
<PackageIcon>Icon.png</PackageIcon>
<RepositoryUrl>https://github.com/gurrenm3/NoMansSky.Api/tree/master/NoMansSky.Api.Shared</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>NoMansSky; NoManSky; NMS; Mod; Modding; Tool; Api; Reloaded; Reloaded2</PackageTags>
<Description>This project contains all of the backend code for NoMansSky.Api.

Due to the nature of Reloaded2, any code that is published using "IModLoader.AddOrReplaceController()" for use with other mods must be contained within a separate project that has zero third party dependencies.
This project contains all of the code that can be published for use in other mods. Or in other words pretty much all of the backend code for the API.
</Description>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReleaseNotes>Initial Release</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Reloaded.ModHelper\Reloaded.ModHelper.Shared\Reloaded.ModHelper.Shared.csproj" />
<None Include="..\NoMansSky.Api\Icon.png">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

<ItemGroup>
<None Update="README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

<PropertyGroup>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<RepositoryType>git</RepositoryType>
<PackageReleaseNotes>Initial Release</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
<None Include="LICENSE" Pack="true" PackagePath="" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Gurrenm3.Reloaded.ModHelper.Shared" Version="1.0.0" />
</ItemGroup>

</Project>
674 changes: 674 additions & 0 deletions NoMansSky.Api/LICENSE

Large diffs are not rendered by default.

35 changes: 29 additions & 6 deletions NoMansSky.Api/ModConfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"ModId": "NoMansSky.Api",
"ModName": "No Man's Sky API",
"ModName": "No Man\u0027s Sky API",
"ModAuthor": "Gurrenm3",
"ModVersion": "1.0.0",
"ModDescription": "An API for modding No Man's Sky",
"ModDescription": "An API for modding No Man\u0027s Sky",
"ModDll": "NoMansSky.Api.dll",
"ModIcon": "Icon.png",
"ModR2RManagedDll32": "",
Expand All @@ -12,9 +12,32 @@
"ModNativeDll64": "",
"IsLibrary": false,
"ReleaseMetadataFileName": "Sewer56.Update.ReleaseMetadata.json",
"PluginData": {},
"PluginData": {
"GitHubDependencies": {
"IdToConfigMap": {
"reloaded.sharedlib.hooks": {
"Config": {
"UserName": "Reloaded.SharedLib.Hooks.ReloadedII",
"RepositoryName": "Sewer56",
"UseReleaseTag": true,
"AssetFileName": "reloaded.sharedlib.hooks.zip"
}
}
}
},
"GitHubRelease": {
"UserName": "",
"RepositoryName": "",
"UseReleaseTag": true,
"AssetFileName": "Mod.zip"
}
},
"IsUniversalMod": false,
"ModDependencies": ["reloaded.sharedlib.hooks"],
"ModDependencies": [
"reloaded.sharedlib.hooks"
],
"OptionalDependencies": [],
"SupportedAppId": []
}
"SupportedAppId": [
"nms.exe.unpacked.exe"
]
}
2 changes: 1 addition & 1 deletion NoMansSky.Api/NMSMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class NMSMod : ReloadedMod
/// <summary>
/// Represents the instance of the Game class.
/// </summary>
public IGame Game => Api.Game.Instance;
public IGame Game => IGame.Instance;

/// <summary>
/// Represents the instance of the Game Loop.
Expand Down
41 changes: 30 additions & 11 deletions NoMansSky.Api/NoMansSky.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<OutputPath>$(RELOADEDIIMODS)\NoMansSky.Api</OutputPath>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<PackageTags>NoMansSky; NoManSky; NMS; Mod; Modding; Tool; Api; Reloaded; Reloaded2</PackageTags>
<PackageIcon>Icon.png</PackageIcon>
<RepositoryUrl>https://github.com/gurrenm3/NoMansSky.Api</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

<ItemGroup>
Expand All @@ -24,26 +29,40 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Reloaded.Memory.Sigscan" Version="2.0.0" />
<PackageReference Include="Reloaded.Mod.Interfaces" Version="2.1.0" />
<PackageReference Include="Reloaded.SharedLib.Hooks" Version="1.9.0" />
<None Include="..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Reloaded.ModHelper\Reloaded.ModHelper.Shared\Reloaded.ModHelper.Shared.csproj" />
<ProjectReference Include="..\..\Reloaded.ModHelper\Reloaded.ModHelper\Reloaded.ModHelper.csproj" />
<ProjectReference Include="..\NoMansSky.Api.Shared\NoMansSky.Api.Shared.csproj" />
</ItemGroup>
<PropertyGroup>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<RepositoryType>git</RepositoryType>
<PackageReleaseNotes>Initial Release</PackageReleaseNotes>
<Title>$(AssemblyName)</Title>
<PackageId>Gurrenm3.$(AssemblyName)</PackageId>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Description>A C# modding API for No Man's Sky. Built with Reloaded2, a set of extremely powerful modding tools.
The purpose of this library is to help mod makers create incredibly diverse and unique mods that would normally be quite impossible. </Description>
</PropertyGroup>

<ItemGroup>
<None Include="LICENSE" Pack="true" PackagePath="" />
</ItemGroup>

<ItemGroup>
<Reference Include="libMBIN">
<HintPath>..\Dependencies\libMBIN.dll</HintPath>
</Reference>
<PackageReference Include="Gurrenm3.NoMansSky.Api.Shared" Version="1.0.0" />
<PackageReference Include="Gurrenm3.Reloaded.ModHelper" Version="1.0.0" />
<PackageReference Include="Reloaded.Memory.Sigscan" Version="2.0.0" />
<PackageReference Include="Reloaded.Mod.Interfaces" Version="2.1.0" />
<PackageReference Include="Reloaded.SharedLib.Hooks" Version="1.9.0" />
</ItemGroup>

<ItemGroup>
<None Update="Icon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

Expand Down
5 changes: 5 additions & 0 deletions NoMansSky.Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class Program : IMod, IExports
private IModLogger Logger = null!;

private IGame gameInstance = null!;
private IGameLoop gameLoop = null!;

/// <summary>
/// Entry point for your mod.
Expand Down Expand Up @@ -84,7 +85,11 @@ Your mod code starts below.

Logger = new ModLogger(_modConfig, _logger);
gameInstance = new Game(Logger);
gameLoop = gameInstance.GameLoop;
Logger.WriteLine($"gameLoop == null {gameLoop == null}");

_modLoader.AddOrReplaceController(this, gameInstance);
_modLoader.AddOrReplaceController(this, gameLoop);

_mod = new Mod(_modConfig, _hooks, Logger);

Expand Down

0 comments on commit 6bfd56a

Please sign in to comment.