-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFuelTank.cs
44 lines (39 loc) · 1.16 KB
/
FuelTank.cs
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using UnityEngine;
namespace MajiirKerbalLib
{
public class FuelTank : global::FuelTank
{
protected override void onPartStart()
{
this.started = true;
base.onPartStart();
}
protected override void onPartFixedUpdate()
{
if ((this.state == PartStates.DEACTIVATED) && (this.fuel > 0))
{
this.state = PartStates.ACTIVE;
this.stackIcon.SetIconColor(XKCDColors.BrightTeal);
this.DrainFuel(0);
}
base.onPartFixedUpdate();
}
[KSPEvent(guiActive = false, guiName = "Enable flow")]
private void AllowFlow()
{
this.allowFlow = true;
UpdateGui();
}
[KSPEvent(guiActive = true, guiName = "Disable flow")]
private void DenyFlow()
{
this.allowFlow = false;
UpdateGui();
}
private void UpdateGui()
{
Events["AllowFlow"].guiActive = Events["AllowFlow"].active = !this.allowFlow;
Events["DenyFlow"].guiActive = Events["DenyFlow"].active = this.allowFlow;
}
}
}