turtle.refuel
From ComputerCraft Wiki
Function turtle.refuel | |
If the current selected slot contains a fuel item, it will consume it to give the turtle the ability to move. If the current slot doesn't contain a fuel item, it returns false. If a quantity is specified, it will refuel only up to that many items (if 32 is specified and 16 is present only 16 will be consumed), otherwise, it will consume all the items in the slot. | |
Syntax | turtle.refuel(number fuel item consume quantity) |
Returns | boolean true if fuel, else false. |
Part of | ComputerCraft |
API | turtle |
Examples
Example | |
Checks if the item in the current slot can be used as fuel without consuming it | |
Code |
local valid = turtle.refuel(0) print(valid) |
Output | If the current slot is valid fuel |
Example | |
Consumes only 4 items in the current slot if the item is a valid fuel | |
Code |
local success = turtle.refuel(4) print(success) |
Output | whether it successfully refuelled |
Fuel Values
Fuel values for different items.
Item | Movement gained | Added by |
---|---|---|
Biofuel Can | 520 | IndustrialCraft |
Scrap | 15 | IndustrialCraft |
Coalfuel Can | 1520 | IndustrialCraft |
Wooden Scaffolding | 15 | IndustrialCraft |
Peat | 80 | Forestry |
Sugar Cane | 0 | Vanilla |
Wooden Tools | 10 | Vanilla |
Lava | 1000 | Vanilla |
Blaze Rod | 120 | Vanilla |
Wood Blocks | 15 | Vanilla |
Sticks | 5 | Vanilla |
Coal/Charcoal | 80 | Vanilla |
Mushroom Blocks | 15 | Vanilla |
Coal Coke | 320 | Railcraft |
1.41:
The formula for calculating the movement gain from a fuel is "((fuel / 100) * 6)". Where fuel is the items burn time in ticks in a regular furnace and "/" is integer division.
1.42+:
Formula changed to ((fuel * 6) / 100). This will give more accurate movement values.
1.48:
Formula changed to ((fuel * 5) / 100)