From 51fb6e450231379f062683b0e26444c29ea53743 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Wed, 7 Sep 2022 21:23:44 +0900 Subject: [PATCH] Updated modules --- Home.mediawiki | 2 +- Modules.md | 6 ++-- Modules:Setup.md | 89 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+), 4 deletions(-) diff --git a/Home.mediawiki b/Home.mediawiki index a95a822..3f205e8 100644 --- a/Home.mediawiki +++ b/Home.mediawiki @@ -1,4 +1,4 @@ == Welcome to Terrarum Wiki portal! == * [[Developer Portal|Developer's Den]] -* [[Player Portal|Player Page]] \ No newline at end of file +* [[Player Portal|Player Portal]] diff --git a/Modules.md b/Modules.md index 9d689ff..b1c0ad8 100644 --- a/Modules.md +++ b/Modules.md @@ -17,7 +17,7 @@ Modules' default config must be found under `/default.json`. Any co The user config will have a key with `:` prepended: for example, if the module `basegame` contains config key `gameplay_max_crafting`, the user-modified config will be named as `basegame:gameplay_max_crafting` on the `/config.json`. -## Loading Modules +## Managing Modules * [[Module Organisation|Modules:Load Order]], aka Load Order * [[The Entry Point|Modules:How to Get Started]] @@ -30,10 +30,10 @@ The user config will have a key with `:` prepended: for example, if * [[Hottest Editor of '20: CRISPR|Modules:New Actors]] * [[Texture Packs|Modules:Retextures]] -## Dirty Jobs +## Dirty Deeds * [[Items in-depth|Development:Items]] * [[Actors in-depth|Development:Actors|]] -## Other Documentations +## Recondite References * [[Creature RAW|Development:RAW]] * [[Faction|Development:Faction]] diff --git a/Modules:Setup.md b/Modules:Setup.md index 0c23b4a..fdb048d 100644 --- a/Modules:Setup.md +++ b/Modules:Setup.md @@ -1,10 +1,99 @@ ## Metadata +Every modules must be able to introduce themselves through the `metadata.properties` file. + +The metadata file is a standard-issue Java properties file with some required keys. ### metadata.properties +A metadata must have following keys: + +- **propername** — the displayed name of the module +- **description** — a short text describing the module +- **author** — the author of the module +- **package** — the root package of the module +- **entrypoint** — the fully-qualified class name of the Entry Point (see Contents § Entry Point) +- **version** — the version of the module. The version format must strictly follow the [Semver 2.0.0](https://semver.org/) scheme +- **releasedate** — the release date of the module of the version. The date format must be `YYYY-MM-DD` +- **jar** — the name of the Jar file the module's codes are contained. If there is none, leave it as a blank +- **jarhash** — the Sha256sum of the Jar file. If there is no Jar file, leave it as a blank +- **dependency** — list the other modules that this module requires. + +### Dependency Format + +The dependency string has following syntax: +- `module_name version` +- `module1 version;module2 version` +- `module1 version;module2 version;module3 version; ...` + +The version string has following syntax: +- `a.b.c` — the exact version a.b.c +- `a.b.c+` — Any version between a.b.c and a.b.65535 +- `a.b.*` — Any version between a.b.0 and a.b.65535 +- `a.b+` — Any version between a.b.0 and a.255.65535 +- `a.*` — Any version between a.0.0 and a.255.65535 +- `*` — Any version. Period. + +For example, if your module requires `basegame` 0.3 or higher, the dependency string will be `basegame 0.3+`. ### icon.png +A module can have an icon about themselves. The image must be sized 48x48 and in 32-bit colour PNG format. ### Jar File +A module may have one Jar file. Two or more Jars are not allowed: if your module requires external libraries, package them as a Fatjar. ## Contents +Except for the [[retextures|Modules:Retextures]], there are *technically* no strict directory structure required, certain ingame elements loaded by the engine expects certain paths. +### Entry Point +If your module has a Jar file, it must have single class that extends `net.torvald.terrarum.ModuleEntryPoint`: such class is called a Entry Point. The Entry Point initialises and installs your module to the game. What the Entry Point does to load your module depends upto you, but the engine provides the Modmgr for installing ingame elements to the game. + +### The Modmgr + +The Modmgr provides function to load following ingame elements: +- ModMgr.**GameBlockLoader** — loads the blocks and wires +- ModMgr.**GameItemLoader** — loads the items +- ModMgr.**GameMaterialLoader** — loads the materials that accompany with the blocks and items +- ModMgr.**GameLanguageLoader** — loads the text translations +- ModMgr.**GameRetextureLoader** — loads the retextures +- ModMgr.**GameCraftingRecipeLoader** — loads the crafting recipes + +#### GameBlockLoader + +The GameBlockLoader looks for the `/blocks/blocks.csv` for the list of blocks and the `/wires/wires.csv` for the list of wires. + +Every block within a module gets a unique number as an ID. A texture of the block must be named as the ID, with the extension of `.tga`. + +TODO describe the csv + +##### Block Texture Format + +Autotiling and TODO + +#### GameItemLoader + +The GameBlockLoader looks for the `/items/itemid.csv` for the list of items. + +TODO describe the csv but not the GameItem + +#### GameMaterialLoader + +The GameMaterialLoader looks for the `/materials/materials.csv` for the list of materials. + +TODO + +#### GameLanguageLoader + +The GameMaterialLoader looks for the `/locales/` for the translations. + +TODP + +#### GameRetextureLoader + +The GameRetextureLoader looks for the `/retextures/` for the retextures. + +For the retexture file formats, please refer to the [[Modules:Retextures]] + +#### GameCraftingRecipeLoader + +The GameCraftingRecipeLoader looks for the `/crafting/*.json` for the crafting recipes. + +TODQ