Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
HubertJan committed Jul 17, 2024
2 parents edc1032 + 84b619e commit c26bb0d
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 44 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/deployment_webhook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ jobs:

- name: Trigger deployment webhook
run: |
curl -X POST -H "Content-Type: application/json" -d '{"text": "All checks passed and deployment is starting."}' http://webhooks.ivo-zilkenat.de/hooks/distributed-systems-io-deploy?secret=1c3b5kFdi/DEwDbFenrw3C0M+Tp5d4pPvNjaFk/xdxg=
curl -X POST -H "Content-Type: application/json" -d '{}' http://webhooks.ivo-zilkenat.de/hooks/distributed-systems-io-deploy?secret=65VEmylIjfE4S1IHm9A77AzMuzcW22qyqFgoEKLINEg=
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,7 @@ packages/react-devtools-extensions/shared/build
packages/react-devtools-extensions/.tempUserDataDir
packages/react-devtools-inline/dist
packages/react-devtools-shell/dist
packages/react-devtools-timeline/dist
packages/react-devtools-timeline/dist

# Credentials file
services/game_server/data/credentials.json
18 changes: 14 additions & 4 deletions services/game_server/frontend/src/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,30 @@ export class Game {
this.app.stage.addChild(map);
map.interactive = true;
map.on('click', (evt: any) => {
if (this.player.canShoot) {
let angle = Math.atan2(evt.data.global.y - this.gameSize[1] / 2, evt.data.global.x - this.gameSize[0] / 2);
this.socket.emit("player_click", angle);
}
this.try_shoot([evt.data.global.x, evt.data.global.y]);
});
return map;
}

try_shoot(pos: number[]): void {
if(this.player.canShoot) {
let angle = Math.atan2(pos[1] - this.gameSize[1] / 2, pos[0] - this.gameSize[0] / 2);
this.socket.emit("player_click", angle);
}
}

loop(): void {
this.app.ticker.add(() => {
if (this.keys['right']) this.socket.emit('player_move', [1, 0]);
if (this.keys['left']) this.socket.emit('player_move', [-1, 0]);
if (this.keys['up']) this.socket.emit('player_move', [0, -1]);
if (this.keys['down']) this.socket.emit('player_move', [0, 1]);
if (this.keys['space']) {
// TODO fix this if you can
// const mousePosition = this.app.renderer.plugins.interaction.mouse.global; // @ts-ignore
// this.try_shoot([1, 3]);
console.log("pew pew");
};
this.leaderboardGraphic!.visible = this.keys['tab'];
this.draw();
});
Expand Down
1 change: 1 addition & 0 deletions services/game_server/frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
"esModuleInterop": true,

/* Bundler mode */
"moduleResolution": "bundler",
Expand Down
11 changes: 5 additions & 6 deletions services/matchmaking_server/backend/route_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ def get_servers():
color = "green" if server["status"] == "HEALTHY" else "yellow" if server["status"] == "UNHEALTHY" else "gray"
html = html + f'''
<tr>
<td class="border px-4 py-2 name">{server['name']}</td>
<td class="border px-4 py-2 url">{server['url']}</td>
<td class="border px-4 py-2 last_seen">{server['last_seen']}</td>
<td class="border px-4 py-2 player_count">{server['player_count']}</td>
<td class="border px-4 py-2 status">{server['status']}</td>
<td class="border px-4 py-2 ping">-</td>
<td class="border px-4 py-2">{server['name']}</td>
<td class="border px-4 py-2">{server['url']}</td>
<td class="border px-4 py-2">{server['last_seen']}</td>
<td class="border px-4 py-2">{server['player_count']}</td>
<td class="border px-4 py-2">{server['status']}</td>
<td class="border px-4 py-2">
<a class="bg-{color}-500 text-white px-4 py-2 rounded hover:bg-{color}-700" href="{server['url']}" target="_blank">Connect</a>
</td>
Expand Down
29 changes: 0 additions & 29 deletions services/matchmaking_server/frontend/js/ping.js

This file was deleted.

3 changes: 0 additions & 3 deletions services/matchmaking_server/frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
<title>Game Server Browser</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
<script src="https://unpkg.com/htmx.org@1.7.0"></script>
<script src="https://cdn.jsdelivr.net/gh/alfg/ping.js@0.2.2/dist/ping.min.js" type="text/javascript"></script>
<script src="/js/ping.js"></script>
</head>
<body class="bg-gray-100 flex items-center justify-center min-h-screen">
<div class="container mx-auto p-4">
Expand All @@ -26,7 +24,6 @@ <h1 class="text-2xl font-bold mb-4 text-center">Game Server Browser</h1>
<th class="px-4 py-2 text-left">Last Seen</th>
<th class="px-4 py-2 text-left">Player Count</th>
<th class="px-4 py-2 text-left">Status</th>
<th class="px-4 py-2 text-left">Ping</th>
<th class="px-4 py-2 text-left">Action</th>
</tr>
</thead>
Expand Down

0 comments on commit c26bb0d

Please sign in to comment.