2
3
Fork
You've already forked protector
2

Protector placer allows a 1-node unprotected gap #16

Closed
opened 2026年02月06日 21:04:50 +01:00 by monk-afk · 1 comment

The current check for existing protectors:

Line 66 in b4d6296
if #core.find_nodes_in_area(vector.subtract(pos, 1), vector.add(pos, 1),

opens an edge case where two protectors placed at a distance of (protector.radius * 2) + 1 will leave a single-node-wide unprotected gap between them.

The placer checks for protector nodes within a 1-node radius, and prevents adjacent placement when adjacency is needed to fully cover protection radius.

For players, the expected behavior of the placer tool is that it always places a new protector at a distance to protect the area between an existing protector and the new one.

As a local workaround (not a suggested fix), replacing find_nodes_in_area with get_node produces the expected behavior:

	if core.get_node(pos).name:match("^protector:protect[%a%d_]*$") then
		core.chat_send_player(name, S("Protector already in place!"))
		return
	end
The current check for existing protectors: https://codeberg.org/tenplus1/protector/src/commit/b4d62961070be13a180900b1ad85d333ad46127b/tool.lua#L66 opens an edge case where two protectors placed at a distance of `(protector.radius * 2) + 1` will leave a single-node-wide unprotected gap between them. The placer checks for protector nodes within a 1-node radius, and prevents adjacent placement when adjacency is needed to fully cover protection radius. For players, the expected behavior of the placer tool is that it always places a new protector at a distance to protect the area between an existing protector and the new one. As a local workaround (not a suggested fix), replacing find_nodes_in_area with get_node produces the expected behavior: ```lua if core.get_node(pos).name:match("^protector:protect[%a%d_]*$") then core.chat_send_player(name, S("Protector already in place!")) return end ```

Changed so it only checks pos and not surrounding nodes :)

Changed so it only checks pos and not surrounding nodes :)
Sign in to join this conversation.
No Branch/Tag specified
master
No results found.
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 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
tenplus1/protector#16
Reference in a new issue
tenplus1/protector
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?