src/clojurecraft/actions.clj @ 0431d566789d

Update everything to use the new data structures.
author Steve Losh <steve@stevelosh.com>
date Thu, 21 Jul 2011 21:23:41 -0400
parents cc621ecb4d27
children 0551a05c0e1e
(ns clojurecraft.actions
  (:use [clojurecraft.util]))


(defn move [bot x-change y-change z-change]
  (let [player (:player bot)]
    (dosync
      (let [location (:loc @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))})]
        (println (str "Moving from " location " to " new-location))
        (alter player merge {:loc new-location}))))
  bot)