napDistressed method

void napDistressed (
  1. covariant MissileSite sm,
  2. SamReq req
)

nap handler for entering MS.ssDistressed state.

The covariant keyword is used to inform Dart that sm will be a subclass of SamModel and not SamModel specifically.

Note that nap function are not called if we flip the state into itself.

If we do not have a timer instance we create it (and it will begin counting).

If we have a timer (site has previously been in MS.ssDuistressde state, restart timer.

Implementation

void napDistressed(covariant MissileSite sm, SamReq req) {
  //assert(log("Enter distressed mode"));
  if (sm._timer == null) {
    sm._timer = RestartableTimer(sm._timerDuration,(){incrementCtr(sm);});
  } else {
    sm._timer.reset();
  }
}