Add clerk and bell
[mudsync.git] / mudsync / gameobj.scm
index b686e3cbd74a4d2d41825f0f5f5777290b8357f4..9d4a91380a660c04f0106e8dd557d9f669aa871f 100644 (file)
@@ -24,6 +24,7 @@
   #:use-module (8sync systems actors)
   #:use-module (8sync agenda)
   #:use-module (srfi srfi-1)
+  #:use-module (ice-9 format)
   #:use-module (ice-9 match)
   #:use-module (oop goops)
   #:export (<gameobj>
@@ -31,6 +32,7 @@
             gameobj-loc
             gameobj-gm
 
+            gameobj-act-init
             gameobj-set-loc!
             gameobj-occupants
             gameobj-actions
@@ -48,7 +50,7 @@
 ;;; Actions supported by all gameobj
 (define gameobj-actions
   (build-actions
-   (init (wrap-apply gameobj-init))
+   (init (wrap-apply gameobj-act-init))
    ;; Commands for co-occupants
    (get-commands (wrap-apply gameobj-get-commands))
    ;; Commands for participants in a room
   ;; @@: Would be preferable to be using generic methods for this...
   ;;   Hopefully we can port this to Guile 2.2 soon...
   (visible-to-player?
-   #:init-value (wrap-apply gameobj-visible-to-player?)))
+   #:init-value (wrap-apply gameobj-visible-to-player?))
+
+  ;; Set this on self-destruct
+  ;; (checked by some "long running" game routines)
+  (destructed #:init-value #f))
 
 
 ;;; gameobj message handlers
          (replace-step actor replace-reply))
        replace-steps))))
 
-;; @@: This could be kind of a messy way of doing gameobj-init
+;; @@: This could be kind of a messy way of doing gameobj-act-init
 ;;   stuff.  If only we had generic methods :(
-(define-mhandler (gameobj-init actor message)
+(define-mhandler (gameobj-act-init actor message)
   "Your most basic game object init procedure.
 Assists in its replacement of occupants if necessary and nothing else."
   (run-replacement actor message gameobj-replace-steps*))
@@ -315,6 +321,7 @@ By default, this is whether or not the generally-visible flag is set."
   "General gameobj self destruction routine"
   ;; Unregister from being in any particular room
   (gameobj-set-loc! gameobj #f)
+  (slot-set! gameobj 'destructed #t)
   ;; Boom!
   (self-destruct gameobj))