From 92360fa1585ea5310cee1f4cd660ae97c94744d7 Mon Sep 17 00:00:00 2001
From: Pear <20259871+TheRealPear@users.noreply.github.com>
Date: Mon, 23 Sep 2024 00:58:45 -0400
Subject: [PATCH] Document server version, variant, & constant changes
Signed-off-by: Pear <20259871+TheRealPear@users.noreply.github.com>
---
docs/modules/general/main.mdx | 36 +++++++++++++++++++++++++++++++----
1 file changed, 32 insertions(+), 4 deletions(-)
diff --git a/docs/modules/general/main.mdx b/docs/modules/general/main.mdx
index 0114eff6..51fbb826 100644
--- a/docs/modules/general/main.mdx
+++ b/docs/modules/general/main.mdx
@@ -22,6 +22,8 @@ The maps version should follow the versioning schema `major.minor.patch`.
| Map Attributes | Description | Value | Default |
|---|---|---|---|
| `proto` | RequiredThe map's XML protocol version. | `1.4.2` |
+| `min-server-version` | The minimum server version this map can run on. |
+| `max-server-version` | The maximum server version this map can run on. |
| `internal` | Prevent compass teleports above Y=255. | true/false | false |
##### Map Sub-elements
@@ -29,7 +31,7 @@ The maps version should follow the versioning schema `major.minor.patch`.
| Element | Description | Value/Children | Default |
|---|---|---|---|
| `` | RequiredThe name of the map. | String |
-| `` | The map's internal identifier, usually auto generated from the map's name. This should only be used when a map is renamed to retain the map's ratings, etc.
*Valid slugs are lowercase and only contain the characters:* `a-z 0-9 _` | String | Auto Generated |
+| `` | The map's internal identifier, usually auto generated from the map's name. This should only be used when a map is renamed to retain its information, etc.
*Valid slugs are lowercase and only contain the characters:* `a-z 0-9 _` | String | Auto Generated |
| `` | RequiredThe map's [semantic version](https://semver.org/). | `1.0.0` |
| `` | RequiredThe map's objective, shown at the start of the match. | String |
| `` | RequiredThe authors of the map. At least one author is required. | `` |
@@ -141,6 +143,7 @@ Additionally, a variant can also contain constants, which allows you to define t
| Attribute | Description | Value | Default |
|---|---|---|---|
| `id` | RequiredUnique identifier used to reference this map variant from other places in the XML. | String |
+| `slug` | The variant's internal identifier, usually auto generated from the variant's name. This should only be used when a variant is renamed to retain its information, etc.
*Valid slugs are lowercase and only contain the characters:* `a-z 0-9 _` | String | Auto Generated |
| `world` | The world the variant should use during a match. | String |
| `override` | Toggle if the variant name should override the base map name. If set to false, PGM will append `: [variant]` to the base map name. | true/false | false |
@@ -155,10 +158,34 @@ Additionally, a variant can also contain constants, which allows you to define t
| Attribute | Description | Value |
|---|---|---|
-| `variant` | The name of the variant to target. | Variant ID |
+| `variant` | The map variant to target.
*Multiple variants can be targeted as long as it is separated with a comma (`,`).* | Variant ID |
| `has-variant` | Target all maps with a specified variant.
**Note:** This can be useful in a server's global XML file. | Variant ID |
-
-**Note:** Multiple variants can be targeted as long as it is separated with a comma (`,`).
+| `min-server-version` | The minimum server version this variant can run on. |
+| `max-server-version` | The maximum server version this variant can run on. |
+| `constant` | The name of the constant to check against.
*Constants must be defined before this conditional.* | Constant ID |
+| `constant-value` | The constant value to check for. | Constant Value
+| `constant-comparison` | The type of comparison performed.
**Note:** If there is no value, it will default to `defined value`. With a value, it will default to `equals`. | `undefined`, `defined`,
`defined delete`,
`defined value`,
`contains`, `regex`, `range`. |
+
+###### Constant Comparison
+
+* UNDEFINED: checks that the constant has not been defined to anything.
+* DEFINED: checks the constant has been defined, to anything (either to delete or to a value).
+* DEFINED_DELETE: the constant has been defined as a delete.
+* DEFINED_VALUE: the constant has defined as an actual value (not a delete).
+* EQUALS: the constant equals to the attribute constant-value.
+* CONTAINS: the constant is one of the the comma-separated list of values in `constant-value`.
+ ```xml
+
+ ```
+* REGEX: checks if the constant matches the regex.
+ ```xml
+
+ ```
+* RANGE: check if the constant, interpreted as a number, is in the range.
+ * In this example, we check if the value is between 0 and 12.
+ ```xml
+
+ ```
### Constants
Constants are values that remain the same, regardless of conditions.
@@ -178,6 +205,7 @@ PGM will search and replace any corresponding placeholders (`${constant_id}`) wi
|---|---|---|---|
| `id` | RequiredUnique identifier used to reference this constant from other places in the XML. | String |
| `delete` | When true, PGM will completely delete the attribute or element the constant was used in, rather than leaving it blank. | true/false | false |
+| `fallback` | When true, this constant will not override any previous declaration.
**Note:** This is useful for includes, since you may not want to override individual maps' constant value. | true/false | false |
The following example utilizes both map variants and constant.
```xml