Skip to main content

fire_at_target

Function fire_at_target 

Source
pub fn fire_at_target(
    name: &str,
    can_fire_key: &str,
    ammo_key: &str,
    fire_request_key: &str,
) -> BehaviorNode
Expand description

Action: attempt to fire a projectile at a target.

Reads:

  • "{can_fire_key}" — bool: is the weapon ready?
  • "{ammo_key}" — int: remaining ammo

Writes:

  • "{fire_request_key}" — bool true (game system consumes this)
  • "{ammo_key}" — decremented by 1

Succeeds once the fire request is written. Fails if can_fire is false or ammo is zero.