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
After doing some testing, I THINK Exited() and Entered() may actually work as intended in my project.