diff --git a/Aircraft/ufo/ufo-set.xml b/Aircraft/ufo/ufo-set.xml index c021ea85d..55442924a 100644 --- a/Aircraft/ufo/ufo-set.xml +++ b/Aircraft/ufo/ufo-set.xml @@ -38,11 +38,11 @@ <desc>add model to scenery</desc> </key> <key> - <name>space bar + mouse click</name> + <name>Ctrl + mouse click</name> <desc>select nearest model (flashes)</desc> </key> <key> - <name>space bar + cursor up/down</name> + <name>Ctrl + cursor up/down</name> <desc>cycle through model list</desc> </key> <key> @@ -142,11 +142,11 @@ </input> <!-- default model --> - <cursor>Aircraft/ufo/Models/cursor.ac</cursor> + <cursor type="string">Aircraft/ufo/Models/cursor.ac</cursor> <!-- subdirs of $FG_ROOT to search models in. Comma separated, e.g. "Models,Scenery/Objects/w130n30" --> - <source>Models</source> + <source type="string">Models</source> <nasal> <ufo> diff --git a/Aircraft/ufo/ufo.nas b/Aircraft/ufo/ufo.nas index 40bba3214..0e5046846 100644 --- a/Aircraft/ufo/ufo.nas +++ b/Aircraft/ufo/ufo.nas @@ -36,6 +36,7 @@ m2ft = func { arg[0] / 0.3048 } floor = func(v) { v < 0.0 ? -int(-v) - 1 : int(v) } ceil = func(v) { -floor(-v) } pow = func(v, w) { math.exp(math.ln(v) * w) } +pow2 = func(e) { e ? 2 * pow2(e - 1) : 1 } printf = func(_...) { print(call(sprintf, _)) } @@ -566,7 +567,6 @@ ModelMgr = { m.lonN.setValue(0); m.latN.setValue(0); - m.spacebarN = props.globals.getNode("/controls/engines/engine/starter", 1); m.modelpath = path; m.dynamic = nil; @@ -579,7 +579,7 @@ ModelMgr = { if (me.block) { return; } - if (me.spacebarN.getBoolValue()) { + if (KbdCtrl.getBoolValue()) { me.select(); } else { me.add_instance(); @@ -709,7 +709,7 @@ ModelMgr = { incElevator = controls.incElevator; controls.incElevator = func(step, apstep) { - if (getprop("/controls/engines/engine/starter")) { + if (KbdCtrl.getBoolValue()) { modelmgr.cycle(step > 0 ? 1 : -1); } else { incElevator(step, apstep); @@ -861,8 +861,16 @@ var modellist = nil; var adjust = nil; var modelmgr = nil; +var KbdShift = nil; +var KbdCtrl = nil; +var KbdAlt = nil; + settimer(func { + KbdShift = props.globals.getNode("/devices/status/keyboard/shift"); + KbdCtrl = props.globals.getNode("/devices/status/keyboard/ctrl"); + KbdAlt = props.globals.getNode("/devices/status/keyboard/alt"); + modellist = scanDirs(getprop("/source")); adjust = Adjust.new("/data"); modelmgr = ModelMgr.new(getprop("/cursor"));