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

Dev #18

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
17 changes: 0 additions & 17 deletions ContentAPI/API/Components/CustomKeybind.cs

This file was deleted.

3 changes: 2 additions & 1 deletion ContentAPI/API/Features/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public class Player : IWrapper<PlayerAPI>, IWorldSpace
internal Player(PlayerAPI player)
{
Base = player;
Dictionary.Add(player.gameObject, this);
if (!Dictionary.ContainsKey(player.gameObject))
Dictionary.Add(player.gameObject, this);
}

/// <summary>
Expand Down
39 changes: 35 additions & 4 deletions ContentAPI/ContentAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<PackageReadmeFile>README.md</PackageReadmeFile>
<Copyright>GNU</Copyright>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<Version>0.0.4</Version>
<Version>0.0.5</Version>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -58,13 +58,44 @@
<Reference Include="Zorro.Core.Runtime" HintPath="$(CONTENTWARNING_REFERENCES)\Zorro.Core.Runtime.dll" Private="false" />
<Reference Include="Zorro.Settings.Runtime" HintPath="$(CONTENTWARNING_REFERENCES)\Zorro.Settings.Runtime.dll" Private="false" />
<Reference Include="ModalAssembly" HintPath="$(CONTENTWARNING_REFERENCES)\ModalAssembly.dll" Private="false" />

<Reference Include="0Harmony" HintPath="$(CONTENTWARNING_REFERENCES)\0Harmony.dll" Private="false" />
<Reference Include="mscorlib" HintPath="$(CONTENTWARNING_REFERENCES)\mscorlib.dll" Private="false" />
<Reference Include="netstandard" HintPath="$(CONTENTWARNING_REFERENCES)\netstandard.dll" Private="false" />
</ItemGroup>

<Target Name="CopyOutputFileToGame" AfterTargets="Build">
<Copy SourceFiles="$(OutputPath)\$(AssemblyName).dll;$(MSBuildProjectDirectory)/ThunderAssets/icon.png" DestinationFolder="$(CWDir)\Plugins\ExampleCWPlugin" />
<Target Name="BuildWithAndWithoutBepInEx" AfterTargets="Build">
<!-- Build with BepInEx -->
<PropertyGroup>
<DefineConstants>BEPINEX</DefineConstants>
<AssemblyName>$(AssemblyName).BepInEx</AssemblyName>
</PropertyGroup>

<!-- Build BepInEx version -->
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="Build"
Properties="DefineConstants=BEPINEX;OutputPath=$(CWDir)\BepInEx\plugins" />

<!-- Build without BepInEx -->
<PropertyGroup>
<DefineConstants></DefineConstants>
<AssemblyName>$(AssemblyName)</AssemblyName>
</PropertyGroup>

<!-- Build without BepInEx version -->
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="Build"
Properties="DefineConstants=;OutputPath=$(CWDir)\Plugins\ContentAPI\" />

<!-- Ensure the file exists before copying it -->
<ItemGroup>
<NoBepInExDll Include="$(CWDir)\Plugins\ContentAPI\$(AssemblyName).dll" />
</ItemGroup>

<!-- Copy non-BepInEx DLL to the correct path -->
<Copy SourceFiles="@(NoBepInExDll);$(MSBuildProjectDirectory)/ThunderAssets/icon.png"
DestinationFiles="$(CWDir)\Plugins\ContentAPI\$(AssemblyName).dll;$(CWDir)\Plugins\ContentAPI\icon.png"
Condition="@(NoBepInExDll) != ''" />

</Target>

<PropertyGroup>
Expand Down
6 changes: 4 additions & 2 deletions ContentAPI/ContentBepinLoad.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace ContentAPI
#if BEPINEX
namespace ContentAPI
{
using BepInEx;
using HarmonyLib;
Expand All @@ -19,4 +20,5 @@ private void Awake()
new Harmony(ContentGuid).PatchAll();
}
}
}
}
#endif
3 changes: 1 addition & 2 deletions ContentAPI/ContentPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ public static class ContentPlugin
/// <summary>
/// Gets the version of the API.
/// </summary>
public const string ContentVersion = "0.0.4";

public const string ContentVersion = "0.0.5";
/// <summary>
/// Gets whether its compatible with vanilla.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion ContentAPI/Example/InputShowcase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class InputShowcase : Input
/// <inheritdoc/>
public override void ProcessInput()
{
Debug.Log("YOOO! The player clicked Backspace.");
Debug.Log("The player Clicked Backspace Button.");
}
}
}
9 changes: 7 additions & 2 deletions ContentAPI/Patches/Generic/PickupWrapPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ private static void Postfix(PickupAPI __instance)
[HarmonyPatch(typeof(PickupAPI), nameof(PickupAPI.OnDisable))]
internal class PickupWrapPatch_Remove
{
private static void Postfix(PickupAPI __instance)
private static void Prefix(PickupAPI __instance)
{
Pickup.Items.Remove(Pickup.Get(__instance.m_itemID));
Pickup pickup = Pickup.Get(__instance.m_itemID);

if (pickup == null)
return;

Pickup.Items.Remove(pickup);
}
}
}
2 changes: 1 addition & 1 deletion ContentAPI/ThunderAssets/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ContentAPI",
"version_number": "0.0.4",
"version_number": "0.0.5",
"website_url": "https://github.com/CircusStudios/ContentAPI/",
"description": "A library of tools to help developers.",
"dependencies": [
Expand Down