- Make randomize and set_property have other event responses (#260)

This commit is contained in:
Xterionix
2024-04-01 13:56:29 +05:00
committed by GitHub
parent b3ec07b419
commit 0844044bf7

View File

@@ -69,32 +69,7 @@
"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 }],
"properties": { "$ref": "#/definitions/weighted_event_base"
"add": {
"$ref": "#/definitions/addremove",
"description": "What gets added when the event gets triggered.",
"title": "Add"
},
"remove": {
"$ref": "#/definitions/addremove",
"description": "What gets removed when the event gets triggered.",
"title": "Remove"
},
"trigger": {
"description": "Triggers additional events.",
"$comment": "UNDOCUMENTED",
"title": "Trigger",
"$ref": "./types/trigger.json"
},
"weight": {
"type": "number",
"default": 1,
"minimum": 1,
"description": "The weight on how likely this section is to trigger.",
"$comment": "UNDOCUMENTED",
"title": "Weight"
}
}
} }
}, },
"sequence": { "sequence": {
@@ -105,25 +80,7 @@
"description": "Filters and components to be added.", "description": "Filters and components to be added.",
"title": "Sequence", "title": "Sequence",
"type": "object", "type": "object",
"properties": { "$ref": "#/definitions/event_base"
"add": {
"$ref": "#/definitions/addremove",
"description": "What gets added when the event gets triggered.",
"title": "Add"
},
"remove": {
"$ref": "#/definitions/addremove",
"description": "What gets removed when the event gets triggered.",
"title": "Remove"
},
"trigger": {
"description": "Triggers additional events.",
"$comment": "UNDOCUMENTED",
"title": "Trigger",
"$ref": "./types/trigger.json"
},
"filters": { "$ref": "./../filters/filters.json" }
}
} }
}, },
"emit_vibration": { "emit_vibration": {
@@ -189,6 +146,141 @@
} }
} }
} }
},
"weighted_event_base": {
"additionalProperties": false,
"type": "object",
"examples": [{}, { "add": { "component_groups": [] } }, { "remove": { "component_groups": [] } }],
"defaultSnippets": [
{ "label": "New Add Event", "body": { "add": { "component_groups": ["$1"] } } },
{ "label": "New Remove Event", "body": { "remove": { "component_groups": ["$1"] } } },
{
"label": "New Random Event",
"body": {
"randomize": [
{ "add": { "component_groups": ["$1"] }, "weight": 1 },
{ "add": { "component_groups": ["$2"] }, "weight": 1 }
]
}
},
{
"label": "New Sequence Events",
"body": {
"sequence": [{ "add": { "component_groups": ["$1"] } }, { "add": { "component_groups": ["$2"] } }]
}
}
],
"properties": {
"filters": { "$ref": "./../filters/filters.json" },
"trigger": {
"description": "Triggers additional events.",
"$comment": "UNDOCUMENTED",
"title": "Trigger",
"$ref": "./types/trigger.json"
},
"add": {
"$ref": "#/definitions/addremove",
"description": "What gets added when the event gets triggered.",
"title": "Add"
},
"remove": {
"$ref": "#/definitions/addremove",
"description": "What gets removed when the event gets triggered.",
"title": "Remove"
},
"randomize": {
"type": "array",
"description": "Randomly selects one of the following items based upon their weight and the total weights.",
"title": "Randomize",
"items": {
"description": "Randomly selects one of the following items based upon their weight and the total weights.",
"title": "Randomize",
"examples": [{ "add": { "component_groups": ["foo:example"] }, "weight": 1 }],
"$ref": "#/definitions/weighted_event_base"
}
},
"sequence": {
"type": "array",
"description": "A series of filters and components to be added.",
"title": "Sequences",
"items": {
"description": "Filters and components to be added.",
"title": "Sequence",
"type": "object",
"$ref": "#/definitions/event_base"
}
},
"emit_vibration": {
"title": "Emit Vibration",
"description": "UNDOCUMENTED",
"type": "object",
"properties": {
"vibration": {
"enum": [
"shear",
"entity_act",
"entity_interact"
]
}
},
"examples": [
{ "vibration": "shear"},
{ "vibration": "entity_act"},
{ "vibration": "entity_interact"}
]
},
"set_property": {
"title": "Set Property",
"description": "Sets a property on the entity.",
"type": "object",
"additionalProperties": {
"title": "Property",
"type": ["string", "number", "integer", "boolean"],
"description": "The value to set the property to.",
"examples": [false, 0, 0.0, "math.random(0, 10)"]
},
"examples": [
{ "example:property": false },
{ "example:property": 0 },
{ "example:property": 0.0 },
{ "example:property": "one" },
{ "example:property": "math.random(0, 10)" }
]
},
"queue_command": {
"description": "Queues a command to be executed.",
"properties": {
"command": {
"title": "Command",
"description": "The command to execute.",
"oneOf": [
{
"type": "string",
"pattern": "^[^/].*$",
"examples": ["say Hello World"]
},
{
"type": "array",
"items": {
"type": "string",
"description": "The command to execute.",
"examples": ["say Hello World"],
"pattern": "^[^/].*$"
}
}
]
}
}
},
"weight": {
"type": "number",
"default": 1,
"minimum": 1,
"description": "The weight on how likely this section is to trigger.",
"$comment": "UNDOCUMENTED",
"title": "Weight"
}
}
} }
}, },
"properties": { "properties": {