Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialized plugin in CombatDirector #2

Merged
merged 1 commit into from
Mar 17, 2022
Merged

Initialized plugin in CombatDirector #2

merged 1 commit into from
Mar 17, 2022

Conversation

arimah
Copy link
Owner

@arimah arimah commented Mar 17, 2022

Recent changes in Risk of Rain 2 seem to have altered the way content is loaded. If we access CombatDirector data through EliteAPI too early, then things like elite types simply will not be available; everything under RoR2Content.Elites is null. Worse, using EliteAPI forces the combat director to be initialized immediately (CombatDirector.Init() is called early), and then every elite tier gets null, and no elites can ever spawn.

Patching CombatDirector.Init() is unreliable, as it can be called during plugin loading by mods that use EliteAPI. Mod order can then break this mod by simply not calling CombatDirector.Init() too early. Instead I patch ResetEliteType(), which is called before each monster wave to select an elite tier, and that seems to work much more reliably (in addition to being called as late as possible, when assets are guaranteed to have been loaded).

Bonus: normalized indentation! No mixed tabs and spaces, thank goodness.

Fixes #1

Recent changes in Risk of Rain 2 seem to have altered the way content is
loaded. If we access `CombatDirector` data through `EliteAPI` too early,
then things like elite types simply will not be available; everything
under `RoR2Content.Elites` is null. Worse, using `EliteAPI` forces the
combat director to be initialized immediately (`CombatDirector.Init()`
is called early), and then *every* elite tier gets null, and no elites
can ever spawn.

Patching `CombatDirector.Init()` is unreliable, as it can be called
during plugin loading by mods that use `EliteAPI`. Mod order can then
break this mod by simply not calling `CombatDirector.Init()` too early.
Instead I patch `ResetEliteType()`, which is called before each monster
wave to select an elite tier, and that seems to work much more reliably
(in addition to being called as *late* as possible, when assets are
guaranteed to have been loaded).
@arimah arimah changed the title Initialize plugin in CombatDirector Fix #1 Mar 17, 2022
@arimah arimah changed the title Fix #1 Initialized plugin in CombatDirector Mar 17, 2022
@arimah arimah merged commit 7f62c08 into master Mar 17, 2022
@arimah arimah deleted the issue-1 branch March 17, 2022 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Elites not spawning whatsoever
1 participant