Closed iqualfragile closed 9 years ago
Hey @iqualfragile,
I looked over the code in init.lua
, the stack dump says it calls inventory_plus.set_inventory_formspec
during minetest.register_on_joinplayer
:
https://github.com/cornernote/minetest-inventory_plus/blob/master/inventory_plus/init.lua#L102
it buggs out on this line: https://github.com/cornernote/minetest-inventory_plus/blob/master/inventory_plus/init.lua#L60
I suspect that its trying to get the players inventory before the player is completely initialized.
Can you try changing the wait after join from 1 to 10 (or even try 30) on this line: https://github.com/cornernote/minetest-inventory_plus/blob/master/inventory_plus/init.lua#L101
FIND:
minetest.after(1,function()
CHANGE TO:
minetest.after(10,function()
Please let me know if that fixes it. If so I'll update the code on git.
that can not be the reason, as https://github.com/cornernote/minetest-inventory_plus/blob/master/inventory_plus/init.lua#L91-95 allready call get_inventory and it does not crash there. (additionally there seems to be some code duplication as everything in register_on_joinplayer exists in get_inventory_formspec, too, and get_inventory_formspec obviously has a side effect (setting craft field size)
on a 2nd thought: why is craft grid size setting even in inventory plus? shouldnt that be part of a seperate mod?
that can not be the reason, as https://github.com/cornernote/minetest-inventory_plus/blob/master/inventory_plus/init.lua#L91-95 allready call get_inventory and it does not crash there.
Good point.
additionally there seems to be some code duplication as everything in register_on_joinplayer exists in get_inventory_formspec, too, and get_inventory_formspec obviously has a side effect (setting craft field size)
Not sure why I duplicated that code. It seems line 91-95 can be removed. I'd have to try it out and these days I don't get a lot of time to play minetest. If you want to try it and it works, I'd be happy to update the code in the repo.
2nd thought: why is craft grid size setting even in inventory plus? shouldnt that be part of a seperate mod?
The concept was to have a couple of things as part of inventory_plus, namely the things that were part of the default inventory. They could, and probably should be branched to a new mod that depends on inventory_plus.
Now, as for the crash you are getting... it occurs on player:get_inventory():set_width("craft", 3)
, and I have no idea how that is causing an issue, given that the same line has already run on line 95. Very strange. I'm open to ideas but I don't have any suggestions.
is it possible to just remove that logic?
Yes, as mentioned:
Not sure why I duplicated that code. It seems line 91-95 can be removed. I'd have to try it out and these days I don't get a lot of time to play minetest. If you want to try it and it works, I'd be happy to update the code in the repo.
Let me know if you have tested it and if it worked still.
16:26:04: ERROR[main]: ERROR: An unhandled exception occurred: .../../mods/minetest-inventory_plus/inventory_plus/init.lua:60: attempt to index a nil value 16:26:04: ERROR[main]: stack traceback: 16:26:04: ERROR[main]: .../../mods/minetest-inventory_plus/inventory_plus/init.lua:60: in function 'get_formspec' 16:26:04: ERROR[main]: .../../mods/minetest-inventory_plus/inventory_plus/init.lua:102: in function 'func' 16:26:04: ERROR[main]: /home/minetest/minetest/bin/../builtin/misc.lua:17: in function 16:26:04: ERROR[main]: /home/minetest/minetest/bin/../builtin/misc_register.lua:348: in function
In thread 7fb39d23d760: /home/minetest/minetest/src/main.cpp:1875: int main(int, char**): Assertion '0' failed. Debug stacks: DEBUG STACK FOR THREAD 7fb396eb7700:
0 virtual void* CurlFetchThread::Thread()
DEBUG STACK FOR THREAD 7fb39d23d760:
0 int main(int, char**)
(Leftover data: #1 Dedicated server branch) (Leftover data: #2 virtual void ServerMap::save(ModifiedState)) (Leftover data: #3 virtual void Database_SQLite3::saveBlock(MapBlock*)) (Leftover data: #4 void ItemStack::serialize(std::ostream&) const)
manages to shut down my server more often then i do