+
+(define (gameobj-replace-data-occupants actor)
+ "The general purpose list of replacement data"
+ (list #:occupants (hash-map->list (lambda (occupant _) occupant)
+ (slot-ref actor 'occupants))))
+
+(define (gameobj-replace-data* actor)
+ ;; For now, just call gameobj-replace-data-occupants.
+ ;; But there may be more in the future!
+ (gameobj-replace-data-occupants actor))
+
+;; So sad that objects must assist in their replacement ;_;
+;; But that's life in a live hacked game!
+(define (gameobj-act-assist-replace actor message)
+ "Vanilla method for assisting in self-replacement for live hacking"
+ (apply <-reply actor message
+ (gameobj-replace-data* actor)))
+
+\f
+;;; Utilities every gameobj has
+;;; ---------------------------
+
+(define (dyn-ref gameobj special-symbol)
+ "Dynamically look up a special object from the gm"
+ (match special-symbol
+ ;; if it's a symbol, look it up dynamically
+ ((? symbol? _)
+ (message-ref
+ (<-wait gameobj (slot-ref gameobj 'gm) 'lookup-special
+ #:symbol special-symbol)
+ 'val))
+ ;; if it's false, return nothing
+ (#f #f)
+ ;; otherwise it's probably an address, return it as-is
+ (_ special-symbol)))