Just to note for the record that this parameter in line 107 of ruleset.2da clearly isn’t the whole story about preventing rest when enemies are nearby.
The default value is 30 metres, but if you place an enemy at 31 meters, the engine still won’t allow rest.
To be fair, ruleset.2da says it is all untested.
I had hoped to perform a check before calling ActionRest(), but a better way of doing it is to call ActionRest() unconditionally, allowing it to fail if enemies are nearby. In that case, the rest events never occur, so as long as all the custom code is in one of those events, it’s safe to allow the engine to manage the check.