X-Git-Url: https://jxself.org/git/?p=mudsync.git;a=blobdiff_plain;f=mudsync%2Fthing.scm;h=6399c6f71e174dbd0599e25fe0d6577a55cbd18d;hp=7b3a71d1538cc81c14693f3630ff88e866d22646;hb=6f7c1d4f9a2043c16f83facef6b3216e45e14f40;hpb=6cff5b0062ef928204295ab4327bf2d417070421 diff --git a/mudsync/thing.scm b/mudsync/thing.scm index 7b3a71d..6399c6f 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* (thing-cmd-take thing message #:key direct-obj) (define player (message-from message)) (define player-name - (msg-receive (_ #:key val) - (<-wait thing player 'get-name) - val)) + (mbody-val (<-wait player 'get-name))) (define player-loc - (msg-receive (_ #:key val) - (<-wait thing player 'get-loc) - val)) + (mbody-val (<-wait player 'get-loc))) (define thing-name (slot-ref thing 'name)) (define should-take (slot-ref-maybe-runcheck thing 'takeable player)) @@ -96,28 +80,24 @@ ;; Set the location to whoever's picking us up (begin (gameobj-set-loc! thing player) - (<- thing player 'tell + (<- player 'tell #:text (format #f "You pick up ~a.\n" thing-name)) - (<- thing player-loc 'tell-room + (<- player-loc 'tell-room #:text (format #f "~a picks up ~a.\n" player-name thing-name) #:exclude player)) - (<- thing player 'tell + (<- player 'tell #:text (format #f "It doesn't seem like you can pick up ~a.\n" thing-name)))) (define* (thing-cmd-drop thing message #:key direct-obj) (define player (message-from message)) (define player-name - (msg-receive (_ #:key val) - (<-wait thing player 'get-name) - val)) + (mbody-val (<-wait player 'get-name))) (define player-loc - (msg-receive (_ #:key val) - (<-wait thing player 'get-loc) - val)) + (mbody-val (<-wait player 'get-loc))) (define thing-name (slot-ref thing 'name)) (define should-drop (slot-ref-maybe-runcheck thing 'dropable player)) @@ -125,14 +105,14 @@ ;; Set the location to whoever's picking us up's location (begin (gameobj-set-loc! thing player-loc) - (<- thing player 'tell + (<- player 'tell #:text (format #f "You drop ~a.\n" thing-name)) - (<- thing player-loc 'tell-room + (<- player-loc 'tell-room #:text (format #f "~a drops ~a.\n" player-name thing-name) #:exclude player)) - (<- thing player 'tell + (<- player 'tell #:text (format #f "It doesn't seem like you can drop ~a.\n" thing-name))))