This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Buho's profile picture

turtle.detectEntity()

Started by Buho, 29 November 2013 - 07:20 AM
Buho #1
Posted 29 November 2013 - 08:20 AM
turtle.detectEntity()
turtle.detectEntityDown()
turtle.detectEntityUp()

Tagging along the breeding suggestion, a way to detect if a mob or player is near the turtle would be nice. Right now, melee turtles attack() blindly, but it would be nice if there was a turtle.detectEntity() as there is turtle.detect() for blocks (including chests). Failing an attack() is fine for detecting mobs and players, but if place() fails with a carrot in slot 1, the truth may be either nothing is there or the mob can't be bred with a carrot (such as a chicken). Although I can check with other items I suppose. detectEntity() would also help with navigating around mobs instead of using dig() or attack() to plow through them.

Perhaps also include dropped items in this suggestion since they technically are entities as well. A turtle.suck() would determine if the entity is an item or not.
awsmazinggenius #2
Posted 29 November 2013 - 11:25 PM
Try placing a Proximity Sensor Block from OpenCCSensors and changing the mode to "Any Living Entity" :)/>