Smart Rail¶
This rail is a combination of detector rail, activator rail, and powered rail.
| Peripheral Name | Interfaces with | Has events | Introduced in |
|---|---|---|---|
| smart_rail | Minecarts | Yes | 0.8 |
Events¶
cart_attached¶
Fires when a minecart get on a smart rail
Values:
peripheral_name: stringThe smart rail's name.carts_data: tableList of Entity object of the carts get on the rail in the tick.
1 2 | |
cart_detached¶
Fires when a minecart get off a smart rail
Values:
peripheral_name: stringThe smart rail's name.carts_id: tableList of UUID of the carts get off the rail in the tick.
1 2 | |
Functions¶
hasCarts¶
hasCarts() -> boolean
Check if any carts is currently on the rail.
getCarts¶
getCarts() -> table
Returns the entity data of the carts currently on the rail.
getState¶
getState() -> string, number
Returns the current operate state of the rail.
The default state is "STOP", 0
setState¶
setState(state: string | number) -> nil
Set the operate state of the rail.
Available states:
| State | ID | Description |
|---|---|---|
| STOP | 0 | Stop any cart on the rail |
| PASS | 1 | Let any cart on the rail pass through like on a normal rail. |
| ACC_NEG | 2 | Accelerate all carts on the rail towards negative axis direction (north and west). |
| ACC_BOTH | 3 | Accelerate any cart passing the rail like on a powered rail. |
| ACC_POS | 4 | Accelerate all carts on the rail towards positive axis direction (south and east). |
isActivating¶
isActivating() -> boolean
Check if the rail is acting like a powered activator rail.
setActivating¶
setActivating(value: boolean) -> nil
Set if the rail should act like a powered activator rail.
Changelog/Trivia¶
0.8
Added the Smart Rail peripheral.
