Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib-tempo/include/tempo/system/SystemPlayer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace tempo
{
struct SystemPlayer : anax::System<anax::Requires<ComponentPlayerRemote>> {
anax::Entity nearest_player(glm::ivec2 pos);
void TeleportPlayers();

};
}
Expand Down
17 changes: 17 additions & 0 deletions src/lib-tempo/src/system/SystemPlayer.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#include <tempo/system/SystemPlayer.hpp>
#include<iostream>

#define TELEPORT_LEFT 30
#define TELEPORT_RIGHT 1100

#define TELEPORT_EXIT glm::ivec2(1000,1000)

namespace tempo
{
Expand All @@ -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<ComponentStagePosition>().getOrigin();
if (pos.y > TELEPORT_LEFT && pos.y < TELEPORT_RIGHT)
entity.getComponent<ComponentStagePosition>().setPosition(TELEPORT_EXIT);

}
}

}
1 change: 1 addition & 0 deletions src/server/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ int main(int argc, const char **argv)
system_attack.processAttacks();
system_health.regenerate();
system_movement.processTranslation();
system_player.TeleportPlayers();
}

////////////////
Expand Down