summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2021-02-26 19:12:45 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2021-02-26 19:12:45 -0500
commite644f5c0d769989bd3b0665312c6949d76f5e388 (patch)
tree7a9c448267e80f73da7b8bf20c228081932618be /src
parentc304defdd7b0c5a8bea83f2540c009ededd450cb (diff)
downloadtanetane-e644f5c0d769989bd3b0665312c6949d76f5e388.tar.gz
tanetane-e644f5c0d769989bd3b0665312c6949d76f5e388.tar.bz2
tanetane-e644f5c0d769989bd3b0665312c6949d76f5e388.zip
Exposed loadMapScripts to scripting engine
This allows common functions to be stored in not per-map script files. Which is useful for code that we're going to want in a lot of places -- i.e. how every underwater map is going to have a copy of the same exit area function.
Diffstat (limited to 'src')
-rw-r--r--src/script_system.cpp6
1 files changed, 6 insertions, 0 deletions
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