fixed achievement to actually show.

This commit is contained in:
Bryce Covert
2015-11-18 23:13:46 -08:00
parent 47aab81ed6
commit c96e864e35
5 changed files with 41 additions and 6 deletions

View File

@@ -4,6 +4,7 @@
+ something about shepherd
+ Worthy in wisdom
+ Worthy in courage
+
+ Worthy in might
+ Escaped jail
+ Returned monacle

View File

@@ -1 +1 @@
14
15

View File

@@ -28,9 +28,17 @@
[org.clojure/data.csv "0.1.3"]]
:warn-on-reflection true}
:steam {
:dependencies [[com.code-disaster.steamworks4j/steamworks4j "1.2.2"]]
}
:steam {:dependencies [[com.code-disaster.steamworks4j/steamworks4j "1.2.2"]]}
:steam-dev {
:source-paths ["src" "src-common" "src-dev"]
:jvm-opts ["-Duse-repl=true"]
:dependencies [[com.badlogicgames.gdx/gdx-tools "1.5.3"]
[org.clojure/tools.nrepl "0.2.7"]
[slamhound "1.5.5"]
[org.clojure/data.csv "0.1.3"]
[com.code-disaster.steamworks4j/steamworks4j "1.2.2"]]
:warn-on-reflection true}
}
:aot [advent.core.desktop-launcher]
:main advent.core.desktop-launcher)

View File

@@ -99,12 +99,14 @@
(actions/update-entity entities :peeling #(assoc % :opacity 0))
(actions/update-state entities (fn [state] (assoc state :opened-crack? true))))))
:scripts {:stick (actions/get-script entities
(if (get-in @entities [:state :opened-crack?])
(actions/talk entities :ego "I could shove the stick in that hole, but why?")
(actions/do-dialogue entities
:ego "It looks like that wall is crumbling."
:ego "I can probably scratch it off with my hand.")))
:sword (actions/get-script entities
(actions/do-dialogue entities
:ego "I should be careful with this sword."
:ego "It's sharp!"))})

View File

@@ -15,6 +15,30 @@
(when (and has-steam? (eval `(SteamAPI/isSteamRunning)))
(eval `(SteamAPI/runCallbacks))))
(defn set-achievement [achievement]
(defn achievement-fn [f achievement]
(when has-steam?
(eval `(.setAchievement (SteamUserStats. nil) ~achievement))))
(eval `(let [stats# (atom nil)]
(reset! stats# (SteamUserStats. (reify SteamUserStatsCallback
(onUserStatsReceived [this# game-id# steam-user-id# result#]
(~f @stats# ~achievement)
)
(onUserStatsStored [this# gameId# result#]
)
(onUserAchievementStored [_ _ _ _ _ _]
))))
(.requestCurrentStats @stats#)))))
(def set-achievement (partial achievement-fn
(fn [stats achievement]
(.setAchievement stats achievement)
(.storeStats stats))))
(def clear-achievement (partial achievement-fn
(fn [stats achievement]
(.clearAchievement stats achievement)
(.storeStats stats))))
(def all-achievements ["MASTER_SLEUTH"])
(defn clear-all-achievements []
(doall (map clear-achievement all-achievements)))