  We run stochastic simulations of the spatial version of the
rock-paper-scissors game, considering that individuals use sensory abilities to
scan the environment to detect the presence of enemies. If the local
dangerousness level is above a tolerable threshold, individuals aggregate
instead of moving randomly on the lattice. We study the impact of the locally
adaptive aggregation on the organisms' spatial organisation by measuring the
characteristic length scale of the spatial domains occupied by organisms of a
single species. Our results reveal that aggregation is beneficial if triggered
when the local density of opponents does not exceed $30\%$; otherwise, the
behavioural strategy may harm individuals by increasing the average death risk.
We show that if organisms can perceive further distances, they can accurately
scan and interpret the signals from the neighbourhood, maximising the effects
of the locally adaptive aggregation on the death risk. Finally, we show that
the locally adaptive aggregation behaviour promotes biodiversity independently
of the organism's mobility. The coexistence probability rises if organisms join
conspecifics, even in the presence of a small number of enemies. We verify that
our conclusions hold for more complex systems by simulating the generalised
rock-paper-scissors models with five and seven species. Our discoveries may be
helpful to ecologists in understanding systems where organisms' self-defence
behaviour adapts to local environmental cues.
