added manually saving scripts.

This commit is contained in:
2014-11-28 12:04:41 -08:00
parent a34ae1dbd2
commit 6fda6d80b5
2 changed files with 10 additions and 3 deletions

View File

@@ -38,6 +38,11 @@
(thread ~@forms (thread ~@forms
(utils/save @~entities))))) (utils/save @~entities)))))
(defmacro get-unsaved-script [entities & forms]
`(fn [starting-entities#]
(let [~entities (atom starting-entities#)]
(thread ~@forms))))
(defn jump-to [screen entities entity [x y] update-baseline?] (defn jump-to [screen entities entity [x y] update-baseline?]
(let [scale-fn (-> entities :room :scale-fn) (let [scale-fn (-> entities :room :scale-fn)

View File

@@ -98,7 +98,8 @@
:wizard "If this is truely your quest, boy, then I will help you in your quest. " :wizard "If this is truely your quest, boy, then I will help you in your quest. "
:wizard "But heed the warning from the prophecy: No cheat can pull the Sword of Blergh." :wizard "But heed the warning from the prophecy: No cheat can pull the Sword of Blergh."
:ego "No cheating." :ego "No cheating."
:ego "Check."))}]} :ego "Check.")
(utils/save @entities))}]}
"By besting swamp, foe, and the occasional bizarre conversation tree." "By besting swamp, foe, and the occasional bizarre conversation tree."
{:run #(do (actions/respond entities % {:run #(do (actions/respond entities %
:wizard "While your goal sounds noble, no amount of bizarre conversation tree searching will earn my respect." :wizard "While your goal sounds noble, no amount of bizarre conversation tree searching will earn my respect."
@@ -121,14 +122,15 @@
(rooms/make :music :town-2 (rooms/make :music :town-2
:interactions :interactions
{:door {:box [258 100 281 160] {:door {:box [258 100 281 160]
:script (actions/get-script :script (actions/get-unsaved-script
entities entities
(actions/walk-to entities :ego [267 90]) (actions/walk-to entities :ego [267 90])
(actions/talk entities :ego (str "Anyone home?")) (actions/talk entities :ego (str "Anyone home?"))
(actions/play-animation entities :ego :reach) (actions/play-animation entities :ego :reach)
(actions/transition-background entities :inside-house [237 0]) (actions/transition-background entities :inside-house [237 0])
(if (get-in @entities [:state :convinced-wizard?]) (if (get-in @entities [:state :convinced-wizard?])
(actions/talk entities :wizard (str "Oh, hello there boy.")) (do (actions/talk entities :wizard (str "Oh, hello there boy."))
(utils/save @entities))
(wizard-dialogue entities)))} (wizard-dialogue entities)))}
:sword {:box [274 55 305 88] :sword {:box [274 55 305 88]
:script (actions/get-script :script (actions/get-script