75
1
6
8
8
level
(3)
75
0
0
5
.
owner
(#7)
75
0
0
5
.
pubread
(1)
75
0
0
5
.
pubwrite
(0)
75
0
0
5
.
fertile
(1)
75
0
0
5
.
name
("Generic Builder")
75
0
0
5
.
description
("The most generic builder you could imagine!")
7
0
0
5
.
location
(#3)
75
0
0
5
.
5
@dig
;;; Syntax: @dig <new-room-name>
;;;     or: @dig <dir> to <new-room-name>

(do
 (settaskperms caller)
 (if (= 0 (len argstr))
     (caller:tell "Syntax: <INSERT HELP HERE>")
     (if (= -1 (index argstr " to ")) ; no exit specified
         (let ((new-room (self:new-room-named argstr)))
           (caller:tell "New room created: " ($o new-room)))
         (let ((spl (split argstr " to "))
               (dir (get spl 0))
               (full-dir ($strutils:expand-exit-name dir))
               (new-name (get spl 1))
               (loc (getprop caller "location" nil)))
           (if (nil? loc)
               (caller:tell "You should move somewhere before trying to dig in a direction.")
               (if (= 0 (len dir))
                   (caller:tell "You need to specify a direction.")
                   (if (= 0 (len new-name))
                       (caller:tell "You need to specify a new name.")
                       (if (loc:has-exit-dir? full-dir)
                           (caller:tell "An exit in direction " full-dir " already exists!")
                           (let ((other-room 
                                  (if (nil? iobj)
                                      (do
                                       (let ((new-room (self:new-room-named new-name)))
                                         (do
                                          (caller:tell "New room created: " ($o new-room))
                                          new-room)))
                                      iobj))
                                 (new-exit (self:new-exit full-dir loc other-room)))
                             (do
                              (caller:tell "New exit created: " ($o new-exit))
                              (caller:tell "Attempting to link " loc " to " other-room
                                           " in direction " full-dir ".")
                              (try (do
                                    (self:connect-rooms-with loc other-room new-exit)
                                    (caller:tell "Success!"))
                                   (if (erristype error E_PERM)
                                       (caller:tell "I couldn't link the room.  Perhaps you could"
                                                    " ask this room's owner?")
                                       (error)))))))))))))
.
7
0
oAny pAny oAny
5
.
new-room-named
(do
 (settaskperms caller)
 (let ((new-room (create $room)))
   (do
    (setprop new-room "name" (get args 0))
    new-room)))
.
7
0
oThis pNone oThis
5
.
new-exit
(do
 (settaskperms caller)
 (let ((exit-dir (get args 0))
       (exit-src (get args 1))
       (exit-dest (get args 2))
       (new-exit (create $exit)))
   (do
    (setprop new-exit "name" (cat "exit to " exit-dest))
    (setprop new-exit "dir" exit-dir)
    (setprop new-exit "source" exit-src)
    (setprop new-exit "destination" exit-dest)
    new-exit)))
.
7
0
oThis pNone oThis
5
.
@undig
(do
 (settaskperms caller)
 (let ((dir ($strutils:expand-exit-name argstr))
       (loc (getprop caller "location")))
   (if (nil? loc)
       (caller:tell "You should move somewhere before trying to un-dig!")
       (if (loc:has-exit-name? dir)
           ()
           (caller:tell "There is no exit in direction " dir ".")))))
.
7
0
oAny pAny oAny
5
.
connect-rooms-with
(do
 (settaskperms caller)
 (let ((source (get args 0))
       (dest (get args 1))
       (exit (get args 2)))
   (do
    (source:add-exit exit)
    (dest:add-entrance exit))))
.
7
0
oThis pNone oThis
5
.
