Search all turfs where an object is? in Developer Help
|
|
When I create this object, I am trying to make it so it checks what is in its' location. If there are not one of two required turfs there, I want to null the objects' loc(thus deleting it).
Here is my attempt at a New() statement under the object, but it's just not working out how I thought it would.
New() for(var/turf/T in src.loc) turflist.Add(T) for(var/turf/tt in turflist) if(tt!=/turf/tile/grey&&tt!=/turf/tile/beige) src.loc = null ..()
|
|
You check types with istype.
There is only one turf per coordinate.
Edit:
As Nadrew pointed out, you have to put the ..() first.
New()
..()
var/turf/tile/tt=src.loc
if(!istype(tt,/turf/tile/grey)&&!istype(tt,/turf/tile/beige))
src.loc = null