File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313 Release| Any CPU = Release| Any CPU
1414 EndGlobalSection
1515 GlobalSection (ProjectConfigurationPlatforms ) = postSolution
16- {2A62527B-B543-4E5A-A197-D28C37F282D8} .Debug| Any CPU .ActiveCfg = Release |Any CPU
17- {2A62527B-B543-4E5A-A197-D28C37F282D8} .Debug| Any CPU .Build .0 = Release |Any CPU
16+ {2A62527B-B543-4E5A-A197-D28C37F282D8} .Debug| Any CPU .ActiveCfg = Debug |Any CPU
17+ {2A62527B-B543-4E5A-A197-D28C37F282D8} .Debug| Any CPU .Build .0 = Debug |Any CPU
1818 {2A62527B-B543-4E5A-A197-D28C37F282D8} .Deploy| Any CPU .ActiveCfg = Deploy| Any CPU
1919 {2A62527B-B543-4E5A-A197-D28C37F282D8} .Deploy| Any CPU .Build .0 = Deploy| Any CPU
2020 {2A62527B-B543-4E5A-A197-D28C37F282D8} .DeployAndRun| Any CPU .ActiveCfg = DeployAndRun| Any CPU
Original file line number Diff line number Diff line change 11@new()
22:resource_units {
3- Water: "l ";
4- WasteWater: "l ";
3+ Water: "L ";
4+ WasteWater: "L ";
55}
Original file line number Diff line number Diff line change 55 "name" : " Community Resources" ,
66 "description" : " Adds generic resources for mods to use" ,
77 "source" : " https://github.com/KSP2Community/CommunityResources" ,
8- "version" : " 0.1.0 " ,
8+ "version" : " 0.1.1 " ,
99 "version_check" : " https://raw.githubusercontent.com/KSP2Community/CommunityResources/main/plugin_template/swinfo.json" ,
1010 "ksp2_version" : {
1111 "min" : " 0.1.5" ,
Original file line number Diff line number Diff line change 11using HarmonyLib ;
2+ using KSP ;
23using KSP . Game ;
4+ using KSP . Iteration . UI . Binding ;
35using KSP . Modules ;
6+ using KSP . OAB ;
47using KSP . Sim . Definitions ;
58using KSP . Sim . ResourceSystem ;
69using KSP . UI ;
@@ -60,4 +63,23 @@ private static void ResourceCapacities_GetUnits(Module_ResourceCapacities __inst
6063 }
6164 }
6265 }
66+
67+ [ HarmonyPrefix ]
68+ [ HarmonyPatch ( typeof ( PartInfoOverlay ) , nameof ( PartInfoOverlay . PopulateResourceInfoFromPart ) ) ]
69+ private static bool PopulateResourceInfoFromPart ( List < KeyValuePair < string , string > > dict ,
70+ IObjectAssemblyResource [ ] resourceArray )
71+ {
72+ foreach ( var resource in resourceArray )
73+ {
74+ if ( ! ResourceUnits . TryGetValue ( resource . Name , out var unitName ) )
75+ {
76+ unitName = resource . Name == "ElectricCharge" ? Units . SymbolUnits : Units . SymbolTonne ;
77+ }
78+
79+ dict . Add ( new KeyValuePair < string , string > ( PartInfoOverlay . LocalizeVABTooltipString ( resource . Name ) ,
80+ $ "{ resource . Count } { PartInfoOverlay . LocalizeVABTooltipString ( unitName ) } ") ) ;
81+ }
82+
83+ return false ;
84+ }
6385}
You can’t perform that action at this time.
0 commit comments