Make first_valid an array (#341)

This commit is contained in:
Piotr Brzozowski
2025-04-04 16:20:26 +02:00
committed by GitHub
parent 2d24f4f5cd
commit b4aacd0bf4

View File

@@ -10,7 +10,7 @@
"title": "Add Or Remove", "title": "Add Or Remove",
"description": "The components groups to add or remove.", "description": "The components groups to add or remove.",
"type": "object", "type": "object",
"examples": [ { "component_groups": [ "self:variant1" ] } ], "examples": [{ "component_groups": ["self:variant1"] }],
"properties": { "properties": {
"component_groups": { "component_groups": {
"title": "Component Groups", "title": "Component Groups",
@@ -18,10 +18,12 @@
"anyOf": [ "anyOf": [
{ {
"type": "array", "type": "array",
"items": { "type": "string", "description": "A reference to a component group.", "title": "Component Groups" } "items": { "type": "string", "description": "A reference to a component group.", "title": "Component Groups" }
}, },
{ {
"type": "string", "description": "A reference to a component group.", "title": "Component Groups" "type": "string",
"description": "A reference to a component group.",
"title": "Component Groups"
} }
] ]
} }
@@ -30,23 +32,23 @@
"event_base": { "event_base": {
"additionalProperties": false, "additionalProperties": false,
"type": "object", "type": "object",
"examples": [ { }, { "add": { "component_groups": [ ] } }, { "remove": { "component_groups": [ ] } } ], "examples": [{}, { "add": { "component_groups": [] } }, { "remove": { "component_groups": [] } }],
"defaultSnippets": [ "defaultSnippets": [
{ "label": "New Add Event", "body": { "add": { "component_groups": [ "$1" ] } } }, { "label": "New Add Event", "body": { "add": { "component_groups": ["$1"] } } },
{ "label": "New Remove Event", "body": { "remove": { "component_groups": [ "$1" ] } } }, { "label": "New Remove Event", "body": { "remove": { "component_groups": ["$1"] } } },
{ {
"label": "New Random Event", "label": "New Random Event",
"body": { "body": {
"randomize": [ "randomize": [
{ "add": { "component_groups": [ "$1" ] }, "weight": 1 }, { "add": { "component_groups": ["$1"] }, "weight": 1 },
{ "add": { "component_groups": [ "$2" ] }, "weight": 1 } { "add": { "component_groups": ["$2"] }, "weight": 1 }
] ]
} }
}, },
{ {
"label": "New Sequence Events", "label": "New Sequence Events",
"body": { "body": {
"sequence": [ { "add": { "component_groups": [ "$1" ] } }, { "add": { "component_groups": [ "$2" ] } } ] "sequence": [{ "add": { "component_groups": ["$1"] } }, { "add": { "component_groups": ["$2"] } }]
} }
} }
], ],
@@ -75,7 +77,7 @@
"items": { "items": {
"description": "Randomly selects one of the following items based upon their weight and the total weights.", "description": "Randomly selects one of the following items based upon their weight and the total weights.",
"title": "Randomize", "title": "Randomize",
"examples": [ { "add": { "component_groups": [ "foo:example" ] }, "weight": 1 } ], "examples": [{ "add": { "component_groups": ["foo:example"] }, "weight": 1 }],
"$ref": "#/definitions/weighted_event_base" "$ref": "#/definitions/weighted_event_base"
} }
}, },
@@ -108,7 +110,7 @@
"description": "Allows an entity to reset its target.", "description": "Allows an entity to reset its target.",
"type": "object", "type": "object",
"additionalProperties": false, "additionalProperties": false,
"properties": { } "properties": {}
}, },
"emit_vibration": { "emit_vibration": {
"title": "Emit Vibration", "title": "Emit Vibration",
@@ -116,18 +118,10 @@
"type": "object", "type": "object",
"properties": { "properties": {
"vibration": { "vibration": {
"enum": [ "enum": ["shear", "entity_act", "entity_interact"]
"shear",
"entity_act",
"entity_interact"
]
} }
}, },
"examples": [ "examples": [{ "vibration": "shear" }, { "vibration": "entity_act" }, { "vibration": "entity_interact" }]
{ "vibration": "shear" },
{ "vibration": "entity_act" },
{ "vibration": "entity_interact" }
]
}, },
"set_property": { "set_property": {
"title": "Set Property", "title": "Set Property",
@@ -135,9 +129,9 @@
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"title": "Property", "title": "Property",
"type": [ "string", "number", "integer", "boolean" ], "type": ["string", "number", "integer", "boolean"],
"description": "The value to set the property to.", "description": "The value to set the property to.",
"examples": [ false, 0, 0.0, "math.random(0, 10)" ] "examples": [false, 0, 0.0, "math.random(0, 10)"]
}, },
"examples": [ "examples": [
{ "example:property": false }, { "example:property": false },
@@ -157,14 +151,14 @@
{ {
"type": "string", "type": "string",
"pattern": "^[^/].*$", "pattern": "^[^/].*$",
"examples": [ "say Hello World" ] "examples": ["say Hello World"]
}, },
{ {
"type": "array", "type": "array",
"items": { "items": {
"type": "string", "type": "string",
"description": "The command to execute.", "description": "The command to execute.",
"examples": [ "say Hello World" ], "examples": ["say Hello World"],
"pattern": "^[^/].*$" "pattern": "^[^/].*$"
} }
} }
@@ -223,37 +217,38 @@
"description": "Sets the entity's home position to its current position", "description": "Sets the entity's home position to its current position",
"type": "object", "type": "object",
"additionalProperties": false, "additionalProperties": false,
"properties": { } "properties": {}
}, },
"first_valid": { "first_valid": {
"title": "First Valid", "title": "First Valid",
"description": "Will evaluate every filter in order and execute the first valid one", "description": "Will evaluate every filter in order and execute the first valid one",
"type": "object", "type": "array",
"additionalProperties": false, "items": {
"properties": { } "$ref": "#/definitions/event_base"
}
} }
} }
}, },
"weighted_event_base": { "weighted_event_base": {
"additionalProperties": false, "additionalProperties": false,
"type": "object", "type": "object",
"examples": [ { }, { "add": { "component_groups": [ ] } }, { "remove": { "component_groups": [ ] } } ], "examples": [{}, { "add": { "component_groups": [] } }, { "remove": { "component_groups": [] } }],
"defaultSnippets": [ "defaultSnippets": [
{ "label": "New Add Event", "body": { "add": { "component_groups": [ "$1" ] } } }, { "label": "New Add Event", "body": { "add": { "component_groups": ["$1"] } } },
{ "label": "New Remove Event", "body": { "remove": { "component_groups": [ "$1" ] } } }, { "label": "New Remove Event", "body": { "remove": { "component_groups": ["$1"] } } },
{ {
"label": "New Random Event", "label": "New Random Event",
"body": { "body": {
"randomize": [ "randomize": [
{ "add": { "component_groups": [ "$1" ] }, "weight": 1 }, { "add": { "component_groups": ["$1"] }, "weight": 1 },
{ "add": { "component_groups": [ "$2" ] }, "weight": 1 } { "add": { "component_groups": ["$2"] }, "weight": 1 }
] ]
} }
}, },
{ {
"label": "New Sequence Events", "label": "New Sequence Events",
"body": { "body": {
"sequence": [ { "add": { "component_groups": [ "$1" ] } }, { "add": { "component_groups": [ "$2" ] } } ] "sequence": [{ "add": { "component_groups": ["$1"] } }, { "add": { "component_groups": ["$2"] } }]
} }
} }
], ],
@@ -282,7 +277,7 @@
"items": { "items": {
"description": "Randomly selects one of the following items based upon their weight and the total weights.", "description": "Randomly selects one of the following items based upon their weight and the total weights.",
"title": "Randomize", "title": "Randomize",
"examples": [ { "add": { "component_groups": [ "foo:example" ] }, "weight": 1 } ], "examples": [{ "add": { "component_groups": ["foo:example"] }, "weight": 1 }],
"$ref": "#/definitions/weighted_event_base" "$ref": "#/definitions/weighted_event_base"
} }
}, },
@@ -303,18 +298,10 @@
"type": "object", "type": "object",
"properties": { "properties": {
"vibration": { "vibration": {
"enum": [ "enum": ["shear", "entity_act", "entity_interact"]
"shear",
"entity_act",
"entity_interact"
]
} }
}, },
"examples": [ "examples": [{ "vibration": "shear" }, { "vibration": "entity_act" }, { "vibration": "entity_interact" }]
{ "vibration": "shear" },
{ "vibration": "entity_act" },
{ "vibration": "entity_interact" }
]
}, },
"set_property": { "set_property": {
"title": "Set Property", "title": "Set Property",
@@ -322,9 +309,9 @@
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"title": "Property", "title": "Property",
"type": [ "string", "number", "integer", "boolean" ], "type": ["string", "number", "integer", "boolean"],
"description": "The value to set the property to.", "description": "The value to set the property to.",
"examples": [ false, 0, 0.0, "math.random(0, 10)" ] "examples": [false, 0, 0.0, "math.random(0, 10)"]
}, },
"examples": [ "examples": [
{ "example:property": false }, { "example:property": false },
@@ -344,14 +331,14 @@
{ {
"type": "string", "type": "string",
"pattern": "^[^/].*$", "pattern": "^[^/].*$",
"examples": [ "say Hello World" ] "examples": ["say Hello World"]
}, },
{ {
"type": "array", "type": "array",
"items": { "items": {
"type": "string", "type": "string",
"description": "The command to execute.", "description": "The command to execute.",
"examples": [ "say Hello World" ], "examples": ["say Hello World"],
"pattern": "^[^/].*$" "pattern": "^[^/].*$"
} }
} }