PhysicsPESensor: OnProductUnblocking

Invoked when a product that was blocking the sensor beam stops blocking it. The sensor is only unblocked when all products that were blocking it unblock it; the sensor could still be blocked. The Blocked property of the sensor will be false if no products are blocking it.

Note: OnProductUnblocking does not support multiple subscriptions. Only the most recent subscription will be called.

Event

void xxxxxxxxxxxxxxxxx(sender: PhysicsPESensor, product: Product);

Parameters

Name Type Description
sender PhysicsPESensor The sensor that is being unblocked.
product Product The product that is no longer blocking the sensor. Note: if the product unblocked because it was deleted (either explicitly, or because it left an unconnected conveyor) this parameter will be null.

Example

function OnSimulationStart()
{
    SubscribeAll("OnProductUnblocking", "Physics PE Sensor", OnProductUnblocking);
}

function OnProductUnblocking(sensor, product)
{
    if (product == null) {
        LogDebug(`A product was deleted and unblocked ${sensor.Name}.`);
    } else {
        LogDebug(`${product.Name} has unblocked ${sensor.Name}.`);
    }
    if (sensor.Blocked) {
        LogDebug("The sensor is still blocked.");
    } else {
        LogDebug("The sensor is no longer blocked.");
    }
}