X-Git-Url: https://jxself.org/git/?p=mudsync.git;a=blobdiff_plain;f=mudsync%2Fthing.scm;h=6963c01b985a2867f7fa89e89a12831ac50dfd70;hp=a3ae6b003e3d706407252ca931e9f1fbd4d50a56;hb=701425bc611abaa8b4140942d995d5f32d24e2d7;hpb=b2f9a911ac1663fda4dc3cf18ade3334c01327b2 diff --git a/mudsync/thing.scm b/mudsync/thing.scm index a3ae6b0..6963c01 100644 --- a/mudsync/thing.scm +++ b/mudsync/thing.scm @@ -21,7 +21,7 @@ (define-module (mudsync thing) #:use-module (mudsync command) #:use-module (mudsync gameobj) - #:use-module (8sync systems actors) + #:use-module (8sync actors) #:use-module (8sync agenda) #:use-module (oop goops) #:use-module (ice-9 match) @@ -30,9 +30,7 @@ thing-commands thing-commands* thing-contained-commands - thing-contained-commands* - thing-actions - thing-actions*)) + thing-contained-commands*)) (define thing-commands (list @@ -50,18 +48,6 @@ ;; so it's an alias. (define thing-contained-commands* thing-contained-commands) -(define thing-actions - (build-actions - (cmd-take (wrap-apply thing-cmd-take)) - (cmd-drop (wrap-apply thing-cmd-drop)))) - -(define thing-actions* - (append thing-actions - gameobj-actions)) - -(define thing-dispatcher - (simple-dispatcher thing-actions*)) - (define-class () ;; Can be a boolean or a procedure accepting two arguments ;; (thing-actor whos-acting) @@ -75,20 +61,18 @@ #:init-value (wrap thing-commands)) (contained-commands #:init-value (wrap thing-contained-commands)) - (message-handler - #:init-value - (wrap-apply thing-dispatcher))) + (actions #:allocation #:each-subclass + #:init-value + (build-actions + (cmd-take thing-cmd-take) + (cmd-drop thing-cmd-drop)))) -(define-mhandler (thing-cmd-take thing message direct-obj) +(define* (thing-cmd-take thing message #:key direct-obj) (define player (message-from message)) (define player-name - (message-ref - (<-wait thing player 'get-name) - 'val)) + (msg-val (<-wait thing player 'get-name))) (define player-loc - (message-ref - (<-wait thing player 'get-loc) - 'val)) + (msg-val (<-wait thing player 'get-loc))) (define thing-name (slot-ref thing 'name)) (define should-take (slot-ref-maybe-runcheck thing 'takeable player)) @@ -108,16 +92,12 @@ #:text (format #f "It doesn't seem like you can pick up ~a.\n" thing-name)))) -(define-mhandler (thing-cmd-drop thing message direct-obj) +(define* (thing-cmd-drop thing message #:key direct-obj) (define player (message-from message)) (define player-name - (message-ref - (<-wait thing player 'get-name) - 'val)) + (msg-val (<-wait thing player 'get-name))) (define player-loc - (message-ref - (<-wait thing player 'get-loc) - 'val)) + (msg-val (<-wait thing player 'get-loc))) (define thing-name (slot-ref thing 'name)) (define should-drop (slot-ref-maybe-runcheck thing 'dropable player))