Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify that ABM neighbor check is correct #29

Open
S-S-X opened this issue Sep 17, 2021 · 1 comment
Open

Verify that ABM neighbor check is correct #29

S-S-X opened this issue Sep 17, 2021 · 1 comment
Labels
good first issue Good for newcomers question Further information is requested

Comments

@S-S-X
Copy link
Owner

S-S-X commented Sep 17, 2021

If this is correct then just drop comment about it and close issue.
If this is not correct then obviously fix it (or leave comment about it, possibly pointing out what should be changed + bug label).
https://github.com/mt-mods/mineunit/blob/8fc399e1f597ab9a17e285d563aac895c50584dc/server.lua#L53-L68

@S-S-X S-S-X added question Further information is requested good first issue Good for newcomers labels Sep 17, 2021
@S-S-X
Copy link
Owner Author

S-S-X commented Oct 22, 2021

ABM handling was updated (for performance) here #36, match_neighbor loop however is still the same and requires checking for correct behavior.

mineunit/server.lua

Lines 39 to 56 in 3ab99b0

local function match_neighbor(pos, nodes, groups)
-- TODO: Make sure this is how engine actually looks for neighbors
local rnodes = core.registered_nodes
for x=-1,1 do
for y=-1,1 do
for z=-1,1 do
-- Skip pos itself
if not (x == 0 and y == 0 and z == 0) then
local node = world.nodes[core.hash_node_position({x=x,y=y,z=z})]
local name = node and node.name
if name and match_nodes(name, rnodes[name] and rnodes[name].groups, nodes, groups) then
return true
end
end
end
end
end
end

@S-S-X S-S-X added this to Mineunit Jan 11, 2024
@S-S-X S-S-X moved this to Ready in Mineunit Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers question Further information is requested
Projects
Status: Ready
Development

No branches or pull requests

1 participant