Empress ShopLoaderAPI
A developer focused API for R.E.P.O. that simplifies custom shop loading with automatic networking, RNG selection, and BepInEx config integration.
模組介紹 作者原文
Empress ShopLoaderAPI v2.1.0
- A developer focused API for R.E.P.O. that simplifies custom shop loading with automatic networking, shop level registration, and BepInEx config integration.
Changelog
2.1.0
- Added Safeguards just in-case.
Discord
-
Developers Only: This is an API for loading your custom shops. You still need to create your own shop Prefab. This API handles the loading, networking, and integration for you.
Features & Configuration
- Automatic Config Generation: My API automatically generates a configuration entry for ALL shops that use it. Users can find these under [Registered Shops] in the com.Empress.ShopAPI.cfg file.
- Shop Level Registration: Custom shops are registered as shop level entries so compatible level toggle tools can enable or disable them.
- Seamless Integration: My API automatically injects your shop into the LevelGenerator and handles the ResourceCache for both singleplayer and multiplayer pools.
Dependencies
- BepInEx is required.
- REPOLib is not required by this API.
For Developers
Critical Requirement: The Truck, Spawn Points, Screens, and Vehicle Charger
Since version 1.1.0, this API overrides the default Shop Start Room. Because of this, you must follow these rules to prevent the game from crashing:
- Use the Module Shop as your Base: When creating your shop, use the Module Shop prefab as your foundation. It contains the working shop interior, extractor components, items ect.
- COPY THE CURRENT TRUCK: The Module Shop prefab does not include a truck by default. You MUST open a current standard Shop Start Room, copy the Truck parent object, and paste it into your custom shop prefab.
- Why? The Truck handles the game's Spawn Points, Truck Screens, vehicle charging station, and critical level logic. If you do not have the current Truck object in your prefab, the game will find zero spawn points or missing shop systems and can crash.
Implementation Guide
- Add EmpressShopAPI.dll as a reference in your IDE project.
- Add [BepInDependency("com.Empress.ShopAPI")] to your plugin metadata.
- Call ShopAPI.RegisterShop in your Awake method.
using BepInEx;
using UnityEngine;
using Empress_ShopLoaderAPI;
using System.IO;
[BepInPlugin("com.YourName.MyCoolShop", "My Cool Shop", "1.0.0")]
[BepInDependency("com.Empress.ShopAPI")]
public class MyShopPlugin: BaseUnityPlugin
{
private void Awake()
{
string bundlePath = Path.Combine(Path.GetDirectoryName(Info.Location), "my_shop_bundle");
AssetBundle bundle = AssetBundle.LoadFromFile(bundlePath);
if (bundle!= null)
{
GameObject myShopPrefab = bundle.LoadAsset("MyShopPrefabName");
if (myShopPrefab!= null)
{
ShopAPI.RegisterShop(myShopPrefab, "YourName/MyCoolShop");
}
}
}
}
Credits
- Omniscye / Empress
安裝與使用 安裝:BepInEx 外掛
- 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
- 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
- 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
- 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。
帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。
下面這些內容需要先安裝,否則該模組不會生效: