BeforeProjectileLaunched

Fires before a projectile is launched, allowing you to cancel the event.

Example usage:

-- Cancel all telepearl throws
Events.BeforeProjectileLaunched(function(event)
    if (event.shooter == nil) then
        return
    end
    
    if (event.projectileType == "telepearl") then
       event.cancelled = true
    end
end)

Parameters

shooter: Entity | nil

The entity that launched the projectile (may not exist).

projectileType: ProjectileType

The type of projectile that hit.

position: Vector3

The position from which the projectile was launched.

velocity: Vector3

The velocity of the projectile when launched.

sourceItemType: ItemType | nil

The type of item from which the projectile was launched, if the projectile was directly fired from the item.

cancelled: bool [modifiable]

If set to true, the projectile launch will be cancelled.

Last updated