ID:161331
 
I've never really messed with areas, but in this project I have in my mind, I think I'll have to use areas in a fairly complex way.

Some questions I have at the moment:
  • Is it possible to *create* areas? As in, New() them somewhere. If it is possible, how do you do it?
  • Does a proc like for() work with areas? As in, for(var/area/a in world)...
  • Can I use procs such as walk_to(), but using areas as the objective?

    Thanks. Some new questions may come up, soon.
Gooseheaded wrote:
  • Is it possible to *create* areas? As in, New() them somewhere. If it is possible, how do you do it?

    Yes. Areas are created using new() just like anything else. If you supply a turf as an argument to new(), then it adds that turf to an existing area of the same type (not sure of the exact behavior, it wouldn't be useful in cases where it's indeterminate, however).

    Don't pass anything but a turf, or new() will probably fail.

    Once an area is created, you can append turfs by adding them to its contents. Adding objs or mobs will cause that obj or mob to be relocated to the bottom-left most free spot in the area, which is undesirable. Adding areas will cause a crash, so you can't append view() or related procs to an area, unless if you loop through an add each non-area element one at a time. Otherwise, lists are okay to add.
  • Does a proc like for() work with areas? As in, for(var/area/a in world)...

  • Yes.
  • Can I use procs such as walk_to(), but using areas as the objective?

  • No, but it shouldn't be too difficult to grab a turf from that area to walk to, depending on how you want it to work.