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

Turtle.DetectMob()

Started by PedroBarbosa, 21 November 2012 - 08:11 AM
PedroBarbosa #1
Posted 21 November 2012 - 09:11 AM
Hi! I think that the title say's everything Turtle.DetectMob() or just the turtle.Detect() could detect mob's
ChunLing #2
Posted 21 November 2012 - 11:32 AM
Well, I'm somewhat opposed to the current detect working on mobs, because it is useful to know if something is a block rather than a mobile entity. And it isn't like it's terribly hard to detect mobs, if your turtle can't move/place in a given direction and there is not a block in the way…well, aside from the height limit there's pretty much only one thing that it could be.

That said, it would be nice to have something like a motion detector or something on a turtle. Not that it's really critical. I'd prefer a programmable iron golem, all things considered.
PedroBarbosa #3
Posted 22 November 2012 - 02:08 AM
Well, I'm somewhat opposed to the current detect working on mobs, because it is useful to know if something is a block rather than a mobile entity. And it isn't like it's terribly hard to detect mobs, if your turtle can't move/place in a given direction and there is not a block in the way…well, aside from the height limit there's pretty much only one thing that it could be.

That said, it would be nice to have something like a motion detector or something on a turtle. Not that it's really critical. I'd prefer a programmable iron golem, all things considered.
I only said this idea because if you type like:
i=1,10 do
turtle.attack()
and if it is 1 mob in front of the turtle, the turtle will just kill him and dont repeat the 8/9 times…
And i wanted to turtle detect mob's for someting like
while turtle.detectMob() do
turtle.attack()
ChunLing #4
Posted 22 November 2012 - 02:26 AM
while not turtle.forward() do turtle attack() end

Or you could use turtle.place(), since that also will fail if a mob is in the way and doesn't use fuel. Use the detect to make sure that you aren't trying to attack a block, and you're all set.
Edited on 22 November 2012 - 01:28 AM
Doyle3694 #5
Posted 25 November 2012 - 04:20 AM
well chun, show me your mobfarm working with that line of code lol…
ChunLing #6
Posted 26 November 2012 - 06:38 AM
I was just basing it on the while turtle.detectMob() do turtle.attack() suggestion.

And I wouldn't use a moving turtle for a mobfarm, I'd use other kill methods and have water flows dump all the drops down a hole.