ID:1740076
 
(See the best response by Zecronious.)
Code:
obj/props/emerg
icon='props.dmi'
icon_state="emerg"
density=1
opacity=1
name= "Emergency Panel"
verb/Use()
set src in oview(1)
set hidden=1
view(6)<<"<font color=purple><b><small>[usr] has opened the Emergency Hatch!"
EmergSpace()


Problem description: I've been trying to get this code to work. Whenever a player opens up an Emergency Hatch, any mob within a certain area get sucked out into space, and essentially killed instantly.

obj/proc/EmergSpace()
src.icon_state="emergopen"
src.density=0
src.opacity=0
for(var/mob/client/M in view(6))
step_to(src,5,5)
sleep(50)
src.icon_state="emerg"
src.density=1
src.opacity=1
return


And then as soon as they Enter the space turf it kills them (already have that coded in and working.

I just can't get the sucking to work for the life of me. Then, once the emergency hatch automatically closes, players can no longer get sucked outside.

Best response
Here's my edit of yours & here's the files I used to test my suck() proc.
http://files.byondhome.com/Zecronious/Suck_src.zip

obj/props/emerg
icon='props.dmi'
icon_state="emerg"
density=1
opacity=1
name= "Emergency Panel"

var/open = 0

verb/Use()
set src in oview(1)
set hidden=1
view(6)<<"<font color=purple><b><small>[usr] has opened the Emergency Hatch!"
EmergSpace()

proc/EmergSpace()
open()
suck()
sleep(50)
close()

proc/open()
icon_state="emergopen"
density=0
opacity=0
open = 1

proc/close()
icon_state="emerg"
density=1
opacity=1
open = 0

proc/suck()
spawn()
var/turf/Space/nearestSpace = locate(/turf/Space) in oview(2,src)
while(open)
for(var/mob/M in view(6,src))
step_to(M,nearestSpace)
sleep(1)
In response to Zecronious
You are a saint, thank you.
In response to Manio
Anything to help out such a great project.