minetest-LOTR / Lord-of-the-Test

LOTR-inspired Subgame for Minetest. Rewrite: https://github.com/minetest-LOTR/Third-Age
Other
67 stars 31 forks source link

Problem with mobs api.lua #153

Closed 3raven closed 4 years ago

3raven commented 4 years ago

Hi,

I am using the latest version of minetest (5.2.0) with the most recent version of the master branch of lott I had the same problem that ca-min with the api.lua script in mobs that couldn't find the default:obsidianbrick node so I copied and paste the definition of this node from the default in minetest to the default in lott game.

It would be great if you can fix this (if you want I can do a pull request with the modification).

Then the game can load but crash few seconds after having started, and I get the following error :

AsyncErr: ServerThread::run Lua: Runtime error from mod '' in callback luaentity_Step(): ...home/.minetest/games/Lord-of-the-Test/mods/mobs/api.lua:102: attempt to perform arithmetic on a nil value stack traceback: ...home/.minetest/games/Lord-of-the-Test/mods/mobs/api.lua:102: in function 'set_velocity' ...home/.minetest/games/Lord-of-the-Test/mods/mobs/api.lua:1287: in function 'do_states' ...etest/games/Lord-of-the-Test/mods/lottmobs/functions.lua:298: in function 'do_custom' ...home/.minetest/games/Lord-of-the-Test/mods/mobs/api.lua:2176: in function <...elise/.minetest/games/Lord-of-the-Test/mods/mobs/api.lua:2118>

The problem seems to come from line 102 of api.lua in the function set_velocity

local yaw = self.object:get_yaw() + self.rotate or 0

Take care

lumidify commented 4 years ago

Hi, can you try to change that line to local yaw = (self.object:get_yaw() or 0) + self.rotate? I can't seem to trigger that error, but this might fix it. See https://notabug.org/TenPlus1/mobs_redo/commit/13fcf681910541467b0df18fefb31d2dae9d5451

3raven commented 4 years ago

I tried with the change you suggested. I got this mistake :

AsyncErr: ServerThread::run Lua: Runtime error from mod 'builtin' in callback luaentity_Step(): ...home/.minetest/games/Lord-of-the-Test/mods/mobs/api.lua:106: attempt to index a nil value stack traceback: ...home/.minetest/games/Lord-of-the-Test/mods/mobs/api.lua:106: in function 'set_velocity' ...home/.minetest/games/Lord-of-the-Test/mods/mobs/api.lua:1287: in function 'do_states' ...etest/games/Lord-of-the-Test/mods/lottmobs/functions.lua:298: in function 'do_custom' ...home/.minetest/games/Lord-of-the-Test/mods/mobs/api.lua:2176: in function <...home/.minetest/games/Lord-of-the-Test/mods/mobs/api.lua:2118>

3raven commented 4 years ago

I had a similar problem with mobs_redo and minetest game after the update of minetest, and then I downloaded the latest version of mobs_redo and now it works well (I dont know if this helps)

lumidify commented 4 years ago

Hi, can you try changing line 106 from y = self.object:get_velocity().y, to y = self.object:get_velocity() and self.object:get_velocity().y or 0? Relevant mobs_redo commit: https://notabug.org/TenPlus1/mobs_redo/commit/dc3ed1dfe378a2f59ff7ff9736f939d10cecfd35

I'll try to backport the nil checks from mobs_redo to our copy, but I don't know when I'll get around to it. The problem is that our mobs_redo is very old, so there are many problems with it. I don't want to update it, though, because we've changed so many parts of it to work properly with LOTT that that wouldn't be trivial. I just want to try to backport as much as is needed to make it work and then make a bugfix release of LOTT.

Amaz1 commented 4 years ago

This should be fixed now - if you could check it and let us know if it all works for you, that would be great! If it still isn't working, you can either reopen this issue, or open a new one.

3raven commented 4 years ago

Yes it works now (sorry for the late answer) thanks !