Kibitised.
This commit is contained in:
parent
34d3745ecb
commit
03733f8ddf
6 changed files with 33 additions and 35 deletions
|
|
@ -47,7 +47,7 @@
|
|||
(compiler/compile-file
|
||||
(io/get-resource "/rulesets/basic.txt")))
|
||||
(session/get :rules)))
|
||||
generation (+ (or (session/get :generation) 0) 1)
|
||||
generation (inc (or (session/get :generation) 0))
|
||||
w2 (engine/transform-world world rules)
|
||||
]
|
||||
(session/put! :world w2)
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@
|
|||
(let [params (keywordize-keys (:params request))
|
||||
xs (:x params)
|
||||
ys (:y params)
|
||||
x (if (not (empty? xs)) (read-string xs) 0)
|
||||
y (if (not (empty? ys)) (read-string ys) 0)
|
||||
x (if (seq xs) (read-string xs) 0)
|
||||
y (if (seq ys) (read-string ys) 0)
|
||||
world (session/get :world)
|
||||
cell (engine-utils/get-cell world x y)
|
||||
state (:state params)]
|
||||
|
|
@ -61,7 +61,7 @@
|
|||
|
||||
(defn list-states []
|
||||
(sort
|
||||
(filter #(not (nil? %))
|
||||
(remove nil?
|
||||
(map #(first (rest (re-matches #"([0-9a-z-]+).png" (.getName %))))
|
||||
(file-seq (clojure.java.io/file "resources/public/img/tiles"))))))
|
||||
|
||||
|
|
|
|||
|
|
@ -31,15 +31,14 @@
|
|||
pause (:pause params)
|
||||
rulefile (:ruleset params)
|
||||
rulepath (str "/rulesets/" rulefile ".txt")]
|
||||
(if (not (= map ""))
|
||||
(if (not= map "")
|
||||
(session/put! :world
|
||||
(heightmap/apply-heightmap
|
||||
(io/get-resource (str "/img/heightmaps/" map ".png")))))
|
||||
(if (not (= rulefile ""))
|
||||
(do
|
||||
(session/put! :rule-text (io/slurp-resource rulepath))
|
||||
(session/put! :rules (compiler/compile-file (io/get-resource rulepath)))))
|
||||
(if (not (= pause ""))
|
||||
(when (not= rulefile "")
|
||||
(session/put! :rule-text (io/slurp-resource rulepath))
|
||||
(session/put! :rules (compiler/compile-file (io/get-resource rulepath))))
|
||||
(if (not= pause "")
|
||||
(session/put! :pause pause))
|
||||
(layout/render "params.html"
|
||||
(merge (send-params)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,6 @@
|
|||
[path (str (io/resource-path) directory)]
|
||||
(session/put! :list-resources-path path)
|
||||
(sort
|
||||
(filter #(not (nil? %))
|
||||
(remove nil?
|
||||
(map #(first (rest (re-matches pattern (.getName %))))
|
||||
(file-seq (clojure.java.io/file path)))))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue