ID:174155
 
How would I use New() the make a turfs .dir be the same as the turf under it? I tried for(var/turf/t in view(0)) src.dir = t.dir but it didnt do anything.
Aridale wrote:
How would I use New() the make a turfs .dir be the same as the turf under it? I tried for(var/turf/t in view(0)) src.dir = t.dir but it didnt do anything.

Problem is, you can only replace turfs; one doesn't go under the other. (Turfs are unique map locations; they don't coexist.) In the map editor when you add a turf, what really happens is that the old one becomes an underlay.

However you can add an argument to New() to take a direction, if supplied, and then just use the old turf's dir for that argument when you replace it.
turf
New(turf/T, newdir)
if(newdir) dir=newdir
Then when replacing it:
var/turf/T = locate(1, 2, 3)
new /turf/door(T, T.dir)

Lummox JR
In response to Lummox JR
ahh so I should set it to its underlays dir? see its water flowing in one direction and I made a turf called NoPass it has an icon in the editor so I can see it but in New() its icon_state is set to a blank icon so its invisible. And Im puttin it over water at the edges so you cant get in the water. The water is animated in directions so it flows but with the NoPass over them even tho its invisible its direction is messing up the way the water flows by changing the dir.
In response to Aridale
Aridale wrote:
ahh so I should set it to its underlays dir? see its water flowing in one direction and I made a turf called NoPass it has an icon in the editor so I can see it but in New() its icon_state is set to a blank icon so its invisible. And Im puttin it over water at the edges so you cant get in the water. The water is animated in directions so it flows but with the NoPass over them even tho its invisible its direction is messing up the way the water flows by changing the dir.

I think you replied before I edited my post to add something. My solution won't apply to using the map editor, though.

Lummox JR
In response to Lummox JR
Naa I cant do that itll have to be similar to changing it to whatever its underlay is at runtime cause they have to be placed in the editor and theyre not in straight lines or just here and there they make full map edges to help with seamless transitions from map to map and stuff too so its not ALWAYS needed just in the case of being over an animated underlay.
In response to Aridale
You can't get info like the direction of an underlay; it doesn't have one.

Lummox JR