Skip to content

Commit 1674652

Browse files
committed
readme update and some minor stuff
1 parent 3668168 commit 1674652

5 files changed

Lines changed: 31 additions & 15 deletions

File tree

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33

44
namespace EasyPackageAPI.Core;
55

6-
public static class PackageRegister
6+
public static class PackageRegistry
77
{
88
public static List<Package> Packages = [];
99

1010
// this is not really ideal imo and will break if an update adds new packages or another mod modifies the payloads array
1111
private const int baseIndex = 17; // current (1.12c) vanilla payloadmanager payload array length - 1
1212
private static int currentIndexCount = -1;
1313

14-
public static void RegisterPackage(GameObject package, string[] shops)
14+
public static void Register(GameObject package, string[] shops)
1515
{
1616
Packages.Add(new Package(package, shops, AddIndex()));
1717
}
1818

19-
public static void RegisterPackage(GameObject package, string shop)
19+
public static void Register(GameObject package, string shop)
2020
{
2121
Packages.Add(new Package(package, [shop] , AddIndex()));
2222
}

Core/PayloadLoader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ internal static class PayloadLoader
66
{
77
public static void Load(PayloadManager payloadManager)
88
{
9-
if (PackageRegister.Packages == null) return;
9+
if (PackageRegistry.Packages == null) return;
1010

11-
foreach (Package p in PackageRegister.Packages)
11+
foreach (Package p in PackageRegistry.Packages)
1212
{
1313
if (payloadManager.payloads.Contains(p.GameObject)) return;
1414

Core/ShopLoader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ internal static class ShopLoader
66
{
77
public static void Load(ShopInfo shopInfo)
88
{
9-
if (PackageRegister.Packages == null) return;
9+
if (PackageRegistry.Packages == null) return;
1010

11-
foreach (Package p in PackageRegister.Packages)
11+
foreach (Package p in PackageRegistry.Packages)
1212
{
1313
if (shopInfo.payloads.Contains(p.GameObject)) return;
1414

EasyPackageAPI.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
99
<LangVersion>latest</LangVersion>
1010
<EasyDeliveryPath>/home/fab/.local/share/Steam/steamapps/common/Easy Delivery Co/</EasyDeliveryPath>
11-
<ModProfilePath>/home/fab/.local/share/com.kesomannen.gale/easy-delivery-co/profiles/Default/BepInEx/plugins/EasyPackageAPI/</ModProfilePath>
11+
<ModProfilePath>/home/fab/.local/share/com.kesomannen.gale/easy-delivery-co/profiles/Default/BepInEx/plugins/</ModProfilePath>
1212
<RestoreAdditionalProjectSources>
1313
https://api.nuget.org/v3/index.json;
1414
https://nuget.bepinex.dev/v3/index.json;
@@ -52,6 +52,6 @@
5252
</ItemGroup>
5353

5454
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
55-
<Exec Command="cp &quot;$(ProjectDir)bin/Debug/net472/EasyPackageAPI.dll&quot; &quot;$(ModProfilePath)/&quot;" />
55+
<Exec Command="cp &quot;$(ProjectDir)bin/Debug/net472/EasyPackageAPI.dll&quot; &quot;$(ModProfilePath)/EasyPackageAPI/&quot;" />
5656
</Target>
57-
</Project>
57+
</Project>

README.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
11
# EasyPackageAPI
22

3-
API for adding custom packages to easy delivery co.
3+
API for easily adding custom packages to easy delivery co.
44

5-
This mod does not add any packages of its own
5+
This mod does not add any packages of its own.
66

77
## How To Use
88

9-
### Example
9+
### Preamble
1010

11+
The registering of a custom package with the API is extremely easy, however the setup for a creation
12+
for a prefab is a quite tedious process.
13+
14+
I'm not going into details for this rn, but basically you would need to do these things:
15+
1. Extract the assets using a tool from the game
16+
2. Create a Unity project and import the required assets for a package
17+
3. Use an existing prefab as a template and modify it however you want
18+
(makes it easier than recreating one from scratch)
19+
4. Export your package(s) as a Asset Bundle
20+
21+
### Loading And Registering
22+
23+
#### Example Plugin.cs
1124
```csharp
1225
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
26+
[BepInDependency(EasyPackageAPI.MyPluginInfo.PLUGIN_GUID)]
1327
public class Plugin : BaseUnityPlugin
1428
{
1529
internal static ManualLogSource Log;
@@ -28,6 +42,7 @@ public class Plugin : BaseUnityPlugin
2842
RegisterPackages()
2943
}
3044

45+
// for loading your asset bundle. you can do this however you want
3146
private void LoadAssets()
3247
{
3348
// ideally put your assets in a assets sub directory but it can be anywhere
@@ -42,15 +57,16 @@ public class Plugin : BaseUnityPlugin
4257
packageTwo = myAssetBundle.LoadAsset<GameObject>("Package Two");
4358
}
4459

60+
// registering your packages
4561
private void RegisterPackages()
4662
{
4763
// add a package to multiple shops
48-
PackageRegister.RegisterPackage(packageOne,
64+
PackageRegistry.Register(packageOne,
4965
[Shops.Pawn_Shop, Shops.Easy_Depot,
5066
Shops.Bar, Shops.EZ_Bakery, Shops.Easy_Flowers]);
5167

5268
// add a package to one shop
53-
PackageRegister.RegisterPackage(packageTwo, Shops.Easy_Depot);
69+
PackageRegistry.Register(packageTwo, Shops.Easy_Depot);
5470
}
5571
}
5672
```

0 commit comments

Comments
 (0)