turtle.attack

From ComputerCraft
Jump to: navigation, search

turtle.attack
Function
Syntax
turtle.attack()
Returns bool didAttack
API BIOS globals
Source CC:Tweaked (source)

Attacks the entity in direction and range

  • The turtle can only attack when it has a tool and when a mob is in its range.
ExampleExampleCheck for hit
See if it was able to hit the entity it targeted
Code
local didHit = turtle.attack()
print(didHit)
Output
false
1