ID:178693
 
i need help programming doors
i need an open verb but then the door closes after 1 second...... how would i program that??
Aleis wrote:
i need help programming doors
i need an open verb but then the door closes after 1 second...... how would i program that??

turf/door
density=1
icon_state="closed"
var/waitingtoclose

verb/Open()
spawn(10) TryClose()
icon_state="open"
density=0

proc/TryClose()
for(var/atom/movable/A in contents)
if(A.density)
waitingtoclose=1
return
waitingtoclose=0
icon_state="closed"
density=1

Exited(atom/movable/A)
..()
if(waitingtoclose) TryClose()

This door will stay open for exactly 1 second (you'll probably want it to stay open longer). If a user stays in the door or pushes/drops a dense object in the doorway, the door won't close until the user or object moves.

Lummox JR