src/examples/jumpbot.clj @ e207b5fdb092
now working with protocol 23 (modulo a few intermittent errors)
author |
Jason Dufair <jase@dufair.org> |
date |
Tue, 31 Jan 2012 12:57:17 -0500 |
parents |
7942222da830 |
children |
eb08d252e542 |
(ns examples.jumpbot
(:require [clojurecraft.core :as core])
(:require [clojurecraft.events :as events])
(:require [clojurecraft.loops :as loops])
(:require [clojurecraft.actions :as actions]))
(defn jump [bot]
[(actions/jump bot)])
(defn handle-dead [bot]
[(actions/chat bot "WHY DO YOU NOT WANT ME TO JUMP?!")
(actions/respawn bot)])
(defn make-jumpbot [server username]
(let [bot (core/connect server username)]
(events/add-handler bot :dead #'handle-dead)
(loops/add-loop bot #'jump 2000 :jump-loop)
bot))