Details
Target: Obenseuer 0.5.08 (buildid 25969064), Unity 6000.0.77f1 Mono, BepInEx 6 Unity.Mono (be.788, the tested build) or BepInEx 5 (5.4.23 or later). Namespace: ObenseuerCore. Logs go to BepInEx\logs\obenseuer.moddingframework.contests.log.
Everything not listed in this reference is internal and may change without notice.
The framework changes some of the game’s methods when it starts, so it can tell your mod when a contest starts and ends and change a rat fight’s winnings. This page calls each set of changes for one feature a feature group. Each group has a name that shows up in the log. This page uses two: obenseuer.moddingframework.contests (the Started and Finished events) and obenseuer.moddingframework.contests.payout (the rat fight payout factors).
When you can call it
- Call everything from your mod’s normal code (
OnLoad, event handlers,Update), not from a background thread you started. The game only runs safely on the main thread (see the glossary). This includesOpponentToleranceandGiveUp. - It is safe to call any of it at any time. On the main menu or with no save loaded,
Active()andParticipants()give empty lists andLastResult()givesnull. Nothing throws an error to you. A failure inside the framework is caught, and the first failure of each member goes to the log. SetPayoutFactorandClearalso work insideEvents.SceneLoadedand while a save loads or saves.- Your event handlers run inside the game’s own call, one at a time. If one of your handlers throws an error, the framework logs it and still runs the other handlers.
- Events fire during a save load too. The framework does not hold them back. A handler that should ignore them can check whether the game is busy loading or saving. (
SaveData.Busyis true while a save is loading or being written.)
If something fails to set up
The framework changes some of the game’s methods when it starts. If a game update breaks one of them, the framework turns off the feature group that depends on it, and writes error lines and a warning to the group’s log file in BepInEx\logs. The rest of the framework keeps working.
- If the event changes fail, only
StartedandFinishedstop.Contests.IsAvailablebecomesfalse, andActive(),Participants()andLastResult()keep working. Its feature group isobenseuer.moddingframework.contests. (This also happens when the private field the framework needs onContestControlleris missing or has a different type.) - If the payout change fails, only the payout factors stop.
Contests.PayoutFactorsAvailablebecomesfalseandSetPayoutFactorreturnsfalse. Nothing else changes. Its feature group isobenseuer.moddingframework.contests.payout.