diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-24 22:19:00 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-24 22:19:00 -0500 |
commit | e4251457fa46d22071c034e04d1f5ac53ba29593 (patch) | |
tree | 8b61201a9a2d109041a298fa8ae43ae2f03cda3f /src/game.cpp | |
parent | 4effe126d5b04d7e8572f8d785735a66150aa4ee (diff) | |
download | tanetane-e4251457fa46d22071c034e04d1f5ac53ba29593.tar.gz tanetane-e4251457fa46d22071c034e04d1f5ac53ba29593.tar.bz2 tanetane-e4251457fa46d22071c034e04d1f5ac53ba29593.zip |
Added map init scripts
Map scripts also now actually run in their own lua thread.
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/game.cpp b/src/game.cpp index af66068..6564da6 100644 --- a/src/game.cpp +++ b/src/game.cpp | |||
@@ -3,6 +3,7 @@ | |||
3 | #include "animation_system.h" | 3 | #include "animation_system.h" |
4 | #include "character_system.h" | 4 | #include "character_system.h" |
5 | #include "camera_system.h" | 5 | #include "camera_system.h" |
6 | #include "script_system.h" | ||
6 | 7 | ||
7 | int Game::emplaceSprite(std::string alias) { | 8 | int Game::emplaceSprite(std::string alias) { |
8 | int id; | 9 | int id; |
@@ -84,4 +85,9 @@ void Game::loadMap(std::string filename) { | |||
84 | getSystem<TransformSystem>().setUpCollision(spriteId, {0, 0}, t.size, false); | 85 | getSystem<TransformSystem>().setUpCollision(spriteId, {0, 0}, t.size, false); |
85 | getSprite(spriteId).walkthroughScript = t.script; | 86 | getSprite(spriteId).walkthroughScript = t.script; |
86 | } | 87 | } |
88 | |||
89 | // Run the map's init script. | ||
90 | if (getSystem<ScriptSystem>().mapHasScript(map_->getName(), "init")) { | ||
91 | getSystem<ScriptSystem>().runScript(map_->getName(), "init"); | ||
92 | } | ||
87 | } | 93 | } |