ID:262207
 
    train2
icon='building.dmi'
icon_state="train2"
density = 1
Enter()
if(density)
density = 0
src.icon_state = "train4"
else
sleep(4)
density = 1
src.icon_state = "train2"


Shut the dam door its cold in here.

lol

My door wont close it will close if i bump it twice but its not supposed to do that
o.O
Why'd you put enter?
Try used Bumped(forum,search,for,it).
In response to Hell Ramen
i tried to use Bump , Bumped i keep getting undefined proc -_-
In response to Dranzer_Solo
Dranzer_Solo wrote:
i tried to use Bump , Bumped i keep getting undefined proc -_-

Look at the args I gave it. ;)
In response to Hell Ramen
....
In response to Dranzer_Solo
Duh, Bumped() isn't a predefined proc.

Basically Dranzer, don't make pointless posts like that, listen to what he is saying.


Write the proc.
Give it arguments like the ones he told you to go look at.
Fix your door.
mob/Bump(obj/O)
if(istype(O,/obj/train2))
if(O.density)
//do opening stuff
else if(!O.density)
//do closing stuff
else
..()

try that
In response to Hell Ramen
Hell Ramen wrote:
o.O
Why'd you put enter?
Try used Bumped(forum,search,for,it).

Enter() is actually a decent choice here, if it's used correctly. The only real problem is, he's not returning a value, which you have to do for Enter() to work right.

Lummox JR
In response to Lummox JR
    train2
icon='building.dmi'
icon_state="train2"
density = 1
Enter()
if(density)
density = 0
src.icon_state = "train4"
return ..()
else
sleep(4)
density = 1
src.icon_state = "train2"


like that right well if it is the door dosent close -_-

   train2
icon='building.dmi'
icon_state="train2"
density = 1
Enter()
if(density)
density = 0
src.icon_state = "train4"
sleep(30)//change to the amount of seconds you
//want to wait times 10
icon='building.dmi'
icon_state="train2"

that should fix your problems...
In response to Jamesburrow
Jamesburrow wrote:
    train2
icon='building.dmi'
icon_state="train2"
density = 1
Enter()
if(density)
density = 0
src.icon_state = "train4"
sleep(30)//change to the amount of seconds you
//want to wait times 10
icon='building.dmi'
icon_state="train2"
that should fix your problems...

No, it won't. Enter() returns a value, true or false, if something is allowed to enter. If it doesn't return a value or ..(), then nothing can enter that turf through the normal movement procs.

Plus, you never reset density. And there's really no reason to change the icon--only the icon state.

You're also trying to do too much in this proc. You should be doing almost all of it in Entered(). All you need Enter() to do is return 1 if dense, so the door will open automatically.

Here's a form of that code that's not only correct, but also doesn't shut the door on a person who's standing in the doorway:
Enter(atom/movable/A)
if(ismob(A) && icon_state==initial(icon_state)) return 1
return ..()

Entered()
if(icon_state==initial(icon_state))
density = 0
icon_state = "train4"
sleep(30)
density = 1
Exited()

Exited()
if(!density) return // not ready to reset icon state
for(var/atom/movable/A in src) return
icon_state = initial(icon_state)

This code uses icon_state to tell if the door is open or closed, and uses density to determine if it's ready to be closed again. Playing with density for this purpose doesn't matter because if it's time to close the door but someone is standing in it, resetting density to 1 will have no impact on anything else.

Lummox JR
In response to Lummox JR
Thanks