src/clojurecraft/actions.clj @ 4d4fca0a37f9
Refactor. It's pretty, but not for long. :(
author |
Steve Losh <steve@stevelosh.com> |
date |
Mon, 08 Aug 2011 21:01:07 -0400 |
parents |
c41de2845803 |
children |
6f54b979c6b5 |
(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))})]
(alter player merge {:loc new-location}))))
nil)