ID:2196741
 
Code:
    Enter(atom/movable/O, atom/oldloc)
if(root_area)
return root_area.Enter(O,oldloc)
return ..()

Exit(atom/movable/O, atom/newloc)
if(root_area)
return root_area.Enter(O,newloc)
return ..()

Entered(atom/movable/O, atom/oldloc)
if(root_area)
return root_area.Entered(O,oldloc)
//this will only be run if this area is the root area
if(oldloc)
//if the movable is moving here from elsewhere
//get the old turf the player was associated with
var/turf/t = locate(oldloc.x,oldloc.y,oldloc.z)
//if the turf exists
if(t && isSame(t.loc))
//if the old area's root area is this object, don't trigger Entered() behavior.
//return 0 even though it's not necessary. We can use this for expanded behavior later.
return 0
//provided the movable is coming from an area that's not a subdivision of this one:
if(istype(O,/mob))
var/mob/m = O
if(m.client)//&&!m.roofshidden)
//m.roofshidden=1
HideRoof(m.client)
return ..()

Exited(atom/movable/O, atom/newloc)
if(root_area)
return root_area.Exited(O,newloc)
//this will only be run if this area is the root area
if(newloc)
//if the movable is leaving to another location
//get the new turf the player will be moving toward
var/turf/t = locate(newloc.x,newloc.y,newloc.z)
//if the turf exists
if(t && isSame(t.loc))
//if the new area's root area is this object, don't trigger Exited() behavior.
//return 0 even though it's not necessary. We can use this for expanded behavior later.
return 0
//provided the movable is going to an area that's not a subdivision of this one:
if(istype(O,/mob))
var/mob/m = O
if(m.client)
ShowRoof(m.client)
return ..()


Problem description:
The project I'm working on doesn't work too hot with enter(), entered(), exit() and exited(). Perhaps some work more then others? But overall, I don't use any of the following in my project.

Unfortunately, I also love Ter13's roofing library and it just happens to be handled under those procs. The lib works as intended when I first enter a roof, although if I move 1 pixel outside of the newly entered roof area, the roof will flicker as if I'm leaving it's area and then become solid until I completely leave the roof area and re enter.

What I've been trying to do is find a way to make this work without incorporating Enter, Exit, Entered and Exited. The main method I tried tackling was checking for areas that per tick(Hella more CPU intensive, I know). I have literally sat down on over 3 occasions now over the past year to try and hack this into something that works but never yielded any success; I'm burning out ladies n' gents.

I'll try tackling this again tomorrow and post my work. If anyone can shoot any suggestions before I do that, that would be greatly appreciated.

Thanks in advance and for full documentation of the library, go here: http://www.byond.com/forum/?post=1797736
I think the problem I'm experiencing may be more so linked to Exit() and Enter() rather than Entered() and Exited() but that's just a speculation.

After doing some testing, I THINK Exited() and Entered() may actually work as intended in my project.
Enter Exit etc are very useful in general, I'd try to keep them rather than do some other awful solution like polling. Sounds like you need to relook at your Move() overrides. You can always call Enter Exit manually if you don't want to/can't call ..() in Move().
I believe one or more of the following procs work, like I said, probably enter and exit. I could be mistaken though and need to run a little bit of testing first.

Since my project has no other need for said procs, overriding other code isn't really an option for me at this point. To be clear, and I'm already hearing y'all cringe... ..I... ..use my own adaptation of facc's sidescroller.

My version has 0 cpu issues thus far, fixes a few missed bugs and adds a lot of content to the overall framework. The reason the procs are flakey is probably due to how the library overrides movement.

If you'd like to try and test it out for yourself, combine both libraries and you'll crop the same results. I'd be happy to take the liberty of doing that myself and uploading a copy to file dropper if anyone is interested.