ID:269075
 
Long Story-
I've read alot of libs and have conquered them all.
Then I get to Sidewalk santa and I am bombarded
with odd letters.
what does the /turf/proc/offset accomplish and how does it
work?
You can find the source
Here.
/turf/proc/Offset(D,xo,yo)
var/J=yo
switch(D)
if(2)
xo=-xo
yo=-yo
if(4)
yo=-xo
xo=j
if(8)
yo=xo
xo=-j
return locate(x+xo,y+yo,z)

ie:
why does the xo and yo turn negative if the usr is facing south and so forth...
I haven't looked at the source but judging from that:

I assume D is direction. Since direction can be given through numbers, if(2) means if(the thing is facing south) make the pixel_x and pixel_y offsets negative.
In response to DeathAwaitsU
yea it is and you're right on cue I just want to know why this happens.Why done the xo and yo became negative if D were lets say EAST;WEST;NORTH?
In response to Angel_Inc
Angel_Inc wrote:
yea it is and you're right on cue I just want to know why this happens.Why done the xo and yo became negative if D were lets say EAST;WEST;NORTH?

If that was a typo for "don't" then because:

When you do, switch(D) you can now do if(2) instead of doing if(D.dir==2).

So if(2) means if we're south.
if(4) means if we're [what_ever_direction_4_is]
...

And then just follow what the if is asking xo and yo to be.
In response to DeathAwaitsU
DeathAwaitsU wrote:
If that was a typo for "don't" then because:
Yes it was
When you do, switch(D) you can now do if(2) instead of doing if(D.dir==2).

So if(2) means if we're south.
if(4) means if we're [what_ever_direction_4_is]
East
But what is the mathematicl/trigonnomical reason for this??