[1.0,1.1] Deep Storage (functional)

Started by LWM, January 06, 2019, 06:22:47 PM

Previous topic - Next topic

LWM

Hello all!

Deep Storage Units, yet another storage solution (that will likely be [WIP] for some time).

LWM presents yet another way to deal with your storage needs:  Deep Storage units!

Currently available are multiple buildings that can store more than one object at a time.  Inspired by Skullywag's Extended Storage, this mod takes a different approach - storage buildings that pawns can simply carry multiple items to.  An approach that got a lot harder with 1.0, BTW, but I like the results so far.

This mod will be updating as I tweak items and fix bugs, but I wanted to make it available now that it's mostly working.

Pallets, clothing racks, food storage trays, etc.  You can also write your own <ThingDef>s if you don't like what I've done.

Requirements
Deep Storage Units

  • Big Shelf - a shelf with enough space to store two items per cell
  • Medicine Cabinet - what it says on the box
  • Meal Tray Racks - efficient storage for meals.  Or desserts.
  • Food Baskets - store raw food, some plant matter, or pile in drugs
  • Meat Hooks - I think you can figure out what these are for
  • Weapon Lockers - currently requires Machining? Efficiently store weapons!
  • Clothing Rack - currently stores both civilian and military clothing - subject to change
  • Pallet - for piling so many things onto!
  • Pallet with Wrapping - can store loose matter, too!
  • Skips - Are you American?  Did you know "Dumpster" is a registered TM?  Rock chunks, heavy resournces
Using Deep Storage - bonus tip:  If you have selected an item in DeepStorage, if you right-click, you jump the storage unit!

Known Bugs

  • It may be possible to end up with a small amount of free storage from time to time.  (An extra partially filled stack)
Planned/Likely Changes

  • Possible more options
  • Possible changes to how much/what kinds of stuff is allowed in various units
  • Possible more units
Compatibility (load Deep Storage after these)

  • Combat Extended - Weapon Lockers can store a maximum total Bulk (Sumghai)
  • RimWorld Search Agency (Hauling Hysteresis): hysteresis disabled for DSUs
Known To Be Compatible With

  • Common Sense
  • Pick Up and Haul
Uncompatibility - or - Strange Bugs?

  • Likely incompatible with other storage solutions that pile lots of things in one place (extended storage, RT_Shelves, ???)
  • I f***ed with the Selector and some mesh Drawing.  It's possible, altho unlikely, this may cause an incompatibility
The code can be found online at: https://github.com/lilwhitemouse/RimWorld-LWM.DeepStorage
On Steam: https://steamcommunity.com/id/littlewhitemouse/myworkshopfiles/?appid=294100
In the Ludeon Forum: https://ludeon.com/forums/index.php?topic=47707.0

Most images used with permission from Skullywag. (Thanks!)
Weapons Cabinets and Lockers are sumghai's. (Also thanks!)
Meat Hooks are (c) LWM.

License
Almost all code (c) LWM.
Also (currently) includes some code from Ratysz, allowing right-click to select actions on items, which Sumghai had permission to use (also GPL).  Thanks!
Released under GPL 3.0.
All of LWM's code (and sumghai's additions) are also released under LGPL, because I think that the LGPL is the license we should actually be using for mods.  Not that anyone is likely to complain, but altho we have a stupid copyright system, we should still use it correctly.
All of LWM's code (and sumghai's) are also available to Ludeon Studios, should they be incorporated into the base RimWorld game.
Thanks to Marnador for the RimWorld font.  Thanks to Pardeike for Harmony.  Awesome.



Canute

Hi,
you know there is allready an very old mod named Deep storage out there.
https://ludeon.com/forums/index.php?topic=38010.msg389361#msg389361

Just one question, does the stuff inside the storage count toward the colony, or does ist get stored in a dimensional pocket ?

sumghai

This looks very promising!

I was originally working on something similar for storing multiple weapons in dedicated weapons lockers buildings, based on ratysz's RT Shelves mod. However, I haven't made much progress due to my general inexperience with C# coding, so I'm thinking of simply providing my art assets to whoever has a working implementation of storing multiple weapons.

I'll definitely give this a go, and let you know how it goes on my end.

LWM

Quote from: Canute on January 07, 2019, 06:08:03 AM
Hi,
you know there is allready an very old mod named Deep storage out there.
https://ludeon.com/forums/index.php?topic=38010.msg389361#msg389361
*sigh*  No, I had no idea.  TBH, there are only so many phrases that work with "____ Storage - a new way to do lots of storage!"  I've got the name ALL over the place in my code, too; not easy to change.  At least they have their mod called something else entirely.  I'll check if they care about the name.  Thank you.

QuoteJust one question, does the stuff inside the storage count toward the colony, or does ist get stored in a dimensional pocket ?
This is one aspect of the different approach I wanted: all the stuff should behave exactly the same as if it were on a vanilla shelf.  I convinced the engine it was okay to put more than one Thing down in a square, so everything is still very much in the same universe.

--LWM

LWM

Quote from: sumghai on January 07, 2019, 09:28:52 PM
This looks very promising!
Thank you!  ^.^

QuoteI was originally working on something similar for storing multiple weapons in dedicated weapons lockers buildings, based on ratysz's RT Shelves mod. However, I haven't made much progress due to my general inexperience with C# coding, so I'm thinking of simply providing my art assets to whoever has a working implementation of storing multiple weapons.
The coding got waaaay more complicated with 1.0, where the vanilla code specifically doesn't allow more than one thing in one place ><  If you want to plow thru, and have questions, ask away ^.^

If you want to use my engine without my specific items, feel free!  (hat tip, acknowledgement, etc is always good ;) )  The XML should be really easy to write.

A weapon rack was actually 2nd or 3rd on my list (after an armor rack...but not far after), but I am not a professional artist in any way.  I thought I might start with trying to draw a hat rack, figured that would be easy.  I would love sprites to use for a weapon rack (and thoughts about quantity to store, etc), and if you wanted to share, could have that code up very quickly!

--LWM

sumghai

I found some time last night to properly test Deep Storage.

The included 2x1 storage buildings seem to work as expected, fully utilizing both cells for stacking multiple items (instead of having one cell act as a placeholder staging area like in Extended Storage). I particularly liked the intuitiveness of defining the stack size limit for each cell per building type in XML.

I then created a custom definition for a 1x1 Weapons Locker using my own art assets, and was able to store up to 10 weapons:


<ThingDef ParentName="LWM_DeepStorage" >
<defName>LWM_WeaponsLockerLocker</defName>
<label>(LWM) Weapons Locker</label>
<description>(Experimental) A locker for storing multiple weapons. Items stored in this will not deteriorate, even if outside.</description>
<graphicData>
<texPath>Things/Building/Furniture/WeaponsLocker/weaponsLocker</texPath>
<graphicClass>Graphic_Multi</graphicClass>
<drawSize>(3,3)</drawSize>
</graphicData>
<castEdgeShadows>true</castEdgeShadows>
<size>(1,1)</size>
<statBases>
<MaxHitPoints>200</MaxHitPoints>
<WorkToBuild>600</WorkToBuild>
<Flammability>1.0</Flammability>
<Mass>8</Mass>
</statBases>
<stuffCategories>
<li>Metallic</li>
</stuffCategories>
<costStuffCount>50</costStuffCount>
<building>
<preventDeteriorationOnTop>true</preventDeteriorationOnTop>
<ignoreStoredThingsBeauty>true</ignoreStoredThingsBeauty>
<fixedStorageSettings>
<priority>Important</priority>
<filter>
<categories>
<li>Weapons</li>
</categories>
</filter>
</fixedStorageSettings>
<defaultStorageSettings>
<priority>Important</priority>
<filter>
<categories>
<li>Weapons</li>
</categories>
</filter>
</defaultStorageSettings>
</building>
<comps>
<li Class="LWM.DeepStorage.Properties" >
<maxNumberStacks>10</maxNumberStacks>
<timeStoringTakes>50</timeStoringTakes>
</li>
</comps>
<researchPrerequisites>
<li>ComplexFurniture</li>
<li>Machining</li>
</researchPrerequisites>
</ThingDef>


That being said, I noticed a few problems:

  • Having so many items stored in the same cell means it takes multiple clicks before the user can get to the storage building (in order to change its filter settings, for example)
  • If I select a pawn and then right-click on the stack of multiple weapons only the topmost or most recently stored item can be equipped/hauled

I do have some partial solutions/suggestions to these problems, as well as some enhancements/features specific to weapons storage. Would you like me to describe them here, or would you rather we continue this particular conversation via PM?

LWM

Quote from: sumghai on January 09, 2019, 03:09:23 PM
Having so many items stored in the same cell means it takes multiple clicks before the user can get to the storage building (in order to change its filter settings, for example)
Yeah, that was my 2nd listed planned sometime...

I had assumed I would be able to add a "Gizmo" check to "Thing" that would see if it's spawned and in storage and if so add the actual gizmo with a command to select the Deep Storage.  But now I'm not sure that's an easy harmony patch, as it's an IEnumerable.  I haven't looked too closely at that problem yet (as it's not strictly required for functionality, only for sanity).

If you have suggestions, I'm v happy to hear them, either here or PM!

QuoteIf I select a pawn and then right-click on the stack of multiple weapons only the topmost or most recently stored item can be equipped/hauled
That's the known issue: "Pawns cannot use many types of items."  FloatMapMenuMaker (or whatever it's called) is a huge function and handles each type of floating menu separately (they were probably added at various times).  So for "consume"ing food it loops thru each item on a square, but clothing, it stops after finding the first item.  Each strippable body (dead or alive) gets its own menu, but only the first weapon...  I only realized it happened recently, because my early testing was with food....and then a raid came and I was like "but there's an advanced helmet I want you to wear, I know there is!"

There are a lot of moving parts, and it will require a fair bit of attention to detail, but it's a relatively straightforward patch.  (If you can call any transpiler patch changing "if" blocks to "foreach" blocks straightforward.)  Maybe there's an easier approach, but I haven't looked at it yet.  Worst case scenario, fiddly careful work.

So the big stopping point there is time.

Anyway, in general, I am quite open to suggestions/thoughts/hopes, as long as you don't mind me saying "yeah, I already know about that" ;)

Given Ludeon Forums are not threaded discussions, anything particular for weapon racks might go in its own post ("[WIP] Weapon Racks for Deep Storage"?) or as PMs.  Or, I suppose, on the github page.  So many options.

Anyway, it's past bedtime here in EST, so zzzzzzzz...

--LWM

ps - FloatMenuMakerMap.cs is the file; the function is AddHumanlikeOrders.  Ugh, also items to be manually loaded into a caravan, carried from the map, etc.  But trading things are okay?  Fiddly and so many details :p

sumghai

Sounds good - just PMed you some details and textures.

LWM

Update:
  • To quickly select a Deep Storage Unit under a pile of things:  Select one of the items in the unit, and then right click!
  • Now using Ratysz' fix allowing right-clicking on a large pile of weapons/clothing to give menu options for each one.  (thanks, and GPL for the win).
  • Added preliminary Weapon Locker - subject to change!  But you can put some weapons away now, at least ;)  (working with Sumghai)

    This should make it a little easier to use.  If anyone runs into a problem with the right-click to jump to the Deep Storage Building selection, let me know!  It was a very sudden decision.

    --LWM

Sixdd

#9
So I'm having some issues and hoping they can be resolved. First, I really like the mod, Extended Storage has problems these days so a good replacement is sorely needed. The problem I seem to be having is that once the first item (or stack in the case of stackables) is in the storage tile it doesn't accept any more items. I have tried tweaking the max stack value in the xml but nothing seems to work. Worth noting is that I am using Stack XXL, could that be the problem? If more information is needed I'll be happy to provide it.

EDIT: After doing some more testing I've found that the issue seems to affect the pallet, skip, weapon locker, and clothing rack. In each test I placed the building with godmode on, set the storage to accept everything that it can store and watched as pawns deliver to the storage. In each test pawns deliver one stack of an item to each slot on the storage device (pallet, skip, weapon locker, clothing rack) and then refuse to stack additional items on the storage device. In one test, with the food basket I did notice that it does store multiple stacks, but specifically only one stack of each item and only two stacks per slot total. After seeing this I edited the xml to change the number of stacks it can store to 32 (just for testing) and it still held only 2 stacks per slot. I am almost positive that there is a mod interaction going on here as I did manage to get at least the weapon locker to store two weapons with only this mod active, but it still refused to hold more than two after editing the xml to store 8. At this point I'm at a loss as to what more I could do but if more information is needed, I'll provide it.

LWM

#10
Sixdd - if it's a mod interaction, it's almost certainly the NoStorageBlockers function that's being affected.

I just found out the ...RimWorld Search Agency (....RimWorld aaah, whatever it is that lets you search in all your storage zones...and has Hauling Hysteresis) interferes with my storage mod.  I think I can use someone else's compatibility fix (RT has some excellent code that does things I didn't see Harmony could do), so I should have that out shortly.  But a list of mods you're using would be super helpful - especially anything involving storage zones or carrying.

--LWM

Sixdd

Ok, here is my modlist. And yeah I have Rimworld Search Agency so that is most likely the culprit.

Linky

LWM

Definitely the culprit.  That fix will probably be the next thing that happens, so soon, I hope, cold allowing.

--LWM

Sixdd

Sounds good, I'll be waiting patiently :)

LWM

Okay.  Should be compatble with RimWorld Search Agency - load AFTER RSA, please.  (not perfect compatibility, but hauling hysteresis is disabled for DSUs, so at least it all works!)  Future updates possible!  Thanks for patience ^.^

Also, now have a "Contents" tab for Deep Storage Units, courtesy of sumghai - expect a little more information to show up as more features mature.

Also, Meat Hooks have been added.  I think that's all that got uploaded today.

Any problems, let me know!

--LWM