;;; derive from this class.
;;; And all of them need a GM!
-(define-class <game-actor> (<actor>)
+(define-class <gameobj> (<actor>)
;; location id
(loc #:init-value #f
- #:accessor game-actor-loc)
+ #:accessor gameobj-loc)
;; game master id
(gm #:init-keyword #:gm
- #:getter game-actor-gm))
+ #:getter gameobj-gm)
+
+ ;; Commands we can handle
+ (commands #:init-value #f)
+ ;; Commands we can handle by being something's container
+ (contain-commands #:init-value #f))
\f
#:val (slot-ref actor slot))))
-(define-class <room> (<game-actor>)
+(define-class <room> (<gameobj>)
(name #:init-keyword #:name)
(desc #:init-value ""
#:init-keyword #:desc)
(for-each
(lambda (exit)
(define new-exit
- (<-wait room (game-actor-gm room) 'lookup-room
+ (<-wait room (gameobj-gm room) 'lookup-room
#:symbol (exit-to-symbol exit)))
(set! (exit-to-address exit) new-exit))
;;; Players
;;; =======
-(define-class <player> (<game-actor>)
+(define-class <player> (<gameobj>)
(username #:init-keyword #:username
#:accessor player-username)
;; Connection id
(define-mhandler (player-set-loc! player message id)
(format #t "DEBUG: Location set to ~s for player ~s\n"
id (actor-id-actor player))
- (set! (game-actor-loc player) id))
+ (set! (gameobj-loc player) id))
(define-mhandler (player-init! player message)
(player-look-around player))
(define (player-look-around player)
(define room-name
(message-ref
- (<-wait player (game-actor-loc player) 'get-name)
+ (<-wait player (gameobj-loc player) 'get-name)
'val))
(define room-desc
(message-ref
- (<-wait player (game-actor-loc player) 'get-desc)
+ (<-wait player (gameobj-loc player) 'get-desc)
'val))
(define message-text
(format #f "**~a**\n~a\n" room-name room-desc))
- (<- player (game-actor-gm player) 'write-home #:text message-text))
+ (<- player (gameobj-gm player) 'write-home #:text message-text))
\f
;;; Debugging stuff