server crash when mcl_util.get_natural_light(pos,0.5) is nil #4048

Open
opened 2023-12-04 22:44:29 +01:00 by pepebotella · 3 comments
Contributor

MineClone2 version: master branch commit 4b63ff1c2a

What happened?

server crash in raids when mcl_util.get_natural_light(pos,0.5) is nil

ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'mcl_events' in callback environment_Step(): .../../games/MineClone2/mods/ENVIRONMENT/mcl_raids/init.lua:244: attempt to compare nil with number
ERROR[Main]: stack traceback:
ERROR[Main]: 	.../../games/MineClone2/mods/ENVIRONMENT/mcl_raids/init.lua:244: in function 'func'
ERROR[Main]: 	...-paminetest/bin/../builtin/common/after.lua:20: in function <...-paminetest/bin/../builtin/common/after.lua:5>
ERROR[Main]: 	...minetest/bin/../builtin/common/register.lua:26: in function <...minetest/bin/../builtin/common/register.lua:12>
MineClone2 version: master branch commit 4b63ff1c2a5828f3d68aa31cdaf5d0d9836a3120 ### What happened? server crash in raids when `mcl_util.get_natural_light(pos,0.5)` is `nil` ``` ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'mcl_events' in callback environment_Step(): .../../games/MineClone2/mods/ENVIRONMENT/mcl_raids/init.lua:244: attempt to compare nil with number ERROR[Main]: stack traceback: ERROR[Main]: .../../games/MineClone2/mods/ENVIRONMENT/mcl_raids/init.lua:244: in function 'func' ERROR[Main]: ...-paminetest/bin/../builtin/common/after.lua:20: in function <...-paminetest/bin/../builtin/common/after.lua:5> ERROR[Main]: ...minetest/bin/../builtin/common/register.lua:26: in function <...minetest/bin/../builtin/common/register.lua:12> ```
pepebotella added the
bug
unconfirmed
labels 2023-12-04 22:44:29 +01:00

I'm guessing this is another fake player issue. Are you using a fake player? If so, you should clearly indicate this, and any mods you use.

The code gets pos from self which I think is the mob or the player.

I have already told you, please tell us what happened before the crash and how we can recreate it. Continuing this again ignoring that suggestion does come across as trolling. If you're genuinely not trolling, you really need to give us more info. We are a project of volunteers and don't have time to fix all the bugs, let alone try to imagine niche issues and how to recreate them. Was this after completing a raid, or did you have your clock set to new years day for some testing? ;)

You raise some really niche issues, so without context, it's hard to debug. For reference, I've completed raids on server and the game didn't crash, so I know it works.

I'm guessing this is another fake player issue. Are you using a fake player? If so, you should clearly indicate this, and any mods you use. The code gets pos from self which I think is the mob or the player. I have already told you, please tell us what happened before the crash and how we can recreate it. Continuing this again ignoring that suggestion does come across as trolling. If you're genuinely not trolling, you really need to give us more info. We are a project of volunteers and don't have time to fix all the bugs, let alone try to imagine niche issues and how to recreate them. Was this after completing a raid, or did you have your clock set to new years day for some testing? ;) You raise some really niche issues, so without context, it's hard to debug. For reference, I've completed raids on server and the game didn't crash, so I know it works.

Possibly related to #3975

@Codiac

Possibly related to #3975 @Codiac
the-real-herowl added the
#P1 CRITICAL
gameplay
environment
labels 2023-12-05 02:54:31 +01:00

Possibly related to #3975

@Codiac

I'm not so sure:

local function start_firework_rocket(pos)
	local p = get_point_on_circle(pos,math.random(32,64),32)
	local n = minetest.get_node(p)
	local l = mcl_util.get_natural_light(pos,0.5)

Which is called following the raid. It sets up the raid based on the player it starts with.

cond_start  = function(self)
		--minetest.log("Cond start raid")
		local r = {}
		for _,p in pairs(minetest.get_connected_players()) do
			if mcl_potions.player_has_effect(p,"bad_omen") then
				local raid_pos = mcl_raids.find_village(p:get_pos())
				if raid_pos then
					--minetest.log("We have a raid position. Start raid")
					table.insert(r,{ player = p:get_player_name(), pos = raid_pos })
				end
			end
		end
		if #r > 0 then return r end
	end,

Pos is set here:

		for _,p in pairs(minetest.get_connected_players()) do
			if mcl_potions.player_has_effect(p,"bad_omen") then
				local raid_pos = mcl_raids.find_village(p:get_pos())
				if raid_pos then
					--minetest.log("We have a raid position. Start raid")
					table.insert(r,{ player = p:get_player_name(), pos = raid_pos })

Looks like this fake player mod is so broken, yet we seem to be spending a ridiculous amount of time investigating it because the author hasn't made that effort.

> Possibly related to #3975 > > @Codiac I'm not so sure: ``` local function start_firework_rocket(pos) local p = get_point_on_circle(pos,math.random(32,64),32) local n = minetest.get_node(p) local l = mcl_util.get_natural_light(pos,0.5) ``` Which is called following the raid. It sets up the raid based on the player it starts with. ``` cond_start = function(self) --minetest.log("Cond start raid") local r = {} for _,p in pairs(minetest.get_connected_players()) do if mcl_potions.player_has_effect(p,"bad_omen") then local raid_pos = mcl_raids.find_village(p:get_pos()) if raid_pos then --minetest.log("We have a raid position. Start raid") table.insert(r,{ player = p:get_player_name(), pos = raid_pos }) end end end if #r > 0 then return r end end, ``` Pos is set here: ``` for _,p in pairs(minetest.get_connected_players()) do if mcl_potions.player_has_effect(p,"bad_omen") then local raid_pos = mcl_raids.find_village(p:get_pos()) if raid_pos then --minetest.log("We have a raid position. Start raid") table.insert(r,{ player = p:get_player_name(), pos = raid_pos }) ``` Looks like this fake player mod is so broken, yet we seem to be spending a ridiculous amount of time investigating it because the author hasn't made that effort.
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 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#4048
No description provided.