1
0
Fork 0

Fix timer usage

- didn't need to be a maketimer as it is a single shot usage.
This commit is contained in:
Richard Harrison 2018-12-15 16:28:32 +01:00
parent 0200041d74
commit 07ac341b70

View file

@ -1,18 +1,13 @@
seaportLoop = func { _setlistener("/sim/signals/nasal-dir-initialized", func {
_setlistener("/sim/presets/latitude-deg", func {
printlog("info", "*** NEW LOCATION ***");
settimer(func {
var typ = getprop("/sim/type"); var typ = getprop("/sim/type");
var lat = getprop("/position/latitude-deg"); var lat = getprop("/position/latitude-deg");
var lon = getprop("/position/longitude-deg"); var lon = getprop("/position/longitude-deg");
var g = geodinfo(lat, lon); var g = geodinfo(lat, lon);
if ((g != nil and g[1] != nil and g[1].solid) and (typ == "seaplane") ) if ((g != nil and g[1] != nil and g[1].solid) and (typ == "seaplane") )
fgcommand("dialog-show", props.Node.new({ "dialog-name": "seaport" })); fgcommand("dialog-show", props.Node.new({ "dialog-name": "seaport" }));
}; }, 8);
seaportTimer = maketimer(8, seaportLoop);
seaportTimer.simulatedTime = 1;
_setlistener("/sim/signals/nasal-dir-initialized", func {
_setlistener("/sim/presets/latitude-deg", func {
printlog("info", "*** NEW LOCATION ***");
seaportTimer.restart(8);
}, 1); }, 1);
}); });