Optimize rake entity handling
This commit is contained in:
parent
9bd49cc78a
commit
ad0952a773
@ -59,16 +59,21 @@ end
|
|||||||
|
|
||||||
local function dorake(pos, node, user, ...)
|
local function dorake(pos, node, user, ...)
|
||||||
local sneak = user:get_player_control().sneak
|
local sneak = user:get_player_control().sneak
|
||||||
|
local objpos = {}
|
||||||
for _, rel in ipairs(rakepos) do
|
for _, rel in ipairs(rakepos) do
|
||||||
local p = vector.add(pos, rel)
|
local p = vector.add(pos, rel)
|
||||||
local n = minetest.get_node(p)
|
local n = minetest.get_node(p)
|
||||||
if rakable[n.name] and ((not sneak) or matching(pos, node, p, n)) then
|
if rakable[n.name] and ((not sneak) or matching(pos, node, p, n)) then
|
||||||
minetest.node_dig(p, n, user, ...)
|
minetest.node_dig(p, n, user, ...)
|
||||||
end
|
end
|
||||||
for _, obj in pairs(nodecore.get_objects_at_pos(p)) do
|
objpos[minetest.hash_node_position(p)] = true
|
||||||
local lua = obj and obj.get_luaentity and obj:get_luaentity()
|
end
|
||||||
if lua and lua.name == "__builtin:item" then
|
for _, lua in pairs(minetest.luaentities) do
|
||||||
obj:set_pos(pos)
|
if lua.name == "__builtin:item" then
|
||||||
|
local p = lua.object and lua.object:get_pos()
|
||||||
|
if p and objpos[minetest.hash_node_position(
|
||||||
|
vector.round(p))] then
|
||||||
|
lua.object:set_pos(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user