1
0
Fork 0

use fixed speed values (prettier and more consistent)

This commit is contained in:
mfranz 2006-03-11 11:04:59 +00:00
parent c86cd8c013
commit d43853763d

View file

@ -39,16 +39,19 @@
<ufo>
<script>
var maxspeed = props.globals.getNode("engines/engine/speed-max-mps");
var speed = [5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000];
var current = 8;
controls.flapsDown = func(x) {
if (!x) { return }
var speed = maxspeed.getValue();
if (x > 0 and speed > 5) {
speed /= 1.5;
} elsif (x &lt; 0 and speed &lt; 20000) {
speed *= 1.5;
if (x > 0 and current > 0) {
current -= 1;
} elsif (x &lt; 0 and current &lt; size(speed) - 1) {
current += 1;
}
maxspeed.setDoubleValue(speed);
gui.popupTip(sprintf("MaxSpeed " ~ int(speed) ~ " m/s"));
var s = speed[current];
maxspeed.setDoubleValue(s);
gui.popupTip(sprintf("MaxSpeed " ~ s ~ " m/s"));
}
</script>
</ufo>