EverestAPI / Everest

Everest - Celeste Mod Loader / Mod API
https://everestapi.github.io/
MIT License
345 stars 76 forks source link

SettingNumberInput crashes in game #798

Open underscoreevelyn opened 1 month ago

underscoreevelyn commented 1 month ago

My mods and Everest install are up to date

Yes

I have recreated the bug with only Everest OR a minimum number of mods enabled

Yes

Describe the bug

Trying to change a setting with SettingNumberInput while in game crashes.

Steps to reproduce

  1. Create a mod with a SettingNumberInput setting. The arguments don't matter.
  2. Enter a level. It doesn't crash in the overworld.
  3. Select the setting.

Expected behavior

Given that the number input is an Oui element like the string input, I think the setting just shouldn't show up in game, like with strings. However, reworking the number and string inputs to work in game is the more correct fix, in my opinion.

Operating System

Linux

Everest Version

4896

Mods required to reproduce

Any mod that uses SettingNumberInput, which may be none of them? IDK how this hasn't been noticed before. Here's a sample mod.

Additional context

log.txt

WEGFan commented 1 month ago

I modified string inputs into entity in my mod, and made them changable in level. Theoretically it could be used to replace the current implementation in Everest but it's a bit messy and I remember there are some small bugs in it.

https://github.com/WEGFan/Celeste-Trailine/blob/master/Code/UI/

SnipUndercover commented 1 month ago

I'm pretty sure input OUIs are unsupported outside of the overworld and require a [SettingInGame(false)] attribute to prevent them from appearing in-game.

This is what's done for string properties already, though this should probably be documented and/or handled to gray out [SettingNumberInput] properties if the player's in-game.

RedFlames commented 1 month ago

It's here https://github.com/EverestAPI/Everest/blob/d08681b0992e1c2e9020b4348af73d7373d61d56/Celeste.Mod.mm/Mod/Module/EverestModule.cs#L764 where string properties get a options button that opens a OuiModOptionString but only if not inGame. You could presumably still try to open a OuiTextEntry (=OuiModOptionString) just as you can open a SettingNumberInput... Or is it this https://github.com/EverestAPI/Everest/blob/d08681b0992e1c2e9020b4348af73d7373d61d56/Celeste.Mod.mm/Mod/Module/EverestModule.cs#L721-L722 that should be guarded against !inGame as well when there's a SettingNumberInputAttribute?

I guess that's what Snip's mentioning too, not generating the button for [SettingNumberInput] and mentioning it on the Wiki like it already is for string inputs 🤔

(Edit: Also I can't read, this is specifically about the attribute after all. Would've been nice to include the code snippet from the zip you built instead of just the binary :D) image