+HitResponse
+Door::collision(GameObject& other, const CollisionHit& hit_)
+{
+ switch (state) {
+ case CLOSED:
+ break;
+ case OPENING:
+ break;
+ case OPEN:
+ {
+ // if door is open and was touched by a player, teleport the player
+ Player* player = dynamic_cast<Player*> (&other);
+ if (player) {
+ state = CLOSING;
+ sprite->set_action("closing", 1);
+ if(!script.empty()) {
+ std::istringstream stream(script);
+ Sector::current()->run_script(stream, "Door");
+ }
+
+ if(!target_sector.empty()) {
+ GameSession::current()->respawn(target_sector, target_spawnpoint);
+ }
+ }
+ }
+ break;
+ case CLOSING:
+ break;
+ }
+
+ return TriggerBase::collision(other, hit_);
+}
+
+/* EOF */