src/caves/entities/aspects/mobile.clj @ 1a3a4f8d5d85
Refactor the world code into separate files.
This pulls out the world generation code into its own file. It was
getting a bit crowded in there.
author |
Steve Losh <steve@stevelosh.com> |
date |
Wed, 01 Aug 2012 21:13:37 -0400 |
parents |
811f328099c6 |
children |
(none) |
(ns caves.entities.aspects.mobile
(:use [caves.entities.core :only [defaspect]]
[caves.world.core :only [is-empty?]]))
(defaspect Mobile
(move [this dest world]
{:pre [(can-move? this dest world)]}
(assoc-in world [:entities (:id this) :location] dest))
(can-move? [this dest world]
(is-empty? world dest)))