Skip to content

Commit 9525ded

Browse files
committed
Changed info format in parts list window: now full path is displayed
1 parent e0d3f99 commit 9525ded

6 files changed

Lines changed: 78 additions & 34 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
0.2.2
2+
-----
3+
- Slightly changed info format in Parts selection window. Now full path to part CFG file is displayed. PAW menu still has only basic mod folder info to avoid clutter.
4+
- Updated README.
5+
16
0.2.1
27
-----
38
- Added mod folder parameter to displayed information. For some mods (like Bluedog_DB or USI family) 2 or 3 nested mod folder levels are shown (for example, "Bluedog_DB/Parts_Atlas" instead of just "Bluedog_DB").
@@ -15,4 +20,4 @@
1520

1621
0.1.0
1722
-----
18-
Initial release.
23+
- Initial release.

GameData/PartInfoInPAW/Localization/en-us.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Localization
55
#LOC_PartInfoInPAW_PartInfo_GroupTitle = Part info
66
#LOC_PartInfoInPAW_Engine1Info_GroupTitle = Engine #1 info
77
#LOC_PartInfoInPAW_Engine2Info_GroupTitle = Engine #2 info
8-
#LOC_PartInfoInPAW_PartName_Title = Name
8+
#LOC_PartInfoInPAW_PartName_Title = Name (ID)
99
#LOC_PartInfoInPAW_PartMod_Title = Mod folder
1010
#LOC_PartInfoInPAW_PartDryMass_Title = Dry mass
1111
#LOC_PartInfoInPAW_PartDryWetMass_Title = Dry / wet mass
@@ -17,6 +17,6 @@ Localization
1717
#LOC_PartInfoInPAW_CopyPartNode_Action = Copy part CFG node
1818
#LOC_PartInfoInPAW_Kg_Unit = kg
1919
#LOC_PartInfoInPAW_T_Unit = t
20-
#LOC_PartInfoInPAW_PartModuleInfo = <b>Part name:</b> <<1>>\n<b>Part mod (GameData folder):</b> <<2>>
20+
#LOC_PartInfoInPAW_PartModuleInfo = <b>Part name:</b> <<1>><br>\n<b>Path to part CFG-file:</b> <<2>>
2121
}
2222
}

GameData/PartInfoInPAW/Localization/ru.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ Localization
1717
#LOC_PartInfoInPAW_CopyPartNode_Action = Скопировать конфиг детали
1818
#LOC_PartInfoInPAW_Kg_Unit = кг
1919
#LOC_PartInfoInPAW_T_Unit = т
20-
#LOC_PartInfoInPAW_PartModuleInfo = <b>Имя (ID) детали:</b> <<1>>\n<b>Папка мода детали:</b> <<2>>
20+
#LOC_PartInfoInPAW_PartModuleInfo = <b>Имя (ID) детали:</b> <<1>><br>\n<b>Путь к CFG-файлу детали:</b> <<2>>
2121
}
2222
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"NAME": "PartInfoInPAW",
3+
"URL": "https://raw.githubusercontent.com/judicator/PartInfoInPAW/master/GameData/PartInfoInPAW/PartInfoInPAW.version",
4+
"DOWNLOAD": "https://github.com/judicator/PartInfoInPAW/releases",
5+
"VERSION":
6+
{
7+
"MAJOR":0,
8+
"MINOR":2,
9+
"PATCH":2,
10+
"BUILD":0
11+
},
12+
"KSP_VERSION":
13+
{
14+
"MAJOR":1,
15+
"MINOR":12,
16+
"PATCH":4
17+
},
18+
"KSP_VERSION_MIN":
19+
{
20+
"MAJOR":1,
21+
"MINOR":8,
22+
"PATCH":0
23+
24+
},
25+
"KSP_VERSION_MAX":
26+
{
27+
"MAJOR":1,
28+
"MINOR":12,
29+
"PATCH":99
30+
}
31+
}

README.md

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,38 @@
11
# Part info in PAW menu
22

3-
Very small and simple mod for Kerbal Space Program.
4-
Mod works in VAB/SPH and adds some useful information about part to right-click menu (PAW menu):
5-
* part name (basically, part ID);
6-
* part mod (GameData folder name);
7-
* dry/wet mass;
8-
* cost;
9-
* entry cost;
10-
* dry engine TWR ("dry means" TWR is only calculated for this specific part, not craft or stage). Of course, is shown only for engines.
3+
Mod for Kerbal Space Program intended for mod creators and advanced players.
4+
Get useful information about part from PAW menu, copy part ID or full part CFG node to clipboard with one click.
115

12-
By default, mod adds it's functionality to all in game parts.
6+
## What does this mod do?
137

14-
For engines, mod also display formatted string of additional data about engine (the same you can see in part information screen in left panel in VAB/SPH). If part has more than one ModuleEngines (for example, multi-mode engine like RAPIER), information for first two ModuleEngines will be displayed.
8+
1. It displays part name (basically, part ID) and path to part CFG file in the parts list (in VAB/Hangar):
9+
![PartInfoInPAW](https://i.imgur.com/x889rHz.png)
10+
This feature is more or less identical to [PartInfo mod by linuxgurugamer](https://forum.kerbalspaceprogram.com/index.php?/topic/182040-*).
1511

16-
Lastly, mod adds two buttons to PAW menu, which allows you to copy part name (part ID) or whole part config (in-game part representation in human-readable text) to clipboard.
12+
2. PartInfoInPAW also adds some information to PAW menu (right-click menu) for alls parts (works only in VAB/SPH).
13+
This information include:
14+
* part name (basically, part ID);
15+
* part mod (GameData folder name);
16+
* dry/wet mass;
17+
* cost;
18+
* entry cost;
19+
* dry engine TWR ("dry" means TWR is only calculated for this specific part, not craft or stage). And of course, it is shown only for engines.
20+
21+
For engines, mod also display formatted string of additional data about engine (the same you can see in parts list in VAB/SPH). If part has more than one ModuleEngines (for example, multi-mode engine like RAPIER), information for first two ModuleEngines will be displayed.
1722

18-
Actually, one picture can tell more than a thousand words:
19-
![PartInfoInPAW](https://i.imgur.com/ucCfDGe.png)
23+
![PartInfoInPAW](https://i.imgur.com/5Mj9Wdk.png)
2024

25+
3. Finally, mod adds two buttons to PAW menu (see screenshot above), which allows you to copy part name (part ID) or whole part config (in-game part representation in human-readable text) to clipboard.
26+
This is my favorite feature, and I hope other players and modders will find it useful (as did I).
2127

2228
## Dependencies
2329

24-
* [Module manager (last version preferred)](https://github.com/sarbian/ModuleManager)
25-
30+
* [Module manager (preferably last version)](https://forum.kerbalspaceprogram.com/index.php?/topic/50533-*)
31+
Version 4.2.2 is bundled as part of download.
2632

2733
## Supported KSP versions
2834

29-
KSP 1.8.1 or newer is supported.
30-
35+
KSP 1.8.0 or newer is supported.
3136

3237
## Licensing
3338

@@ -40,3 +45,6 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
4045
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
4146

4247
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
48+
49+
50+
Bundled Module Manager is licensed under a "CC share-alike license". More information can be found [here](https://forum.kerbalspaceprogram.com/index.php?/topic/50533-*).

src/Modules/PartInfoInPAW.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public bool UrlMatches(string url)
6666
public string BuildModName(string url)
6767
{
6868
int nestLevel = NestingLevel;
69-
string[] folders = url.Split('/');
69+
string[] folders = url.Split('/');
7070
string result = "";
7171
if (folders.Length < nestLevel)
7272
{
@@ -229,15 +229,15 @@ private string GetPartName()
229229
}
230230

231231
private string GetPartMod()
232-
{
232+
{
233233
string url = part.partInfo.partUrl;
234234
foreach (var mod in ModsWithComplexFoldersStruct)
235-
{
235+
{
236236
if (mod.UrlMatches(url))
237-
{
237+
{
238238
return "\n" + mod.BuildModName(url);
239-
}
240-
}
239+
}
240+
}
241241
return url.Split('/')[0];
242242
}
243243

@@ -250,8 +250,6 @@ private string GetConfigNodeText()
250250
node = cfg.ToString();
251251
if (cfg != null && !cfg.HasValue("name") && (partName != ""))
252252
{
253-
// node.Replace($"PART{Environment.NewLine}" + "{" + $"{Environment.NewLine}", $"PART{Environment.NewLine}" + "{" + $"{Environment.NewLine}\tname = " + partName + $"{Environment.NewLine}");
254-
// node.Replace("PART\n{\n", "PART\n{" + $"\n\tname = {partName}\n");
255253
node = ReplaceFirstOccurrence(node, "{", "{" + $"{Environment.NewLine}\tname = {partName}");
256254
}
257255
}
@@ -275,11 +273,13 @@ public override string GetInfo()
275273
{
276274
partName = GetPartName();
277275
}
278-
if (partMod == "")
279-
{
280-
partMod = GetPartMod();
281-
}
282-
return Localizer.Format("#LOC_PartInfoInPAW_PartModuleInfo", partName, partMod);
276+
string[] urlSegments = part.partInfo.partUrl.Split('/');
277+
if (urlSegments.Length > 1)
278+
{
279+
Array.Resize(ref urlSegments, urlSegments.Length - 1);
280+
}
281+
string partURL = String.Join("<color=#888888>/</color><br>", urlSegments) + ".cfg";
282+
return Localizer.Format("#LOC_PartInfoInPAW_PartModuleInfo", partName, partURL);
283283
}
284284

285285
[KSPEvent]

0 commit comments

Comments
 (0)