ID:179545
 
I am wondering how i could make it so when you unlock a door and go through the door reapeers after he has passed it
(like in dwo)
Thanx so much
Greg wrote:
I am wondering how i could make it so when you unlock a door and go through the door reapeers after he has passed it
(like in dwo)
Thanx so much

I think the best way would be something like this:
obj/door
icon_state="closed"
density=1

New()
..()
// tell our doorway turf there's a door here
if(istype(loc,/turf/doorframe))
var/turf/doorframe/T=loc
T.door=src

// return 1 if M may open this door
proc/knock(atom/movable/M)
return 1 // sure, come on in

proc/open()
icon_state="open"
density=0

proc/close()
for(atom/movable/thing in loc)
if(!thing.density) continue
return // a dense item was found in the doorway
icon_state="closed"
density=1

turf/doorframe
var/obj/door/door

Enter(atom/movable/M)
if(!M.density) return ..()
if(!door.density || door.knock(M)) return ..()
return 0 // door is locked

Entered(atom/movable/M)
door.open()

Exited(atom/movable/M)
door.close()

I did this a little different from DWO; to open a door you just walk right into it. To use this, you create a special turf for the doorway. Put the door object on that, and when the world starts up the door will notify the turf that it's there. It might be more interesting to have the door close after a certain time period, like maybe a second; to do that, change door.close() to:
    spawn(10) door.close()

Lummox JR