summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrant Shangreaux <grant@unabridgedsoftware.com>2022-02-04 16:21:34 -0600
committerGrant Shangreaux <grant@unabridgedsoftware.com>2022-02-04 16:21:34 -0600
commitf966c1bc913ce6f99993dbf5262209f603bf8930 (patch)
treed801147a579b06e067695ed05ef904b6acb38794
parent71b828dbb30f471cb45bf528be2d62f2a8bc8724 (diff)
Docs: eieio custom widgets example
-rw-r--r--mafia.org40
1 files changed, 37 insertions, 3 deletions
diff --git a/mafia.org b/mafia.org
index 48ca53e..67b59b1 100644
--- a/mafia.org
+++ b/mafia.org
@@ -251,7 +251,8 @@ will never make eye contact.
(when (> 5 (random 11))
(with-slots (id target) actor
(let ((new-target (mafia-random-other actor (slot-value mafia-active-game 'actors))))
- (mafia-log "Innocent %d observes %d and sees they are %s" id (mafia-actor-id new-target) (slot-value new-target 'status))
+ (mafia-log "Innocent %d observes %d and sees they are %s" id
+ (mafia-actor-id new-target) (slot-value new-target 'status))
(setf target new-target))))
(cl-call-next-method))
#+end_src
@@ -485,8 +486,41 @@ Let's see...
Ah ok, we can pack up data for a ~format~ string into a list and print whatever.
+*** Inspecting/Manipulating Individual Actors
+EIEIO has facilites to hook into the Emacs Custom / Widget apis if you add
+correct properties to the class definition. For example:
+#+begin_src emacs-lisp
+ (require 'eieio-custom)
+
+ (defclass my-foo nil
+ ((a-string :initarg :a-string
+ :initform "Thunderous pop!"
+ :custom string
+ :label "Amorphous String"
+ :group (default foo)
+ :documentation "A string for testing custom.
+ This is the next line of documentation. It will be folded up
+ in the 'UI'.")
+ (listostuff :initarg :listostuff
+ :initform ("1" "2" "3")
+ :type list
+ :custom (repeat (string :tag "Stuff"))
+ :label "List of Strings"
+ :group foo
+ :documentation "A list of stuff."))
+ "A class for testing the widget on.")
+
+ (eieio-customize-object (my-foo))
+#+end_src
+
+This is Emacs specific, but can leverage the powerful text interface already provided.
+You can extend the methods for editing and displaying the objects, so it could be used
+while paused for inspecting and tweaking the state of anything in the simulation.
+
+However, this and the log above make me think that we also need things we can detect as
+the simulation runs. Something like ~mafia-event~ objects that build a *timeline* on the
+game. The high level view would be focused on the timeline, rather than what an individual
+actor is doing at any given time.
-* english villiage simulator
-https://archaeology.co.uk/articles/specials/timeline/the-origins-of-the-english-village.htm