Jump to content

[Minimum KSP version - 1.12] Kerbal Inventory System (KIS) v1.29


IgorZ

Recommended Posts

24 minutes ago, KoldDark said:

help, pls! I can't open container inventory, EVA inventory, and I have no "grab" ability, after 1.18 update.
P.S I am russian, so I can have mistakes.

Are you sure you have the dependencies (Community Category Kit and Module Manager) installed?

Also note that while the mod is packaged inside a GameData folder, make sure that you put the contents of that into KSP’s GameData.

Link to comment
Share on other sites

Is this a potential typo within KIS, or is KSP's output_log just on drugs?
 

==========================================================================================================
[AddonLoader]: Instantiating addon 'MainScreenTweaker' from assembly 'KIS'
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

Loading persistent fields: type=KIS.MainScreenTweaker, group=""
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

Loading persistent fileds: db path=KIS/settings/KISConfig, group=""
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

Loading 3 persistent fields: group="", node=KISConfig
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

[AddonLoader]: Instantiating addon 'AtmosphereFixer' from assembly 'Kopernicus'
==========================================================================================================

 

Link to comment
Share on other sites

6 hours ago, Tig said:

I'm assuming the crash fix came from this change to the code (Support lost texture event):

https://github.com/ihsoft/KIS/commit/aec6da26f218311695bafe5b193709382967d691#diff-9fd2acd34859195030978517c3414ef4

Nope. This change only improves the behavior. The lost texture is drawn as a black rectangle, no other consequences.

The right change is this one. The comments to the new/change code should be self explanatory.

C# finalizers are called from the GC thread, so you cannot manage Unity resources from it. Usually, Unity explicitly warns when you try to mangle its resources not from the main thread, but in case of the finalizers it doesn't. It simply crashes!

6 hours ago, Tig said:

With my background that scares the crap out of me.  I thought that was part of the whole it-just-works-managed-code-magic. :)

Everything that you create by means of C# is managed by it, but everything else you need to manage yourselves. If you request a resource from Unity, you're responsible for disposing it since Unity cannot know when you don't need it anymore. And there is another tricky thing in Unity+C#  sinergy: if the resource get destroyed within Unity, then all the references to int in the C# code will cast to NULL, but they will not be NULL in C# terms! In usual cases it doesn't matter, but there are edge cases. I've been hit by this once or twice.

3 hours ago, KoldDark said:

help, pls! I can't open container inventory, EVA inventory, and I have no "grab" ability, after 1.18 update.
P.S I am russian, so I can have mistakes.

Try reading the troubleshoot guide. People who instal mods manually sometimes do it wrong.

1 hour ago, _Zee said:

Is this a potential typo within KIS, or is KSP's output_log just on drugs?

It's a typo in the KSPDev logging system. Thanks for bringing my attention :)

Link to comment
Share on other sites

10 hours ago, Tranquil said:

Hi there! Can someone help me plz, I used stuff from different sources. Sunglasses and a custom made headset. They don't work anymore. Does someone know where they should click to the Kerbals now? 

There was a breaking change in 1.15. Third-party mods need to upgrade.

Link to comment
Share on other sites

4 hours ago, Tonka Crash said:

@IgorZ KIS 1.18 KSP 1.6.1 - I'm seeing a "Too Heavy" message when trying to grab items too far away. The "Too Heavy" message does display correctly when the item is too heavy.

qKsaQ0l.png

Yeah, I saw it too. The pick up kerbals are looked in range, and if none found (too far from everyone), a zero mass is calculated. An explicit check for zero kerbals needs to be added. Created a bug.

Link to comment
Share on other sites

A query: is there supposed to be the same mass/proximity check on simply detaching things without grabbing them (i.e. with H instead of G)? Because it seems like I can always detach even when the object would be too heavy to grab, and the detach distance definitely exceeds the grab distance.

Link to comment
Share on other sites

On 2/3/2019 at 5:58 PM, IgorZ said:

There was a breaking change in 1.15. Third-party mods need to upgrade.

@IgorZ

I am in the process of updating the OSE Workshop, and just ran into a small problem:

I've created a new part called Duct.Tape, and it holds a resource called DuctTape.  This is used to repair the workshop if it gets damaged.

Each roll of Duct.Tape starts off with 100 units of DuctTape.  So I have the following problem:

First, I need to be able to store one or more rolls of Duct.Tape in the inventory.  This is not the problem, but, I then need to be able to decrement the amount of DuctTape from one of the rolls in the inventory.  The idea is that a Kerbal will be in a pod and will be using the Duct.Tape while in the pod to do repairs, so no need to worry about equiping it.

I have been able to create a list of all the rolls of Duct.Tape, but what I need now is to be able to take an item out of inventory, update the resource and then put it back.

Along the same lines, I suspect that I'll need to set the KIS_Item.usableFromContainer, but don't know what to do in the part file to do that.

The workshop mod is referencing the KIS DLL for compile time, no need here for any Reflection.

Thanks in advance

LGG

 

Edit:

I think this will work, please confirm:

Where d is a Key/value pair and amt is  a negative number :

The following works, but does not return the remaining amount of the resource:

d.Value.UpdateResource(DUCTTAPERESOURCE, amt, true);

This is a deeper call, which does return the remaining resource:
 double? res = KISAPI.PartNodeUtils.UpdateResource(d.Value.partNode, DUCTTAPERESOURCE, -amt, true);

I also need to get the current resource amount for the part, so I know whether I need to delete it or not

 

Edit 2:  Problem solved, I updated the code above for anyone else who needs it

Edited by linuxgurugamer
Link to comment
Share on other sites

3 hours ago, linuxgurugamer said:

Edit 2:  Problem solved, I updated the code above for anyone else who needs it

Cool. If you need to remove the item from inventory once the duct tape reserve depleted, call `StackRemove`.

Link to comment
Share on other sites

10 minutes ago, IgorZ said:

Cool. If you need to remove the item from inventory once the duct tape reserve depleted, call `StackRemove`.

What if there are more than one, how do I make sure that the one I want to remove is removed?  Specifically, if there are two rolls of tape, I would only want to remove the empty roll

Link to comment
Share on other sites

6 minutes ago, linuxgurugamer said:

What if there are more than one, how do I make sure that the one I want to remove is removed?  Specifically, if there are two rolls of tape, I would only want to remove the empty roll

Every slot (which is mistakenly named "item" in the code) can have only one configuration, it's used for all the items in the slot (stack). That's why KIS specifically restricts stacking items that have resources. If you haven't override this check (via the settings file), then you can be sure the slot has exactly one item. You cannot selectively change resources for an item in a stack, the items in the stack are required to have exactly same config/state.

Edited by IgorZ
Link to comment
Share on other sites

4 minutes ago, IgorZ said:

Every slot (which is mistakenly named "item" in the code) can have only one configuration, it's used for all the items in the slot (stack). That's why KIS specifically restricts stacking items that have resources. If you haven't override this check (via the settings file), then you can be sure the slot has exactly one item. You cannot selectively change resources for an item in a stack, the items in the stack are required to have exactly same config/state.

 So that means that one roll of duct tape with the resources will use up one slot, and I cannot have multiple rolls  of duct tape there. Is this correct? 

Link to comment
Share on other sites

17 minutes ago, linuxgurugamer said:

 So that means that one roll of duct tape with the resources will use up one slot, and I cannot have multiple rolls  of duct tape there. Is this correct? 

This is correct.

Link to comment
Share on other sites

9 hours ago, IgorZ said:

This is correct.

@IgorZ

Got a small bug for you:

The situation was that I was hovering the mouse over an item in the inventory when it was deleted using:

d.Value.StackRemove(1);

The item was deleted, but I got this:


Workshop: ductTapeInInventory.Count: 1, neededDuctTape: 0
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

NullReferenceException: Object reference not set to an instance of an object
  at KIS.ModuleKISInventory.GuiTooltip (Int32 windowID) [0x00000] in <filename unknown>:0 
  at UnityEngine.GUILayout+LayoutedWindow.DoWindow (Int32 windowID) [0x00000] in <filename unknown>:0 
  at UnityEngine.GUI.CallWindowDelegate (UnityEngine.WindowFunction func, Int32 id, Int32 instanceID, UnityEngine.GUISkin _skin, Int32 forceRect, Single width, Single height, UnityEngine.GUIStyle style) [0x00000] in <filename unknown>:0 
 

 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...