Updated references and added LICENSE.

This commit is contained in:
Keanu Timmermans 2021-03-05 17:25:16 +01:00
parent 0e9d900311
commit e0c8a39d67
Signed by: keanucode
GPG key ID: A7431C0D513CA93B
3 changed files with 71 additions and 28 deletions

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 NovaGM Members
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -2,7 +2,7 @@
User-made documentation for [GooseMod](https://goosemod.com).
[View the documentation](https://keanugoosemod.github.io/Documentation).
[View the documentation](https://novagm.github.io/Documentation).
## Adding content
@ -15,32 +15,38 @@ To add a page, add a MarkDown `.md` file to one of the categories
You can also add your own category by adding a directory with a `README.md`
file inside, that describes what your category is about and lists the
category's files by adding this line:
```
{% include list.liquid all=true %}
```
By default Jekyll will pull the first title as the page's title, but that can
be overwritten with front matter at the top of your page:
```yaml
---
title: Your title
# other front matter definitions
---
```
To sort a category's pages, add a `sort` property to the pages' front matter
section:
```yaml
---
# other front matter definitions
sort: <number>
---
```
## Updating the documentation website
Before pushing your edits to the documentation, you may want to see what they
look like. To do so, you need to:
- have a local [Ruby](https://www.ruby-lang.org) environment
- install the `bundler` and `jekyll` gems
`gem install bundler jekyll`
@ -64,3 +70,4 @@ repo.
- Generator: [Jekyll docs](https://jekyllrb.com/docs/)
- Theme: [jekyll-rtd-theme](https://jekyll-rtd-theme.rundocs.io/) and
[rundocs.io](https://rundocs.io/)

View file

@ -11,7 +11,6 @@ The GooseMod settings interface can be accessed in your modules by importing
`@goosemod/settings`. You can extend Discord's settings with more categories,
pages, and other elements by importing the right procedures.
## Adding a new settings page
When GooseMod loads all modules, it first creates a new category called
@ -26,14 +25,16 @@ Do remember to remove the settings pages you add when your module gets disabled
though.
First import `createItem`:
```js
import { createItem } from '@goosemod/settings';
```
Then in your module's `onLoadingFinished`, call to `createItem` like this:
```js
createItem("Page name", [
"version",
createItem('Page name', [
'version',
// field objects
]);
```
@ -47,15 +48,16 @@ restore the state of Discord prior to when it was enabled.
removing one is even easier.
First add `removeItem` to your imports from `@goosemod/settings`:
```js
import { createItem, removeItem } from '@goosemod/settings';
```
Then in your module's `onRemove`, call to `removeItem` like so:
```js
removeItem("Page name");
```
```js
removeItem('Page name');
```
## Types of settings fields
@ -65,6 +67,7 @@ a `text` property defining the field's text.
Most fields also have a `subtext` property to add additional information if
needed, for example: precising the default values of your settings. The way
you would define a fields subtext is like so:
```js
{
// field definition elements
@ -77,9 +80,10 @@ you would define a fields subtext is like so:
A simple divider to separate your fields. Most other fields already add a
divider, so needing one is a more specific use case. They are defined like so:
```js
{
type: "divider"
type: 'divider';
}
```
@ -97,6 +101,7 @@ and documented.
Header fields let you make categories in your settings page, they are defined
like so:
```js
{
type: "header",
@ -111,6 +116,7 @@ Header fields do not use the `subtext` property.
### Text field
Text fields let you write text without user controls, they are defined like so:
```js
{
type: "text",
@ -122,6 +128,7 @@ Text fields let you write text without user controls, they are defined like so:
Button fields let you add simple buttons to launch actions, they are defined
like so:
```js
{
type: "button",
@ -152,6 +159,7 @@ Given that button fields are so bare, I'd recommend using
A regular [text field](#text-field) with a smaller [button](#button-field).
They are defined like so:
```js
{
type: "text-and-button",
@ -172,6 +180,7 @@ Unlike [button fields](#button-field), text-button fields include a
Exactly like the [text-button field](#text-button-field), but the button has
the danger styling (red). They are defined like so:
```js
{
type: "text-and-danger-button",
@ -192,6 +201,7 @@ action could have impactful consequences.
Toggle fields let you make on/off switches for your basic settings, they are
defined like so:
```js
{
type: "toggle",
@ -211,6 +221,7 @@ defined like so:
A [toggle field](#toggle-field) with a small [button](#button-field), or a
[text-button field](#text-button-field) with a [toggle switch](#toggle-field).
They are defined like so:
```js
{
type: "toggle-text-button",
@ -233,6 +244,7 @@ They are defined like so:
Exactly like the [toggle-text-button field](#toggle-text-button-field), but
the button has the danger styling (red). They are defined like so:
```js
{
type: "toggle-text-danger-button",
@ -260,6 +272,7 @@ action could have impactful consequences.
Colour fields let you make colour pickers for your settings, they are defined
like so:
```js
{
type: "text-and-color",
@ -300,6 +313,7 @@ Not yet experimented with or documented.
Custom fields only support a single property: `element`. They are defined like
so:
```js
{
type: "custom",
@ -314,5 +328,6 @@ so:
```note
Custom fields can be used to make any kind of field that is not built into
GooseMod. For example, [here is a procedure building a text input field](https://github.com/KeanuGooseMod/Modules/blob/master/settings-experiment/custom-settings.js#L1-L57).
GooseMod. For example, [here is a procedure building a text input field](https://github.com/NovaGM/Modules/blob/master/settings-experiment/custom-settings.js#L1-L57).
```