diff --git a/src/lib-tempo/include/tempo/system/SystemPlayer.hpp b/src/lib-tempo/include/tempo/system/SystemPlayer.hpp index 7e50615d..58ea2b6f 100644 --- a/src/lib-tempo/include/tempo/system/SystemPlayer.hpp +++ b/src/lib-tempo/include/tempo/system/SystemPlayer.hpp @@ -12,6 +12,7 @@ namespace tempo { struct SystemPlayer : anax::System> { anax::Entity nearest_player(glm::ivec2 pos); + void TeleportPlayers(); }; } diff --git a/src/lib-tempo/src/system/SystemPlayer.cpp b/src/lib-tempo/src/system/SystemPlayer.cpp index 214e55d4..2e81e433 100644 --- a/src/lib-tempo/src/system/SystemPlayer.cpp +++ b/src/lib-tempo/src/system/SystemPlayer.cpp @@ -1,4 +1,10 @@ #include +#include + +#define TELEPORT_LEFT 30 +#define TELEPORT_RIGHT 1100 + +#define TELEPORT_EXIT glm::ivec2(1000,1000) namespace tempo { @@ -21,4 +27,15 @@ anax::Entity SystemPlayer::nearest_player(glm::ivec2 pos) return out; } +void SystemPlayer::TeleportPlayers() +{ + for (auto entity : getEntities()) + { + glm::vec2 pos = entity.getComponent().getOrigin(); + if (pos.y > TELEPORT_LEFT && pos.y < TELEPORT_RIGHT) + entity.getComponent().setPosition(TELEPORT_EXIT); + + } +} + } diff --git a/src/server/main.cpp b/src/server/main.cpp index d8b361a5..c307da15 100644 --- a/src/server/main.cpp +++ b/src/server/main.cpp @@ -380,6 +380,7 @@ int main(int argc, const char **argv) system_attack.processAttacks(); system_health.regenerate(); system_movement.processTranslation(); + system_player.TeleportPlayers(); } ////////////////