ID:273048
 
I'm creating a game where players will cut down trees to basically solve puzzles. What I want is players to be able to cut down a tree only when they are adjacent to the tree (I DON'T want the diagonals to be included) and if they are facing the tree. Please post if you have an idea. Thanks!
mob/verb/Choppachoppa()
for(var/obj/TREEZORZ/T in get_step(src,dir))
world<<"I CHOPPA YOU!"
del T
break
In response to AJX
No need to use a loop for that if you're just going to break out of it the first time you find a match.

var/obj/tree/T = locate() in get_step(src,dir)
if(T)
// Do stuff
In response to Nadrew
I didn't know you could call locate without arguments? O.o

Would that actually work?
In response to AJX
Yes. It defaults to the variable type, so var/obj/O = locate() is short for var/obj/O = locate(/obj).
In response to Garthor
Thanks for the help!