src/clojurecraft/actions.clj @ cc621ecb4d27

Fix move to update stance.
author Steve Losh <steve@stevelosh.com>
date Thu, 07 Jul 2011 09:39:18 -0400
parents c242e7b1f58c
children 0431d566789d
(ns clojurecraft.actions
  (:use [clojurecraft.util]))


(defn move [bot x-change y-change z-change]
  (let [player (:player bot)]
    (dosync
      (let [location (:location @player)
            new-location (merge location
                                {:x (+ x-change (:x location))
                                 :y (+ y-change (:y location))
                                 :z (+ z-change (:z location))
                                 :stance (+ y-change (:stance location))})]
        (alter player merge {:location new-location}))))
  bot)