diff --git a/desktop/achievement-ideas.txt b/desktop/achievement-ideas.txt index dab1835c..d5da1bfc 100644 --- a/desktop/achievement-ideas.txt +++ b/desktop/achievement-ideas.txt @@ -4,6 +4,7 @@ + something about shepherd + Worthy in wisdom + Worthy in courage + + + Worthy in might + Escaped jail + Returned monacle diff --git a/desktop/last-release b/desktop/last-release index 8351c193..60d3b2f4 100644 --- a/desktop/last-release +++ b/desktop/last-release @@ -1 +1 @@ -14 +15 diff --git a/desktop/project.clj b/desktop/project.clj index bd145c77..1b8eeecf 100644 --- a/desktop/project.clj +++ b/desktop/project.clj @@ -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) diff --git a/desktop/src-common/advent/screens/rooms/behind_house.clj b/desktop/src-common/advent/screens/rooms/behind_house.clj index 987c0ee0..a48e17a4 100644 --- a/desktop/src-common/advent/screens/rooms/behind_house.clj +++ b/desktop/src-common/advent/screens/rooms/behind_house.clj @@ -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!"))}) diff --git a/desktop/src-common/advent/steam.clj b/desktop/src-common/advent/steam.clj index e7661701..04387c63 100644 --- a/desktop/src-common/advent/steam.clj +++ b/desktop/src-common/advent/steam.clj @@ -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)))