Skip to content

Commit 7783653

Browse files
authored
Merge pull request #21 from KSP2Community/dev
Dev
2 parents ef7f6e7 + 5945c5a commit 7783653

10 files changed

Lines changed: 26 additions & 8 deletions

File tree

plugin_template/swinfo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "Patch Manager",
66
"description": "A mod for generic patching needs similar to KSP 1's Module Manager.",
77
"source": "https://github.com/KSP2Community/PatchManager",
8-
"version": "0.6.0",
8+
"version": "0.6.1",
99
"version_check": "https://raw.githubusercontent.com/KSP2Community/PatchManager/main/plugin_template/swinfo.json",
1010
"ksp2_version": {
1111
"min": "0.1.5",

src/PatchManager.Core/Assets/PatchingManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public static void CreateNewAssets(Action resolve, Action<string> reject)
300300
try
301301
{
302302
var text = generator.Create(out var label, out var name);
303-
Logging.LogInfo($"Generated an asset with the label {label}, and name {name}:\n{text}");
303+
Logging.LogDebug($"Generated an asset with the label {label}, and name {name}:\n{text}");
304304

305305
if (!_createdAssets.ContainsKey(label))
306306
_createdAssets[label] = new List<(string name, string text)>();

src/PatchManager.Missions/Modifiables/MissionModifiable.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public override void Set(DataValue dataValue)
1818
if (dataValue.IsDeletion)
1919
{
2020
_missionSelectable.SetDeleted();
21+
return;
2122
}
2223
base.Set(dataValue);
2324
}

src/PatchManager.SassyPatching/Attributes/PatcherRulesetAttribute.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
namespace PatchManager.SassyPatching.Attributes;
1+
using JetBrains.Annotations;
2+
using PatchManager.SassyPatching.Interfaces;
3+
4+
namespace PatchManager.SassyPatching.Attributes;
25

36

47

@@ -8,6 +11,8 @@
811
/// </summary>
912

1013
[AttributeUsage(AttributeTargets.Class)]
14+
[BaseTypeRequired(typeof(IPatcherRuleSet))]
15+
[MeansImplicitUse]
1116
public class PatcherRulesetAttribute : Attribute
1217
{
1318
/// <summary>

src/PatchManager.SassyPatching/Attributes/SassyConstantAttribute.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
namespace PatchManager.SassyPatching.Attributes;
1+
using JetBrains.Annotations;
2+
3+
namespace PatchManager.SassyPatching.Attributes;
24

35
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
6+
[MeansImplicitUse]
47
public class SassyConstantAttribute : Attribute
58
{
69
public string ConstantName;

src/PatchManager.SassyPatching/Attributes/SassyLibraryAttribute.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
namespace PatchManager.SassyPatching.Attributes;
1+
using JetBrains.Annotations;
2+
3+
namespace PatchManager.SassyPatching.Attributes;
24

35
/// <summary>
46
/// Represents a builtin (C#) library for the sassy patcher execution engine
57
/// </summary>
68
[AttributeUsage(AttributeTargets.Class)]
9+
[MeansImplicitUse]
710
public class SassyLibraryAttribute : Attribute
811
{
912
/// <summary>

src/PatchManager.SassyPatching/Attributes/SassyMethodAttribute.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
namespace PatchManager.SassyPatching.Attributes;
1+
using JetBrains.Annotations;
2+
3+
namespace PatchManager.SassyPatching.Attributes;
24

35
/// <summary>
46
/// Defines this as a method for sassy patcher, it can define any argument type it wants, and reflection will be used to convert them at runtime
57
/// Method overloading is not allowed
68
/// </summary>
79
[AttributeUsage(AttributeTargets.Method)]
10+
[MeansImplicitUse]
811
public class SassyMethodAttribute : Attribute
912
{
1013
/// <summary>

src/PatchManager.Science/Modifiables/ExperimentModifiable.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public override void Set(DataValue dataValue)
1818
if (dataValue.IsDeletion)
1919
{
2020
_experimentSelectable.SetDeleted();
21+
return;
2122
}
2223
base.Set(dataValue);
2324
}

src/PatchManager.Science/Modifiables/ScienceModifiable.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public override void Set(DataValue dataValue)
1919
if (dataValue.IsDeletion)
2020
{
2121
_scienceSelectable.SetDeleted();
22+
return;
2223
}
2324
base.Set(dataValue);
2425
}

src/PatchManager.Science/Rulesets/ScienceRuleset.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using PatchManager.SassyPatching.Interfaces;
55
using PatchManager.SassyPatching.NewAssets;
66
using PatchManager.SassyPatching.Selectables;
7+
using PatchManager.Science.Selectables;
78

89
namespace PatchManager.Science.Rulesets;
910

@@ -13,12 +14,12 @@ public class ScienceRuleset : IPatcherRuleSet
1314
public bool Matches(string label) => label == "techNodeData";
1415

1516
public ISelectable ConvertToSelectable(string type, string name, string jsonData) =>
16-
new JTokenSelectable(() => { }, JObject.Parse(jsonData), name, type);
17+
new ScienceSelectable(JObject.Parse(jsonData));
1718

1819

1920
public INewAsset CreateNew(List<DataValue> dataValues)
2021
{
2122
return new NewGenericAsset("techNodeData", dataValues[0].String,
22-
new JTokenSelectable(() => { }, JObject.Parse($"{{\n \"Version\": 12,\n \"ID\": \"{dataValues[0].String}\",\n \"NameLocKey\": \"Science/TechNodes/Names/tNode_4v_docking_01\",\n \"IconID\": \"ICO-RDCenter-Docking-24x\",\n \"CategoryID\": \"\",\n \"HiddenByNodeID\": \"\",\n \"DescriptionLocKey\": \"Science/TechNodes/Descriptions/tNode_4v_docking_01\",\n \"RequiredSciencePoints\": 7000,\n \"UnlockedPartsIDs\": [\n \"dockingring_4v_inline\",\n \"dockingport_3v_inline\"\n ],\n \"RequiredTechNodeIDs\": [\n \"tNode_4v_decouplers_01\"\n ],\n \"TierToUnlock\": 0,\n \"TechTreePosition\": {{\n \"x\": 5220.0,\n \"y\": 310.0\n }}\n}}"), dataValues[0].String, "techNodeData"));
23+
new ScienceSelectable(JObject.Parse($"{{\n \"Version\": 12,\n \"ID\": \"{dataValues[0].String}\",\n \"NameLocKey\": \"Science/TechNodes/Names/tNode_4v_docking_01\",\n \"IconID\": \"ICO-RDCenter-Docking-24x\",\n \"CategoryID\": \"\",\n \"HiddenByNodeID\": \"\",\n \"DescriptionLocKey\": \"Science/TechNodes/Descriptions/tNode_4v_docking_01\",\n \"RequiredSciencePoints\": 7000,\n \"UnlockedPartsIDs\": [\n \"dockingring_4v_inline\",\n \"dockingport_3v_inline\"\n ],\n \"RequiredTechNodeIDs\": [\n \"tNode_4v_decouplers_01\"\n ],\n \"TierToUnlock\": 0,\n \"TechTreePosition\": {{\n \"x\": 5220.0,\n \"y\": 310.0\n }}\n}}")));
2324
}
2425
}

0 commit comments

Comments
 (0)