ID:156772
 
Say I activate a skill that teleports me in front an enemy and the enemy is on the edge of the map. Normally it would give me null coordinates(0,0,0). Is there a way to check if theres area or a turf where im going to teleport so that I dont face this problem?
Sure, when you find the turf in front of the target just check to see if it is null or not. If it isn't null handle things normally otherwise you'll have to come up with what to do when the target player is facing the edge of the map.
var/turf/tileInFront = get_step(target, target.dir)
if(tileInFront)
// The tile exists proceed normally here.
else
// The tile doesn't exist! Do something else.


A, possibly, better solution would be to not allow players to see/reach the edges of the map, which are more of design issues.