Files
RustRaptor/schemas/hook-v1.json
T

538 lines
12 KiB
JSON

{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "HookResult",
"type": "object",
"properties": {
"commands": {
"description": "Transactional commands, applied in order only when the callback succeeds.",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/Command"
}
},
"state": {
"description": "JSON-serializable state shared by callbacks in this script; maximum 64 KiB.",
"default": null
}
},
"additionalProperties": false,
"definitions": {
"Command": {
"oneOf": [
{
"description": "Add an enemy at an integer position in the original logical canvas.",
"type": "object",
"required": [
"enemy",
"op",
"x",
"y"
],
"properties": {
"enemy": {
"type": "string"
},
"op": {
"type": "string",
"enum": [
"spawn"
]
},
"x": {
"type": "integer",
"format": "int32"
},
"y": {
"type": "integer",
"format": "int32"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"op",
"vx",
"vy",
"weapon",
"x",
"y"
],
"properties": {
"hostile": {
"default": false,
"type": "boolean"
},
"op": {
"type": "string",
"enum": [
"projectile"
]
},
"vx": {
"type": "integer",
"format": "int32"
},
"vy": {
"type": "integer",
"format": "int32"
},
"weapon": {
"type": "string"
},
"x": {
"type": "integer",
"format": "int32"
},
"y": {
"type": "integer",
"format": "int32"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"amount",
"entity",
"op"
],
"properties": {
"amount": {
"type": "integer",
"format": "int32"
},
"entity": {
"description": "Enemy entity ID; zero addresses the player.",
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"op": {
"type": "string",
"enum": [
"damage"
]
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"entity",
"op"
],
"properties": {
"entity": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"op": {
"type": "string",
"enum": [
"despawn"
]
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"entity",
"op",
"x",
"y"
],
"properties": {
"entity": {
"description": "Existing enemy entity ID.",
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"op": {
"type": "string",
"enum": [
"move"
]
},
"x": {
"type": "integer",
"format": "int32"
},
"y": {
"type": "integer",
"format": "int32"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"entity",
"op",
"vx",
"vy"
],
"properties": {
"entity": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"op": {
"type": "string",
"enum": [
"velocity"
]
},
"vx": {
"type": "integer",
"format": "int32"
},
"vy": {
"type": "integer",
"format": "int32"
}
},
"additionalProperties": false
},
{
"description": "Pin a nonlegacy enemy's artwork frame; null resumes automatic animation.",
"type": "object",
"required": [
"entity",
"op"
],
"properties": {
"entity": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"frame": {
"type": [
"integer",
"null"
],
"format": "uint32",
"minimum": 0.0
},
"op": {
"type": "string",
"enum": [
"animation"
]
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"count",
"item",
"op"
],
"properties": {
"count": {
"type": "integer",
"format": "uint32",
"minimum": 0.0
},
"item": {
"type": "string"
},
"op": {
"type": "string",
"enum": [
"give_item"
]
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"count",
"item",
"op"
],
"properties": {
"count": {
"type": "integer",
"format": "uint32",
"minimum": 0.0
},
"item": {
"type": "string"
},
"op": {
"type": "string",
"enum": [
"consume_item"
]
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"amount",
"op"
],
"properties": {
"amount": {
"type": "integer",
"format": "int32"
},
"op": {
"type": "string",
"enum": [
"credits"
]
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"amount",
"op"
],
"properties": {
"amount": {
"type": "integer",
"format": "int32"
},
"op": {
"type": "string",
"enum": [
"shield"
]
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"op",
"x",
"y"
],
"properties": {
"kind": {
"default": "air_blast",
"allOf": [
{
"$ref": "#/definitions/ScriptEffectKind"
}
]
},
"op": {
"type": "string",
"enum": [
"effect"
]
},
"x": {
"type": "integer",
"format": "int32"
},
"y": {
"type": "integer",
"format": "int32"
}
},
"additionalProperties": false
},
{
"description": "Cosmetic lightning; pair with damage commands for gameplay effects.",
"type": "object",
"required": [
"op",
"to_x",
"to_y",
"x",
"y"
],
"properties": {
"anchor": {
"description": "Follow this entity's movement; zero is the player. Endpoints remain absolute coordinates at creation, preserving their initial offset.",
"default": null,
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0.0
},
"op": {
"type": "string",
"enum": [
"arc"
]
},
"ticks": {
"default": 3,
"type": "integer",
"format": "uint32",
"maximum": 12.0,
"minimum": 1.0
},
"to_anchor": {
"description": "Optional independent anchor for the destination endpoint.",
"default": null,
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0.0
},
"to_x": {
"type": "integer",
"format": "int32"
},
"to_y": {
"type": "integer",
"format": "int32"
},
"x": {
"type": "integer",
"format": "int32"
},
"y": {
"type": "integer",
"format": "int32"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"asset",
"op"
],
"properties": {
"asset": {
"type": "integer",
"format": "uint32",
"minimum": 0.0
},
"op": {
"type": "string",
"enum": [
"sound"
]
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"op",
"sound"
],
"properties": {
"op": {
"type": "string",
"enum": [
"play_sound"
]
},
"sound": {
"type": "string"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"key",
"op",
"value"
],
"properties": {
"key": {
"description": "Stable namespaced objective key, at most 128 bytes.",
"type": "string"
},
"op": {
"type": "string",
"enum": [
"objective"
]
},
"value": {
"type": "integer",
"format": "int32"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"op"
],
"properties": {
"op": {
"type": "string",
"enum": [
"complete"
]
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"op"
],
"properties": {
"op": {
"type": "string",
"enum": [
"fail"
]
}
},
"additionalProperties": false
}
]
},
"ScriptEffectKind": {
"description": "Script names are independent of the legacy effect serialization format.",
"type": "string",
"enum": [
"ground_blast",
"small_ground",
"large_air",
"medium_air",
"small_air",
"air_blast",
"energy",
"person",
"platoon",
"flare",
"sparkle"
]
}
}
}