Skip to content

Commit

Permalink
Showing 3 changed files with 47 additions and 0 deletions.
Binary file modified GameData/RP-0/Plugins/RP0.dll
Binary file not shown.
46 changes: 46 additions & 0 deletions Source/ModuleNonRecharge.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using KSP;

namespace RP0
{
public class ModuleNonRecharge : PartModule
{
[KSPField]
public string resourceName = "ElectricCharge";

protected PartResource res;

public override string GetInfo()
{
return "This module has non-rechargeable " + resourceName + ". Once depleted it cannot be replenished.";
}

public override void OnAwake()
{
base.OnAwake();

res = part.Resources.Get(resourceName);
if (res == null)
Debug.LogError("ModuleNonRecharge ERROR: cannot find resource " + resourceName);
}

protected void FixedUpdate()
{
if (!HighLogic.LoadedSceneIsFlight || vessel == null)
return;

if ((object)res != null)
{
double target = 0.0001d;
if (res.amount > target)
target = res.amount;

if (res.maxAmount > target)
res.maxAmount = target;
}
}
}
}
1 change: 1 addition & 0 deletions Source/RP0.csproj
Original file line number Diff line number Diff line change
@@ -59,6 +59,7 @@
<Compile Include="Maintenance\MaintenanceHandler.cs" />
<Compile Include="Crew\CrewHandler.cs" />
<Compile Include="DifficultyPresets.cs" />
<Compile Include="ModuleNonRecharge.cs" />
<Compile Include="ModuleNonReentryRated.cs" />
<Compile Include="ModuleNoEVA.cs" />
<Compile Include="ModuleUnpressurizedCockpit.cs" />

0 comments on commit 67441c9

Please sign in to comment.