You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-10Lines changed: 20 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,23 @@
1
1
# Integrate
2
2
3
-
A library for mod loading into serialisable registries.
3
+
A library for mod loading into serialisable registries.
4
+
Can be used in conjunction with [ISL](https://github.com/LightningLaser8/ISL) to perform complex operations.
4
5
5
6
## Terminology
6
7
7
8
- A _registry_ is a data structure for holding case-insensitive key-value pairs. Simply, it matches names to objects, without caring about capitalisation. They are instances of `Integrate.Registry`.
8
-
-*Registry name*s are string locations of an item in a _registry_.
9
-
-*Constructible object*s are basic objects with a `type` property, holding a _registry name_ of a class.
10
-
-_Content_ refers to any constructible object with a registry name, defined by the mod. Any content is an instance of `Integrate.Content`.
9
+
-*Registry name*s or *Registry location*s are strings which are keys in a _registry_. They can be used to refer to a _constructible object_.
10
+
-*Constructible object*s are basic, serialisable objects with a `type` property, holding a _registry name_ of a class.
11
+
-_Content_ refers to any _constructible object_ with a _registry name_, defined by the _mod_. Any content is an instance of `Integrate.Content`.
11
12
- A _mod_ is a directory of files, each one adding _content_.
12
13
- A _content file_ is a JSON file holding a _constructible object_.
13
14
15
+
### ISL
16
+
17
+
-_ISL_, or _Integrate Scripting Language_ is an external interpreted scripting language for use with this modloader, to create complex events.
18
+
- A _script_ is a `.isl` file to be executed when an _event_ is fired.
19
+
- An _event_ is a signal from the game that Integrate needs to run some scripts. Every script needs to define which events they fire on.
20
+
14
21
## Example (JS)
15
22
16
23
_Adding Integrate mods to your project_
@@ -91,11 +98,13 @@ This is the most important file in any Integrate mod, defining paths and registr
91
98
It consists of a _single array_, each entry being an object with these three properties:
92
99
`path` defining the _relative location_ of the _content file_ being described.
93
100
`name` being the _registry name_ of this content.
94
-
`registry` being optional, defining the registry this content will be added to. By default, this will be `"content"`. **This registry does not exist by default, and will throw errors if not defined.**
101
+
`registry` being optional, defining the registry this content will be added to. By default, this will be `"content"`. **This registry does not exist by default, and will throw errors if not defined using `Integrate.addModdableRegistry()`.**
95
102
96
103
### Content Files
97
104
98
105
These describe the actual content itself, not metadata.
106
+
They can be anywhere, even outside the mod directory, as long as `definitions.json` points to them, and the program can reach them.
107
+
This is to leave organisation up to the mod developer, so you can organise the files hovever you like.
99
108
100
109
```json
101
110
{
@@ -112,6 +121,7 @@ These describe the actual content itself, not metadata.
112
121
## Interface
113
122
114
123
Integrate has several functions to customise modloading, which are documented here.
124
+
This section assumes you imported Integrate in a single namespace, called `Integrate`.
115
125
116
126
### Integrate.add()
117
127
@@ -142,7 +152,7 @@ Returns an `Integrate.Mod` object, holding all the info about the imported mod.
`Integrate.construct()` is a helpful function that combines `Integrate.Registry.create()` and `Integrate.Registry.construct` for mod content.
185
+
`Integrate.construct()` is a helpful function that combines `Integrate.Registry.create()` and `Integrate.Registry.construct()` for mod content. It constructs an object either literally or from any moddable registry, using types from `Integrate.types`.
`create()` Constructs an item from registry. Note that this only works with objects. The parameter `registry` should be the registry holding all types, such as `Integrate.types`.
251
-
`construct()` Constructs an item using a type from registry. Note that this only works with object entries.
260
+
`create()` Constructs an item from this registry. Note that this only works with object entries. The parameter `registry` should be the registry holding all types, such as `Integrate.types`.
261
+
`construct()` Constructs an item using a type from this registry. Note that this only works with object parameters.
252
262
`rename()` Renames a registry item. Neither parameter is case-sensitive.
253
263
`alias()` Adds another registry item with the same content as the specified one.
254
264
`forEach()` Executes a function for each element in the registry.
ISL is a scripting language designed for use with this loader, allowing mods to script complex events in addition to simple content.
5
+
This can be disabled by game devs, so check the project's Integrate documentation for this information.
6
+
7
+
There are no standard keywords in Integrate, as they are all added by the developer. Because of this, it is recommended to fully read through their extension documentation before making an ISL mod for their project.
8
+
9
+
This documentation from this point assumes you know about ISL, and have familiarised yourself with its basic features. If not, go read the [ISL wiki](https://github.com/LightningLaser8/ISL/wiki).
10
+
11
+
### Creating Scripts
12
+
Scripts are a bit different to normal mod content. They don't have a `type`, and are defined in `.isl` files, instead of `.json`.
13
+
14
+
A script file is essentially a normal ISL program, with some extra properties, defined in metatags.
15
+
16
+
An example script file (`script.isl`):
17
+
```isl
18
+
[onevent mod-load] // When the mod loads
19
+
[with loadstate, contentnamelist] // Using some properties from the event
0 commit comments