Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
ScopePartitioningLibrary
A library for mod developers: splits R.E.P.O.'s player lookups into scopes (enemies, hazards, truck, UI...) so mods can add proxy players that only some of the game sees. Changes nothing on its own.
| Last updated | 18 minutes ago |
| Total downloads | 0 |
| Total rating | 0 |
| Categories | Libraries AI Generated |
| Dependency string | HatterTeam-ScopePartitioningLibrary-1.0.0 |
| Dependants | 0 other packages depend on this package |
This mod requires the following mods to function
BepInEx-BepInExPack
BepInEx pack for Mono Unity games. Preconfigured and ready to use.
Preferred version: 5.4.2305README
Latest changes 1.0.0
- First release: splits the game's player lookups into scopes, with a startup report and config overrides.
- Proxy players: mods can add players that only the chosen scopes see, with health events, an optional physics body, and multiplayer sync.
Scope Partitioning Library
TLDR
If you want to develop mods that mimics players, this library helps to separate the different scopes which interact with players. For example, in the mod HatterMiscellaneousPack, there's an item Decoy Bear which pulls enemies attention by mimicking a player body in the bear, but the same body doesn't interact with other scopes such as the truck healing at the end of a level.
WARNING FOR DEVELOPERS
This library is vibe-coded, I've done a bit of testing with the library itself and with HatterMiscellaneousPack, but I havn't actually to hand-write the code using the library, so the API docs MIGHT be a bit problematic to read. I highly recommend just feeding LLM Guide.md to AI and let it do the work instead.
A library for mod developers. On its own it changes nothing in the game; install it only if a mod asks for it.
R.E.P.O. keeps one list of players, and every part of the game reads it: enemies, traps, the truck, extraction, spectating, voice chat... This library splits those lookups into scopes (Enemies, Hazards, Valuables, NPCs, Items, LevelFlow, CameraAndUI, VoiceAndEyes, Network, Mods). Mods can then add proxy players that only some scopes see: for example a decoy only enemies notice, which the truck, extraction and spectating ignore.
- Real players behave the same way as before, all scopes are left in place.
- With no proxies, every part of the game gets the game's own player list back, unchanged.
- It finds the game's player lookups by reading the game's code at startup, so updates that add new ones are picked up (unknown ones are left alone).
For players
Nothing to set up. The config (BepInEx/config/ScopePartitioningLibrary.cfg) has an on/off switch, scope overrides and
log switches. At startup one line in BepInEx/LogOutput.log sums up what was found; turn on
[Report] LogFullReport for the full list of player lookups and their scopes.
For mod developers
The full API reference is in API.md, included in this package (next to the DLL, with ScopePartitioningLibrary.xml
for your editor's tooltips). LLM_GUIDE.md, also included, is the same API written to be handed straight to an AI
coding assistant (complete signatures, the rules that make proxies work, templates). Short version:
[BepInDependency(ScopePartitioningLibrary.Plugin.Guid)]
// the players enemies can see (real players + proxies visible to enemies)
List<PlayerAvatar> seen = ScopedPlayers.Get(PlayerScope.Enemies);
// run code as if it were enemy code
using (ScopedPlayers.Enter(PlayerScope.Enemies)) { var all = SemiFunc.PlayerGetList(); }
// a decoy only enemies see, on every player's game (host)
var decoy = ProxyPlayer.CreateNetworked(new ProxySettings { Name = "Decoy", Anchor = transform, MaxHealth = 200 }, photonView);
decoy.Hurt += (p, hit) => { /* your health logic */ };
Modders can test with [Debug] TestProxyKey in the config: it places a stand-in only enemies can see.
Feedback
If you have any issues or feedback, contact me at the GitHub page: https://github.com/kt-kianheng/repo_mods