Action on key sequence
too-many-attributes:action_on_key_sequencepower type
Runs success_action when the holder presses keys in a set order, like a fighting-game combo. Steps can be single presses, several taps of one key, or holds.
| Field | Type | Default | Description |
|---|---|---|---|
key_sequence | Array of steps | required | The keys to press, in order. A step is a keybind id, or an object (below). |
success_action | Entity action | optional | Runs on the holder when the whole sequence is done. |
fail_action | Entity action | optional | Runs on the holder when a press breaks a sequence that was partly done, or a step's time runs out. |
timeout | Integer | 20 | Ticks without a new press before a partly done sequence starts over. 0 never times out. |
keys | Array of keys | [] | Extra keys to react to on their own, outside the sequence. Each is a keybind id or an object (below). |
cooldown | Integer | 0 | Ticks after success_action before the sequence can run again. |
hud_render | HUD render | hidden | Shows the cooldown as a bar, like other Origins cooldown powers. |
A step object:
| Field | Type | Default | Description |
|---|---|---|---|
key | String | required | The keybind id. |
taps | Integer | 1 | Press it this many times, from 1 to 16. |
hold | Integer | 0 | Keep the last press held for this many ticks. Letting go early fails the sequence. |
max_gap | Integer | 0 | At most this many ticks since the step before. 0 is no limit, other than timeout. |
A key object in keys:
| Field | Type | Default | Description |
|---|---|---|---|
key | String | required | The keybind id. |
action | Entity action | optional | Runs on the holder when the key is pressed. |
continuous | Boolean | false | true runs action every tick while the key is held. |
- A wrong press that could also start the sequence counts as that start. Pressing jump, jump, sneak in a
jump, sneaksequence still works. - With several of these powers, a sequence that's part of a longer one waits until the longer one finishes or can't anymore. Only the longer one fires.
- Pressing several keys in the same tick counts them in alphabetical order of their ids.
- Only keybinds named by one of the holder's key sequence powers count. Other keybinds, including another mod's keybind on the same physical key, are ignored, so they don't break a sequence.
- It runs on the server. On a mob it reacts to keys held by
force_key_pressed. - From Overgrown's Apoli: the fields match, without the
presses,hold_ticks,windowandcontinousaliases.cooldownis a number of ticks.
Example: "Dash". Double-tapping forward within 5 ticks launches you forward.
{
"type": "too-many-attributes:action_on_key_sequence",
"key_sequence": [
"key.forward",
{ "key": "key.forward", "max_gap": 5 }
],
"success_action": {
"type": "origins:add_velocity",
"z": 1.2,
"space": "local_horizontal_normalized"
},
"timeout": 10,
"cooldown": 40,
"hud_render": {
"should_render": true
}
}Example: "Charge". Hold sneak for 2 seconds, then jump.
{
"type": "too-many-attributes:action_on_key_sequence",
"key_sequence": [
{ "key": "key.sneak", "hold": 40 },
"key.jump"
],
"success_action": {
"type": "origins:apply_effect",
"effect": {
"effect": "minecraft:jump_boost",
"duration": 40,
"amplifier": 4
}
}
}