#include "sprite/sprite_manager.hpp"
#include "supertux/game_session.hpp"
#include "supertux/object_factory.hpp"
+#include "supertux/sector.hpp"
#include "trigger/door.hpp"
#include "util/reader.hpp"
reader.get("sector", target_sector);
reader.get("spawnpoint", target_spawnpoint);
+ reader.get("script", script);
+
sprite = sprite_manager->create("images/objects/door/door.sprite");
sprite->set_action("closed");
bbox.set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height());
if (player) {
state = CLOSING;
sprite->set_action("closing", 1);
- GameSession::current()->respawn(target_sector, target_spawnpoint);
+ if(script != "") {
+ std::istringstream stream(script);
+ Sector::current()->run_script(stream, "Door");
+ }
+
+ if(target_sector != "") {
+ GameSession::current()->respawn(target_sector, target_spawnpoint);
+ }
}
}
break;