MirrorPlumber
Utility BepInEx Mod that allows modders to utilize various Mirror Networking functions at runtime
模組介紹 作者原文
Mirror Plumber
Utility BepInEx Mod that allows modders to utilize various Mirror Networking functions at runtime
This was built for YAPYAP, however, it should work in any other unity game that utilizes the same style of Mirror Networking.
Features:
- Plumber class which facilitates all the internal plumbing Mirror requires to get a NetworkBehaviour working at runtime.
- Mirror does not recognize it's Attribute tags at runtime so you'll need to utilize this Plumber in order to get things working. (without a patcher or Mirror's weaver)*
- Currently supports Commands, ClientRpcs, TargetRpcs, and Psuedo-SyncVars (PlumbVars). See `ExampleNetBehaviour.cs`
- BehaviourAdder class handles adding custom classes that inherit NetworkBehaviour to existing Prefabs.
- Currently supports adding custom NetworkBehaviour classes to the Player Prefab and any prefab in NetworkManager's spawnPrefabs list.
- The classes are hooked into the prefabs during a NetworkManager Awake prefix patch.
- You will need to supply the assetId for any non-player prefab you wish to add a custom NetworkBehaviour class to.
- NOTE: Prefabs cannot contain more than 64 NetworkBehaviours
- NOTE 2: You will still need to have MirrorPlumber perform the plumbing of your NetworkBehaviour class for it to properly network.
- NOTE 3: When adding a NetworkBehaviour to the Player Prefab, keep in mind your NetworkBehaviour will be on every instance of the Player Prefab. Not just the local instance.
- GameObjectExtensions class which holds useful gameobject extension methods that pertain to Mirror and MirrorPlumber.
- `TryRegisterPrefab Attempts to add a given gameobject to an internal MirrorPlumber list of game objects that will be registered at Mirror's NetworkClient.Initialize`
- If the prefab is null or does not contain a NetworkIdentity this will return false
- `TryGetAssetId` Attempts to provide you with a given gameobject's NetworkIdentity assetId.
- If the game object is null or does not have a NetworkIdentity, returns false
- `TryUntrackPrefab Attempts to remove a given gameobject (prefab) from the internal MirrorPlumber list of game objects that will be registered at NetworkClient.Initialize`
- If the gameobject is null, does not contain a NetworkIdentity, or is not already in the list it will return false.
- `TrySpawnOnServer` Attempts to spawn a given gameobject (prefab) on the server
- If the prefab is null or Mirror's `NetworkClient` does not contain the prefab in it's prefabs list, this will return false.
Examples:
- Network Behaviour using MirrorPlumber - ExampleNetBehaviour.cs
- Loading a Network Prefab with MirrorPlumber - ExampleCustomNetworkPrefab.cs
- Example Mod using MirrorPlumber - SkeletonCostume
Documentation:
- Documentation is WIP, for now you can view the old readme which had a lot of good but poorly organized information.
- It is HIGHLY recommended to reference Mirror's own documentation
安裝與使用 安裝:按包內說明操作
- 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
- 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
- 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
- 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。
不同模組的安裝位置差異較大,包內說明是最可靠的依據。