(define-module (mudsync gameobj)
#:use-module (mudsync command)
#:use-module (mudsync utils)
(define-module (mudsync gameobj)
#:use-module (mudsync command)
#:use-module (mudsync utils)
#:use-module (8sync actors)
#:use-module (8sync agenda)
#:use-module (8sync rmeta-slot)
#:use-module (8sync actors)
#:use-module (8sync agenda)
#:use-module (8sync rmeta-slot)
(tell gameobj-tell-no-op)
(assist-replace gameobj-act-assist-replace)
(ok-to-drop-here? (lambda (gameobj message . _)
(tell gameobj-tell-no-op)
(assist-replace gameobj-act-assist-replace)
(ok-to-drop-here? (lambda (gameobj message . _)
(define (create-gameobj class gm loc . args)
"Create a gameobj of CLASS with GM and set to location LOC, applying rest of ARGS.
Note that this doesn't do any special dyn-ref of the location."
(define (create-gameobj class gm loc . args)
"Create a gameobj of CLASS with GM and set to location LOC, applying rest of ARGS.
Note that this doesn't do any special dyn-ref of the location."
;; Kind of a useful utility, maybe?
(define (simple-slot-getter slot)
(lambda (actor message)
;; Kind of a useful utility, maybe?
(define (simple-slot-getter slot)
(lambda (actor message)
- (mbody-receive (_ #:key occupants)
- (<-wait replaces 'assist-replace)
- (for-each
- (lambda (replace-step)
- (replace-step actor occupants))
- replace-steps))))
+ (call-with-values
+ (lambda ()
+ (<-wait replaces 'assist-replace))
+ (lambda* (#:key occupants)
+ (for-each
+ (lambda (replace-step)
+ (replace-step actor occupants))
+ replace-steps)))))
(hashq-set! (slot-ref gameobj 'props) key val))
(define* (gameobj-act-get-prop actor message key #:optional dflt)
(hashq-set! (slot-ref gameobj 'props) key val))
(define* (gameobj-act-get-prop actor message key #:optional dflt)
(define (gameobj-goes-by gameobj)
"Find the name we go by. Defaults to #:name if nothing else provided."
(define (gameobj-goes-by gameobj)
"Find the name we go by. Defaults to #:name if nothing else provided."
(define (val-or-run val-or-proc)
"Evaluate if a procedure, or just return otherwise"
(define (val-or-run val-or-proc)
"Evaluate if a procedure, or just return otherwise"
"Get commands a co-occupant of the room might execute for VERB"
(define candidate-commands
(get-candidate-commands actor 'commands verb))
"Get commands a co-occupant of the room might execute for VERB"
(define candidate-commands
(get-candidate-commands actor 'commands verb))
(define* (gameobj-get-container-dom-commands actor message #:key verb)
"Get (dominant) commands as the container / room of message's sender"
(define candidate-commands
(get-candidate-commands actor 'container-dom-commands verb))
(define* (gameobj-get-container-dom-commands actor message #:key verb)
"Get (dominant) commands as the container / room of message's sender"
(define candidate-commands
(get-candidate-commands actor 'container-dom-commands verb))
(define* (gameobj-get-container-sub-commands actor message #:key verb)
"Get (subordinate) commands as the container / room of message's sender"
(define candidate-commands
(get-candidate-commands actor 'container-sub-commands verb))
(define* (gameobj-get-container-sub-commands actor message #:key verb)
"Get (subordinate) commands as the container / room of message's sender"
(define candidate-commands
(get-candidate-commands actor 'container-sub-commands verb))
(define* (gameobj-get-contained-commands actor message #:key verb)
"Get commands as being contained (eg inventory) of commanding gameobj"
(define candidate-commands
(get-candidate-commands actor 'contained-commands verb))
(define* (gameobj-get-contained-commands actor message #:key verb)
"Get commands as being contained (eg inventory) of commanding gameobj"
(define candidate-commands
(get-candidate-commands actor 'contained-commands verb))
(define* (gameobj-add-occupant! actor message #:key who)
"Add an actor to our list of present occupants"
(define* (gameobj-add-occupant! actor message #:key who)
"Add an actor to our list of present occupants"
(define* (gameobj-get-occupants actor message #:key exclude)
"Get all present occupants of the room."
(define* (gameobj-get-occupants actor message #:key exclude)
"Get all present occupants of the room."
(define* (gameobj-get-desc actor message #:key whos-looking)
"This is the action equivalent of the gameobj-desc getter"
(define* (gameobj-get-desc actor message #:key whos-looking)
"This is the action equivalent of the gameobj-desc getter"
(define (gameobj-visible-to-player? gameobj whos-looking)
"Check to see whether we're visible to the player or not.
(define (gameobj-visible-to-player? gameobj whos-looking)
"Check to see whether we're visible to the player or not.
;; But that's life in a live hacked game!
(define (gameobj-act-assist-replace gameobj message)
"Vanilla method for assisting in self-replacement for live hacking"
;; But that's life in a live hacked game!
(define (gameobj-act-assist-replace gameobj message)
"Vanilla method for assisting in self-replacement for live hacking"
(define (gameobj-ok-to-be-taken-from gameobj message whos-acting)
(call-with-values (lambda ()
(slot-ref-maybe-runcheck gameobj 'take-me?
whos-acting #:from #t))
;; This allows this to reply with #:why-not if appropriate
(define (gameobj-ok-to-be-taken-from gameobj message whos-acting)
(call-with-values (lambda ()
(slot-ref-maybe-runcheck gameobj 'take-me?
whos-acting #:from #t))
;; This allows this to reply with #:why-not if appropriate
(define (gameobj-ok-to-be-put-in gameobj message whos-acting where)
(call-with-values (lambda ()
(slot-ref-maybe-runcheck gameobj 'drop-me?
whos-acting where))
;; This allows this to reply with #:why-not if appropriate
(define (gameobj-ok-to-be-put-in gameobj message whos-acting where)
(call-with-values (lambda ()
(slot-ref-maybe-runcheck gameobj 'drop-me?
whos-acting where))
;; This allows this to reply with #:why-not if appropriate
((? symbol? _)
;; TODO: If we get back an #f at this point, should we throw
;; an error? Obviously #f is okay, but maybe not if
((? symbol? _)
;; TODO: If we get back an #f at this point, should we throw
;; an error? Obviously #f is okay, but maybe not if
;; if it's false, return nothing
(#f #f)
;; otherwise it's probably an address, return it as-is
;; if it's false, return nothing
(#f #f)
;; otherwise it's probably an address, return it as-is
(define our-name (slot-ref gameobj 'name))
(define should-drop
(slot-ref-maybe-runcheck gameobj 'drop-me? player))
(define (room-objection-to-drop)
(define our-name (slot-ref gameobj 'name))
(define should-drop
(slot-ref-maybe-runcheck gameobj 'drop-me? player))
(define (room-objection-to-drop)
(<-wait player-loc 'ok-to-drop-here? player (actor-id gameobj))
(and (not drop-ok?)
;; Either give the specified reason, or give a boilerplate one
(<-wait player-loc 'ok-to-drop-here? player (actor-id gameobj))
(and (not drop-ok?)
;; Either give the specified reason, or give a boilerplate one