X-Git-Url: https://jxself.org/git/?p=mudsync.git;a=blobdiff_plain;f=mudsync%2Fgameobj.scm;fp=mudsync%2Fgameobj.scm;h=21c655980b4d33d52c7dbd45fb250b9bb37c6045;hp=6011be2fccc1d07ecf2004f8b7c26c08f89e8359;hb=9588c965d19182edf4d8ee752bc880ff5a0945dc;hpb=fc80f814a2ebd5e562e9e5dbf74eea8daf063db7 diff --git a/mudsync/gameobj.scm b/mudsync/gameobj.scm index 6011be2..21c6559 100644 --- a/mudsync/gameobj.scm +++ b/mudsync/gameobj.scm @@ -32,6 +32,7 @@ #:use-module (oop goops) #:export ( + create-gameobj gameobj-loc gameobj-gm @@ -187,6 +188,27 @@ ;;; gameobj message handlers ;;; ======================== +;; TODO: This init stuff is a mess, and should be redone now that +;; we have the *init* action stuff. We've really spread out the +;; logic for creating a gameobj in several places, eg gm-inject-special! +(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." + (let ((new-gameobj (apply create-actor (%current-actor) class + #:gm gm args))) + ;; Set the location + (<-wait new-gameobj 'set-loc! #:loc loc) + ;; Initialize the object + (<-wait new-gameobj 'init))) + +;; ;; @@: Should we also dyn-ref the loc here? We can do that, unlike with +;; ;; create-gameobj. +;; ;; Another route could be to have set-loc! itself know how to use the +;; ;; dyn-ref. +;; (define (gameobj-create-gameobj gameobj class loc . args) +;; "Like create-gameobj but saves the step of passing in the gm." +;; (apply create-gameobj class (gameobj-gm gameobj) loc args)) + ;; Kind of a useful utility, maybe? (define (simple-slot-getter slot) (lambda (actor message) @@ -455,6 +477,8 @@ By default, this is whether or not the generally-visible flag is set." (match special-symbol ;; if it's a symbol, look it up dynamically ((? symbol? _) + ;; TODO: If we get back an #f at this point, should we throw + ;; an error? Obviously #f is okay, but maybe not if (mbody-val (<-wait (slot-ref gameobj 'gm) 'lookup-special #:symbol special-symbol))) ;; if it's false, return nothing