diff options
-rw-r--r-- | res/scripts/underwater.lua | 6 | ||||
-rw-r--r-- | res/scripts/underwater_start.lua | 5 | ||||
-rw-r--r-- | src/script_system.cpp | 6 |
3 files changed, 14 insertions, 3 deletions
diff --git a/res/scripts/underwater.lua b/res/scripts/underwater.lua index 8e1ae1a..0b62ff5 100644 --- a/res/scripts/underwater.lua +++ b/res/scripts/underwater.lua | |||
@@ -1,5 +1,11 @@ | |||
1 | underwater = {} | 1 | underwater = {} |
2 | 2 | ||
3 | function underwater.make_lucas_underwater() | ||
4 | PreventCrouching() | ||
5 | StartBobbing("lucas") | ||
6 | SetAnimationSlowdown("lucas", 2) | ||
7 | end | ||
8 | |||
3 | function underwater.leave() | 9 | function underwater.leave() |
4 | AllowCrouching() | 10 | AllowCrouching() |
5 | StopBobbing("lucas") | 11 | StopBobbing("lucas") |
diff --git a/res/scripts/underwater_start.lua b/res/scripts/underwater_start.lua index 0852885..56b0b5e 100644 --- a/res/scripts/underwater_start.lua +++ b/res/scripts/underwater_start.lua | |||
@@ -1,9 +1,8 @@ | |||
1 | underwater_start = {} | 1 | underwater_start = {} |
2 | 2 | ||
3 | function underwater_start.init() | 3 | function underwater_start.init() |
4 | PreventCrouching() | 4 | loadMapScripts("underwater") |
5 | StartBobbing("lucas") | 5 | underwater.make_lucas_underwater() |
6 | SetAnimationSlowdown("lucas", 2) | ||
7 | end | 6 | end |
8 | 7 | ||
9 | function underwater_start.talk_to_fish1() | 8 | function underwater_start.talk_to_fish1() |
diff --git a/src/script_system.cpp b/src/script_system.cpp index 18a4e39..1846de2 100644 --- a/src/script_system.cpp +++ b/src/script_system.cpp | |||
@@ -201,6 +201,12 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { | |||
201 | return std::bernoulli_distribution(p)(game_.getRng()); | 201 | return std::bernoulli_distribution(p)(game_.getRng()); |
202 | }); | 202 | }); |
203 | 203 | ||
204 | engine_.set_function( | ||
205 | "loadMapScripts", | ||
206 | [&] (std::string filename) { | ||
207 | loadMapScripts(filename); | ||
208 | }); | ||
209 | |||
204 | engine_.script_file("../res/scripts/common.lua"); | 210 | engine_.script_file("../res/scripts/common.lua"); |
205 | } | 211 | } |
206 | 212 | ||