Skip to content

Commit

Permalink
Add Parachutes; Import ModuleManager definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
602p committed Dec 5, 2014
1 parent a3a7ee1 commit 6d66793
Show file tree
Hide file tree
Showing 9 changed files with 300 additions and 0 deletions.
1 change: 1 addition & 0 deletions Entropy/Entropy/Entropy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<Compile Include="FailureModules\Solar.cs" />
<Compile Include="FailureModules\SRB.cs" />
<Compile Include="Utilities\PermissiveEnginesManager.cs" />
<Compile Include="FailureModules\Parachutes.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
Expand Down
69 changes: 69 additions & 0 deletions Entropy/Entropy/FailureModules/Parachutes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ippo;
using UnityEngine;
using KSP;

namespace coffeeman
{
public class ModuleParachuteReliability : ippo.FailureModule
{
ModuleParachute chute;
bool canFail;

public override string DebugName { get { return "Canopy_stock_chutes"; } }
public override string ScreenName { get { return "Canopy"; } }
public override string FailureMessage { get { return "The Canopy of a Parachute has degraded"; } }
public override string RepairMessage { get { return "You have repaired Canopy"; } }
public override string FailGuiName { get { return "Fail Canopy"; } }
public override string EvaRepairGuiName { get { return "Patch hole"; } }
public override string MaintenanceString { get { return "Patch Canopy"; } }

public override bool PartIsActive()
{
// A chute is active if its not stowed
return chute.deploymentState != ModuleParachute.deploymentStates.STOWED;
}

protected override void DI_Start(StartState state)
{
chute = this.part.Modules.OfType<ModuleParachute>().Single();

foreach ( Part part_each in this.part.vessel.Parts){ //Make sure that there is at least one other chute on the craft!
if (part_each != this.part) {
foreach (PartModule module_each in part_each.Modules) {
if (module_each is ModuleParachute) {
this.canFail = true;
}
}
}
}
}

protected override bool DI_FailBegin()
{
return canFail;
}

protected override void DI_Disable()
{
;
}


protected override void DI_EvaRepair()
{
;
}

protected override void DI_Update(){
if (this.HasFailed) {
chute.deploymentState = ModuleParachute.deploymentStates.SEMIDEPLOYED;
chute.Deploy ();
}
}
}
}

36 changes: 36 additions & 0 deletions ModuleManager/Engines_Coolant.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@PART[*]:HAS[@MODULE[ModuleEngines*]:HAS[!PROPELLANT[SolidFuel],!PROPELLANT[XenonGas]]]:FOR[Entropy]
{
MODULE
{
name = ModuleCoolantReliability

// Annual Failure Rate: 100%
MTBF = 8760

// Engines must decay *VERY* quickly compared to other parts
LifeTime = 1

// Amount of spare parts needed to repair the part
RepairCost = 10
// Fraction of the age that is discounted when repairing (from 0 to 1)
RepairBonus = 0.1

// Amount of spare parts needed for preemptive maintenance
MaintenanceCost = 2

// Fraction of the age that is discounted when doing maintenance (from 0 to 1)
MaintenanceBonus = 0.3

// Duration of the inspection bonus, in seconds
InspectionBonus = 120

// Set to true to suppress all notifications about this module
Silent = false

DANGIT_PERKS
{
perk = Mechanic:Skilled
perk = Electrician:Normal
}
}
}
36 changes: 36 additions & 0 deletions ModuleManager/Intakes.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@PART[*]:HAS[@MODULE[ModuleResourceIntake]]:FOR[Entropy]:NEEDS[DangIt]
{
MODULE
{
name = ModuleIntakeReliability

// Annual Failure Rate: 100%
MTBF = 1

// Engines must decay *VERY* quickly compared to other parts
LifeTime = 1

// Amount of spare parts needed to repair the part
RepairCost = 1
// Fraction of the age that is discounted when repairing (from 0 to 1)
RepairBonus = 1

// Amount of spare parts needed for preemptive maintenance
MaintenanceCost = 1

// Fraction of the age that is discounted when doing maintenance (from 0 to 1)
MaintenanceBonus = 0.3

// Duration of the inspection bonus, in seconds
InspectionBonus = 120

// Set to true to suppress all notifications about this module
Silent = false

DANGIT_PERKS
{
perk = Mechanic:Unskilled
perk = Electrician:Unskilled
}
}
}
36 changes: 36 additions & 0 deletions ModuleManager/Parachutes.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@PART[*]:HAS[@MODULE[ModuleParachute]]:FOR[Entropy]:NEEDS[DangIt&!RealChute]
{
MODULE
{
name = ModuleParachuteReliability

// Two years
MTBF = 17520

// Engines must decay *VERY* quickly compared to other parts
LifeTime = 20

// Amount of spare parts needed to repair the part
RepairCost = 1
// Fraction of the age that is discounted when repairing (from 0 to 1)
RepairBonus = 1

// Amount of spare parts needed for preemptive maintenance
MaintenanceCost = 1

// Fraction of the age that is discounted when doing maintenance (from 0 to 1)
MaintenanceBonus = 0.3

// Duration of the inspection bonus, in seconds
InspectionBonus = 3600

// Set to true to suppress all notifications about this module
Silent = false

DANGIT_PERKS
{
perk = Mechanic:Unskilled
perk = Electrician:Unskilled
}
}
}
36 changes: 36 additions & 0 deletions ModuleManager/SRBs.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@PART[*]:HAS[@MODULE[ModuleEngines]:HAS[@PROPELLANT[SolidFuel]],!MODULE[NoSRBFailures],]:NEEDS[DangIt]:FOR[Entropy]
{
MODULE
{
name = ModuleSRBReliability

// Annual Failure Rate: 100%
MTBF = 8000;

// Engines must decay *VERY* quickly compared to other parts
LifeTime = 1

// Amount of spare parts needed to repair the part
RepairCost = 10
// Fraction of the age that is discounted when repairing (from 0 to 1)
RepairBonus = 1

// Amount of spare parts needed for preemptive maintenance
MaintenanceCost = 5

// Fraction of the age that is discounted when doing maintenance (from 0 to 1)
MaintenanceBonus = 0.3

// Duration of the inspection bonus, in seconds
InspectionBonus = 600

// Set to true to suppress all notifications about this module
Silent = false

DANGIT_PERKS
{
perk = Mechanic:Skilled
perk = Electrician:Normal
}
}
}
36 changes: 36 additions & 0 deletions ModuleManager/SmallTanks.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@PART[*]:HAS[@RESOURCE[MonoPropellant]]:NEEDS[DangIt]:FOR[Entropy]
{
MODULE
{
name = ModuleSmallTankExploder

// Annual Failure Rate: 100%
MTBF = 32000;

// Engines must decay *VERY* quickly compared to other parts
LifeTime = 320

// Amount of spare parts needed to repair the part
RepairCost = 10
// Fraction of the age that is discounted when repairing (from 0 to 1)
RepairBonus = 1

// Amount of spare parts needed for preemptive maintenance
MaintenanceCost = 2

// Fraction of the age that is discounted when doing maintenance (from 0 to 1)
MaintenanceBonus = 0.3

// Duration of the inspection bonus, in seconds
InspectionBonus = 600

// Set to true to suppress all notifications about this module
Silent = false

DANGIT_PERKS
{
perk = Mechanic:Skilled
perk = Electrician:Normal
}
}
}
36 changes: 36 additions & 0 deletions ModuleManager/Solar.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@PART[*]:HAS[@MODULE[ModuleDeployableSolarPanel]]:FOR[Entropy]
{
MODULE
{
name = ModuleSolarReliability

// Two years
MTBF = 17520

// Engines must decay *VERY* quickly compared to other parts
LifeTime = 17520

// Amount of spare parts needed to repair the part
RepairCost = 2
// Fraction of the age that is discounted when repairing (from 0 to 1)
RepairBonus = 0.8

// Amount of spare parts needed for preemptive maintenance
MaintenanceCost = 1

// Fraction of the age that is discounted when doing maintenance (from 0 to 1)
MaintenanceBonus = 0.3

// Duration of the inspection bonus, in seconds
InspectionBonus = 86400

// Set to true to suppress all notifications about this module
Silent = false

DANGIT_PERKS
{
perk = Mechanic:Normal
perk = Electrician:Skilled
}
}
}
14 changes: 14 additions & 0 deletions ModuleManager/Stock_Ignores.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@PART[sepMotor1]:BEFORE[Entropy]
{
MODULE
{
name = NoSRBFailures
}
}
@PART[LaunchEscapeSystem]:BEFORE[Entropy]
{
MODULE
{
name = NoSRBFailures
}
}

0 comments on commit 6d66793

Please sign in to comment.