================================================================
  Plant Trees on Any Terrain  -  v1.2.0
  by Piccinator
================================================================


----------------------------------------------------------------
  ENGLISH
----------------------------------------------------------------

WHAT IT DOES
    1) Trees can be planted on ANY ground - rock, gravel, sand
       and everything else - instead of only on fertile soil.
       Works for manual planting and for the Forestry Tower.

    2) You decide how densely trees are placed, from 1 to 15
       tiles. At 1 they stand on neighbouring tiles with
       overlapping crowns.

WHAT IT DOES NOT DO
    Collision handling stays fully intact. Tiles occupied by a
    building, conveyor, pipe or ramp still reject trees, and two
    trees can never share the same tile.

IN-GAME SETTINGS
    A tree button sits in the top right of the HUD, next to the
    date. It opens a small window:

    Plant on any terrain          [on]
        The terrain feature. Turn it off for vanilla behaviour
        without uninstalling the mod.

    Use custom tree spacing       [off]
        While off, the game's normal spacing applies.

    Minimum spacing               [3]
        Slider, 1 to 15 tiles.

    The same options also appear in the game's own mod settings
    (mod list -> this mod). Changes apply immediately.

TIP
    The spacing takes effect when you hold the mouse button and
    drag. While dragging you can still fine-tune with the mouse
    wheel - the mod only sets the starting value, and the next
    drag starts from your slider setting again.

HOW IT WORKS
    Three Harmony patches:

    Mafi.Core.Terrain.Trees.TreesManager
        postfix IsGroundFertileAtPosition   -> terrain check off
        prefix  HasEnoughSpacingToOtherTrees-> own distance check

    StaticEntityMassPlacer+DragPlacementHelper
        postfix startDrag                   -> drag step

    The planting check in the game runs as three steps:
        1. IsBlockedOrOccupied         building / occupied tile
        2. IsGroundFertileAtPosition   terrain          <- patched
        3. HasEnoughSpacingToOtherTrees spacing         <- patched
    Step 1 is never touched, which is why building collision keeps
    working.

    Note on step 3: the game normally answers this from a
    precomputed distance field that only stores distances below
    TreeProto.MAX_TREE_SPACING (4). Larger values could not work
    at all, and small values behaved unpredictably, so the mod
    replaces the check with its own lookup against the actual
    trees.

INSTALLATION
    Place this folder - manifest.json, config.json, 0Harmony.dll
    and AllTerrainTreePlanting.dll - into:

        %APPDATA%\Captain of Industry\Mods\AllTerrainTreePlanting\

    Then enable modding under Settings -> Misc -> Modding and tick
    the mod when starting or loading a save.

SAVES
    Can be added to and removed from existing saves at any time.

COMPATIBILITY
    Built and tested against game version 0.8.6c.
    Bundles Harmony 2.4.2.
    Log file: %APPDATA%\Captain of Industry\Logs

    The HUD button reads a private field of HudController through
    reflection - there is no official API for it. If a game update
    renames that field the button disappears; everything else,
    including the settings in the built-in mod menu, keeps working.

CHANGELOG
    1.2.0  Spacing now works for click-and-drag placement, freely
           adjustable from 1 to 15 tiles. Added a HUD button with
           its own settings window and a slider.
    1.1.0  Added settings: toggle for the terrain feature plus
           optional custom tree spacing.
    1.0.0  Initial release.


----------------------------------------------------------------
  DEUTSCH
----------------------------------------------------------------

WAS DIE MOD MACHT
    1) Baeume koennen auf JEDEM Untergrund gepflanzt werden -
       Fels, Kies, Sand und alles andere - statt nur auf
       fruchtbarer Erde. Gilt fuer manuelles Setzen und fuer den
       Forstturm.

    2) Du bestimmst, wie dicht gepflanzt wird, von 1 bis 15
       Kacheln. Bei 1 stehen die Baeume auf Nachbarkacheln und
       die Kronen ueberlappen.

WAS DIE MOD NICHT MACHT
    Die Kollisionspruefung bleibt vollstaendig erhalten. Auf
    Kacheln mit Gebaeude, Foerderband, Rohr oder Rampe waechst
    weiterhin kein Baum, und zwei Baeume auf derselben Kachel
    gibt es nicht.

EINSTELLUNGEN IM SPIEL
    Oben rechts im HUD, neben dem Datum, sitzt ein Baum-Symbol.
    Es oeffnet ein kleines Fenster:

    Plant on any terrain          [an]
        Das Terrain-Feature. Abschalten stellt das normale
        Spielverhalten wieder her, ohne die Mod zu entfernen.

    Use custom tree spacing       [aus]
        Solange aus, gilt der normale Abstand des Spiels.

    Minimum spacing               [3]
        Schieberegler, 1 bis 15 Kacheln.

    Dieselben Optionen stehen auch im eingebauten Mod-Menue
    (Mod-Liste -> diese Mod). Aenderungen wirken sofort.

TIPP
    Der Abstand wirkt beim Ziehen mit gedrueckter Maustaste.
    Waehrend des Ziehens kannst du mit dem Mausrad weiter
    nachjustieren - die Mod setzt nur den Startwert, beim
    naechsten Ziehen gilt wieder dein Regler.

WIE ES FUNKTIONIERT
    Drei Harmony-Patches:

    Mafi.Core.Terrain.Trees.TreesManager
        Postfix IsGroundFertileAtPosition    -> Bodenpruefung aus
        Prefix  HasEnoughSpacingToOtherTrees -> eigene Pruefung

    StaticEntityMassPlacer+DragPlacementHelper
        Postfix startDrag                    -> Schrittweite

    Die Pflanzpruefung laeuft im Spiel in drei Schritten:
        1. IsBlockedOrOccupied          Gebaeude / belegte Kachel
        2. IsGroundFertileAtPosition    Terrain        <- gepatcht
        3. HasEnoughSpacingToOtherTrees Abstand        <- gepatcht
    Schritt 1 wird nie angefasst, deshalb funktioniert die
    Gebaeudekollision unveraendert.

    Anmerkung zu Schritt 3: Das Spiel beantwortet ihn normalerweise
    aus einem vorberechneten Abstandsfeld, das nur Abstaende
    unterhalb von TreeProto.MAX_TREE_SPACING (4) speichert.
    Groessere Werte konnten dadurch gar nicht wirken, kleine
    verhielten sich unvorhersehbar. Die Mod ersetzt die Pruefung
    deshalb durch eine eigene Abfrage der tatsaechlichen Baeume.

INSTALLATION
    Diesen Ordner - manifest.json, config.json, 0Harmony.dll und
    AllTerrainTreePlanting.dll - ablegen unter:

        %APPDATA%\Captain of Industry\Mods\AllTerrainTreePlanting\

    Danach im Spiel unter Einstellungen -> Sonstiges -> Modding das
    Modding aktivieren und die Mod beim Laden anhaken.

SPIELSTAENDE
    Laesst sich jederzeit hinzufuegen und wieder entfernen.

KOMPATIBILITAET
    Gebaut und getestet gegen Spielversion 0.8.6c.
    Enthaelt Harmony 2.4.2.
    Log-Datei: %APPDATA%\Captain of Industry\Logs

    Der HUD-Button liest per Reflection ein privates Feld des
    HudController aus - eine offizielle Schnittstelle dafuer gibt
    es nicht. Benennt ein Spiel-Update dieses Feld um, verschwindet
    der Button; alles andere funktioniert weiter, die Einstellungen
    bleiben ueber das eingebaute Mod-Menue erreichbar.

CHANGELOG
    1.2.0  Abstand wirkt jetzt beim Ziehen mit der Maus und ist
           frei von 1 bis 15 Kacheln einstellbar. HUD-Button mit
           eigenem Einstellungsfenster und Schieberegler ergaenzt.
    1.1.0  Einstellungen ergaenzt: Schalter fuer das
           Terrain-Feature sowie optionaler eigener Baumabstand.
    1.0.0  Erstveroeffentlichung.
