turtle.getFuelLimit

From ComputerCraft Wiki
Jump to: navigation, search


Grid Redstone.png  Function turtle.getFuelLimit
Added by version 1.6 of ComputerCraft, this command returns the maximum amount of fuel a turtle may store. By default, a regular turtle may hold 20,000 units, and an advanced model 100,000 units; both values can be changed in ComputerCraft.cfg.

In builds prior to 1.6, turtles may store practically unlimited amounts of fuel.

See also: turtle.getFuelLevel(), turtle.refuel()
Syntax turtle.getFuelLimit()
Returns "unlimited" if fuel is disabled, otherwise the maximum fuel level.
Part of ComputerCraft
API turtle

Examples

Grid paper.png  Example
If a fuel limit is present, consumes fuel items from the selected slot one at a time, until the storage limit is reached; otherwise consumes the entire stack.
Code
if turtle.getFuelLevel() ~= "unlimited" then
	if turtle.getFuelLimit then
		while turtle.getFuelLevel() < turtle.getFuelLimit() and turtle.getItemCount(turtle.getSelectedSlot()) > 0 do
			turtle.refuel(1)
		end
	else
		turtle.refuel()
	end
end
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox