Skip to content

Commit

Permalink
Added cancel option to delayed Kaboom.
Browse files Browse the repository at this point in the history
  • Loading branch information
Russ Nash committed Dec 26, 2014
1 parent c24fde3 commit 3b0440a
Show file tree
Hide file tree
Showing 21 changed files with 36 additions and 6 deletions.
Binary file modified GameData/Kaboom/plugins/Kaboom.dll
Binary file not shown.
Binary file added Kaboom-1.1.0.zip
Binary file not shown.
Binary file modified Source/Kaboom.v12.suo
Binary file not shown.
21 changes: 19 additions & 2 deletions Source/Kaboom/Kaboom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@ public class Kaboom : PartModule
[KSPField(isPersistant = true)]
public double kaboomTime;

[KSPEvent(guiActive = true, guiActiveUnfocused = true, unfocusedRange = 2f, guiName = "Kaboom!")]
[KSPEvent(guiActive = true, guiActiveUnfocused = true, unfocusedRange = 5f, guiName = "Kaboom!", active = true)]
public void KaboomEvent()
{
KaboomIt();
}

[KSPEvent(guiActive = true, guiActiveUnfocused = true, unfocusedRange = 5f, guiName = "Cancel Kaboom!", active = false)]
public void CancelKaboomEvent()
{
CancelKaboomIt();
}

[KSPAction("Kaboom!")]
public void KaboomAction(KSPActionParam param)
{
Expand All @@ -31,6 +37,8 @@ public void KaboomAction(KSPActionParam param)

private void KaboomIt()
{
Events["CancelKaboomEvent"].active = true;
Events["KaboomEvent"].active = false;
part.force_activate();

if (delay == 0)
Expand All @@ -39,14 +47,23 @@ private void KaboomIt()
}
else
{
ScreenMessages.PostScreenMessage("Kaboom set for " + delay + " seconds.", 5.0f, ScreenMessageStyle.UPPER_CENTER);
kaboomTime = Planetarium.GetUniversalTime() + delay;
timerActive = true;
}
}

private void CancelKaboomIt()
{
Events["CancelKaboomEvent"].active = false;
Events["KaboomEvent"].active = true;
ScreenMessages.PostScreenMessage("Kaboom cancelled.", 5.0f, ScreenMessageStyle.UPPER_CENTER);
timerActive = false;
}

public override void OnUpdate()
{
base.OnFixedUpdate();
base.OnUpdate();
if (timerActive)
{
if (Planetarium.GetUniversalTime() >= kaboomTime)
Expand Down
10 changes: 6 additions & 4 deletions Source/Kaboom/Kaboom.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\..\..\..\..\KSP_win\KSP_Data\Managed\Assembly-CSharp.dll</HintPath>
<Reference Include="Assembly-CSharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\KSP_MOD\KSP_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -41,8 +42,9 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>..\..\..\..\..\..\..\KSP_win\KSP_Data\Managed\UnityEngine.dll</HintPath>
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\KSP_MOD\KSP_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down
Binary file removed Source/Kaboom/bin/Debug/Kaboom.dll
Binary file not shown.
File renamed without changes.
Binary file added Source/Kaboom/bin/Release/Kaboom.dll
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file removed Source/Kaboom/obj/Debug/Kaboom.dll
Binary file not shown.
Binary file not shown.
11 changes: 11 additions & 0 deletions Source/Kaboom/obj/Release/Kaboom.csproj.FileListAbsolute.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
C:\Users\Russ\Documents\GitHub\Kaboom\Source\Kaboom\bin\Release\Kaboom.dll
C:\Users\Russ\Documents\GitHub\Kaboom\Source\Kaboom\bin\Release\Kaboom.pdb
C:\Users\Russ\Documents\GitHub\Kaboom\Source\Kaboom\bin\Release\Assembly-CSharp.dll
C:\Users\Russ\Documents\GitHub\Kaboom\Source\Kaboom\bin\Release\UnityEngine.dll
C:\Users\Russ\Documents\GitHub\Kaboom\Source\Kaboom\bin\Release\Assembly-CSharp-firstpass.dll
C:\Users\Russ\Documents\GitHub\Kaboom\Source\Kaboom\bin\Release\TDx.TDxInput.dll
C:\Users\Russ\Documents\GitHub\Kaboom\Source\Kaboom\bin\Release\Mono.Cecil.dll
C:\Users\Russ\Documents\GitHub\Kaboom\Source\Kaboom\bin\Release\Mono.Security.dll
C:\Users\Russ\Documents\GitHub\Kaboom\Source\Kaboom\obj\Release\Kaboom.csprojResolveAssemblyReference.cache
C:\Users\Russ\Documents\GitHub\Kaboom\Source\Kaboom\obj\Release\Kaboom.dll
C:\Users\Russ\Documents\GitHub\Kaboom\Source\Kaboom\obj\Release\Kaboom.pdb
Binary file not shown.
Binary file added Source/Kaboom/obj/Release/Kaboom.dll
Binary file not shown.
Binary file not shown.

0 comments on commit 3b0440a

Please sign in to comment.