AIChargeComponent - acrimi/Raven GitHub Wiki

AIChargeComponent works alongside ChargeComponent and SightComponent to trigger a charge behavior when another entity enters this entity's line of sight. The charge will not trigger if the entity has collision enabled via its CollisionComponent and there are any collision objects blocking the path to the targeted entity. This can optionally be expanded to include certain terrain types as well. Once activated, the projected charge path will be reevaluated up to a certain distance each frame to see if a collision tile or terrain will block the next movement and cancel the charge if necessary.

Configuration

When used inside the components block, the initial state of the component can be configured with the following parameters:

Key Type Description
targetEntityTypes string|string[] One or more entity types that will trigger a charge if visible
avoidTerrains string[] An optional list of terrains that should be treated as blocking the entity's charge path
lookahead float The forward distance that will be checked during charge to determine if the charge should be canceled. Defaults to 1/2 of the entity's size along the axis of the charge.

Examples:

"AIChargeComponent": {
  "targetEntityTypes": [
    "player",
    "npc"
  ],
  "avoidTerrains": [
    "water",
    "lava"
  ],
  "lookahead": 32
}
"AIChargeComponent": {
  "targetEntityTypes": "player",
  "avoidTerrains": [
    "water",
    "lava"
  ],
  "lookahead": 32
}

Properties

This component has no exposed properties