minetest-mods / lightning

A mod that adds thunder and lightning effects.
13 stars 15 forks source link

Runtime error from mod 'lightning' in callback environment_Step() #2

Closed Fixer-007 closed 8 years ago

Fixer-007 commented 8 years ago

Happened while I was in etherial biome and it was raining, lightning was present, shortly it stopped with lua error (weather_pack mod was installed).

2016-06-19 01:09:58: ERROR[Main]: ServerError: Runtime error from mod 'lightning' in callback environment_Step(): Runtime error from mod 'lightning' in callback node_on_construct(): D:\Newprog\minetest\bin\..\builtin\game\misc.lua:41: Invalid core.after invocation
2016-06-19 01:09:58: ERROR[Main]: stack traceback:
2016-06-19 01:09:58: ERROR[Main]:   [C]: in function 'assert'
2016-06-19 01:09:58: ERROR[Main]:   D:\Newprog\minetest\bin\..\builtin\game\misc.lua:41: in function 'after'
2016-06-19 01:09:58: ERROR[Main]:   ...minetest\bin\..\mods\etherial_modpack\lightning\init.lua:203: in function <...minetest\bin\..\mods\etherial_modpack\lightning\init.lua:201>
2016-06-19 01:09:58: ERROR[Main]:   [C]: in function 'set_node'
2016-06-19 01:09:58: ERROR[Main]:   ...minetest\bin\..\mods\etherial_modpack\lightning\init.lua:153: in function 'strike'
2016-06-19 01:09:58: ERROR[Main]:   ...inetest\bin\..\mods\etherial_modpack\thunder/thunder.lua:18: in function <...inetest\bin\..\mods\etherial_modpack\thunder/thunder.lua:10>
2016-06-19 01:09:58: ERROR[Main]:   D:\Newprog\minetest\bin\..\builtin\game\register.lua:369: in function <D:\Newprog\minetest\bin\..\builtin\game\register.lua:349>
2016-06-19 01:09:58: ERROR[Main]: stack traceback:
2016-06-19 01:09:58: ERROR[Main]:   [C]: in function 'set_node'
2016-06-19 01:09:58: ERROR[Main]:   ...minetest\bin\..\mods\etherial_modpack\lightning\init.lua:153: in function 'strike'
2016-06-19 01:09:58: ERROR[Main]:   ...inetest\bin\..\mods\etherial_modpack\thunder/thunder.lua:18: in function <...inetest\bin\..\mods\etherial_modpack\thunder/thunder.lua:10>
2016-06-19 01:09:58: ERROR[Main]:   D:\Newprog\minetest\bin\..\builtin\game\register.lua:369: in function <D:\Newprog\minetest\bin\..\builtin\game\register.lua:349>

List of used mods:

3d_armor, 3d_armor_stand, ambience, bakedclay, bedrock, boost_cart, bows, builtin_item, carpet_api, carpet_plus, castle, cblocks, dropondie, ethereal, farming, hbarmor, hbhunger, hopper, hudbars, inventory_plus, lapis, lightning, minetest_vignette, mobs_animal, mobs_monster, mobs_npc, mobs_redo, nether, no_sneak_glitch, pie, playerplus, protector, rain, quartz, shields, signs_lib, simple_skins, smartshop, snow, teleport_potion, thunder, weather_core, wieldview, xdecor

MT 0.4.14-dev

sofar commented 8 years ago

I don't see the fire mod in this list. It is required and I think that this crash is because it is missing. Can you check if fire is enabled?

Fixer-007 commented 8 years ago

Default fire mod is enabled and included in minetest_game I guess, those mods I use are part of my modpack.

sofar commented 8 years ago

I wonder if weather_pack is attempting to strike() nodes that are not loaded. Does the crash happen if weather_pack is disabled?

rautars commented 8 years ago

Issue can be because rainy weather (including thunder) have ABM which removes fire nodes minetest.remove_node(pos) lightning mod probably try perform action for node which no longer exist. @Fixer-007, you can test if my guess is correct by disabling extinguish fire abm by setting config parameter weather_allow_abm=false

@sofar I would appreciate flag to allow disabling "fire creations by lightning" from lightning api.

Fixer-007 commented 8 years ago

I would appreciate flag to allow disabling "fire creations by lightning" from lightning api.

@xeranas @sofar disabling fire is bad workaround, instead you or sofar should make code handle such cases imo. But before rushing into this read text below.

Ok, so I wrote down weather_allow_abm = false into minetest.conf. I did /set_weather thunder to see if lua stops. After very first lightning after few seconds I got error. After restart I've managed to hear more thunder, but after some time again catched error.

2016-06-25 17:58:05: ERROR[Main]: ServerError: Runtime error from mod 'lightning' in callback environment_Step(): Runtime error from mod 'lightning' in callback node_on_construct(): D:\Newprog\minetest\bin\..\builtin\game\misc.lua:41: Invalid core.after invocation
2016-06-25 17:58:05: ERROR[Main]: stack traceback:
2016-06-25 17:58:05: ERROR[Main]:   [C]: in function 'assert'
2016-06-25 17:58:05: ERROR[Main]:   D:\Newprog\minetest\bin\..\builtin\game\misc.lua:41: in function 'after'
2016-06-25 17:58:05: ERROR[Main]:   ...minetest\bin\..\mods\etherial_modpack\lightning\init.lua:203: in function <...minetest\bin\..\mods\etherial_modpack\lightning\init.lua:201>
2016-06-25 17:58:05: ERROR[Main]:   [C]: in function 'set_node'
2016-06-25 17:58:05: ERROR[Main]:   ...minetest\bin\..\mods\etherial_modpack\lightning\init.lua:153: in function 'strike'
2016-06-25 17:58:05: ERROR[Main]:   ...inetest\bin\..\mods\etherial_modpack\thunder/thunder.lua:18: in function <...inetest\bin\..\mods\etherial_modpack\thunder/thunder.lua:10>
2016-06-25 17:58:05: ERROR[Main]:   D:\Newprog\minetest\bin\..\builtin\game\register.lua:369: in function <D:\Newprog\minetest\bin\..\builtin\game\register.lua:349>
2016-06-25 17:58:05: ERROR[Main]: stack traceback:
2016-06-25 17:58:05: ERROR[Main]:   [C]: in function 'set_node'
2016-06-25 17:58:05: ERROR[Main]:   ...minetest\bin\..\mods\etherial_modpack\lightning\init.lua:153: in function 'strike'
2016-06-25 17:58:05: ERROR[Main]:   ...inetest\bin\..\mods\etherial_modpack\thunder/thunder.lua:18: in function <...inetest\bin\..\mods\etherial_modpack\thunder/thunder.lua:10>
2016-06-25 17:58:05: ERROR[Main]:   D:\Newprog\minetest\bin\..\builtin\game\register.lua:369: in function <D:\Newprog\minetest\bin\..\builtin\game\register.lua:349>
rautars commented 8 years ago

disabling fire is bad workaround, instead you or sofar should make code handle such cases imo

Configurable option is always good thing. Also not sure if Lua have try/catch things at all (if it easy to handle such case). However my guess seems was wrong and I'm out of ideas what can cause such issue.

I did /set_weather thunder to see if lua stops. After very first lightning after few seconds I got error.

I newer hit runtime error while testing weather_mod with lightning. For your environment it seems easily reproducible. It would be easier if I could to clone your mod pack and see locally what may cause issue.

Fixer-007 commented 8 years ago

@xeranas, uploaded, try it, use v7 mapgen and as newest mt as possible, be patient: etherial_modpack.zip

sofar commented 8 years ago

wheps, mistake on my part, deleted.

sofar commented 8 years ago

try with https://github.com/minetest-mods/lightning/commit/846079370f874294a83d6dff70b1e615374b199c

Fixer-007 commented 8 years ago

Fixed issue for me