slime spawn crash the server when light is nil #3975

Closed
opened 2023-10-22 17:33:25 +02:00 by pepebotella · 7 comments
Contributor

MineClone2 version:

master branch commit f941817c39

What happened?

it crash when light value is nil

ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod '' in callback environment_Step(): ...es/MineClone2/mods/ENTITIES/mobs_mc/slime+magma_cube.lua:171: attempt to compare number with nil
ERROR[Main]: stack traceback:
ERROR[Main]: 	...es/MineClone2/mods/ENTITIES/mobs_mc/slime+magma_cube.lua:171: in function 'spawn_check'
ERROR[Main]: 	.../../games/MineClone2/mods/ENTITIES/mcl_mobs/spawning.lua:1030: in function 'spawn_a_mob'
ERROR[Main]: 	.../../games/MineClone2/mods/ENTITIES/mcl_mobs/spawning.lua:1125: in function <.../../games/MineClone2/mods/ENTITIES/mcl_mobs/spawning.lua:1101>
ERROR[Main]: 	...rt1/Minetest/minetest/bin/../builtin/common/register.lua:26: in function <...rt1/Minetest/minetest/bin/../builtin/common/register.lua:12>
MineClone2 version: master branch commit f941817c390d0b607b9d173ddad3db0e58aad999 ### What happened? it crash when light value is `nil` ``` ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod '' in callback environment_Step(): ...es/MineClone2/mods/ENTITIES/mobs_mc/slime+magma_cube.lua:171: attempt to compare number with nil ERROR[Main]: stack traceback: ERROR[Main]: ...es/MineClone2/mods/ENTITIES/mobs_mc/slime+magma_cube.lua:171: in function 'spawn_check' ERROR[Main]: .../../games/MineClone2/mods/ENTITIES/mcl_mobs/spawning.lua:1030: in function 'spawn_a_mob' ERROR[Main]: .../../games/MineClone2/mods/ENTITIES/mcl_mobs/spawning.lua:1125: in function <.../../games/MineClone2/mods/ENTITIES/mcl_mobs/spawning.lua:1101> ERROR[Main]: ...rt1/Minetest/minetest/bin/../builtin/common/register.lua:26: in function <...rt1/Minetest/minetest/bin/../builtin/common/register.lua:12> ```
pepebotella added the
bug
unconfirmed
labels 2023-10-22 17:33:25 +02:00
Member

Okay - question... Are you using the very latest master snapshot? Like, from an hour ago?
And, if so, is it with or without the Minecraft 1.18+ light levels enabled?

also, @Codiac (because reasons)

Okay - question... Are you using the very latest master snapshot? Like, from an hour ago? And, if so, is it with or without the Minecraft 1.18+ light levels enabled? also, @Codiac (because reasons)

Okay - question... Are you using the very latest master snapshot? Like, from an hour ago?
And, if so, is it with or without the Minecraft 1.18+ light levels enabled?

also, @Codiac (because reasons)

It seems it is the latest master, look at the commit. Yeah, this one will be very interesting.

> Okay - question... Are you using the very latest master snapshot? Like, from an hour ago? > And, if so, is it with or without the Minecraft 1.18+ light levels enabled? > > > also, @Codiac (because reasons) It seems it is the latest master, look at the commit. Yeah, this one will be very interesting.

Also @Codiac again

Also @Codiac again
the-real-herowl added the
#P1 CRITICAL
label 2023-10-22 19:34:07 +02:00
Member

It seems it is the latest master, look at the commit. Yeah, this one will be very interesting.

Ahh, okay. You're right.
So, the question then remains -- Was the new light levels setting enabled or no?

> It seems it is the latest master, look at the commit. Yeah, this one will be very interesting. Ahh, okay. You're right. So, the question then remains -- Was the new light levels setting enabled or no?

local art_light = minetest.get_artificial_light(my_node.param1)

seems to be zero.

I'm wondering if the node in question doesn't have paramtype = "light" and whether this isn't guaranteed to always return a value, so the spawn check needs to take this into consideration.

https://github.com/minetest/minetest/blob/master/doc/lua_api.md

` local art_light = minetest.get_artificial_light(my_node.param1)` seems to be zero. I'm wondering if the node in question doesn't have paramtype = "light" and whether this isn't guaranteed to always return a value, so the spawn check needs to take this into consideration. https://github.com/minetest/minetest/blob/master/doc/lua_api.md
Contributor

I'm wondering if the node in question doesn't have paramtype = "light" and whether this isn't guaranteed to always return a value, so the spawn check needs to take this into consideration.

These would seem the most likely cause. The question then becomes what to do about the light check for that node?

You could: pass the check, fail the check, use gotten_light is the same check. Thoughts?

> I'm wondering if the node in question doesn't have paramtype = "light" and whether this isn't guaranteed to always return a value, so the spawn check needs to take this into consideration. These would seem the most likely cause. The question then becomes what to do about the light check for that node? You could: pass the check, fail the check, use gotten_light is the same check. Thoughts?
Contributor

Actually looks like git cherry pick fail on my part; it's probably because the declaration of swamp_light_max wasn't moved above the new function.

Actually looks like git cherry pick fail on my part; it's probably because the declaration of swamp_light_max wasn't moved above the new function.
Sign in to join this conversation.
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: VoxeLibre/VoxeLibre#3975
No description provided.