Too Many Attributes
» Entity actions » Action on key sequence

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.

FieldTypeDefaultDescription
key_sequenceArray of stepsrequiredThe keys to press, in order. A step is a keybind id, or an object (below).
success_actionEntity actionoptionalRuns on the holder when the whole sequence is done.
fail_actionEntity actionoptionalRuns on the holder when a press breaks a sequence that was partly done, or a step's time runs out.
timeoutInteger20Ticks without a new press before a partly done sequence starts over. 0 never times out.
keysArray of keys[]Extra keys to react to on their own, outside the sequence. Each is a keybind id or an object (below).
cooldownInteger0Ticks after success_action before the sequence can run again.
hud_renderHUD renderhiddenShows the cooldown as a bar, like other Origins cooldown powers.

A step object:

FieldTypeDefaultDescription
keyStringrequiredThe keybind id.
tapsInteger1Press it this many times, from 1 to 16.
holdInteger0Keep the last press held for this many ticks. Letting go early fails the sequence.
max_gapInteger0At most this many ticks since the step before. 0 is no limit, other than timeout.

A key object in keys:

FieldTypeDefaultDescription
keyStringrequiredThe keybind id.
actionEntity actionoptionalRuns on the holder when the key is pressed.
continuousBooleanfalsetrue 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, sneak sequence 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, window and continous aliases. cooldown is a number of ticks.

Example: "Dash". Double-tapping forward within 5 ticks launches you forward.

json
{
  "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.

json
{
  "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
    }
  }
}