theRAPTLab / gsgo

GEM-STEP Foundation repo migrated from GitLab June 2023
1 stars 1 forks source link

StopRound event / Stop event #442

Open benloh opened 1 year ago

benloh commented 1 year ago

In GitLab by @jdanish on Apr 26, 2023, 10:40

It looks like we can't add a StopRound event in a character and have it get called. It only works via the round definitions which feels inconsistent with how start works.

benloh commented 1 year ago

The issue is probably due to the fact that we switch Sim loops at RoundStop.

function Stop() {
  // stop simulation (pause, allow resume)
  if (DBG) console.log(...PR('Stop'));
  RX_SUB.unsubscribe();
  SIM_RATE = 0;
  console.log(...PR('Post-run Loop Starting'));
  SIMSTATUS.currentLoop = LOOP.POSTRUN;
  SIMSTATUS.completed = ROUNDMGR.RoundStop();
  UR.RaiseMessage('SCRIPT_EVENT', { type: 'RoundStop' });
  RX_SUB = SIM_FRAME_MS.subscribe(m_PostRunStep);
  if (DBG) console.log(...PR('Post-run Loop Running...Monitoring Inputs'));
}

The POSTRUN loop does not run any agent scripts, just visual updates.

  GLOOP_POSTRUN: [
    // After a run, keep objects around for inspection
    // No INPUTS -- so Pozyx/PTrack objects stop moving?
    //              AND how do we keep them from getting removed?
    'UI_UPDATE',
    'VIS_UPDATE',
    'VIS_RENDER'
  ],