diff --git a/docs/scarpet/Full.md b/docs/scarpet/Full.md index b1ea600a..64aec780 100644 --- a/docs/scarpet/Full.md +++ b/docs/scarpet/Full.md @@ -1464,6 +1464,10 @@ but if symbols are used directly in the module body rather than functions, it ma Returns full list of available symbols that could be imported from this module, which can be used to debug import issues, and list contents of libraries. +You can load and import functions from dependencies in a remote app store's source specified in your config's `libraries` block, but make sure +to place your config _before_ the import in order to allow the remote dependency to be downloaded (currently, app resources are only downloaded +when using the `/carpet download` command). + ### `call(function, ? args ...)` calls a user defined function with specified arguments. It is equivalent to calling `function(args...)` directly @@ -2019,30 +2023,46 @@ in a list and contain of map-like resources descriptors, looking like 'resources' -> [ { 'source' -> 'https://raw.githubusercontent.com/gnembon/fabric-carpet/master/src/main/resources/assets/carpet/icon.png', - 'type' -> 'url', 'target' -> 'foo/photos.zip/foo/cm.png', }, { - 'source' -> 'survival/README.md', - 'type' -> 'store', + 'source' -> '/survival/README.md', 'target' -> 'survival_readme.md', 'shared' -> true, }, { - 'source' -> 'carpets.sc', - 'type' -> 'app', - 'target' -> 'apps/flying_carpets.sc', - 'shared' -> true, + 'source' -> 'circle.sc', // Relative path + 'target' -> 'apps/circle.sc', // This won't install the app, use 'libraries' for that }, ] ``` - `source` and `type` indicate resource location: either an arbitrary url (type `'url'`), - absolute location of a file in the app store (type `'store'`), -or a relative location in the same folder as the app in question (type `'app'`). -`'target'` points to the path in app data, or shared app data folder + `source` indicates resource location: either an arbitrary url (starting with `http://` or `https://`), + absolute location of a file in the app store (starting with a slash `/`), +or a relative location in the same folder as the app in question (the relative location directly). +`'target'` points to the path in app data, or shared app data folder. If not specified it will place the app into the main data folder with the name it has. if `'shared'` is specified and `true`. When re-downloading the app, all resources will be re-downloaded as well. -Currently, app resources -are only downloaded when using `/carpet download` command. +Currently, app resources are only downloaded when using `/carpet download` command. +* `libraries` - list of libraries or apps to be downloaded when installing the app from the app store. It needs to be a list of map-like resource +descriptors, like the above `resources` field. + ``` + 'libraries' -> [ + { + 'source' -> '/tutorial/carpets.sc' + }, + { + 'source' -> '/fundamentals/heap.sc', + 'target' -> 'heap-lib.sc' + } + ] + ``` + `source` indicates resource location and must point to a scarpet app or library. It can be either an arbitrary url (starting with `http://` + or `https://`), absolute location of a file in the app store (starting with a slash `/`), or a relative location in the same folder as the app + in question (the relative location directly). + `target` is an optional field indicating the new name of the app. If not specified it will place the app into the main data folder with the name it has. +If the app has relative resources dependencies, Carpet will use the app's path for relatives if the app was loaded from the same app store, or none if the +app was loaded from an external url. +If you need to `import()` from dependencies indicated in this block, make sure to have the `__config()` map before any import that references your +remote dependencies, in order to allow them to be downloaded and initialized before the import is executed. * `'arguments'` - defines custom argument types for legacy commands with `'legacy_command_type_support'` as well as for the custom commands defined with `'commands'`, see below. * `'commands'` - defines custom commands for the app to be executed with `/` command, see below. @@ -2223,6 +2243,7 @@ Here is a list of built-in types, with their return value formats, as well as a * `'dimension'`: string representing a valid dimension in the world. * `'anchor'`: string of `feet` or `eyes`. * `'entitytype'`: string representing a type of entity + * `'entities'`: entity selector, returns a list of entities directly. Can be configured with `'single'` to only accept a single entity (will return the entity instead of a singleton) and with `'players'` to only accept players. * `'floatrange'`: pair of two numbers where one is smaller than the other * `'players'`: returning a list of valid player name string, logged in or not. If configured with `'single'` returns only one player or `null`. * `'intrange'`: same as `'floatrange'`, but requiring integers.