use fixed speed values (prettier and more consistent)
This commit is contained in:
parent
c86cd8c013
commit
d43853763d
1 changed files with 10 additions and 7 deletions
|
@ -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 < 0 and speed < 20000) {
|
||||
speed *= 1.5;
|
||||
if (x > 0 and current > 0) {
|
||||
current -= 1;
|
||||
} elsif (x < 0 and current < 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>
|
||||
|
|
Loading…
Add table
Reference in a new issue