X-Git-Url: https://jxself.org/git/?p=mudsync.git;a=blobdiff_plain;f=mudsync%2Fgameobj.scm;h=3bb743ac5101e09182c0c5e6020c931d73394e10;hp=32506803cfa43bbf71cd764caf3a458122e76de4;hb=ca990b14f563fc450548954184ff6fc0e4792739;hpb=e585ab65215e84cb5fa12fd84ffeee0421e56d07 diff --git a/mudsync/gameobj.scm b/mudsync/gameobj.scm index 3250680..3bb743a 100644 --- a/mudsync/gameobj.scm +++ b/mudsync/gameobj.scm @@ -35,7 +35,6 @@ gameobj-act-init gameobj-set-loc! gameobj-occupants - gameobj-actions gameobj-self-destruct slot-ref-maybe-runcheck @@ -47,30 +46,6 @@ ;;; ======= -;;; Actions supported by all gameobj -(define gameobj-actions - (build-actions - (init (wrap-apply gameobj-act-init)) - ;; Commands for co-occupants - (get-commands (wrap-apply gameobj-get-commands)) - ;; Commands for participants in a room - (get-container-commands (wrap-apply gameobj-get-container-commands)) - ;; Commands for inventory items, etc (occupants of the gameobj commanding) - (get-contained-commands (wrap-apply gameobj-get-contained-commands)) - (get-occupants (wrap-apply gameobj-get-occupants)) - (add-occupant! (wrap-apply gameobj-add-occupant!)) - (remove-occupant! (wrap-apply gameobj-remove-occupant!)) - (get-loc (wrap-apply gameobj-act-get-loc)) - (set-loc! (wrap-apply gameobj-act-set-loc!)) - (get-name (wrap-apply gameobj-get-name)) - (set-name! (wrap-apply gameobj-act-set-name!)) - (get-desc (wrap-apply gameobj-get-desc)) - (goes-by (wrap-apply gameobj-act-goes-by)) - (visible-name (wrap-apply gameobj-visible-name)) - (self-destruct (wrap-apply gameobj-act-self-destruct)) - (tell (wrap-apply gameobj-tell-no-op)) - (assist-replace (wrap-apply gameobj-act-assist-replace)))) - ;;; *all* game components that talk to players should somehow ;;; derive from this class. ;;; And all of them need a GM! @@ -104,10 +79,6 @@ ;; Commands we can handle by being contained by something else (contained-commands #:init-value '()) - (message-handler - #:init-value - (simple-dispatcher gameobj-actions)) - ;; Most objects are generally visible by default (generally-visible #:init-value #t #:init-keyword #:generally-visible) @@ -118,7 +89,32 @@ ;; Set this on self-destruct ;; (checked by some "long running" game routines) - (destructed #:init-value #f)) + (destructed #:init-value #f) + + (actions #:allocation #:each-subclass + ;;; Actions supported by all gameobj + #:init-value + (mhandlers + (init gameobj-act-init) + ;; Commands for co-occupants + (get-commands gameobj-get-commands) + ;; Commands for participants in a room + (get-container-commands gameobj-get-container-commands) + ;; Commands for inventory items, etc (occupants of the gameobj commanding) + (get-contained-commands gameobj-get-contained-commands) + (get-occupants gameobj-get-occupants) + (add-occupant! gameobj-add-occupant!) + (remove-occupant! gameobj-remove-occupant!) + (get-loc gameobj-act-get-loc) + (set-loc! gameobj-act-set-loc!) + (get-name gameobj-get-name) + (set-name! gameobj-act-set-name!) + (get-desc gameobj-get-desc) + (goes-by gameobj-act-goes-by) + (visible-name gameobj-visible-name) + (self-destruct gameobj-act-self-destruct) + (tell gameobj-tell-no-op) + (assist-replace gameobj-act-assist-replace)))) ;;; gameobj message handlers