CICADAFORGE v1.3
Custom level editor for CICADAMATA", and a browser for levels, skins and mods other players
shared. Runs as a GDPatch mod, the same way as
POTATOMATA v2: nothing in the game's files is changed, and deleting the mod folder restores vanilla.

What it does
------------
  * Adds LEVEL EDITOR and FORGE BROWSER to the main menu's EXTRA screen (EXTRA shows up
    once the campaign is finished, as in the normal game).
  * A 3D editor inside the game: block out levels with boxes, ramps and cylinders using the
    game's own wall textures, then place the game's real objects:
      LEVEL     ship / spawn, core, exit, heal, star power
      THREATS   crab, shooter, bouncer, bird, flower, spider, esper
      ELEMENTS  spring, ring, moving platform, glass, fan
      HAZARDS   spikes, lava, water, fizzer
  * TEST PLAY (F5) drops you into the level with the full game: HUD, scoring, grades,
    death and restart, level complete screen. F9 goes back to the editor.
  * Pick the sky/lighting, weather theme, music and score grades per level.
  * The exit opens once every core in the level is collected (any number, 0 = always open).
  * Personal bests per custom level (reset automatically when you edit the level).
  * FORGE BROWSER > LEVELS: play levels other players shared on the CICADAFORGE server
    (https://ccda.ottergirl.dev). Browse or search approved levels, open one by its
    6-character code, see a top-down map, PLAY it or SAVE A COPY into your own levels.
    MY LEVELS shows what you published and whether it was approved.
  * PUBLISH in the editor uploads your level for review (you sign in with Steam; your Steam
    name is shown as the author). Levels only appear in the browser after a moderator
    approves them.

  * FORGE BROWSER > SKINS: skins for the SKIN KIT mod. INSTALL builds the skin from your own
    game's models, WEAR IT puts it on. MY SKINS > SHARE uploads one you made in the SKIN
    STUDIO for review. Needs SKIN KIT.
  * FORGE BROWSER > MODS: GDPatch mods other players shared, after a moderator has read
    their code. INSTALL puts one in GDPatch\mods (it loads the next time you start the game),
    UPDATE gets a newer version, REMOVE deletes it again. MY MODS > SHARE uploads one of
    yours for review.

Sharing skins
-------------
  A shared skin is a SKIN STUDIO recipe (colours, shape values, decal positions) plus your own
  files: paint layers, decal images, models and textures you brought, and the preview. The
  game's own models and textures are never uploaded. Everyone who installs a skin rebuilds it
  from their own copy of the game, the same way the studio builds it. Only skins with a
  recipe.json (made in the studio) can be shared. Max 16 MB, which in practice only own
  models can reach.

Sharing mods
------------
  Mods are programs. A mod runs inside the game with the same access to your computer as the
  game itself, so the browser always asks before installing one. On the server's side:
    * every upload waits for a moderator, who reads every file (with a list of calls that
      reach outside the game: running programs, network, files, Steam) before approving;
    * only text sources and plain media files can be uploaded, nothing compiled;
    * everything except gdpatch_mod.toml, patcher.lua and a readme has to be in
      data/gdpatch/mods/<id>/, so a mod can't replace game files or another mod's files;
    * the first approved uploader of an id owns it; only they can publish new versions.
  The game checks the download against the sha256 the moderator approved and repeats the file
  checks before writing anything. Mods installed from the browser are listed in
  %APPDATA%\CICADAMATA\levels\forge_mods.cfg; mods you put in by hand are never touched.
  To publish an update, raise [meta] version in gdpatch_mod.toml first.

Level safety
------------
  Levels are plain data, never code. Every level the game loads, from your folder or from the
  server, is rebuilt from scratch by a strict checker before anything is built from it:
  only known object types, textures, skies and music are accepted; every number has to be
  finite and in range; text loses control characters and markup; unknown fields are thrown
  away. The game never loads a file path that came from a level. The server runs the same
  checks on every upload, and a moderator approves each level before it goes public.

Custom levels never write to your save, Steam stats, achievements or leaderboards.

Requirements
------------
  * CICADAMATA" on Windows with GDPatch 0.2.3 or newer installed (see the POTATOMATA README,
    steps 1 and 2: winmm.dll next to CICADAMATA.exe).

Install
-------
  Copy the GDPatch folder from this package into the game folder:

    CICADAMATA\
      CICADAMATA.exe
      winmm.dll
      GDPatch\
        mods\
          cicadaforge\
            gdpatch_mod.toml
            patcher.lua
            data\...

  It works next to POTATOMATA (both folders under GDPatch\mods).

Controls
--------
  Hold RIGHT MOUSE + move     look          Hold RIGHT MOUSE + WASD / Q E   fly (SHIFT faster)
  Mouse wheel                 move forward / back (while flying: fly speed)
  Click a palette item, then LEFT CLICK to place it (SHIFT+CLICK keeps placing)
  LEFT CLICK select, LEFT DRAG move, SHIFT+DRAG move up/down, CTRL+DRAG copy
  R rotate 90 (SHIFT+R 15)    ARROWS / PGUP PGDN nudge    ALT+ARROWS / ALT+PGUP PGDN resize brush
  CTRL+D duplicate   DEL delete   G snap   [ ] grid size   , . work plane height   F focus
  CTRL+Z undo   CTRL+Y redo   CTRL+S save   CTRL+O open   CTRL+N new   F5 test   F1 help
  Exact values (position, rotation, size, texture, enemy options, launch force,
  moving platform travel...) are in the panel on the right.

Level rules
-----------
  * Exactly one SHIP / SPAWN. The player starts inside it and drops out, like the campaign.
    The green capsule in the editor shows where the player appears.
  * Falling below the red plane (Y = -30) kills the player.

Files
-----
  Levels:  %APPDATA%\CICADAMATA\levels\<name>.json   (share them by sending the .json)
  Scores:  %APPDATA%\CICADAMATA\levels\scores.cfg
  A SAMPLE COURSE level is created the first time if the folder is empty.

Level format (for hand editing or tools)
-----------------------------------------
  {
    "format": 1, "name": "MY LEVEL", "author": "me",
    "theme": 1,                  world 1-6: weather, intro music, level icon
    "env": "env_world_1",        sky + light: env_world_1..6, env_rain, env_cathedral, env_world_end
    "music": "World1_Main",      World1..6_Main, World6_Alt, Bonus_Main, Bonus2..4_Main, LevelRush_Main
    "grades": [5000, 8000, 12000, 15000],     silver, gold, diamond, CCDA
    "objects": [
      {"t": "box", "p": [0, -0.5, 0], "r": [0, 0, 0], "s": [32, 1, 32],
       "mat": "grey_8", "tile": 4.0, "solid": true},           t: box, ramp, cylinder
      {"t": "crab", "p": [4, 0.5, 10], "r": [0, 180, 0], "props": {"_static": true}},
      {"t": "moving_platform", "p": [0, 4, 20], "r": [0, 0, 0], "props": {"travel": [0, 0, 12]}},
      {"t": "lava", "p": [0, 0, 30], "r": [0, 0, 0], "sc": [8, 1, 8]}
    ]
  }
  p = position, r = rotation in degrees, s = brush size, sc = scale (lava, water, fan, fizzer).
  "mat" is any texture name from the game's FuncGodot/textures folder.

Troubleshooting
---------------
  * No LEVEL EDITOR button: check GDPatch\output.log for "Mods loaded!" and lines starting
    with [cicadaforge]. Every patch logs "patched" or "skipped".
  * If a game update changes the code a patch relies on, that patch is skipped and logged;
    the editor still works, but e.g. the exit may need 4 cores again.

Uninstall
---------
  Delete GDPatch\mods\cicadaforge. Your levels stay in %APPDATA%\CICADAMATA\levels, skins in
  %APPDATA%\CICADAMATA\skinkit\skins, and mods installed from the browser in GDPatch\mods.
