mt-mods / technic

Technic mod for Minetest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nil index with cable plate

SwissalpS opened this issue · comments

AsyncErr: Lua: Runtime error from mod 'technic' in callback item_OnPlace(): table index is nil
stack traceback:
	[C]: in function 'rawset'
	.../20220909_2250/minetest/bin/../builtin/common/vector.lua:21: in function '__newindex'
	...bin/../mods/technic/technic/machines/register/cables.lua:102: in function <...bin/../mods/technic/technic/machines/register/cables.lua:94>

I ran into this when placing a cable plate on top of a travelnet.
(I was doing /area_pos set and missed a node, had a cable plate in hand so tried to place that)

possibly a travelnet top node issue. possibly good to fix here as there may be other such nodes.

commented

pretty sure pointed_thing something something making index to be out of bounds:

local pointed_thing_diff = vector.subtract(pointed_thing.above, pointed_thing.under)
local index = pointed_thing_diff.x + (pointed_thing_diff.y*2) + (pointed_thing_diff.z*3)
local num = index < 0 and -index + 3 or index

I guess pointed_thing above/under is too far which isn't expected, could normalize those to give give just direction instead of distance (which is assumed to be -1, 0 or 1 each axis).

Not sure but it might have something to do with over sized node and might happen with other things that use over sized nodes.