1 (define-module (mudsync command)
2 #:use-module (mudsync parser)
3 #:use-module (8sync systems actors)
4 #:use-module (srfi srfi-1)
5 #:use-module (srfi srfi-9)
6 #:use-module (ice-9 control)
7 #:use-module (ice-9 match)
23 player-gather-command-handlers
29 (define %low-priority 0)
30 (define %default-priority 1)
31 (define %high-priority 2)
33 ;; ;;; Avoiding some annoying issues crossing the continuation barrier
34 ;; ;;; and the "@@" special form
35 ;; (define (make-command verbs matcher should-handle action priority)
36 ;; (list '*command* verbs matcher should-handle action priority))
38 ;; (define command-verbs second)
39 ;; (define command-matcher third)
40 ;; (define command-should-handle fourth)
41 ;; (define command-action fifth)
42 ;; (define command-priority sixth)
44 (define-record-type <command>
45 (make-command verbs matcher should-handle action priority)
48 (matcher command-matcher)
49 (should-handle command-should-handle)
50 (action command-action)
51 (priority command-priority))
54 (define (direct-command verbs action)
57 ;; @@: Should we allow fancier matching than this?
58 ;; Let the actor itself pass along this whole method?
59 (lambda* (goes-by #:key direct-obj)
60 (member direct-obj goes-by))
64 (define (loose-direct-command verbs action)
67 ;; @@: Should we allow fancier matching than this?
68 ;; Let the actor itself pass along this whole method?
74 (define* (indir-command verbs action #:optional prepositions)
77 (lambda* (goes-by #:key direct-obj indir-obj preposition)
80 (member indir-obj goes-by)
81 (member preposition prepositions))
82 (member indir-obj goes-by)))
86 (define* (loose-indir-command verbs action #:optional prepositions)
94 (define (empty-command verbs action)
101 (define (greedy-command verbs action)
108 (define (direct-greedy-command verbs action)
109 "greedy commands but which match the direct object"
111 cmatch-direct-obj-greedy
112 (lambda* (goes-by #:key direct-obj rest)
113 (member direct-obj goes-by))
117 ;; @@: We should probably ONLY allow these to go to users!
118 (define* (custom-command verbs matcher should-handle action
119 #:optional (priority %default-priority))
120 "Full-grained customizable command."
121 (make-command verbs matcher should-handle action priority))