eb53408ae5e0

Update the docs to reflect the action changes.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Fri, 26 Aug 2011 19:16:54 -0400
parents 4693c1d0c903
children cd03086eadf7
branches/tags (none)
files docs/source/actions.rst docs/source/quickstart.rst

Changes

--- a/docs/source/actions.rst	Fri Aug 26 19:12:34 2011 -0400
+++ b/docs/source/actions.rst	Fri Aug 26 19:16:54 2011 -0400
@@ -2,19 +2,19 @@
 =======
 
 Actions are functions that take a ``Bot`` object and some arguments, and return
-a delayed function that will handle writing the packets to your bot perform the
-action.
+a map representing the action.
+
+They return a map instead of actually performing the action to make it easier to unit
+test your event handlers and loops.  This also makes them pure functions that can be
+retried in transactions.
 
 Performing Actions
 ------------------
 
-If you want to make your bot perform an action immediately you should use ``force``
-to make it happen::
+If you want to make your bot perform an action immediately you should use
+``perform!`` to make it happen::
 
-    (force (clojurecraft.actions/jump bot))
-
-Technically you don't need to use ``force``, because the REPL's printing will force
-the result to be evaluated, but conceptually it's a good habit to get into.
+    (clojurecraft.actions/perform! (clojurecraft.actions/jump bot))
 
 Available Actions
 -----------------
--- a/docs/source/quickstart.rst	Fri Aug 26 19:12:34 2011 -0400
+++ b/docs/source/quickstart.rst	Fri Aug 26 19:16:54 2011 -0400
@@ -30,11 +30,11 @@
 
 Now you can go back to your REPL and get started.  Import the things you'll need::
 
-    (require '(clojurecraft [core :as cc] [actions :as act] [events :as es]))
+    (require '(clojurecraft [core :as core] [actions :as actions]))
 
 Create a bot connected to your local server::
 
-    (def bot (cc/connect cc/minecraft-local "desired_username"))
+    (def bot (core/connect core/minecraft-local "desired_username"))
 
 Right now Clojurecraft doesn't support authentication, so it's turned off on the
 bundled server and you can choose any username you like.  You can pass ``nil``
@@ -44,9 +44,9 @@
 through your Minecraft client.
 
 Once your bot is in the world you're all set to play around.  At the moment the only
-action implemented is basic movement.  Move your bot around with ``act/move``::
+action implemented is basic movement.  Move your bot around with ``actions/move``::
 
-    (force (act/move bot 2 0 1))
+    (actions/perform! (actions/move bot 2 0 1))
 
 The numbers are the x, y, and z distance you wish to move.  For now you can't use the
 ``y`` argument -- you must always pass ``0``.
@@ -57,7 +57,7 @@
 
 Now try jumping::
 
-    (force (act/jump bot))
+    (actions/perform! (actions/jump bot))
 
 Clojurecraft isn't stable and is evolving quickly, but you can check out these docs
 to read about some of the design decisions.  As soon as you see a ``v1.0.0`` tag