asobi_zone_grid (asobi v0.75.1)

View Source

Shared square-ring helper for asobi_world_server's interest zones and asobi_world_chat's proximity zones - both computed the exact same bounded neighbourhood of grid coordinates around a centre, previously duplicated verbatim in both modules. See widgrensit/asobi#248.

Summary

Functions

All grid coordinates within Radius of {ZX, ZY} on both axes, clamped to 0 .. GridSize - 1.

Functions

ring/3

-spec ring({integer(), integer()}, non_neg_integer(), non_neg_integer()) -> [{integer(), integer()}].

All grid coordinates within Radius of {ZX, ZY} on both axes, clamped to 0 .. GridSize - 1.

{ZX, ZY} is expected to already be a pos_to_zone/3 result (always integers by construction) - a non-integer centre, or a GridSize of 0, degrades to an empty ring rather than crashing the caller. An oversized Radius does not degrade - it simply clamps to the whole grid.