Skip to content

Commit

Permalink
Merge pull request #335 from ihsoft/next
Browse files Browse the repository at this point in the history
KIS v1.22
  • Loading branch information
ihsoft committed May 31, 2019
2 parents 84543b0 + 1287c2c commit 0659dc9
Show file tree
Hide file tree
Showing 28 changed files with 138 additions and 34 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,12 @@
# 1.22 (May 30th, 2019):
* [Change] "Breaking ground" DLC support.
* [Change] Don't allow `KIS` to deploy or move the ground experiments.
* [Change] Allow the small cargo to be carried by kerbal.
* [Change] Disable the default remove helmet hotkey `J` as it conflicts with "Breaking ground" DLC.
* [Enhancement] Add medium portable cargo to carry 6 experiments.
* [Fix #333] Robotics part trigger physics when making a hover model.
* [Fix #334] Action icons are blurred.

# 1.21 (May 16th, 2019):
* [Fix #89] Portable containers revert to previous content when dropped.
* [Fix #328] KIS fails on every new DLC or major patch that changes kerbal models.
Expand Down
6 changes: 3 additions & 3 deletions KIS.version
Expand Up @@ -19,9 +19,9 @@
"NAME": "Kerbal Inventory System",
"URL": "https://raw.githubusercontent.com/ihsoft/KIS/master/KIS.version",
"VERSION": {
"BUILD": 35942,
"BUILD": 200,
"MAJOR": 1,
"MINOR": 21,
"PATCH": 7075
"MINOR": 22,
"PATCH": 7090
}
}
11 changes: 8 additions & 3 deletions Lang/en-us.cfg
@@ -1,11 +1,10 @@
// Version: 6
// Version: 7
// Do NOT change the version unless a new string is added or an existing one was deleted.
// A simple string update is not a new version! The version number is used to keep all
// the localizations in sync. The EN-US localization file is the primary file, and all the
// 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
// Last updated: 15/05/2019
Localization
{
en-us
Expand Down Expand Up @@ -324,6 +323,9 @@ Localization
#kisLOC_01038 = [<<1>>] to attach
// The tooltip help string for the key binding to cancel the operation.
#kisLOC_01039 = [Escape] to cancel
// The action status to show in the tooltip when the player tries to pick up a
// ground experment from the scene. These parts must be handled via their menus.
#kisLOC_01040 = KIS cannot pickup deployed ground experiments.\nAccess the part's menu!

// ********** Type: KIS.KISAddonPointer, KSPDev Messages

Expand Down Expand Up @@ -566,6 +568,9 @@ Localization
// The info string in the editor to present if kerbals cannot access the items in
// the inventory when going EVA.
#kisLOC_00060 = <color=#FFA500>Cannot be accessed from EVA</color>
// The message to present when a stock game ground experiment part is attempted to
// be stored into inventory in the editor. Such parts cannot be handled by KIS.
#kisLOC_00061 = Use stock game abilities to handle this part

// ********** Type: KIS.ModuleKISItem, KSPDev Messages

Expand Down
10 changes: 8 additions & 2 deletions Lang/ru.cfg
@@ -1,7 +1,7 @@
// Version: 6
// Version: 7
// Before changing the version, read the instructions in the en-us.cfg file!
// Author: Igor Zavoychinskiy (IgorZ)
// Last updated: 02/01/2019
// Last updated: 15/05/2019
Localization
{
ru
Expand Down Expand Up @@ -320,6 +320,9 @@ Localization
#kisLOC_01038 = [<<1>>] присоединить
// The tooltip help string for the key binding to cancel the operation.
#kisLOC_01039 = [Escape] отмена действия
// The action status to show in the tooltip when the player tries to pick up a
// ground experment from the scene. These parts must be handled via their menus.
#kisLOC_01040 = КИС не умеет работать с такими деталями.\nПопробуйте использовать меню самой детали!
// ********** Type: KIS.KISAddonPointer, KSPDev Messages
Expand Down Expand Up @@ -562,6 +565,9 @@ Localization
// The info string in the editor to present if kerbals cannot access the items in
// the inventory when going EVA.
#kisLOC_00060 = <color=#FFA500>Недоступно извне аппарата</color>
// The message to present when a stock game ground experiment part is attempted to
// be stored into inventory in the editor. Such parts cannot be handled by KIS.
#kisLOC_00061 = Пользуйтесь возможностями основной игры для таких деталей
// ********** Type: KIS.ModuleKISItem, KSPDev Messages
Expand Down
35 changes: 35 additions & 0 deletions Patches/MM-DLC-Breaking-Grounds.cfg
@@ -0,0 +1,35 @@
@PART[smallCargoContainer] {
MODULE
{
name = ModuleKISItem
carriable = true
equipMode = part
equipSlot = jetpack
equipBoneName = aliasJetpack
equipPos = 0, 0.15, -0.25
equipDir = 10, 0, 0
}
}

+PART[smallCargoContainer]
{
@name = mediumCargoContainer
@rescaleFactor = 1.33
@entryCost = 750
@cost = 200
@mass = 0.075
@title = SEQ-6 Cargo Storage Unit
%node_attach = 0,0,0.25,0,0,-1,0
%node_stack_top = 0.0, 0.35, 0.0, 0.0, 1.0, 0.0, 1
%node_stack_bottom = 0.0, -0.35, 0.0, 0.0, -1.0, 0.0, 1

%MODULE[ModuleInventoryPart]
{
%InventorySlots = 6
}

%MODULE[ModuleKISItem]
{
@equipPos = 0, 0.30, -0.30
}
}
13 changes: 12 additions & 1 deletion Source/KISAddonPickup.cs
Expand Up @@ -20,7 +20,7 @@

namespace KIS {

// Next localization ID: #kisLOC_01040.
// Next localization ID: #kisLOC_01041.
[PersistentFieldsDatabase("KIS/settings/KISConfig")]
sealed class KISAddonPickup : MonoBehaviour {

Expand Down Expand Up @@ -277,6 +277,12 @@ sealed class KISAddonPickup : MonoBehaviour {
"#kisLOC_01039",
defaultTemplate: "[Escape] to cancel",
description: "The tooltip help string for the key binding to cancel the operation.");

static readonly Message CannotPickupGroundExperimentTooltipTxt = new Message(
"#kisLOC_01040",
defaultTemplate: "KIS cannot pickup deployed ground experiments.\nAccess the part's menu!",
description: "The action status to show in the tooltip when the player tries to pick up a"
+ " ground experment from the scene. These parts must be handled via their menus.");
#endregion

/// <summary>A helper class to handle mouse clicks in the editor.</summary>
Expand Down Expand Up @@ -1462,6 +1468,11 @@ public enum PickupMode {
ReportCheckError(GrabNotOkStatusTooltipTxt, CannotMoveKerbonautTooltipTxt);
return false;
}
// Don't grab stock game's ground experiments.
if (part.Modules.OfType<ModuleGroundPart>().Any()) {
ReportCheckError(GrabNotOkStatusTooltipTxt, CannotPickupGroundExperimentTooltipTxt);
return false;
}
// Check if there are kerbals in range.
if (!HasActivePickupInRange(part)) {
ReportCheckError(TooFarStatusTooltipTxt, TooFarTooltipTxt, cursorIcon: TooFarIcon);
Expand Down
2 changes: 1 addition & 1 deletion Source/KIS_Shared.cs
Expand Up @@ -1044,7 +1044,7 @@ public enum MessageAction {
if (item == null || !item.vesselAutoRename) {
newVessel.vesselName = newPart.partInfo.title;
} else {
newVessel.vesselName = Vessel.AutoRename (newVessel, originatingVesselName);
newVessel.vesselName = Vessel.AutoRename(newVessel, originatingVesselName);
}
newVessel.IgnoreGForces(10);
newVessel.currentStage = StageManager.RecalculateVesselStaging(newVessel);
Expand Down
25 changes: 22 additions & 3 deletions Source/ModuleKISInventory.cs
Expand Up @@ -24,7 +24,7 @@

namespace KIS {

// Next localization ID: #kisLOC_00061.
// Next localization ID: #kisLOC_00062.
[PersistentFieldsDatabase("KIS/settings/KISConfig")]
public class ModuleKISInventory : PartModule,
// KSP interfaces.
Expand Down Expand Up @@ -415,6 +415,12 @@ public class ModuleKISInventory : PartModule,
defaultTemplate: "<color=#FFA500>Cannot be accessed from EVA</color>",
description: "The info string in the editor to present if kerbals cannot access the items in"
+ " the inventory when going EVA.");

static readonly Message CannotAddGroundSciencePartMsg = new Message(
"#kisLOC_00061",
defaultTemplate: "Use stock game abilities to handle this part",
description: "The message to present when a stock game ground experiment part is attempted to"
+ " be stored into inventory in the editor. Such parts cannot be handled by KIS.");
#endregion

#region Public types
Expand Down Expand Up @@ -1049,7 +1055,20 @@ public enum InventoryType {
return item;
}

/// <summary>Adds and item, created from a real part.</summary>
/// <param name="p">The part to capture the state from.</param>
/// <param name="qty">The number of items to create in the slot.</param>
/// <param name="slot">
/// The slot to put the items into. If it's <c>-1</c>, then the slot will be selected
/// automatically.
/// </param>
/// <returns>The created slot or <c>null</c> if part cannot be added to the inventory.</returns>
public KIS_Item AddItem(Part p, int qty = 1, int slot = -1) {
if (p.Modules.OfType<ModuleCargoPart>().Any()) {
ScreenMessaging.ShowPriorityScreenMessage(CannotAddGroundSciencePartMsg);
UISounds.PlayBipWrong();
return null;
}
if (items.ContainsKey(slot)) {
slot = -1; // Choose automatically if the slot is already occupied.
}
Expand Down Expand Up @@ -1424,7 +1443,7 @@ public enum InventoryType {
}

// Show science data
var sciences = KISAPI.PartNodeUtils.GetSciences(tooltipItem.partNode);
var sciences = KISAPI.PartNodeUtils.GetScience(tooltipItem.partNode);
if (sciences.Length > 0) {
foreach (ScienceData scienceData in sciences) {
text2.AppendLine(ItemScienceDataTooltipInfo.Format(
Expand Down Expand Up @@ -1912,7 +1931,7 @@ public enum InventoryType {
}

// Put/remove helmet
if (KIS_Shared.IsKeyDown(evaHelmetKey)) {
if (!string.IsNullOrEmpty(evaHelmetKey) && KIS_Shared.IsKeyDown(evaHelmetKey)) {
// If HelmetChange event haven't fired till this momemnt, then the helmet is ON.
helmetEquippedState = helmetEquippedState ?? true;
SetHelmet(!helmetEquippedState.Value);
Expand Down
7 changes: 3 additions & 4 deletions Source/Properties/AssemblyInfo.cs
Expand Up @@ -29,7 +29,6 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion ("1.21.*")]
[assembly: AssemblyInformationalVersion ("1.21 for KSP 1.7+")]
[assembly: KSPAssembly ("KIS", 1, 21)]
[assembly: AssemblyVersion ("1.22.*")]
[assembly: AssemblyInformationalVersion ("1.22 for KSP 1.7+")]
[assembly: KSPAssembly ("KIS", 1, 22)]
2 changes: 1 addition & 1 deletion Source/api/Utils/PartNodeUtilsImpl.cs
Expand Up @@ -140,7 +140,7 @@ public class PartNodeUtilsImpl {
/// The persistent part's state. It can be a top-level node or the <c>PART</c> node.
/// </param>
/// <returns>The found science.</returns>
public ScienceData[] GetSciences(ConfigNode partNode) {
public ScienceData[] GetScience(ConfigNode partNode) {
return partNode.GetNodes("MODULE")
.SelectMany(m => m.GetNodes("ScienceData"))
.Select(n => new ScienceData(n))
Expand Down
44 changes: 32 additions & 12 deletions Source/api/Utils/PartUtilsImpl.cs
Expand Up @@ -118,21 +118,41 @@ public class PartUtilsImpl {
Hierarchy.GetPartModelTransform(rootPart).gameObject);
modelObj.SetActive(true);

// This piece of code was stolen from PartLoader.CreatePartIcon (alas, it's private).
PartLoader.StripComponent<EffectBehaviour>(modelObj);
PartLoader.StripGameObject<Collider>(modelObj, "collider");
PartLoader.StripComponent<Collider>(modelObj);
PartLoader.StripComponent<WheelCollider>(modelObj);
PartLoader.StripComponent<SmokeTrailControl>(modelObj);
PartLoader.StripComponent<FXPrefab>(modelObj);
PartLoader.StripComponent<ParticleSystem>(modelObj);
PartLoader.StripComponent<Light>(modelObj);
PartLoader.StripComponent<Animation>(modelObj);
PartLoader.StripComponent<DAE>(modelObj);
// Drop stuff that is not intended to show up in flight.
PartLoader.StripComponent<MeshRenderer>(modelObj, "Icon_Hidden", true);
PartLoader.StripComponent<MeshFilter>(modelObj, "Icon_Hidden", true);
PartLoader.StripComponent<SkinnedMeshRenderer>(modelObj, "Icon_Hidden", true);


// Strip anything that is not mesh related.
var joints = new List<Joint>();
var rbs = new List<Rigidbody>();
foreach (var component in modelObj.GetComponentsInChildren(typeof(Component))) {
if (component is Transform) {
continue; // Transforms belong to the GameObject.
}
var rb = component as Rigidbody;
if (rb != null) {
rbs.Add(rb);
continue; // It can be tied with a joint, which must be deleted first.
}
var joint = component as Joint;
if (joint != null) {
joints.Add(joint);
continue; // They must be handled before the connected RBs handled.
}
if (!(component is Renderer || component is MeshFilter)) {
UnityEngine.Object.DestroyImmediate(component);
}
}
// Drop joints before rigidbodies.
foreach (var joint in joints) {
UnityEngine.Object.DestroyImmediate(joint);
}
// Drop rigidbodies once it's safe to do so.
foreach (var rb in rbs) {
UnityEngine.Object.DestroyImmediate(rb);
}

if (goThruChildren) {
foreach (var childPart in rootPart.children) {
var childObj = GetSceneAssemblyModel(childPart);
Expand Down
Binary file modified Textures/attach.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Textures/attachOk.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Textures/detach.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Textures/detachOk.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Textures/drop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Textures/forbidden.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Textures/grab.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Textures/grabOk.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Textures/mount.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Textures/needtool.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Textures/tooFar.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Textures/tooHeavy.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Textures/unknow.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Tools/publish_curseforge_args.txt
Expand Up @@ -4,4 +4,4 @@
--github=ihsoft/KIS
--versions=latest_all_builds
--title=KIS {tag}
--archive=../KIS_v1.21.zip
--archive=../KIS_v1.22.zip
2 changes: 1 addition & 1 deletion Tools/publish_github_args.txt
Expand Up @@ -4,4 +4,4 @@
--changelog=../CHANGELOG.md
--as_draft
--title=KIS v{tag}
--archive=../KIS_v1.21.zip
--archive=../KIS_v1.22.zip
2 changes: 1 addition & 1 deletion Tools/publish_spacedock_args.txt
Expand Up @@ -3,4 +3,4 @@
--changelog=../CHANGELOG.md
--github=ihsoft/KIS
--ksp_version=latest
--archive=../KIS_v1.21.zip
--archive=../KIS_v1.22.zip
2 changes: 1 addition & 1 deletion settings.cfg
Expand Up @@ -64,7 +64,7 @@ KISConfig
{
inventoryKey = tab
rightHandKey = x
helmetKey = j
helmetKey = //j - J conflicts with Breaking Ground DLC.
slotsX = 2
slotsY = 4
slotSize = 50
Expand Down

0 comments on commit 0659dc9

Please sign in to comment.