ID:170300
 
Hi -- I'm new here and just starting to get my feet wet, and one thing that's stumped me (I'm sure it won't be the last) is how to get my directional doors working.

The experiment game I'm working on runs from an orthogonal p.o.v, and so I have four different doors -- north, south, east, and west (north and east show from the "interior" of a buiding while west and south show from the "exterior".

So far, all my doors are stored in one file, doors.dmi, and doors.dmi has two states, "closed" and "opened". Each of those states is a 4-direction, 1-frame movie containing the door's four facings.

I've started by placing the closed doors for each direction on my map, and then (following Deadron's Step BYOND) I've put an "open()" verb under the closed door state which looks like this:

verb
open()
set src in view(1)
new /turf/door/opened(src)

So far, so good -- as long as the door is south-facing, no problem. But when a door for any other direction is opened, it is replaced by the opened icon for south, rather than north, east, or west as appropriate, so clearly I'm missing something important here :)

How do I tell the open verb to replace the close door icon with the opened door facing the right direction?

Thanks in advance for any help with my silly newbie question :)


If the door when pointing south works fine, all you should have to do is make the created door's direction the same as the original door's direction.

Hopefully the verb is off a "closed" door, otherwise I'm not sure how to go about doing this =P

Example with your code:

verb
open()
set src in view(1)
var/turf/D = new /turf/door/opened(src)
D.dir = src.dir
In response to SSJ2GohanDBGT
Thanks for your answer :)

Sadly, though it seems like it should work, it still produces a south-facing door no matter the facing of the original door for me.


I added some messages to show me what direction it thought the doors were facing like so:

verb
open()
set src in view(1)
usr << "Closed door is [src.dir]."
var/turf/D = new /turf/door/opened(src)
D.dir = src.dir
usr << "Open door is [D.dir]."


In this case I get:

Closed door is 8.
Open door is 2.



Color me confused. :|

EDIT: I think I was going about this the wrong way; a simple change of the icon_state a la icon_state = "opened" gives me an open door in the right direction. D'oh. I'll be back with more simple questions, I'm sure :) I'm also still curious about how I'd put a new object in the game with a specific direction to it.
In response to Cruinne
...I'm also still curious about how I'd put a new object in the game with a specific direction to it.

Well if you want a specific direction, just set its dir to that direction at runtime.

Example:
obj
north_facing
New()
..()
src.dir = NORTH
south_facing
New()
..()
src.dir = SOUTH
west_facing
New()
..()
src.dir = WEST
east_facing
New()
..()
src.dir = EAST


And so on... This would be how I would do it, there might be a better way and if there is someone is sure to reply and let you know of it.
In response to XxDohxX
XxDohxX wrote:
Example:
> obj
> north_facing
> New()
> ..()
> src.dir = NORTH
> south_facing
> New()
> ..()
> src.dir = SOUTH
> west_facing
> New()
> ..()
> src.dir = WEST
> east_facing
> New()
> ..()
> src.dir = EAST
>

And so on... This would be how I would do it, there might be a better way and if there is someone is sure to reply and let you know of it.

obj/Doors
var/Direction
north_facing
Direction=NORTH
south_facing
Direction=SOUTH
//And so on...
New()
..()
src.dir = src.Direction


I'd probably do something more like this.

-Angel
In response to Angel of Flames
Waste of time. :P
You can set the dir by itself, ex: dir=NORTH.
In response to Hell Ramen
Thanks all! The help is much appreciated and is very ... helpful ;)

I just started playing with BYOND and I'm having a great time -- and all I have is a person walking around opening and closing doors.

(can you say easily amused?)
In response to Hell Ramen
Hell Ramen wrote:
Waste of time. :P
You can set the dir by itself, ex: dir=NORTH.
man hell ramen I was gonna say that :-).
He's right if you have a bunch of doors and you call this at new youll get some made overhead.So might as wel call it at compile_time instead of run_time.