_sys->gcRelease(_gcSelf);
}
+ bool isRunning() const { return _isRunning; }
+
void stop()
{
if (_isRunning) {
{
naRef *args = NULL;
_sys->callMethod(_func, _self, 0, args, naNil() /* locals */);
+ if (_singleShot) {
+ _isRunning = false;
+ }
}
void setSingleShot(bool aSingleShot)
.method("start", &TimerObj::start)
.method("stop", &TimerObj::stop)
.method("restart", &TimerObj::restart)
- .member("singleShot", &TimerObj::isSingleShot, &TimerObj::setSingleShot);
+ .member("singleShot", &TimerObj::isSingleShot, &TimerObj::setSingleShot)
+ .member("isRunning", &TimerObj::isRunning);
// Now load the various source files in the Nasal directory
simgear::Dir nasalDir(SGPath(globals->get_fg_root(), "Nasal"));
{
static naRef wrapNodeFunc = naNil();
if (naIsNil(wrapNodeFunc)) {
- nasal::Hash g(_globals, _context);
- nasal::Hash props = g.get<nasal::Hash>("props");
+ nasal::Hash props = getGlobals().get<nasal::Hash>("props");
wrapNodeFunc = props.get("wrapNode");
}
if (!_loadList.empty())
{
- // process Nasal load hook (only one per update loop to avoid excessive lags)
- _loadList.pop()->load();
+ if( _delay_load )
+ _delay_load = false;
+ else
+ // process Nasal load hook (only one per update loop to avoid excessive lags)
+ _loadList.pop()->load();
}
else
if (!_unloadList.empty())
void FGNasalSys::registerToLoad(FGNasalModelData *data)
{
- _loadList.push(data);
+ if( _loadList.empty() )
+ _delay_load = true;
+ _loadList.push(data);
}
void FGNasalSys::registerToUnload(FGNasalModelData *data)