A unit's set of contextual actions: voice lines, animations and events that play when
something happens in the game, such as a spell cast, a kill or low health. The unit's
contextual action component reads this object.
Which units run it
The client creates a contextual action component when it initializes a unit. The
shopkeeper also has one. The component finds the unit's data through
SkinCharacterDataProperties.mContextualActionData. Each component keeps its own state:
the situation context, the cooldown timers and the play counts. The client does not test
whether a unit belongs to the local player before it evaluates a situation, so every
client evaluates the situations of every unit that has a component. Only the voice line
event name depends on the viewer (see
ContextualActionPlayAudio).
What fires a situation
A situation is a named game event, such as a kill, an attack order, a spell cast or an
emote. The game event fires the situation on the components that it concerns.
ContextualSituation lists the situation keys and the
game event that fires each one. mHealthPercentThreshold sets the condition of one of
them.
Order of a run
When a situation fires on a unit, the client runs these steps:
- It looks up the key in this object's
mSituations and runs the audio action of the
situation, with the gates that ContextualRule describes.
- In the same entry, it runs the user fact action, the mix state action, the champion
music action and the announcer action, in this order.
- For each GlobalContextualActionData in
AudioGlobalEventManager.GlobalContextualActionData, in list order, it runs the same
four actions of the entry with the same key, against this unit's context. The audio
action of a global object does not run.
If mSituations has no entry for the key, steps 1 and 2 do nothing. Each action kind
chooses its own rule from the entry (see ContextualSituation).
Animation and trigger event actions run only from some situations:
IContextualAction lists them.
Cooldowns
Three cooldowns limit how often voice lines play:
Each time starts when a voice line of a rule with ActiveVoiceOver ends, not when it
starts. A rule whose ActiveVoiceOver is false never starts a cooldown. The other
action kinds ignore all three cooldowns.