"The Mob API" Crash on start

Post Reply
ThePropheticWarrior
New member
Posts: 4
Joined: Fri Feb 27, 2026 22:30

"The Mob API" Crash on start

by ThePropheticWarrior » Post

ModError: Failed to load and run script from C:\Users\ThePropheticWarrior\AppData\Roaming\Minetest\mods\mobs_api\init.lua:
...cWarrior\AppData\Roaming\Minetest\mods\mobs_api\init.lua:181: '}' expected (to close '{' at line 62) near '_mobs_api_health_max'
Check debug.txt for details.

Here is what is actually in the file:

function mobs_api.register_mob(def)
if not def.name then return false, "Needs a name!" end
if not def.health_max then return false, "Needs `health_max = <num>` field!" end

local entity = {
get_staticdata = function(self)
local table = {}

for k, v in pairs(self) do
if not(type(v) == "userdata" or type(v) == "function") then
table[k] = v
end
end

return core.write_json(table)
end,

on_activate = function(self, staticdata, dtime_s)
if staticdata and staticdata ~= "" then
local table = core.parse_json(staticdata) or {}
for k, v in pairs(table) do
self[k] = v
end

elseif not self._mobs_api_spawned then
if self._mobs_api_health_min then
self.object:set_hp(mobs_api.pr:next(self._mobs_api_health_min, self._mobs_api_health_max))
end

self._mobs_api_spawned = true

if self._mobs_api_on_spawn then
self._mobs_api_on_spawn(self)
end
end
end,

on_deactivate = function(self, removal)
if (not removal) and (self._mobs_api_static ~= true) then
self.object:remove()
return
end
end,

on_step = function(self, dtime, moveresult)
if not self._mobs_api_spawned then return end

self._mobs_api_last_step = self._mobs_api_last_step + dtime

if self._mobs_api_last_step >= mobs_api.step_time then
self._mobs_api_age = self._mobs_api_age + self._mobs_api_last_step
if self._mobs_api_life_time and self._mobs_api_age >= self._mobs_api_life_time then
self.object:remove()
return
end

local m_pos = self.object:get_pos()

local despawn = true
for object in core.objects_inside_radius(m_pos, self._mobs_api_despawn_distance) do
if object:is_player() then
despawn = false
break
end
end
if despawn then
self.object:remove()
return
end

if self._mobs_api_chase_distance ~= nil then
local player_to_chase = nil
for object in core.objects_inside_radius(self.object:get_pos(), self._mobs_api_chase_distance) do
if object:is_player() then
player_to_chase = object
break
end
end

if player_to_chase ~= nil then
local p_pos = player_to_chase:get_pos()
local dir = p_pos - m_pos
local mag = math.sqrt(dir.x*dir.x + dir.y*dir.y + dir.z*dir.z)

if mag > 2 then
local v = vector.new(dir.x / mag, dir.y / mag, dir.z / mag)
self.object:set_velocity(v * self._mobs_api_walk_speed + vector.new(0, self._mobs_api_gravity, 0))
if self._mobs_api_on_chase ~= nil then
self._mobs_api_on_chase(self, player_to_chase)
end

else
self.object:set_velocity(vector.new(0, self._mobs_api_gravity, 0))
if self._mobs_api_on_at_player ~= nil then
self._mobs_api_on_at_player(self, player_to_chase)

elseif self._mobs_api_on_stop ~= nil then
self._mobs_api_on_stop(self)
end
end

else
self.object:set_velocity(vector.new(0, self._mobs_api_gravity, 0))

if self._mobs_api_on_idle ~= nil then
self._mobs_api_on_idle(self)
end
end
end


if self._mobs_api_on_step ~= nil then
self._mobs_api_on_step(self, dtime, moveresult)
end

self._mobs_api_last_step = 0
end
end,

on_punched = def.on_punched,
on_rightclick = def.on_rightclick

-- Vars
_mobs_api_health_max = def.health_max,
_mobs_api_static = def.static,
_mobs_api_despawn_distance = def.despawn_distance or 32,
_mobs_api_chase_distance = def.chase_distance,
_mobs_api_walk_speed = def.walk_speed or 1,
_mobs_api_gravity = -(def.gravity or 0),
_mobs_api_spawned = false,
_mobs_api_last_step = 0,
_mobs_api_age = 0,

-- Callbacks
_mobs_api_on_spawn = def.on_spawn,
_mobs_api_life_time = def.life_time,
_mobs_api_on_step = def.on_step,
_mobs_api_on_chase = def.on_chase,
_mobs_api_on_stop = def.on_stop,
_mobs_api_on_at_player = def.on_at_player,
_mobs_api_on_idle = def.on_idle,


_mobs_api_spawned = false,
}

It is definately there, at the end of above text - at line 282 (using Notepad++)! What, is it too far away or something?

I think either Lua needs to be updated, or Luanti needs help!
Last edited by Blockhead on Sat Feb 28, 2026 01:52, edited 1 time in total.
Reason: Better title

User avatar
Blockhead
Moderator
Posts: 2927
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: "The Mob API" Crash on start

by Blockhead » Post

This is a bug in the specific mod called "The Mob API" you installed. It will crash any world when enabled. This is only one of several competing Mob APIs. Was it installed as a dependency for some other mod? I can't see any dependencies on ContentDB. I have forwarded the report as an issue to GitHub
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

jara25
Member
Posts: 15
Joined: Tue Apr 29, 2025 01:45

Re: "The Mob API" Crash on start

by jara25 » Post

The problem is a missing comma after on_rightclick = def.on_rightclick.

...but yeah what is the reason for installing this mod? Also, neither Lua nor Luanti are at fault here, although Lua's error messages could be better.
cdb_16a9468970bf

ThePropheticWarrior
New member
Posts: 4
Joined: Fri Feb 27, 2026 22:30

Re: "The Mob API" Crash on start

by ThePropheticWarrior » Post

Blockhead wrote:
Sat Feb 28, 2026 01:54
This is a bug in the specific mod called "The Mob API" you installed. It will crash any world when enabled. This is only one of several competing Mob APIs. Was it installed as a dependency for some other mod? I can't see any dependencies on ContentDB. I have forwarded the report as an issue to GitHub
I installed it as an additional feature to the Dream Builder game. All the other mob mods I grabbed use it as a dependency. The previous post before this one, has seemed to fix that. Thank you!

User avatar
Blockhead
Moderator
Posts: 2927
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: "The Mob API" Crash on start

by Blockhead » Post

ThePropheticWarrior wrote:
Sat Feb 28, 2026 13:51
I installed it as an additional feature to the Dream Builder game. All the other mob mods I grabbed use it as a dependency. The previous post before this one, has seemed to fix that. Thank you!
Please tell me what mob mods those were, since I don't think any mob mods on ContentDB use this API mod
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

ThePropheticWarrior
New member
Posts: 4
Joined: Fri Feb 27, 2026 22:30

Re: "The Mob API" Crash on start

by ThePropheticWarrior » Post

Blockhead wrote:
Sun Mar 01, 2026 01:24
ThePropheticWarrior wrote:
Sat Feb 28, 2026 13:51
I installed it as an additional feature to the Dream Builder game. All the other mob mods I grabbed use it as a dependency. The previous post before this one, has seemed to fix that. Thank you!
Please tell me what mob mods those were, since I don't think any mob mods on ContentDB use this API mod
I disabled that one, and left the Mobs Redo API active (I had both active, but weren't giving me issues between them).

I fixed the one that was previously mentioned, but there are so many other mods I was trying to use that were broken, so I gave up on Luanti (for now)! I don't have the desire, nor the patience to go around fixing mods, especially if they're not mine, and I'm not in the mood to spend time cataloging them, and posting the errors/log file everywhere for now.

Seriously, the Mod Authors and/or their Collaborators should check the code two or three times after they write code, and follow up the next day or so, after they get plenty of restful sleep - so their creations work, and come back once in a while to update or make sure nobody else is sneaking in errors! This is probably the third time I've tried running mods in Luanti, the last being about a year or two ago, and nothing has been fixed - is there anyone at all still using these, or are the mods in question just dead?

User avatar
Blockhead
Moderator
Posts: 2927
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: "The Mob API" Crash on start

by Blockhead » Post

ThePropheticWarrior wrote:
Tue Mar 03, 2026 02:50
I fixed the one that was previously mentioned, but there are so many other mods I was trying to use that were broken, so I gave up on Luanti (for now)!
You got a complete dud. Of course, I can't see why you downloaded it anyway since you can't tell me anything it depended on. Consider it bad luck more than anything. Well at least it has been delisted from ContentDB for now. And I find most crashes fairly straightforward to fix - it could be far worse with a language that's lower level than Lua.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

ThePropheticWarrior
New member
Posts: 4
Joined: Fri Feb 27, 2026 22:30

Re: "The Mob API" Crash on start

by ThePropheticWarrior » Post

Blockhead wrote:
Tue Mar 03, 2026 05:09
ThePropheticWarrior wrote:
Tue Mar 03, 2026 02:50
I fixed the one that was previously mentioned, but there are so many other mods I was trying to use that were broken, so I gave up on Luanti (for now)!
You got a complete dud. Of course, I can't see why you downloaded it anyway since you can't tell me anything it depended on. Consider it bad luck more than anything. Well at least it has been delisted from ContentDB for now. And I find most crashes fairly straightforward to fix - it could be far worse with a language that's lower level than Lua.
It's an API - the only things that it would depend on are things like the base Minetest game, etc. Other mods depend on it!

User avatar
Blockhead
Moderator
Posts: 2927
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: "The Mob API" Crash on start

by Blockhead » Post

ThePropheticWarrior wrote:
Tue Mar 03, 2026 19:07
It's an API - the only things that it would depend on are things like the base Minetest game, etc. Other mods depend on it!
Despite having a grandiose name of "THE" Mob API, I couldn't find a single thing that used it. This means the author, TX Miner, probably intended to write one later, after publishing the API, for their own mods. And if we compare download figures, something seems a bit off in your estimation of its importance: Mobs Redo with 390,000 downloads, and "The Mob API" with 200.

Minetest Game doesn't need any separate mod downloads off of ContentDB to run properly - it doesn't ship with any mobs at all. And you seem to be missing the fact that if you look for a specific animal mod like Mobs Animal, it uses a different API, Mobs Redo, which you have already mentioned. And when in the in-game Content tab you go to install Mobs Animal, ContentDB checks the dependencies and fetches Mobs Redo API for you. But it sounds like you

So I hope you can see why I think you were only being pre-emptive, or misled. I am trying to be helpful and explanatory, not contradictory (even if my tone can seem sharp :( .. )
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest