From e4251457fa46d22071c034e04d1f5ac53ba29593 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Wed, 24 Feb 2021 22:19:00 -0500 Subject: Added map init scripts Map scripts also now actually run in their own lua thread. --- src/game.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/game.cpp') 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 @@ #include "animation_system.h" #include "character_system.h" #include "camera_system.h" +#include "script_system.h" int Game::emplaceSprite(std::string alias) { int id; @@ -84,4 +85,9 @@ void Game::loadMap(std::string filename) { getSystem().setUpCollision(spriteId, {0, 0}, t.size, false); getSprite(spriteId).walkthroughScript = t.script; } + + // Run the map's init script. + if (getSystem().mapHasScript(map_->getName(), "init")) { + getSystem().runScript(map_->getName(), "init"); + } } -- cgit 1.4.1