Jump to content

Is my simple fix for a complex problem too simple?


Recommended Posts

Less of a direct dev questions and more of a design philosophy and good practices question.  I'm working on a mod that uses the stock inventory system for module management.  The goal is to eventually make a much more modular (no pun intended) command part system where pods and probe cores are basically just empty shells you fill out using the inventory system.  So far it's working pretty well.

However by default KSP disables parts with an inventory (ModuleInventoryPart) from being a storable part itself (ModuleCargoPart), so no nested inventory parts.  This would be a super useful and likely necessary feature and it can be gotten around.

If you create and use a subclass of ModuleInventoryPart, the new subclass won't trigger this restriction so you can in theory store an inventory within an inventory.  The stock game will properly keep track of build cost and mass but it won't see the nested inventory part costs on recovery.  The parts are there but you lose the money for any part stored in a stored part.

Rather than dig into the recovery code or mess too much with the ModuleInventoryPart class I was thinking of just adding in a hidden RESOURCE (call it 'Components' or whatever) and simply adjust the amount based on the cost of the stored parts.  On recovery this 'resource' gets added back into the recovery cost so in theory it all comes out even.

Is this too kludgy?  I feel like it should work just fine but it seems a bit of a cheat somehow.  Any thoughts?

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...