ID:322900
 
(See the best response by Lummox JR.)
Code:
obj/Paredes
ParedePedra2
name = "Parede de Pedra"
icon = 'Pisos.dmi'
icon_state = "parede2"
density = 1
opacity=1
Enter(mob/)
if(ismob(A))
if(usr.density == 0)
return 0


Problem description:

When the person is with Fly, they will be with density = 0, but I don't want they across the wall... but if the wall is not OBJ, then other verb won't work.
Okay there are so many things wrong with this:

1 - Things don't usually Enter() /objs. Enter() is called when enterers actually enter the contents of the enteree. If you're just moving onto the same tile as some object, you're not entering it - you're just stepping next to it.

2 - The Enter procedure there won't even compile
3 - You shouldn't use usr in procs, ever. It won't do what you expect it to. usr in movement procedures is /particularly/ bad.

4 - You need to define exactly what you want 'flying' to do to figure out a good way to implement it. From what I can see, you want flyers to be able to go through everything except tiles with wall objects on them - keep in mind that means that missiles that rely on Bump() and the like won't work either. If this is actually the behaviour you want, something like this might work:

turf/Enter(mob/m)
. = ..()
// If they succesfully entered, are a mob, and are flying
if (. && ismob(m) && m.flying)
if (locate(/obj/wall) in src) // And there's a wall on this turf
return 0 // They don't get to enter


If you want them to bump things usually, but be able to cross some specific types of dense turf, overriding Enter() on the dense turfs to allow flying players might be a good idea.
Best response
One additional point of note: In pixel movement scenarios, you can use obj/Cross() to test for allowing movement.

obj/highwall/Cross(atom/movable/mover)
// nothing can pass this, not even flying mobs
return 0