Stackable Pallet Object Storage Extension
==========================================

This mod lets pallets stack on top of each other inside an object storage instead of only sitting
side by side.

It works everywhere automatically. As soon as the mod is installed, every object storage can stack pallets.

Which base-game pallets are allowed to stack (and at which height) is defined in the curated list that
ships with the mod, located in "config/stackablePallets.xml". 
Pallets that would not stack believably (barrels, big rolls, saplings, wool, ...) are excluded from stacking.

Note: Pallets only appear stacked inside the storage. When you unload them they drop side by side on the
ground like normal, which keeps them from glitching.


For modders
-----------

Three sources decide whether a pallet stacks, resolved in the following priority order:

    1. A storage's own <stackablePallets> list                (highest priority)
    2. A "stackingHeight" attribute on the pallet's own XML
    3. The global list in config/stackablePallets.xml         (lowest priority)

1. Make your own (modded) pallet stackable
   Add a "stackingHeight" attribute to <pallet> in the pallet's own vehicle XML. It will then stack in any
   object storage:

       <vehicle type="pallet" ... >
           <pallet linkNode="..." stackingHeight="1.15" stackMixedFillLevels="true">
               ...
           </pallet>
       </vehicle>

2. Control pallet stacking settings for one specific object storage (takes priority over the global list):

       <objectStorage supportsPallets="true" ... >
           <stackablePallets>
               <pallet filename="myCustomPallet.xml" stackingHeight="1.1" stackMixedFillLevels="true"/>
           </stackablePallets>
       </objectStorage>

3. Opt a storage out of stacking completely ("stackPallets" defaults to "true"):

       <objectStorage supportsPallets="true" stackPallets="false" ... >

4. Limit stacking per storage area (no new attribute needed)
   How many pallets fit on top of each other is bounded by each storage area's existing "maxHeight"
   attribute. To prevent stacking in one specific area, set its "maxHeight" to about one pallet height:

       <storageAreas>
           <storageArea startNode="..." endNode="..." maxHeight="1.2"/>   <!-- ~1 layer: no stacking -->
           <storageArea startNode="..." endNode="..." maxHeight="3.5"/>   <!-- stacks normally -->
       </storageAreas>

5. Rotate pallets by 90 degrees in an object storage
   By default pallets sit packed along their short side (the base-game layout). Set "rotatePallets="true""
   on the object storage to rotate every pallet by 90 deg so it sits along its long side instead.

       <objectStorage supportsPallets="true" rotatePallets="true" ... >

   "rotatePallets" defaults to "false". It applies to every pallet in that storage (stackable or not) and is
   independent of stackPallets, so you can
   - rotate without stacking,
   - stack without rotating,
   - or do both.

   Note: Rotating the pallets changes how the pallets pack in the object storage, so your max item count
   may change.

   Tip: if you rely on options 2, 3 or 5, add this mod as a dependency in your modDesc.xml so it is
   guaranteed to be loaded in the correct order:

       <dependencies>
           <dependency>FS25_stackablePalletObjectStorageExtension</dependency>
       </dependencies>


Attribute reference
-------------------

<pallet> (pallet XML) and <stackablePallets><pallet> (storage XML):
- stackingHeight       Height of one pallet in metres, used for vertical spacing. Recommended: without
                       it the game uses the pallet's bounding box, which is usually too tall and makes
                       stacks look like they float.
- stackMixedFillLevels Optional, default true. When true, pallets of the same type but different fill
                       levels share one visual stack (previewed at the highest fill level). The unload
                       menu still lists each fill level separately and returns correctly filled pallets.
                       Set false to keep the base-game look where each fill level forms its own stack.

   These two attributes go on the <pallet> element - either in a pallet's own vehicle XML, or on a
   <pallet> row inside a storage's <stackablePallets> list:

       (a) in the pallet's OWN vehicle XML, on the existing <pallet> element:
           <vehicle type="pallet" ... >
               <pallet linkNode="palletNode" stackingHeight="1.15" stackMixedFillLevels="true">
                   ...
               </pallet>
           </vehicle>

       (b) in a storage's <stackablePallets> list (see filename below):
           <objectStorage>
               <stackablePallets>
                   <pallet filename="myCustomPallet.xml" stackingHeight="1.15" stackMixedFillLevels="true"/>
               </stackablePallets>
           </objectStorage>

<stackablePallets><pallet> only:
- filename             The end of a pallet's config file name (e.g. fillablePallet.xml). Any stored
                       pallet whose config path ends with this string matches (base-game or modded). The
                       multiPurchase* store variants are matched automatically by their base name.

       <objectStorage supportsPallets="true" ... >
           <stackablePallets>
               <pallet filename="fillablePallet.xml" stackingHeight="0.78"/>
           </stackablePallets>
       </objectStorage>

<objectStorage>:
- stackPallets         Optional, default true. false disables stacking for that storage.
- rotatePallets        Optional, default false. true places every pallet in that storage rotated 90 deg
                       (along its long side) instead of the base-game short-side orientation. Independent
                       of stackPallets.

   Both are attributes of the <objectStorage> element itself:

       <objectStorage supportsPallets="true" stackPallets="false" rotatePallets="true" ... >
           ...
       </objectStorage>
