Browse Source

Implement action queueing

Thomas Dy 8 years ago
parent
commit
e231d77d15
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/bombnet/game.clj

+ 7 - 0
src/bombnet/game.clj

@@ -185,3 +185,10 @@
   (let [{bombs :bombs} state
         new-bombs (mapv #(update-in % [:counter] dec) bombs)]
     (assoc state :bombs new-bombs)))
+
+(defn queue-action [state id action]
+  (update-in state [:players]
+             (partial
+               mapv-if
+               #(= id (:id %))
+               #(assoc % :action action))))