X-Git-Url: https://jxself.org/git/?p=mudsync.git;a=blobdiff_plain;f=mudsync%2Fgameobj.scm;h=9d4a91380a660c04f0106e8dd557d9f669aa871f;hp=b686e3cbd74a4d2d41825f0f5f5777290b8357f4;hb=126d9c593cc4c26082c972741ff69d3b147b7fcd;hpb=b2f9a911ac1663fda4dc3cf18ade3334c01327b2 diff --git a/mudsync/gameobj.scm b/mudsync/gameobj.scm index b686e3c..9d4a913 100644 --- a/mudsync/gameobj.scm +++ b/mudsync/gameobj.scm @@ -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 ( @@ -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 @@ -112,7 +114,11 @@ ;; @@: 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 @@ -149,9 +155,9 @@ (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))