From bfc262c8d1ee79a5481071918aebd10cc969ed0b Mon Sep 17 00:00:00 2001 From: Alexander Yalov Date: Tue, 14 Sep 2021 19:32:37 +0300 Subject: [PATCH 01/13] welding --- Source/Welding.cs | 139 +++++++++++++++++++++++++++++++++ Source/WeldingData.cs | 9 +++ Source/WeldingNodeUtilities.cs | 82 +++++++++++++++++++ source/Kaboom.cs | 50 ++++++++++-- 4 files changed, 275 insertions(+), 5 deletions(-) create mode 100644 Source/Welding.cs create mode 100644 Source/WeldingData.cs create mode 100644 Source/WeldingNodeUtilities.cs diff --git a/Source/Welding.cs b/Source/Welding.cs new file mode 100644 index 0000000..87b3a56 --- /dev/null +++ b/Source/Welding.cs @@ -0,0 +1,139 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEngine; +using System.Reflection; +using PreFlightTests; +using TestScripts; + +namespace Kaboom +{ + public class Welding + { + Vessel vessel; + Part part; + public Welding(Vessel vessel, Part part) + { + this.vessel = vessel; + this.part = part; + } + + public void MergeParts(bool compress) + { + if (vessel.rootPart == part) + { + ScreenMessages.PostScreenMessage("You cannot weld the root part!"); + return; + } + + var wData = LoadWeldingData(); + if (wData == null) + return; + + PerformWeld(wData, compress); + } + + private WeldingData LoadWeldingData(bool silent = false) + { + /********************** + * + * (root)-...-LPA==KGP==LPB + * + * LPA==LPB + * + **********************/ + + var wData = new WeldingData(); + wData.KaboomGluedPart = part; + + + if (part.attachNodes.Count == 2) + { + + wData.LinkedPartA = part.parent; + + foreach(var n in part.attachNodes) + if (n.attachedPart != part.parent) + wData.LinkedPartB = n.attachedPart; + } + + if (wData.LinkedPartA == null || wData.LinkedPartB == null) + { + if (!silent) + ScreenMessages.PostScreenMessage("This part need to have 2 parts on attachment nodes"); + return null; + } + + if (wData.KaboomGluedPart == vessel.rootPart) + { + if (!silent) + ScreenMessages.PostScreenMessage("This part is the root part! Cancelling"); + return null; + } + + return wData; + } + + + private Vector3 GetOffset(WeldingData wData) + { + var nodeA = WeldingNodeUtilities.GetLinkingNode(wData.LinkedPartA, wData.KaboomGluedPart); + var nodeB = WeldingNodeUtilities.GetLinkingNode(wData.LinkedPartB, wData.KaboomGluedPart); + + Vector3 offset = nodeA.position - nodeB.position; + Debug.Log("offset: " + offset); + return offset; + } + + private void PerformWeld(WeldingData wData, bool compress) + { + var nodeA = WeldingNodeUtilities.GetLinkingNode(wData.LinkedPartA, wData.KaboomGluedPart); + var nodeB = WeldingNodeUtilities.GetLinkingNode(wData.LinkedPartB, wData.KaboomGluedPart); + + var offset = GetOffset(wData); + + + WeldingNodeUtilities.DetachPart(wData.KaboomGluedPart); + + WeldingNodeUtilities.SwapLinks( + wData.LinkedPartA, + wData.KaboomGluedPart, + wData.LinkedPartB); + + WeldingNodeUtilities.SwapLinks( + wData.LinkedPartB, + wData.KaboomGluedPart, + wData.LinkedPartA); + + wData.KaboomGluedPart.SetCollisionIgnores(); + + WeldingNodeUtilities.SpawnStructures(wData.LinkedPartA, nodeA); + WeldingNodeUtilities.SpawnStructures(wData.LinkedPartB, nodeB); + + + if (compress) + { + WeldingNodeUtilities.MovePart(wData.LinkedPartB, offset); + } + + + PartJoint newJoint = PartJoint.Create( + wData.LinkedPartB, + wData.LinkedPartA, + nodeB, + nodeA, + AttachModes.STACK); + + wData.LinkedPartB.attachJoint = newJoint; + + SoftExplode(wData.KaboomGluedPart); + } + + private static void SoftExplode(Part thisPart) + { + thisPart.explosionPotential = 0.1f; + thisPart.explode(); + } + } +} diff --git a/Source/WeldingData.cs b/Source/WeldingData.cs new file mode 100644 index 0000000..93305e9 --- /dev/null +++ b/Source/WeldingData.cs @@ -0,0 +1,9 @@ +namespace Kaboom +{ + public class WeldingData + { + public Part LinkedPartA { get; set; } + public Part LinkedPartB { get; set; } + public Part KaboomGluedPart { get; set; } + } +} \ No newline at end of file diff --git a/Source/WeldingNodeUtilities.cs b/Source/WeldingNodeUtilities.cs new file mode 100644 index 0000000..dc833c2 --- /dev/null +++ b/Source/WeldingNodeUtilities.cs @@ -0,0 +1,82 @@ +using System.Linq; +using UnityEngine; +//using USITools; + +namespace Kaboom +{ + public static class WeldingNodeUtilities + { + public static void SpawnStructures(Part thisPart, AttachNode thisNode) + { + var structList = thisPart.FindModulesImplementing(); + foreach (var s in structList.Where(s => s.attachNodeNames.Contains(thisNode.id))) + { + s.SpawnStructure(); + } + } + + public static void DetachPart(Part thisPart) + { + thisPart.parent = null; + thisPart.attachJoint.DestroyJoint(); + thisPart.children.Clear(); + + foreach (var an in thisPart.attachNodes) + { + an.attachedPart = null; + } + thisPart.topNode.attachedPart = null; + } + + public static void MovePart(Part thisPart, Vector3 offset) + { + if (thisPart.Rigidbody != null && thisPart.physicalSignificance == Part.PhysicalSignificance.FULL) + thisPart.transform.position += offset; + + thisPart.UpdateOrgPosAndRot(thisPart.vessel.rootPart); + + foreach (var p in thisPart.children) + MovePart(p, offset); + } + + + public static void SwapLinks(Part thisPart, Part oldPart, Part newPart) + { + if (thisPart.parent != null && thisPart.parent == oldPart) + thisPart.parent = newPart; + + if(thisPart.topNode != null && thisPart.topNode.attachedPart == oldPart) + thisPart.topNode.attachedPart = newPart; + + if (thisPart.attachJoint != null) + { + if (thisPart.attachJoint.Child == oldPart || thisPart.attachJoint.Parent == oldPart) + { + thisPart.attachJoint.DestroyJoint(); + } + } + + foreach (var an in thisPart.attachNodes.Where(an => an.attachedPart == oldPart)) + { + an.attachedPart = newPart; + } + + if (!thisPart.children.Contains(oldPart)) + return; + + thisPart.children.Remove(oldPart); + thisPart.children.Add(newPart); + } + + public static float GetPartThickness(Part thisPart) + { + var diff = thisPart.attachNodes[0].position - thisPart.attachNodes[1].position; + return (diff).magnitude; + } + + public static AttachNode GetLinkingNode(Part p1, Part p2) + { + return p1.attachNodes.FirstOrDefault(an => an.attachedPart == p2); + } + } +} \ No newline at end of file diff --git a/source/Kaboom.cs b/source/Kaboom.cs index ce6b2d1..a606c64 100644 --- a/source/Kaboom.cs +++ b/source/Kaboom.cs @@ -3,6 +3,8 @@ using System.Linq; using System.Text; using UnityEngine; +using KSP.Localization; + namespace Kaboom { /// @@ -23,6 +25,32 @@ public class ModuleKaboom : PartModule [KSPField(isPersistant = true)] public double kaboomTime; + [KSPField(isPersistant = true)] + public bool isGlued = false; + + [KSPField(guiName = "Glued", guiActive = true, guiActiveEditor = true, + groupName = "Kaboom", groupStartCollapsed = true)] + public string gluedText = Localizer.Format("#autoLOC_6001071"); /*Disabled*/ + + + [KSPEvent(guiActive = true, guiActiveEditor = true, guiName = "Enable Glued", groupName = "Kaboom", active = true)] + public void GluedEvent() + { + isGlued = !isGlued; + if (isGlued) + { + gluedText = Events["GluedEvent"].guiName = Localizer.Format("#autoLOC_6001072")/*Enabled*/; + Events["GluedEvent"].guiName = "Disable Glued"; + } + + else + { + gluedText = Events["GluedEvent"].guiName = Localizer.Format("#autoLOC_6001071")/*Disabled*/; + Events["GluedEvent"].guiName = "Enable Glued"; + } + + } + [KSPEvent(guiActive = true, guiActiveUnfocused = true, unfocusedRange = 5f, guiName = "Kaboom!", groupName = "Kaboom", active = true)] public void KaboomEvent() { @@ -36,8 +64,7 @@ public void CancelKaboomEvent() } [KSPAction("Kaboom!")] - public void KaboomAction(KSPActionParam param) -=> KaboomIt(); + public void KaboomAction(KSPActionParam _) => KaboomIt(); private void KaboomIt() { @@ -47,7 +74,7 @@ private void KaboomIt() if (delay == 0) { - part.explode(); + Proceed(); } else { @@ -57,6 +84,19 @@ private void KaboomIt() } } + private void Proceed() + { + if (isGlued) + { + var k = new Welding(vessel, part); + k.MergeParts(true); + } + else + { + part.explode(); + } + } + private void CancelKaboomIt() { Events["CancelKaboomEvent"].active = false; @@ -73,10 +113,10 @@ public override void OnUpdate() if (Planetarium.GetUniversalTime() >= kaboomTime) { timerActive = false; - part.explode(); + Proceed(); } } - base.OnUpdate(); + //base.OnUpdate(); } } } From 250e79b8b58da361144169460787a974ac859179 Mon Sep 17 00:00:00 2001 From: Alexander Yalov Date: Tue, 14 Sep 2021 19:39:47 +0300 Subject: [PATCH 02/13] Superglue --- source/Kaboom.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/source/Kaboom.cs b/source/Kaboom.cs index a606c64..eb96eab 100644 --- a/source/Kaboom.cs +++ b/source/Kaboom.cs @@ -28,27 +28,24 @@ public class ModuleKaboom : PartModule [KSPField(isPersistant = true)] public bool isGlued = false; - [KSPField(guiName = "Glued", guiActive = true, guiActiveEditor = true, - groupName = "Kaboom", groupStartCollapsed = true)] + [KSPField(guiName = "Superglue", guiActive = true, guiActiveEditor = true, groupName = "Kaboom")] public string gluedText = Localizer.Format("#autoLOC_6001071"); /*Disabled*/ - [KSPEvent(guiActive = true, guiActiveEditor = true, guiName = "Enable Glued", groupName = "Kaboom", active = true)] + [KSPEvent(guiName = "Enable Superglue", guiActive = true, guiActiveEditor = true, groupName = "Kaboom", active = true)] public void GluedEvent() { isGlued = !isGlued; if (isGlued) { gluedText = Events["GluedEvent"].guiName = Localizer.Format("#autoLOC_6001072")/*Enabled*/; - Events["GluedEvent"].guiName = "Disable Glued"; + Events["GluedEvent"].guiName = "Disable Superglue"; } - else { gluedText = Events["GluedEvent"].guiName = Localizer.Format("#autoLOC_6001071")/*Disabled*/; - Events["GluedEvent"].guiName = "Enable Glued"; + Events["GluedEvent"].guiName = "Enable Superglue"; } - } [KSPEvent(guiActive = true, guiActiveUnfocused = true, unfocusedRange = 5f, guiName = "Kaboom!", groupName = "Kaboom", active = true)] From 21e76e436d8ac4836f181d5e6fc09d14b858107a Mon Sep 17 00:00:00 2001 From: Alexander Yalov Date: Tue, 14 Sep 2021 20:22:59 +0300 Subject: [PATCH 03/13] copyright --- Source/Welding.cs | 6 +++++- Source/WeldingData.cs | 3 +++ Source/WeldingNodeUtilities.cs | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Source/Welding.cs b/Source/Welding.cs index 87b3a56..3f1d337 100644 --- a/Source/Welding.cs +++ b/Source/Welding.cs @@ -1,4 +1,7 @@ -using System; +// Based on the https://github.com/UmbraSpaceIndustries/Konstruction/tree/master/Source/Konstruction/Konstruction/Welding +// GPLV3 + +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -9,6 +12,7 @@ namespace Kaboom { + public class Welding { Vessel vessel; diff --git a/Source/WeldingData.cs b/Source/WeldingData.cs index 93305e9..c4433e9 100644 --- a/Source/WeldingData.cs +++ b/Source/WeldingData.cs @@ -1,3 +1,6 @@ +// Based on the https://github.com/UmbraSpaceIndustries/Konstruction/tree/master/Source/Konstruction/Konstruction/Welding +// GPLV3 + namespace Kaboom { public class WeldingData diff --git a/Source/WeldingNodeUtilities.cs b/Source/WeldingNodeUtilities.cs index dc833c2..0f9fd0b 100644 --- a/Source/WeldingNodeUtilities.cs +++ b/Source/WeldingNodeUtilities.cs @@ -1,3 +1,6 @@ +// Based on the https://github.com/UmbraSpaceIndustries/Konstruction/tree/master/Source/Konstruction/Konstruction/Welding +// GPLV3 + using System.Linq; using UnityEngine; //using USITools; From 1838a174ecb1726d9ec49020d6a7e42df766ed5e Mon Sep 17 00:00:00 2001 From: Alexander Yalov Date: Tue, 14 Sep 2021 21:24:16 +0300 Subject: [PATCH 04/13] guiName = Toggle Superglue --- source/Kaboom.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/source/Kaboom.cs b/source/Kaboom.cs index eb96eab..bfd45ab 100644 --- a/source/Kaboom.cs +++ b/source/Kaboom.cs @@ -14,7 +14,7 @@ public class ModuleKaboom : PartModule { [KSPField(isPersistant = true, guiActiveEditor = true, guiActive = true, guiName = "Kaboom delay", groupDisplayName = "Switch Safety Cover", groupName = "Kaboom", groupStartCollapsed = true, - guiUnits = "Seconds"), + guiUnits = " Seconds"), UI_FloatRange(minValue = 0f, maxValue = 30f, stepIncrement = 1f)] public float delay = 0; @@ -28,23 +28,21 @@ public class ModuleKaboom : PartModule [KSPField(isPersistant = true)] public bool isGlued = false; - [KSPField(guiName = "Superglue", guiActive = true, guiActiveEditor = true, groupName = "Kaboom")] + [KSPField(isPersistant = true, guiName = "Superglue", guiActive = true, guiActiveEditor = true, groupName = "Kaboom")] public string gluedText = Localizer.Format("#autoLOC_6001071"); /*Disabled*/ - [KSPEvent(guiName = "Enable Superglue", guiActive = true, guiActiveEditor = true, groupName = "Kaboom", active = true)] + [KSPEvent(guiName = "Toggle Superglue", guiActive = true, guiActiveEditor = true, groupName = "Kaboom", active = true)] public void GluedEvent() { isGlued = !isGlued; if (isGlued) { - gluedText = Events["GluedEvent"].guiName = Localizer.Format("#autoLOC_6001072")/*Enabled*/; - Events["GluedEvent"].guiName = "Disable Superglue"; + gluedText = Localizer.Format("#autoLOC_6001072")/*Enabled*/; } else { - gluedText = Events["GluedEvent"].guiName = Localizer.Format("#autoLOC_6001071")/*Disabled*/; - Events["GluedEvent"].guiName = "Enable Superglue"; + gluedText = Localizer.Format("#autoLOC_6001071")/*Disabled*/; } } From 8d9c22fc7597a1acc289a9a4e34bcaaa7abc6a5b Mon Sep 17 00:00:00 2001 From: Alexander Yalov Date: Tue, 14 Sep 2021 23:59:33 +0300 Subject: [PATCH 05/13] new offset; autocancel on glued kaboom problems --- Source/Welding.cs | 37 +++++++++++++++++++------------------ source/Kaboom.cs | 32 ++++++++++++++++++-------------- 2 files changed, 37 insertions(+), 32 deletions(-) diff --git a/Source/Welding.cs b/Source/Welding.cs index 3f1d337..8bd570f 100644 --- a/Source/Welding.cs +++ b/Source/Welding.cs @@ -1,14 +1,7 @@ // Based on the https://github.com/UmbraSpaceIndustries/Konstruction/tree/master/Source/Konstruction/Konstruction/Welding // GPLV3 -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using UnityEngine; -using System.Reflection; -using PreFlightTests; -using TestScripts; namespace Kaboom { @@ -23,19 +16,20 @@ public Welding(Vessel vessel, Part part) this.part = part; } - public void MergeParts(bool compress) + public bool MergeParts(bool compress) { if (vessel.rootPart == part) { ScreenMessages.PostScreenMessage("You cannot weld the root part!"); - return; + return false; } var wData = LoadWeldingData(); if (wData == null) - return; + return false; - PerformWeld(wData, compress); + bool sucess = PerformWeld(wData, compress); + return sucess; } private WeldingData LoadWeldingData(bool silent = false) @@ -82,15 +76,20 @@ private WeldingData LoadWeldingData(bool silent = false) private Vector3 GetOffset(WeldingData wData) { - var nodeA = WeldingNodeUtilities.GetLinkingNode(wData.LinkedPartA, wData.KaboomGluedPart); - var nodeB = WeldingNodeUtilities.GetLinkingNode(wData.LinkedPartB, wData.KaboomGluedPart); + //var nodeA = WeldingNodeUtilities.GetLinkingNode(wData.LinkedPartA, wData.KaboomGluedPart); + //var nodeB = WeldingNodeUtilities.GetLinkingNode(wData.LinkedPartB, wData.KaboomGluedPart); + + // offset in wrong direction //Vector3 offset = nodeA.position - nodeB.position; + // nulref //Vector3 offset2 = nodeA.nodeTransform.localPosition - nodeB.nodeTransform.localPosition; - Vector3 offset = nodeA.position - nodeB.position; - Debug.Log("offset: " + offset); - return offset; + // works for a stack of simmetrical parts + Vector3 offset3 = wData.LinkedPartA.transform.localPosition - wData.LinkedPartB.transform.localPosition; + offset3.Normalize(); + offset3 *= WeldingNodeUtilities.GetPartThickness(wData.KaboomGluedPart); + return offset3; } - private void PerformWeld(WeldingData wData, bool compress) + private bool PerformWeld(WeldingData wData, bool compress) { var nodeA = WeldingNodeUtilities.GetLinkingNode(wData.LinkedPartA, wData.KaboomGluedPart); var nodeB = WeldingNodeUtilities.GetLinkingNode(wData.LinkedPartB, wData.KaboomGluedPart); @@ -131,7 +130,9 @@ private void PerformWeld(WeldingData wData, bool compress) wData.LinkedPartB.attachJoint = newJoint; - SoftExplode(wData.KaboomGluedPart); + //SoftExplode(wData.KaboomGluedPart); + wData.KaboomGluedPart.explode(); + return true; } private static void SoftExplode(Part thisPart) diff --git a/source/Kaboom.cs b/source/Kaboom.cs index bfd45ab..241b146 100644 --- a/source/Kaboom.cs +++ b/source/Kaboom.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using UnityEngine; -using KSP.Localization; +using KSP.Localization; namespace Kaboom { @@ -13,7 +8,7 @@ namespace Kaboom public class ModuleKaboom : PartModule { [KSPField(isPersistant = true, guiActiveEditor = true, guiActive = true, guiName = "Kaboom delay", - groupDisplayName = "Switch Safety Cover", groupName = "Kaboom", groupStartCollapsed = true, + groupDisplayName = "Kaboom Safety Cover", groupName = "Kaboom", groupStartCollapsed = true, guiUnits = " Seconds"), UI_FloatRange(minValue = 0f, maxValue = 30f, stepIncrement = 1f)] @@ -32,7 +27,8 @@ public class ModuleKaboom : PartModule public string gluedText = Localizer.Format("#autoLOC_6001071"); /*Disabled*/ - [KSPEvent(guiName = "Toggle Superglue", guiActive = true, guiActiveEditor = true, groupName = "Kaboom", active = true)] + [KSPEvent(guiName = "Toggle Superglue", groupName = "Kaboom", + guiActive = true, guiActiveEditor = true, active = true, guiActiveUncommand = true)] public void GluedEvent() { isGlued = !isGlued; @@ -46,13 +42,15 @@ public void GluedEvent() } } - [KSPEvent(guiActive = true, guiActiveUnfocused = true, unfocusedRange = 5f, guiName = "Kaboom!", groupName = "Kaboom", active = true)] + [KSPEvent(guiName = "Kaboom!", groupName = "Kaboom", + guiActive = true, guiActiveUnfocused = true, unfocusedRange = 5f, active = true, guiActiveUncommand = true)] public void KaboomEvent() { KaboomIt(); } - [KSPEvent(guiActive = true, guiActiveUnfocused = true, unfocusedRange = 5f, guiName = "Cancel Kaboom!", groupName = "Kaboom", active = false)] + [KSPEvent(guiName = "Cancel Kaboom!", groupName = "Kaboom", + guiActive = true, guiActiveUnfocused = true, unfocusedRange = 5f, active = false, guiActiveUncommand = true)] public void CancelKaboomEvent() { CancelKaboomIt(); @@ -69,7 +67,9 @@ private void KaboomIt() if (delay == 0) { - Proceed(); + bool success = Proceed(); + if (!success) + CancelKaboomIt(); } else { @@ -79,16 +79,18 @@ private void KaboomIt() } } - private void Proceed() + private bool Proceed() { if (isGlued) { var k = new Welding(vessel, part); - k.MergeParts(true); + bool success = k.MergeParts(true); + return success; } else { part.explode(); + return true; } } @@ -108,7 +110,9 @@ public override void OnUpdate() if (Planetarium.GetUniversalTime() >= kaboomTime) { timerActive = false; - Proceed(); + bool success = Proceed(); + if (!success) + CancelKaboomIt(); } } //base.OnUpdate(); From 52e42a7be485942721aa63ce40bb4701dae38af1 Mon Sep 17 00:00:00 2001 From: Alexander Yalov Date: Wed, 15 Sep 2021 00:49:14 +0300 Subject: [PATCH 06/13] update check on attachedParts --- Source/Welding.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Source/Welding.cs b/Source/Welding.cs index 8bd570f..f4189c0 100644 --- a/Source/Welding.cs +++ b/Source/Welding.cs @@ -32,7 +32,7 @@ public bool MergeParts(bool compress) return sucess; } - private WeldingData LoadWeldingData(bool silent = false) + private WeldingData LoadWeldingData() { /********************** * @@ -45,28 +45,28 @@ private WeldingData LoadWeldingData(bool silent = false) var wData = new WeldingData(); wData.KaboomGluedPart = part; + int attachedPartsCount = 0; + foreach (var n in part.attachNodes) + if (n.attachedPart != null) + attachedPartsCount++; - if (part.attachNodes.Count == 2) + //Debug.Log("attachedPartsCount: " + attachedPartsCount + " part.children.Count: " + part.children.Count); + + if (attachedPartsCount == 2 && part.children.Count == 1) { - wData.LinkedPartA = part.parent; - - foreach(var n in part.attachNodes) - if (n.attachedPart != part.parent) - wData.LinkedPartB = n.attachedPart; + wData.LinkedPartB = part.children[0]; } if (wData.LinkedPartA == null || wData.LinkedPartB == null) { - if (!silent) - ScreenMessages.PostScreenMessage("This part need to have 2 parts on attachment nodes"); + ScreenMessages.PostScreenMessage("This part need to have 2 parts on attachment nodes"); return null; } if (wData.KaboomGluedPart == vessel.rootPart) { - if (!silent) - ScreenMessages.PostScreenMessage("This part is the root part! Cancelling"); + ScreenMessages.PostScreenMessage("This part is the root part! Cancelling"); return null; } From dfe077765010202483572c07a8ca5cac984c5af2 Mon Sep 17 00:00:00 2001 From: Alexander Yalov Date: Wed, 15 Sep 2021 21:14:28 +0300 Subject: [PATCH 07/13] add settings: softExplode and red color of the cover --- Source/Welding.cs | 18 +++++++++--------- source/Kaboom.cs | 15 +++++++++++++-- source/Settings.cs | 26 +++++++++----------------- 3 files changed, 31 insertions(+), 28 deletions(-) diff --git a/Source/Welding.cs b/Source/Welding.cs index f4189c0..3be82b1 100644 --- a/Source/Welding.cs +++ b/Source/Welding.cs @@ -1,6 +1,7 @@ // Based on the https://github.com/UmbraSpaceIndustries/Konstruction/tree/master/Source/Konstruction/Konstruction/Welding // GPLV3 +using System; using UnityEngine; namespace Kaboom @@ -79,8 +80,8 @@ private Vector3 GetOffset(WeldingData wData) //var nodeA = WeldingNodeUtilities.GetLinkingNode(wData.LinkedPartA, wData.KaboomGluedPart); //var nodeB = WeldingNodeUtilities.GetLinkingNode(wData.LinkedPartB, wData.KaboomGluedPart); - // offset in wrong direction //Vector3 offset = nodeA.position - nodeB.position; - // nulref //Vector3 offset2 = nodeA.nodeTransform.localPosition - nodeB.nodeTransform.localPosition; + //Vector3 offset = nodeA.position - nodeB.position; // offset in wrong direction, depends of angle of the craft? + //Vector3 offset2 = nodeA.nodeTransform.localPosition - nodeB.nodeTransform.localPosition; // // nulref // works for a stack of simmetrical parts Vector3 offset3 = wData.LinkedPartA.transform.localPosition - wData.LinkedPartB.transform.localPosition; @@ -96,7 +97,6 @@ private bool PerformWeld(WeldingData wData, bool compress) var offset = GetOffset(wData); - WeldingNodeUtilities.DetachPart(wData.KaboomGluedPart); WeldingNodeUtilities.SwapLinks( @@ -114,13 +114,11 @@ private bool PerformWeld(WeldingData wData, bool compress) WeldingNodeUtilities.SpawnStructures(wData.LinkedPartA, nodeA); WeldingNodeUtilities.SpawnStructures(wData.LinkedPartB, nodeB); - if (compress) { WeldingNodeUtilities.MovePart(wData.LinkedPartB, offset); } - PartJoint newJoint = PartJoint.Create( wData.LinkedPartB, wData.LinkedPartA, @@ -130,14 +128,16 @@ private bool PerformWeld(WeldingData wData, bool compress) wData.LinkedPartB.attachJoint = newJoint; - //SoftExplode(wData.KaboomGluedPart); - wData.KaboomGluedPart.explode(); + SoftExplode(wData.KaboomGluedPart); + return true; } - private static void SoftExplode(Part thisPart) + public static void SoftExplode(Part thisPart) { - thisPart.explosionPotential = 0.1f; + if (HighLogic.CurrentGame.Parameters.CustomParams().softExplode) + thisPart.explosionPotential = Math.Min(thisPart.explosionPotential, 0.1f); + thisPart.explode(); } } diff --git a/source/Kaboom.cs b/source/Kaboom.cs index 241b146..4066a42 100644 --- a/source/Kaboom.cs +++ b/source/Kaboom.cs @@ -8,7 +8,7 @@ namespace Kaboom public class ModuleKaboom : PartModule { [KSPField(isPersistant = true, guiActiveEditor = true, guiActive = true, guiName = "Kaboom delay", - groupDisplayName = "Kaboom Safety Cover", groupName = "Kaboom", groupStartCollapsed = true, + groupName = "Kaboom", groupStartCollapsed = true, guiUnits = " Seconds"), UI_FloatRange(minValue = 0f, maxValue = 30f, stepIncrement = 1f)] @@ -59,6 +59,17 @@ public void CancelKaboomEvent() [KSPAction("Kaboom!")] public void KaboomAction(KSPActionParam _) => KaboomIt(); + public override void OnStart(StartState state) + { + base.OnStart(state); + + if (HighLogic.CurrentGame.Parameters.CustomParams().coloredPAW) + Fields["delay"].group.displayName = "Kaboom Safety Cover"; + else + Fields["delay"].group.displayName = "Kaboom Safety Cover"; + + } + private void KaboomIt() { Events["CancelKaboomEvent"].active = true; @@ -89,7 +100,7 @@ private bool Proceed() } else { - part.explode(); + Welding.SoftExplode(part); return true; } } diff --git a/source/Settings.cs b/source/Settings.cs index 138ad8d..f5b3ed7 100644 --- a/source/Settings.cs +++ b/source/Settings.cs @@ -4,10 +4,10 @@ using System.Collections; using System.Reflection; -// This will add a tab to the Stock Settings in the Difficulty settings called "On Demand Fuel Cells" +// This will add a tab to the Stock Settings in the Difficulty settings // To use, reference the setting using the following: // -// HighLogic.CurrentGame.Parameters.CustomParams().needsECtoStart +// HighLogic.CurrentGame.Parameters.CustomParams() // // As it is set up, the option is disabled, so in order to enable it, the player would have // to deliberately go in and change it @@ -19,29 +19,21 @@ namespace Kaboom public class Options : GameParameters.CustomParameterNode { - public override string Title { get { return "Default Settings"; } } + public override string Title { get { return "Kaboom!"; } } public override GameParameters.GameMode GameMode { get { return GameParameters.GameMode.ANY; } } public override string Section { get { return "Kaboom!"; } } public override string DisplaySection { get { return "Kaboom!"; } } public override int SectionOrder { get { return 1; } } - [GameParameters.CustomParameterUI("Require EC to run", - toolTip = "if set to yes, the fuel cells will 'stall' if the vessels total electric charge reaches zero and will not function until vessel electric charge is above zero.", - newGameOnly = false, + [GameParameters.CustomParameterUI("Soft Explode", + toolTip = "Kaboom Explodes makes less fire", unlockedDuringMission = true )] - public bool needsECtoStart = false; + public bool softExplode = false; - [GameParameters.CustomParameterUI("Auto Fuel Mode Switch", - toolTip = "if current fuel mode becomes fuel deprived, will 'hunt' or 'search' for a fuel mode that has fuel.", - newGameOnly = false, - unlockedDuringMission = true)] - public bool autoSwitch = true; - - [GameParameters.CustomParameterUI("PAW Color", - toolTip = "allow color coding in ODC PAW (part action window) / part RMB (right menu button).", - newGameOnly = false, + [GameParameters.CustomParameterUI("PAW Safety Cover is Red", + toolTip = "Red color coding of Kaboom Safety Cover in the Part Action Window.\nUpdates after scene change.", unlockedDuringMission = true)] public bool coloredPAW = true; @@ -49,7 +41,7 @@ public class Options : GameParameters.CustomParameterNode // the "if false" to "if true" and set the values as you like -#if true +#if false public override bool HasPresets { get { return true; } } public override void SetDifficultyPreset(GameParameters.Preset preset) { From 921e952850e11eecc2ea27faeeee40e6a2155843 Mon Sep 17 00:00:00 2001 From: Alexander Yalov Date: Thu, 16 Sep 2021 01:33:15 +0300 Subject: [PATCH 08/13] Offset as diff of nodes, hooray! --- Source/Welding.cs | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Source/Welding.cs b/Source/Welding.cs index 3be82b1..9c05a00 100644 --- a/Source/Welding.cs +++ b/Source/Welding.cs @@ -33,7 +33,7 @@ public bool MergeParts(bool compress) return sucess; } - private WeldingData LoadWeldingData() + public WeldingData LoadWeldingData() { /********************** * @@ -77,19 +77,23 @@ private WeldingData LoadWeldingData() private Vector3 GetOffset(WeldingData wData) { - //var nodeA = WeldingNodeUtilities.GetLinkingNode(wData.LinkedPartA, wData.KaboomGluedPart); - //var nodeB = WeldingNodeUtilities.GetLinkingNode(wData.LinkedPartB, wData.KaboomGluedPart); - - //Vector3 offset = nodeA.position - nodeB.position; // offset in wrong direction, depends of angle of the craft? - //Vector3 offset2 = nodeA.nodeTransform.localPosition - nodeB.nodeTransform.localPosition; // // nulref - - // works for a stack of simmetrical parts - Vector3 offset3 = wData.LinkedPartA.transform.localPosition - wData.LinkedPartB.transform.localPosition; - offset3.Normalize(); - offset3 *= WeldingNodeUtilities.GetPartThickness(wData.KaboomGluedPart); - return offset3; + //Vector3 offset1 = + //nodeA.owner.transform.rotation * nodeA.position + nodeA.owner.transform.position - + //nodeB.owner.transform.rotation * nodeB.position + nodeB.owner.transform.position; + //Vector3 offset2 = wData.LinkedPartA.transform.localPosition - wData.LinkedPartB.transform.localPosition; + //offset2.Normalize(); + //offset2 *= WeldingNodeUtilities.GetPartThickness(wData.KaboomGluedPart); + + var nodeA = WeldingNodeUtilities.GetLinkingNode(wData.KaboomGluedPart, wData.LinkedPartA); + var nodeB = WeldingNodeUtilities.GetLinkingNode(wData.KaboomGluedPart, wData.LinkedPartB); + + Vector3 offset = part.transform.rotation * (nodeA.position - nodeB.position); + + return offset; } + + private bool PerformWeld(WeldingData wData, bool compress) { var nodeA = WeldingNodeUtilities.GetLinkingNode(wData.LinkedPartA, wData.KaboomGluedPart); From 1ef3c57509c21d915af9b2b95a059faae421059c Mon Sep 17 00:00:00 2001 From: Alexander Yalov Date: Thu, 16 Sep 2021 01:58:18 +0300 Subject: [PATCH 09/13] put text of KSPField onto KSPEvent, delete KSPField --- source/Kaboom.cs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/source/Kaboom.cs b/source/Kaboom.cs index 4066a42..ccbd60b 100644 --- a/source/Kaboom.cs +++ b/source/Kaboom.cs @@ -23,23 +23,20 @@ public class ModuleKaboom : PartModule [KSPField(isPersistant = true)] public bool isGlued = false; - [KSPField(isPersistant = true, guiName = "Superglue", guiActive = true, guiActiveEditor = true, groupName = "Kaboom")] - public string gluedText = Localizer.Format("#autoLOC_6001071"); /*Disabled*/ - - - [KSPEvent(guiName = "Toggle Superglue", groupName = "Kaboom", + [KSPEvent(groupName = "Kaboom", guiActive = true, guiActiveEditor = true, active = true, guiActiveUncommand = true)] public void GluedEvent() { isGlued = !isGlued; + GUITextUpdate(); + } + + private void GUITextUpdate() + { if (isGlued) - { - gluedText = Localizer.Format("#autoLOC_6001072")/*Enabled*/; - } + Events["GluedEvent"].guiName = "Superglue: " + Localizer.Format("#autoLOC_6001072")/*Enabled*/; else - { - gluedText = Localizer.Format("#autoLOC_6001071")/*Disabled*/; - } + Events["GluedEvent"].guiName = "Superglue: " + Localizer.Format("#autoLOC_6001071")/*Disabled*/; } [KSPEvent(guiName = "Kaboom!", groupName = "Kaboom", @@ -66,7 +63,9 @@ public override void OnStart(StartState state) if (HighLogic.CurrentGame.Parameters.CustomParams().coloredPAW) Fields["delay"].group.displayName = "Kaboom Safety Cover"; else - Fields["delay"].group.displayName = "Kaboom Safety Cover"; + Fields["delay"].group.displayName = "Kaboom Safety Cover"; + + GUITextUpdate(); } From 3a3adea87092d7278fc4aa86b3f922248c043a36 Mon Sep 17 00:00:00 2001 From: Alexander Yalov Date: Thu, 16 Sep 2021 02:03:29 +0300 Subject: [PATCH 10/13] rename WeldingNodeUtilities to WeldingUtilities --- Source/Welding.cs | 20 +++++++++---------- ...ngNodeUtilities.cs => WeldingUtilities.cs} | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) rename Source/{WeldingNodeUtilities.cs => WeldingUtilities.cs} (98%) diff --git a/Source/Welding.cs b/Source/Welding.cs index 9c05a00..e8de509 100644 --- a/Source/Welding.cs +++ b/Source/Welding.cs @@ -84,8 +84,8 @@ private Vector3 GetOffset(WeldingData wData) //offset2.Normalize(); //offset2 *= WeldingNodeUtilities.GetPartThickness(wData.KaboomGluedPart); - var nodeA = WeldingNodeUtilities.GetLinkingNode(wData.KaboomGluedPart, wData.LinkedPartA); - var nodeB = WeldingNodeUtilities.GetLinkingNode(wData.KaboomGluedPart, wData.LinkedPartB); + var nodeA = WeldingUtilities.GetLinkingNode(wData.KaboomGluedPart, wData.LinkedPartA); + var nodeB = WeldingUtilities.GetLinkingNode(wData.KaboomGluedPart, wData.LinkedPartB); Vector3 offset = part.transform.rotation * (nodeA.position - nodeB.position); @@ -96,31 +96,31 @@ private Vector3 GetOffset(WeldingData wData) private bool PerformWeld(WeldingData wData, bool compress) { - var nodeA = WeldingNodeUtilities.GetLinkingNode(wData.LinkedPartA, wData.KaboomGluedPart); - var nodeB = WeldingNodeUtilities.GetLinkingNode(wData.LinkedPartB, wData.KaboomGluedPart); + var nodeA = WeldingUtilities.GetLinkingNode(wData.LinkedPartA, wData.KaboomGluedPart); + var nodeB = WeldingUtilities.GetLinkingNode(wData.LinkedPartB, wData.KaboomGluedPart); var offset = GetOffset(wData); - WeldingNodeUtilities.DetachPart(wData.KaboomGluedPart); + WeldingUtilities.DetachPart(wData.KaboomGluedPart); - WeldingNodeUtilities.SwapLinks( + WeldingUtilities.SwapLinks( wData.LinkedPartA, wData.KaboomGluedPart, wData.LinkedPartB); - WeldingNodeUtilities.SwapLinks( + WeldingUtilities.SwapLinks( wData.LinkedPartB, wData.KaboomGluedPart, wData.LinkedPartA); wData.KaboomGluedPart.SetCollisionIgnores(); - WeldingNodeUtilities.SpawnStructures(wData.LinkedPartA, nodeA); - WeldingNodeUtilities.SpawnStructures(wData.LinkedPartB, nodeB); + WeldingUtilities.SpawnStructures(wData.LinkedPartA, nodeA); + WeldingUtilities.SpawnStructures(wData.LinkedPartB, nodeB); if (compress) { - WeldingNodeUtilities.MovePart(wData.LinkedPartB, offset); + WeldingUtilities.MovePart(wData.LinkedPartB, offset); } PartJoint newJoint = PartJoint.Create( diff --git a/Source/WeldingNodeUtilities.cs b/Source/WeldingUtilities.cs similarity index 98% rename from Source/WeldingNodeUtilities.cs rename to Source/WeldingUtilities.cs index 0f9fd0b..e05ef9d 100644 --- a/Source/WeldingNodeUtilities.cs +++ b/Source/WeldingUtilities.cs @@ -7,7 +7,7 @@ namespace Kaboom { - public static class WeldingNodeUtilities + public static class WeldingUtilities { public static void SpawnStructures(Part thisPart, AttachNode thisNode) { From fe3cd4bf7c689835571f474860cfe27d1ec408fd Mon Sep 17 00:00:00 2001 From: Alexander Yalov Date: Thu, 16 Sep 2021 02:07:33 +0300 Subject: [PATCH 11/13] move SoftExplode to WeldingUtilities --- Source/Welding.cs | 10 +--------- Source/WeldingUtilities.cs | 9 +++++++++ source/Kaboom.cs | 4 ++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Source/Welding.cs b/Source/Welding.cs index e8de509..fce6caf 100644 --- a/Source/Welding.cs +++ b/Source/Welding.cs @@ -132,17 +132,9 @@ private bool PerformWeld(WeldingData wData, bool compress) wData.LinkedPartB.attachJoint = newJoint; - SoftExplode(wData.KaboomGluedPart); + WeldingUtilities.Explode(wData.KaboomGluedPart); return true; } - - public static void SoftExplode(Part thisPart) - { - if (HighLogic.CurrentGame.Parameters.CustomParams().softExplode) - thisPart.explosionPotential = Math.Min(thisPart.explosionPotential, 0.1f); - - thisPart.explode(); - } } } diff --git a/Source/WeldingUtilities.cs b/Source/WeldingUtilities.cs index e05ef9d..8e7d53e 100644 --- a/Source/WeldingUtilities.cs +++ b/Source/WeldingUtilities.cs @@ -1,6 +1,7 @@ // Based on the https://github.com/UmbraSpaceIndustries/Konstruction/tree/master/Source/Konstruction/Konstruction/Welding // GPLV3 +using System; using System.Linq; using UnityEngine; //using USITools; @@ -81,5 +82,13 @@ public static AttachNode GetLinkingNode(Part p1, Part p2) { return p1.attachNodes.FirstOrDefault(an => an.attachedPart == p2); } + + public static void Explode(Part thisPart) + { + if (HighLogic.CurrentGame.Parameters.CustomParams().softExplode) + thisPart.explosionPotential = Math.Min(thisPart.explosionPotential, 0.1f); + + thisPart.explode(); + } } } \ No newline at end of file diff --git a/source/Kaboom.cs b/source/Kaboom.cs index ccbd60b..26ec349 100644 --- a/source/Kaboom.cs +++ b/source/Kaboom.cs @@ -61,7 +61,7 @@ public override void OnStart(StartState state) base.OnStart(state); if (HighLogic.CurrentGame.Parameters.CustomParams().coloredPAW) - Fields["delay"].group.displayName = "Kaboom Safety Cover"; + Fields["delay"].group.displayName = "Kaboom Safety Cover"; else Fields["delay"].group.displayName = "Kaboom Safety Cover"; @@ -99,7 +99,7 @@ private bool Proceed() } else { - Welding.SoftExplode(part); + WeldingUtilities.Explode(part); return true; } } From 3e7eb45335a34580c2192d1ed66046f2f16337cb Mon Sep 17 00:00:00 2001 From: Alexander Yalov Date: Thu, 16 Sep 2021 02:12:20 +0300 Subject: [PATCH 12/13] Options -> KaboomSettings --- Source/WeldingUtilities.cs | 2 +- source/Kaboom.cs | 2 +- source/Settings.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/WeldingUtilities.cs b/Source/WeldingUtilities.cs index 8e7d53e..f3678e3 100644 --- a/Source/WeldingUtilities.cs +++ b/Source/WeldingUtilities.cs @@ -85,7 +85,7 @@ public static AttachNode GetLinkingNode(Part p1, Part p2) public static void Explode(Part thisPart) { - if (HighLogic.CurrentGame.Parameters.CustomParams().softExplode) + if (HighLogic.CurrentGame.Parameters.CustomParams().softExplode) thisPart.explosionPotential = Math.Min(thisPart.explosionPotential, 0.1f); thisPart.explode(); diff --git a/source/Kaboom.cs b/source/Kaboom.cs index 26ec349..9c6f8bb 100644 --- a/source/Kaboom.cs +++ b/source/Kaboom.cs @@ -60,7 +60,7 @@ public override void OnStart(StartState state) { base.OnStart(state); - if (HighLogic.CurrentGame.Parameters.CustomParams().coloredPAW) + if (HighLogic.CurrentGame.Parameters.CustomParams().coloredPAW) Fields["delay"].group.displayName = "Kaboom Safety Cover"; else Fields["delay"].group.displayName = "Kaboom Safety Cover"; diff --git a/source/Settings.cs b/source/Settings.cs index f5b3ed7..1706aa5 100644 --- a/source/Settings.cs +++ b/source/Settings.cs @@ -17,7 +17,7 @@ namespace Kaboom // http://forum.kerbalspaceprogram.com/index.php?/topic/147576-modders-notes-for-ksp-12/#comment-2754813 // search for "Mod integration into Stock Settings - public class Options : GameParameters.CustomParameterNode + public class KaboomSettings : GameParameters.CustomParameterNode { public override string Title { get { return "Kaboom!"; } } public override GameParameters.GameMode GameMode { get { return GameParameters.GameMode.ANY; } } From b4df189f21b0fddbb7735147d80261ed5be3a08e Mon Sep 17 00:00:00 2001 From: Alexander Yalov Date: Thu, 16 Sep 2021 13:40:50 +0300 Subject: [PATCH 13/13] spaces --- Source/Welding.cs | 15 ++++++--------- Source/WeldingUtilities.cs | 5 ++--- source/Kaboom.cs | 6 +++--- source/Settings.cs | 7 +++---- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/Source/Welding.cs b/Source/Welding.cs index fce6caf..a49dcff 100644 --- a/Source/Welding.cs +++ b/Source/Welding.cs @@ -29,11 +29,11 @@ public bool MergeParts(bool compress) if (wData == null) return false; - bool sucess = PerformWeld(wData, compress); + bool sucess = PerformWeld(wData, compress); return sucess; } - public WeldingData LoadWeldingData() + private WeldingData LoadWeldingData() { /********************** * @@ -74,7 +74,6 @@ public WeldingData LoadWeldingData() return wData; } - private Vector3 GetOffset(WeldingData wData) { //Vector3 offset1 = @@ -84,16 +83,14 @@ private Vector3 GetOffset(WeldingData wData) //offset2.Normalize(); //offset2 *= WeldingNodeUtilities.GetPartThickness(wData.KaboomGluedPart); - var nodeA = WeldingUtilities.GetLinkingNode(wData.KaboomGluedPart, wData.LinkedPartA); - var nodeB = WeldingUtilities.GetLinkingNode(wData.KaboomGluedPart, wData.LinkedPartB); + AttachNode a = WeldingUtilities.GetLinkingNode(wData.KaboomGluedPart, wData.LinkedPartA); + AttachNode b = WeldingUtilities.GetLinkingNode(wData.KaboomGluedPart, wData.LinkedPartB); + + Vector3 offset = part.transform.rotation * (a.position - b.position); - Vector3 offset = part.transform.rotation * (nodeA.position - nodeB.position); - return offset; } - - private bool PerformWeld(WeldingData wData, bool compress) { var nodeA = WeldingUtilities.GetLinkingNode(wData.LinkedPartA, wData.KaboomGluedPart); diff --git a/Source/WeldingUtilities.cs b/Source/WeldingUtilities.cs index f3678e3..5ccf0b8 100644 --- a/Source/WeldingUtilities.cs +++ b/Source/WeldingUtilities.cs @@ -43,13 +43,12 @@ public static void MovePart(Part thisPart, Vector3 offset) MovePart(p, offset); } - public static void SwapLinks(Part thisPart, Part oldPart, Part newPart) { if (thisPart.parent != null && thisPart.parent == oldPart) thisPart.parent = newPart; - if(thisPart.topNode != null && thisPart.topNode.attachedPart == oldPart) + if (thisPart.topNode != null && thisPart.topNode.attachedPart == oldPart) thisPart.topNode.attachedPart = newPart; if (thisPart.attachJoint != null) @@ -91,4 +90,4 @@ public static void Explode(Part thisPart) thisPart.explode(); } } -} \ No newline at end of file +} diff --git a/source/Kaboom.cs b/source/Kaboom.cs index 9c6f8bb..9b14fff 100644 --- a/source/Kaboom.cs +++ b/source/Kaboom.cs @@ -23,7 +23,7 @@ public class ModuleKaboom : PartModule [KSPField(isPersistant = true)] public bool isGlued = false; - [KSPEvent(groupName = "Kaboom", + [KSPEvent(groupName = "Kaboom", guiActive = true, guiActiveEditor = true, active = true, guiActiveUncommand = true)] public void GluedEvent() { @@ -39,14 +39,14 @@ private void GUITextUpdate() Events["GluedEvent"].guiName = "Superglue: " + Localizer.Format("#autoLOC_6001071")/*Disabled*/; } - [KSPEvent(guiName = "Kaboom!", groupName = "Kaboom", + [KSPEvent(guiName = "Kaboom!", groupName = "Kaboom", guiActive = true, guiActiveUnfocused = true, unfocusedRange = 5f, active = true, guiActiveUncommand = true)] public void KaboomEvent() { KaboomIt(); } - [KSPEvent(guiName = "Cancel Kaboom!", groupName = "Kaboom", + [KSPEvent(guiName = "Cancel Kaboom!", groupName = "Kaboom", guiActive = true, guiActiveUnfocused = true, unfocusedRange = 5f, active = false, guiActiveUncommand = true)] public void CancelKaboomEvent() { diff --git a/source/Settings.cs b/source/Settings.cs index 1706aa5..b03b838 100644 --- a/source/Settings.cs +++ b/source/Settings.cs @@ -7,7 +7,7 @@ // This will add a tab to the Stock Settings in the Difficulty settings // To use, reference the setting using the following: // -// HighLogic.CurrentGame.Parameters.CustomParams() +// HighLogic.CurrentGame.Parameters.CustomParams() // // As it is set up, the option is disabled, so in order to enable it, the player would have // to deliberately go in and change it @@ -27,9 +27,8 @@ public class KaboomSettings : GameParameters.CustomParameterNode [GameParameters.CustomParameterUI("Soft Explode", - toolTip = "Kaboom Explodes makes less fire", - unlockedDuringMission = true - )] + toolTip = "Kaboom explosions make less fire", + unlockedDuringMission = true)] public bool softExplode = false; [GameParameters.CustomParameterUI("PAW Safety Cover is Red",