FakeFishGames / Barotrauma

A 2D online multiplayer game taking place in a submarine travelling through the icy depths of Jupiter's moon Europa.
http://www.barotraumagame.com/
1.67k stars 394 forks source link

The way event sets are selected makes it nearly impossible to ensure custom events trigger #14040

Closed Regalis11 closed 1 month ago

Regalis11 commented 1 month ago

Discussed in https://github.com/FakeFishGames/Barotrauma/discussions/14014

Originally posted by **UnhappyWithMyUsername** May 26, 2024 ### Disclaimers - [X] I have searched the issue tracker to check if the issue has already been reported. - [x] My issue happened while using mods. ### What happened? The way EventSets are handled is severely outdated and causes event mods to never be fully compatible due to the way the sets are loaded. The game relies on seemingly extremely old code that loads a set, then checks if that set is additive. If it is in fact additive, it will lock that set in and load another set that isn't configured as additive, then proceeds with generating the level. If the game managed to load a set that isn't additive in the first attempt, it will instantly proceed to generate the level, not even looking for an additive set that might've been configured to always load, resulting in a level with only the main EventSet running. This of course breaks event mods that for example rely on a Set that should always run alongside the main set, but due to there not being a guarantee for additive sets to load in, it is not possible to achieve that. Only allowing for one additive set to be run alongside the main event set is also causing issues if multiple mods introduce events for the same locations as only one of them will have the chance to load in, potentially breaking the mod. Additive should mean, the event set will always load alongside the main set as long as its conditions are met. The code in question: https://github.com/FakeFishGames/Barotrauma/blob/a35dbdc87cc4c07606f79921e10aeda1d4d60f67/Barotrauma/BarotraumaShared/SharedSource/Events/EventManager.cs#L182-L205 ### Reproduction steps 1. Create a mod with multiple event sets and configure them with additive="true" 2. Configure ScriptedEvents inside your sets and configure them to always load. 3. Load into the campaign and check the loaded events with "debugai". You may only see the events of one of your additive sets at all times and perhaps not even see a single one of them. ### Bug prevalence Happens every time I play ### Single player or multiplayer? Happens in both single player and multiplayer ### - _No response_ ### Version v1.4.6.0 (Blood in the Water Update, hotfix 2) ### - _No response_ ### Which operating system did you encounter this bug on? Windows ### Relevant error messages and crash reports _No response_
Regalis11 commented 1 month ago

Addressed in https://github.com/FakeFishGames/Barotrauma-development/commit/76cbe828d6e38c1c26d6909bde93fe2cd4912c0f

Made it easier for modders to add event sets in their mods and guarantee they get selected. We have support for "additive sets", which can get selected on top of a normal non-additive set, but it's entirely random: there's no way to guarantee your modded sets get chosen. I added a new SelectAlways setting to event sets, which can be used to guarantee the set gets selected.

Jasontti commented 1 month ago

Tested in: https://github.com/FakeFishGames/Barotrauma-development/pull/5347/commits/b0f4a1dfc293547a2dfcfca826a16953e01c5bae

Tested with the steps in PR With unmodified evenset set propability to 1 and checked that event trigger that way still Played some rounds to see normal events trigger

No issues found, closing ticket as completed.