I am using Trisquel 11.0.1, but a friend reported that this issue also happens on Windows, and we actually discovered the issue in a different game (that uses code from Shadow Forest) on a Debian machine. Since the issue depends on the Luanti version, I used ROllerozxa's AppImage builds [1] to figure out which versions were affected. I found that versions 5.16.0 and 5.16.1 crash, but 5.15.2 does not. I tested this pull request on all 3 of those versions as well as a local build of 5.8.0.
The crash happens when the player shoots a shadow monster with the Staff of Light, or when a shadow monster attacks the player. I am not sure exactly why the crash happens, but it seems to have something to do with math.huge, as replacing instances of that with nil fixes the crash. This pull request simply replaces math.huge in both calls to punch. There are 2 other uses of math.huge in Shadow Forest, but those don't seem to cause a problem.
I am not very familiar with punch calls, but based on my understanding, the number used here should not affect damage amount, because full_punch_interval is always 0.0 (except for the melee weapons which don't use the affected punch calls). lua_api.md does not describe what passing nil actually does, but my guess is that it's like the previous use of math.huge, which is to just do full damage here.
[1] https://github.com/rollerozxa/luanti-appimage/
I am using Trisquel 11.0.1, but a friend reported that this issue also happens on Windows, and we actually discovered the issue in a different game (that uses code from Shadow Forest) on a Debian machine. Since the issue depends on the Luanti version, I used ROllerozxa's AppImage builds [1] to figure out which versions were affected. I found that versions 5.16.0 and 5.16.1 crash, but 5.15.2 does not. I tested this pull request on all 3 of those versions as well as a local build of 5.8.0.
The crash happens when the player shoots a shadow monster with the Staff of Light, or when a shadow monster attacks the player. I am not sure exactly why the crash happens, but it seems to have something to do with math.huge, as replacing instances of that with nil fixes the crash. This pull request simply replaces math.huge in both calls to punch. There are 2 other uses of math.huge in Shadow Forest, but those don't seem to cause a problem.
I am not very familiar with punch calls, but based on my understanding, the number used here should not affect damage amount, because full_punch_interval is always 0.0 (except for the melee weapons which don't use the affected punch calls). lua_api.md does not describe what passing nil actually does, but my guess is that it's like the previous use of math.huge, which is to just do full damage here.
[1] https://github.com/rollerozxa/luanti-appimage/