ID:1876718
 
(See the best response by Lummox JR.)
I have just the bare minimum. I'm new to BYOND coding and would love to be pointed in the right direction. Thanks all for taking the time to help me out.

Code:
obj
Door_Open
icon = 'Buildings.dmi'
icon_state = "door_open"
density=0
Door_Close
icon = 'Buildings.dmi'
icon_state = "door_close"
density = 0
opacity = 1


Problem description:
I want to be able to walk through the doors without using a verb or clicking or anything - just simply have them change their icon_states when I walk through them.

And once again I appreciate any help I'm able to receive.
Check Enter(), Entered(), Exit() and Exited() proc.

http://www.byond.com/docs/ref/info.html#/atom/proc/Entered
I have reviewed those procs and I feel like oview() doesn't like how my doors are 64x64 rather in 32x32. I've gotten to the point where only 1/4 of the door changes icon_states with that proc, but I will give it another ago.
Is there a proc that checks the surrounding 3-4 tiles for doors and changes them accordingly?
Perhaps you'd like to look at one of the many resources on doors. It's a pretty common thing people ask.

http://www.byond.com/developer/?text=doors
I managed to find a public resource that works, however it makes my game pretty lag because it's checking if I'm bumping into a door every step I take.

I'm going to resize all my images to 32x32 because I bet there was a conflict with 64x64, who knows. Thanks for the help thus far.
Best response
Because your door is an obj, I would suggest that Cross(), Crossed(), and Uncrossed() are what you want.

- First, set up Cross() so that it returns 1 whenever any mob tries to overlap it. (If you wanted something to open more slowly, this wouldn't be the right approach. Instead I might try making the mover's Bump() call a Bumped() routine on whatever it hit, and the door's Bumped() could make it open.)

- In Crossed(), change the icon state to open and the density to 0. Changing the density is only important as far as letting other objs through.

- In Uncrossed(), check for any dense movables in obounds(). If you find none, close the door by changing the icon state and changing the density back to 1.
In response to Lummox JR
obj
Door
icon = 'door.dmi'
icon_state = "door"
density = 1 //closed door cant walk through it derp
layer = 5

mob
Bump(atom/O)
if(istype(O,/obj/Door))
var/obj/Door/D=O
D.icon_state = "dooropen"
D.density = 0
sleep(20)
D.icon_state = "door"
D.density = 1


I found a bump proc scanning through the depths of the door/switch repository and public libraries and I found something that did in fact work for me, but... ever since I've been using this my characters move slower, it's more sluggish, and I know it's because this is being proc'd every time I move.

Edit: I also see how the author of this was using layer = 5? That seems quite inefficient. Anyhow, back to work. I can't complain. I'm still learning here :P
In response to Lummox JR
Lummox JR wrote:
Because your door is an obj, I would suggest that Cross(), Crossed(), and Uncrossed() are what you want.

- First, set up Cross() so that it returns 1 whenever any mob tries to overlap it. (If you wanted something to open more slowly, this wouldn't be the right approach. Instead I might try making the mover's Bump() call a Bumped() routine on whatever it hit, and the door's Bumped() could make it open.)

- In Crossed(), change the icon state to open and the density to 0. Changing the density is only important as far as letting other objs through.

- In Uncrossed(), check for any dense movables in obounds(). If you find none, close the door by changing the icon state and changing the density back to 1.
I am going to give this a go and see how far I get doing this by myself. Hey, best way to learn. I appreciate the point in the right direction because I can't deal with the new lag using that bump proc.
In response to MaxPK
Don't control door opening in mob/Bump(). The door should be responsible for opening itself. Instead, I recommend this:

atom/movable/Bump(atom/O)
if(O) O.Bumped(src)

Make sure if you override Bump() anywhere that you call ..(). Then, you want this:

atom/proc/Bumped(atom/movable/A)
// do nothing by default

obj/Door/Bumped(atom/movable/A)
if(ismob(A))
...

Having mob code open the door is not a good idea design-wise because it means if you ever want to change how doors open, you have to go hunting for the code that does it under /mob--instead of looking under /obj/Door. Hence why Bumped() is the better solution.
Thanks to all who assisted with me this. The solution above by Lummox JR worked flawlessly. Thanks my brotha. Have a good one. I'm going to be making a completely separate noob thread next now.

Edit: No it didn't, never mind :| I'm now back to the beginning and I'm not sure how I get there :|
In response to Lummox JR
Lummox JR wrote:
Because your door is an obj, I would suggest that Cross(), Crossed(), and Uncrossed() are what you want.

- First, set up Cross() so that it returns 1 whenever any mob tries to overlap it. (If you wanted something to open more slowly, this wouldn't be the right approach. Instead I might try making the mover's Bump() call a Bumped() routine on whatever it hit, and the door's Bumped() could make it open.)

- In Crossed(), change the icon state to open and the density to 0. Changing the density is only important as far as letting other objs through.

- In Uncrossed(), check for any dense movables in obounds(). If you find none, close the door by changing the icon state and changing the density back to 1.

Unfortunately I'm still having trouble using Crossed, Uncrossed and obounds() (which I definitely feel is the most appropriate thing to do instead of using bumps).

Would you be so kind as to give me a snippet to start me off? Thanks I've been working at this literally all day >.>
This is of course assuming pixel movement is in play:

obj/Door
density = 1
// you mentioned the door was 64x64
bound_width = 64
bound_height = 64

Cross(atom/movable/A)
if(ismob(A)) return 1
return ..()

Crossed(atom/movable/A)
if(density)
icon_state = "open"
density = 0

Uncrossed(atom/movable/A)
for(var/atom/movable/O in obounds(src))
return // if any mov is found, abort
icon_state = "closed"
density = 1

This solution isn't 100% perfect. If for instance you had an obj for blood spatter and something got killed in the doorway, it'd never close because of the spatter, so you'd want to take that into account. This also does not account for anything being deleted or an object's loc changing abruptly, so it might be wise to spawn a loop (on open) that periodically polls to see if the door is still open and if anything is blocking it.
Awesome after a whole day of trying to figure this out.

Thanks man. I'll see if I can alter this in anyway to prevent "blood splatter" or from people dropping trash in the doorways.
In response to MaxPK
One solution that seems okay for the most part: only check for dense movables.
In response to Kaiochao
Kaiochao wrote:
One solution that seems okay for the most part: only check for dense movables.

atom/movable covers obj and mob. Like Lummox mentioned, what about obj/blood_spatter ?
In response to Zecronious
The emphasis was on "dense." It's already checking for movables, so I suggested only "dense" movables. Blood spatters are typically non-dense, so the door should close on them, whereas dense obstructions, such as players (and corpses?), should keep the door open.
In response to Kaiochao
Kaiochao wrote:
The emphasis was on "dense." It's already checking for movables, so I suggested only "dense" movables. Blood spatters are typically non-dense, so the door should close on them, whereas dense obstructions, such as players (and corpses?), should keep the door open.

Depends on your needs I suppose but I can imagine a non dense obj/chair that is draggable, is non dense and should block doors.

That would be a decent catch all but I think there should be blockDoors = 1 by default for all dense movables and 0 in special cases.
In response to Lummox JR
Lummox JR wrote:
This is of course assuming pixel movement is in play:

I don't see anything pixel movement-related in this code!