forked from Nivekk/KOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBindingsUniverse.cs
More file actions
29 lines (27 loc) · 853 Bytes
/
BindingsUniverse.cs
File metadata and controls
29 lines (27 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace kOS
{
[kOSBinding("ksp")]
public class BindingTimeWarp : Binding
{
public override void AddTo(BindingManager manager)
{
manager.AddGetter("WARP", delegate(CPU cpu) { return TimeWarp.fetch.current_rate_index; });
manager.AddSetter("WARP", delegate(CPU cpu, object val)
{
int newRate;
if (int.TryParse(val.ToString(), out newRate))
{
TimeWarp.SetRate(newRate, false);
}
});
foreach (CelestialBody body in FlightGlobals.fetch.bodies)
{
manager.AddGetter(body.name, delegate(CPU cpu) { return new BodyTarget(body, cpu); });
}
}
}
}