requireTravel method

void requireTravel(
  1. EntityDef entity,
  2. LevelScope scope,
  3. List<LevelIssue> out
)

Reports that a movement offset is missing or goes nowhere.

Implementation

void requireTravel(EntityDef entity, LevelScope scope, List<LevelIssue> out) {
  final travel = entity.vector('travel');
  if (travel == null) {
    out.add(
      LevelIssue(
        Severity.error,
        'has no "travel" offset, so it has nowhere to go',
        where: scope.describe(entity),
      ),
    );
    return;
  }
  if (travel.length < GeometryTolerance.zeroLength) {
    out.add(
      LevelIssue(
        Severity.warning,
        'travels nowhere',
        where: scope.describe(entity),
      ),
    );
  }
}