Skip to content

Commit

Permalink
Merge pull request #325 from ihsoft/next
Browse files Browse the repository at this point in the history
Release v1.19
  • Loading branch information
ihsoft authored May 3, 2019
2 parents 3bbcc57 + 5ba3b75 commit 431c640
Show file tree
Hide file tree
Showing 66 changed files with 1,215 additions and 748 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Release
/Release
*.zip
Source/obj
Source/bin
Expand Down
Binary file removed Binaries/KSPDev_Utils.1.1.dll
Binary file not shown.
Binary file added Binaries/KSPDev_Utils.1.2.dll
Binary file not shown.
816 changes: 630 additions & 186 deletions Binaries/KSPDev_Utils.1.1.xml → Binaries/KSPDev_Utils.1.2.xml

Large diffs are not rendered by default.

18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
# 1.18 (pre-release):
# 1.19 (May 2nd, 2019):
* [Change] `KSP 1.7.*` compatibility.
* [Change] Update ES-ES localization.
* [Change] Make `CB-1` volume physical (no override) and allow carrying it on the kerbal's back.
* [Fix #305] Allow grab hints menu to be turned off in KIS `settings.cfg`.
* [Fix #311] Container item launchID incorrect at vessel launch.
* [Fix #313] Contained item's dry-mass is incorrect in tooltip.
* [Fix #314] KIS.Container1 cannot be selected as root part.
* [Fix #315] When the target is too far, KIS says "too heavy".
* [Fix #317] Stock Parts not stacking in 1.6.1 with no other mods.
* [Fix #319] Restock part volumes is wrong when a skinned mesh is used.
* [Fix #320] Some parts refuse to get detached.
* [Fix #321] KIS Inventory and inflatable parts.
* [Fix #323] EVA fuel canister has infinite reserve.
* [Fix #324] Statically attachable parts don't attach.

# 1.18 (February 2nd, 2019):
* [Change] Add an optional (yet) patch file to make the legacy KIS containers physics complient. See file `kis_physical_containers.cfg.txt`.
* [Enhancement] Add French localization.
* [Enhancement] Improve English part descriptions.
Expand Down
8 changes: 4 additions & 4 deletions Deps/CommunityCategoryKit/CCK.version
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@
},
"KSP_VERSION":{
"MAJOR":1,
"MINOR":5,
"MINOR":6,
"PATCH":0
},
"KSP_VERSION_MIN":{
"MAJOR":1,
"MINOR":5,
"MINOR":6,
"PATCH":0
},
"KSP_VERSION_MAX":{
"MAJOR":1,
"MINOR":5,
"MINOR":6,
"PATCH":9
},
"NAME": "Community Category Kit",
"URL": "https://raw.githubusercontent.com/BobPalmer/CommunityCategoryKit/master/FOR_RELEASE/GameData/CommunityCategoryKit/CCK.version",
"VERSION": {
"MAJOR": 4,
"MINOR": 0,
"MINOR": 1,
"PATCH": 0,
"BUILD": 0
}
Expand Down
6 changes: 5 additions & 1 deletion Deps/CommunityCategoryKit/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
4.0.0 - 2018.10.20
4.1.0 - 2019.02.05
------------------
KSP 1.6.x Compatibility

4.0.0 - 2018.11.20
------------------
KSP 1.5.0 Compatibility

Expand Down
Binary file removed Deps/ModuleManager.4.0.1.dll
Binary file not shown.
Binary file added Deps/ModuleManager.4.0.2.dll
Binary file not shown.
14 changes: 7 additions & 7 deletions KIS.version
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
"DOWNLOAD": "http://forum.kerbalspaceprogram.com/index.php?/topic/149848-12-kerbal-inventory-system-kis-v131/",
"KSP_VERSION": {
"MAJOR": 1,
"MINOR": 6,
"PATCH": 1
"MINOR": 7,
"PATCH": 0
},
"KSP_VERSION_MAX": {
"MAJOR": 1,
"MINOR": 6,
"MINOR": 7,
"PATCH": 99
},
"KSP_VERSION_MIN": {
"MAJOR": 1,
"MINOR": 6,
"MINOR": 7,
"PATCH": 0
},
"NAME": "Kerbal Inventory System",
"URL": "https://raw.githubusercontent.com/ihsoft/KIS/master/KIS.version",
"VERSION": {
"BUILD": 42939,
"BUILD": 39277,
"MAJOR": 1,
"MINOR": 18,
"PATCH": 6971
"MINOR": 19,
"PATCH": 7061
}
}
9 changes: 5 additions & 4 deletions Lang/en-us.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// other languages should catch-up as the version is increasing.
// Last updated: 02/01/2019
// Authors: KospY, IgorZ, Supercheese, rfelipe200
// Last updated: 02/03/2019
Localization
{
en-us
Expand Down Expand Up @@ -90,9 +91,9 @@ Localization

// ********** Part: KIS.Container8

#KIS_Container8_Part_title = IWC-4500 "Wyvern"
#KIS_Container8_Part_manufacturer = Kerbal Inventory Systems
#KIS_Container8_Part_description = The IWC-4500 "Wyvern" Container is specifically designed for when you can't decide whether the food is enough for the trip to Duna or you should take more snacks just in case. Warranty void if used alongside any container outside the KIS containers family (sold separately).
#KIS_Container8_Part_title = IWC-3K "Wyvern"
#KIS_Container8_Part_manufacturer = KIS
#KIS_Container8_Part_description = The IWC-3K "Wyvern" container is specifically designed for when you can't decide whether the food is enough for the trip to Duna or you should take more snacks just in case. Warranty void if used with used alongside any container outside the KIS containers (sold separately).
#KIS_Container8_Part_tags = cck-containers KIS container inventory

// ********** Part: KIS.ContainerMount1
Expand Down Expand Up @@ -459,7 +460,7 @@ Localization
#kisLOC_00029 = Seat <<1>> inventory
// The name of the part's menu item that opens the inventory of a specific kerbal.
// Argument <<1>> is the first name of the kerbal.
#kisLOC_00030 = <<1>>`s inventory
#kisLOC_00030 = <<1>>'s inventory
// The name of the part's menu item that opens the associated inventory. The "part"
// can be a kerbal.
#kisLOC_00031 = Inventory
Expand Down
355 changes: 198 additions & 157 deletions Lang/es-es.cfg

Large diffs are not rendered by default.

54 changes: 49 additions & 5 deletions Lang/pt-br.cfg
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
// Version: 6
// Before changing the version, read the instructions in the en-us.cfg file!
// Author: Rodrigo Felipe (rfelipe200)
// Last updated: 02/01/2019
// Last updated: 02/03/2019
Localization
{
pt-br
{
// ********** Part: KIS.basketball

#KIS_basketball_Part_title = Bola de Basquete
#KIS_basketball_Part_manufacturer = Sistema de Inventário Kerbal
#KIS_basketball_Part_description = Uma grande ferramenta para estudar a gravidade. Se não há gravidade, a terceira lei de Newton pode ser explorada. Se isso também não for interessante, então esta bola pode simplesmente quebrar alguma coisa!
#KIS_basketball_Part_tags = cck-eva-items

// ********** Part: KIS.beer

#KIS_beer_Part_title = Bub's Beer
#KIS_beer_Part_manufacturer = Sistema de Inventário Kerbal
#KIS_beer_Part_description = Uma boa e barata cerveja. Toda agência espacial sábia definitivamente deveria oferecer um pouco à sua grata tripulação para manter moral e motivação altas.
#KIS_beer_Part_tags = cck-eva-items
#KIS_beer_Part_useName = Beber

// ********** Part: KIS.bomb1

Expand Down Expand Up @@ -72,9 +86,9 @@ Localization

// ********** Part: KIS.Container8

#KIS_Container8_Part_title = Container IWC-4500
#KIS_Container8_Part_title = Container IWC-3K
#KIS_Container8_Part_manufacturer = Sistema de Inventário Kerbal
#KIS_Container8_Part_description = O container IWC-4500 "Wyvern" foi projetado especificamente para quando você não consegue decidir se a comida é suficiente para a viagem até Duna ou se leva aquele lanche a mais pra garantir. Garantia anulada se utilizado, transportado ou armazenado com qualquer container não fabricado pelo KIS (vendidos separadamente).
#KIS_Container8_Part_description = O container IWC-3K "Wyvern" foi projetado especificamente para quando você não consegue decidir se a comida é suficiente para a viagem até Duna ou se leva aquele lanche a mais pra garantir. Garantia anulada se utilizado, transportado ou armazenado com qualquer container não fabricado pelo SIK (vendidos separadamente).
#KIS_Container8_Part_tags = cck-containers KIS container inventory

// ********** Part: KIS.ContainerMount1
Expand All @@ -99,6 +113,21 @@ Localization
#KIS_evapropellant_Part_tags = KIS EVA fuel portable cck-eva-items
#KIS_evapropellant_Part_useName = Reabastecer

// ********** Part: KIS.ghettoblaster

#KIS_ghettoblaster_Part_title = Ghetto Blaster
#KIS_ghettoblaster_Part_manufacturer = Sistema de Inventário Kerbal
#KIS_ghettoblaster_Part_description = Vôos longos podem ser chatos e às vezes até insuportáveis. Para alegrar a vida dos corajosos explotadores do espaço, nossos engenheiros desenvolveram uma versão especial do gravador de fita cassete: um gravador de fita sem fita! Ele sempre toca a mesma composição, o que elimina completamente conflitos na tripulação quanto a gostos musicais.
#KIS_ghettoblaster_Part_tags = cck-eva-items

// ********** Part: KIS.golfclub

#KIS_golfclub_Part_title = Taco de golfe Alpard Kerman
#KIS_golfclub_Part_manufacturer = Sistema de Inventário Kerbal
#KIS_golfclub_Part_description = Ballistic calculations are, of course, good, but it is much better to just kick the object and see how it flies. This is vislually! Here is a stick, which can be used as a scientific instrument. It can help kicking.Cálculos balísticos são, claro, bons, mas é muito melhor simplesmente chutar o objeto e ver como ele voa. Esta é uma vara, que pode ser usada como instrumento científico. Ela ajuda a chutar.
#KIS_golfclub_Part_tags = cck-eva-items
#KIS_golfclub_Part_useName = Sacudir

// ********** Part: KIS.guide

#KIS_guide_Part_title = SIK para Trouxas
Expand All @@ -107,6 +136,21 @@ Localization
#KIS_guide_Part_tags = KIS inventory building book portable cck-eva-items
#KIS_guide_Part_useName = Ler

// ********** Part: KIS.guitar

#KIS_guitar_Part_title = Violão Davwie Kerman
#KIS_guitar_Part_manufacturer = Sistema de Inventário Kerbal
#KIS_guitar_Part_description = Mandamos o menino da porteira pro espaço, e seu violão ficou pra trás.
#KIS_guitar_Part_tags = cck-eva-items

// ********** Part: KIS.taco

#KIS_taco_Part_title = Chradfield Kerman's Taco
#KIS_taco_Part_manufacturer = Kerbal Inventory Systems
#KIS_taco_Part_description = Carne, vegetais e molho apimentado numa tortilla. Tudo que nossos kerbonautas precisam para uma refeição em gravidade zero.
#KIS_taco_Part_tags = cck-eva-items
#KIS_taco_Part_useName = Comer

// ********** Part: KIS.wrench

#KIS_wrench_Part_title = Chave Utilitária BS-8
Expand Down Expand Up @@ -667,9 +711,9 @@ Localization
// The name of the context menu item to release the mounted part.
#kisLOC_10000 = Soltar
// ********** Type: Patches localization
// ********** Type: Patches localization
// Caption for the editor category.
#kisLOC_99001 = EVA Items
#kisLOC_99001 = Itens AEV
}
}
6 changes: 3 additions & 3 deletions Lang/ru.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ Localization

// ********** Part: KIS.Container8

#KIS_Container8_Part_title = IWC-4500 "Дракон"
#KIS_Container8_Part_title = IWC-3K "Дракон"
#KIS_Container8_Part_manufacturer = ЗАО «Керман и сын» (КИС)
#KIS_Container8_Part_description = Этот контейнер разрабатывался специально для того чтобы объединять контейнеры разных диаметров из нашей линейки модулей. К несчастью, главный разработчик чрезмерно увлекался сказками, и вот поэтому такое название. Во всём остальном это качественный контейнер с прекрасными аэродинамическими свойствами. Которые, однако, гарантируются ТОЛЬКО при использовании с другими контейнерами производства нашей фирмы.
#KIS_Container8_Part_description = Этот контейнер разрабатывался специально для того чтобы объединять контейнеры разных диаметров из нашей линейки модулей. К несчастью, главный разработчик чрезмерно увлекался сказками, и вот поэтому такое название. Во всём остальном это качественный контейнер с прекрасными аэродинамическими свойствами. Которые, однако, гарантируются ТОЛЬКО при использовании с контейнерами производства нашей фирмы.
#KIS_Container8_Part_tags = cck-containers KIS контейнер инвентарь

// ********** Part: KIS.ContainerMount1
Expand Down Expand Up @@ -596,7 +596,7 @@ Localization
#kisLOC_06010 = Закрепляется на поверхности без инструментов
// The info string to show in the editor to state that the item can be attached to
// the surface, but the appropriate tool will be needed.
#kisLOC_06011 = Требуется инструмен для закрепления на поверхности
#kisLOC_06011 = Требуется инструмент для закрепления на поверхности
// The info string to show in the editor to specify with what force the part will be
// attached to the surface (if such attachment is allowed).
#kisLOC_06012 = Сила сцепления с поверхностью: <<1>>
Expand Down
3 changes: 2 additions & 1 deletion Parts.fun/fun_ghettoblaster/part.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ PART
equipDir = (90,90,0)
loop = true
sndPath = KIS/Parts.fun/fun_ghettoblaster/ghettoBlaster1
allowPartAttach = Disabled
// Keep it in sync with attachRules.
allowPartAttach = AllowedWithKisTool
}
}
13 changes: 11 additions & 2 deletions Parts/concreteBase1/part.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,19 @@ PART
MODULE
{
name = ModuleKISItem
volumeOverride = 100
stackable = true

// ModuleKISItem
allowPartAttach = AllowedWithKisTool
allowStaticAttach = AllowedAlways
staticAttachBreakForce = 200

// ModuleKISItemEvaTweaker
carriable = true
equipMode = model
equipSlot = jetpack
equipBoneName = aliasJetpack
equipPos = 0, 0.2, -0.23
equipDir = 105, 0, 180
runSpeed = 0.8
}
}
2 changes: 1 addition & 1 deletion Parts/container1/part.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ PART
title = #KIS_Container1_Part_title // #KIS_Container1_Part_title = SC-62 Portable Container
manufacturer = #KIS_Container1_Part_manufacturer // #KIS_Container1_Part_manufacturer = Kerbal Inventory Systems
description = #KIS_Container1_Part_description // #KIS_Container1_Part_description = This external container for tools, snacks, and more was designed specifically for the Mun mission. Two days before launch, the ground crew discovered that there was no more room for Valentina's favorite koffee mug. This put the entire mission at risk! Our engineers were thankfully able to solve the problem by attaching an ordinary hiking backpack reinforced with aluminum tubing to the exterior of the ship. Crews liked this design so much that these container-backpacks are now mass-produced.
attachRules = 1,0,0,1,0
attachRules = 1,0,1,1,0
mass = 0.1
dragModelType = default
maximum_drag = 0.2
Expand Down
Binary file modified Parts/container4/kis_mini_bw_c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container4/kis_mini_c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container4/kis_mini_dark_c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container4/kis_mini_go_c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container4/kis_mini_orange_c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container5/kis_giga_bw_c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container5/kis_giga_c 1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container5/kis_giga_dark_c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container5/kis_giga_e.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container5/kis_giga_orange_c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container6/kis_micro_bw_c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container6/kis_micro_c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container6/kis_micro_dark_c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container6/kis_micro_go_c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container6/kis_micro_orange_c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container7/kis_mega_bw_c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container7/kis_mega_c 1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container7/kis_mega_dark_c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container7/kis_mega_e.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container7/kis_mega_orange_c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container8/kis_dragon_c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container8/kis_dragon_c_blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container8/kis_dragon_c_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container8/kis_dragon_c_go.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container8/kis_dragon_e.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Parts/container8/kis_dragon_e_blue.png
Binary file removed Parts/container8/kis_dragonlights_c.png
Diff not rendered.
Binary file removed Parts/container8/kis_dragonlights_c_blue.png
Diff not rendered.
4 changes: 2 additions & 2 deletions Parts/container8/part.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ PART
cost = 2250
category = Payload
subcategory = 0
title = #KIS_Container8_Part_title // #KIS_Container8_Part_title = IWC-4500 "Wyvern"
title = #KIS_Container8_Part_title // #KIS_Container8_Part_title = IWC-3K "Wyvern"
manufacturer = #KIS_Container8_Part_manufacturer // #KIS_Container8_Part_manufacturer = Kerbal Inventory Systems
description = #KIS_Container8_Part_description // #KIS_Container8_Part_description = The IWC-4500 "Wyvern" Container is specifically designed for when you can't decide whether the food is enough for the trip to Duna or you should take more snacks just in case. Warranty void if used alongside any container outside the KIS containers family (sold separately).
description = #KIS_Container8_Part_description // #KIS_Container8_Part_description = The IWC-3K "Wyvern" Container is specifically designed for when you can't decide whether the food is enough for the trip to Duna or you should take more snacks just in case. Warranty void if used alongside any container outside the KIS containers family (sold separately).
attachRules = 1,0,1,1,1
mass = 0.2
dragModelType = default
Expand Down
3 changes: 2 additions & 1 deletion Parts/evapropellant1/part.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ PART
equipBoneName = aliasJetpack
equipPos = 0.06, 0.04, -0.09
equipDir = 10, 0, 0
allowPartAttach = Disabled
// Keep it in sync with attachRules.
allowPartAttach = AllowedWithKisTool
}
}
4 changes: 2 additions & 2 deletions Source/KIS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>Q:\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="KSPDev_Utils.1.1">
<HintPath>..\Binaries\KSPDev_Utils.1.1.dll</HintPath>
<Reference Include="KSPDev_Utils.1.2">
<HintPath>..\Binaries\KSPDev_Utils.1.2.dll</HintPath>
</Reference>
<Reference Include="System">
<HintPath>Q:\KSP_x64_Data\Managed\System.dll</HintPath>
Expand Down
42 changes: 26 additions & 16 deletions Source/KISAddonConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ sealed class KISAddonConfig : MonoBehaviour {
[PersistentField("EquipAliases/alias", isCollection = true)]
public readonly static List<string> equipAliases = new List<string>();

[PersistentField("Global/breathableAtmoPressure")]
public static float breathableAtmoPressure = 0.5f;
[PersistentField("Global/showHintText")]
public static bool showHintText = true;

[PersistentField("Global/hideHintKey")]
public static KeyCode hideHintKey = KeyCode.None;

[PersistentField("EvaInventory")]
readonly static PersistentConfigNode evaInventory = new PersistentConfigNode();
Expand Down Expand Up @@ -77,7 +80,7 @@ public override void StartLoad() {
|| !avPart.partPrefab || avPart.partPrefab.CrewCapacity < 1)) {
DebugEx.Fine("Found part with crew: {0}, CrewCapacity={1}",
avPart.name, avPart.partPrefab.CrewCapacity);
AddPodInventories(avPart.partPrefab, avPart.partPrefab.CrewCapacity);
AddPodInventories(avPart.partPrefab);
}
}
}
Expand Down Expand Up @@ -106,27 +109,34 @@ public void Awake() {
}
}

public static void AddPodInventories(Part part, int crewCapacity) {
/// <summary>Adds seat inventories to cover the maximum pod occupancy.</summary>
/// <remarks>
/// If the part already has seat inventories, they will be adjusted to have the unique seat
/// indexes. This is usefull if the part's config provides the needed number of modules. If number
/// of the existing modules is not enough to cover <c>CrewCapacity</c>, extra modules are added.
/// </remarks>
/// <param name="part">The part to add seat inventorties for.</param>
public static void AddPodInventories(Part part) {
var checkInventories = part.Modules.OfType<ModuleKISInventory>()
.Where(m => m.invType == ModuleKISInventory.InventoryType.Pod);
if (checkInventories.Any()) {
DebugEx.Error("Part {0} has pod inventories in config. Cannot make a proper setup!", part);
}

// Assign the seats.
var podInventories = part.Modules.OfType<ModuleKISInventory>()
.Where(m => m.invType == ModuleKISInventory.InventoryType.Pod)
.ToArray();
for (var i = 0; i < crewCapacity; i++) {
DebugEx.Fine("{0}: Add pod inventory at seat: {0}", i);
var moduleNode = new ConfigNode("MODULE", "Dynamically created by KIS. Not persistant!");
var seatIndex = 0;
foreach (var inventory in checkInventories) {
HostedDebugLog.Info(
inventory, "Assinging seat to a pre-configured pod inventory: {0}", seatIndex);
inventory.podSeat = seatIndex++;
}
while (seatIndex < part.CrewCapacity) {
var moduleNode = new ConfigNode("MODULE", "Dynamically created by KIS.");
evaInventory.CopyTo(moduleNode);
moduleNode.SetValue("name", typeof(ModuleKISInventory).Name, createIfNotFound: true);
moduleNode.SetValue(
"invType", ModuleKISInventory.InventoryType.Pod.ToString(), createIfNotFound: true);
moduleNode.SetValue("podSeat", i, createIfNotFound: true);
moduleNode.SetValue("podSeat", seatIndex, createIfNotFound: true);
part.partInfo.partConfig.AddNode(moduleNode);
part.AddModule(moduleNode, forceAwake: true);
var inventory = part.AddModule(moduleNode, forceAwake: true);
HostedDebugLog.Info(inventory, "Dynamically created pod inventory at seat: {0}", seatIndex);
seatIndex++;
}
}

Expand Down
Loading

0 comments on commit 431c640

Please sign in to comment.