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

[CRASH] Crash when "Enable Damage" is off; no functionality at all #39

Open
twity1337 opened this issue Aug 8, 2022 · 5 comments
Open

Comments

@twity1337
Copy link

The mod is not working with "Enable damage" turned off in the game settings.
Either sprinting is not possible, nor consuming of items works.

Furthermore, when an item is consumed, the game crashes with the stacktraces shown below.
The reason for the crashes seem to be the missing stamina hud bar.
A solution would be to display the hud even with "Enable damage" turned off, and just don't reduce the health on starvation. With "Enable damage" turned off, it might be enough to just prevent the player from sprinting with an empty stamina.

Eating normal item:

AsyncErr: Lua: Runtime error from mod 'flowers' in callback item_OnUse(): ...nloads\minetest-5.6.0-win64\bin\..\mods\stamina\init.lua:50: bad argument #1 to 'hud_change' (number expected, got nil)
stack traceback:
	[C]: in function 'hud_change'
	...nloads\minetest-5.6.0-win64\bin\..\mods\stamina\init.lua:50: in function 'stamina_update_level'
	...nloads\minetest-5.6.0-win64\bin\..\mods\stamina\init.lua:294: in function 'eat'
	...nloads\minetest-5.6.0-win64\bin\..\mods\stamina\init.lua:267: in function <...nloads\minetest-5.6.0-win64\bin\..\mods\stamina\init.lua:265>

Eating poisened item:

AsyncErr: Lua: Runtime error from mod 'flowers' in callback item_OnUse(): ...nloads\minetest-5.6.0-win64\bin\..\mods\stamina\init.lua:298: bad argument #1 to 'hud_change' (number expected, got nil)
stack traceback:
	[C]: in function 'hud_change'
	...nloads\minetest-5.6.0-win64\bin\..\mods\stamina\init.lua:298: in function 'eat'
	...nloads\minetest-5.6.0-win64\bin\..\mods\stamina\init.lua:267: in function <...nloads\minetest-5.6.0-win64\bin\..\mods\stamina\init.lua:265>
@fluxionary
Copy link
Contributor

stamina is not meant to work in a meaningful way when playing in a creative world, but i agree that it should not crash, and perhaps sprinting should work.

@fluxionary
Copy link
Contributor

@twity1337 just double checking, did you remove these lines from the mod so that it'd load when enable_damage = false?

stamina/init.lua

Lines 1 to 4 in 1a6e893

if not minetest.settings:get_bool("enable_damage") then
minetest.log("warning", "[stamina] Stamina will not load if damage is disabled (enable_damage=false)")
return
end

@fluxionary
Copy link
Contributor

actually, the biggest problem here is that the player is using a very old copy of stamina mod, which is what's in the content DB. can someone update that?

@twity1337
Copy link
Author

twity1337 commented Aug 12, 2022

actually, the biggest problem here is that the player is using a very old copy of stamina mod, which is what's in the content DB. can someone update that?

I can confirm that I downloaded the version from contentDB (it is release "13133").

just double checking, did you remove these lines from the mod so that it'd load when enable_damage = false?

No, I didn't change any of the files. There might have been a warning showing up. However, a warning does not prevent the game from crashing.

I think, a adequate fix would include:

  • Showing the hunger/stamina bar in the hud, even if enable_damage=false.
  • No health reduction on poisonings or low stamina.
  • Being able to sprint with sufficient stamina.
  • No crashes when consuming items.

@SmallJoker
Copy link
Member

Someone created a new release on ContentDB 7-8 days ago. Does that fix the issue?

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

No branches or pull requests

3 participants