Skip to content

Commit

Permalink
added b | bullet console command
Browse files Browse the repository at this point in the history
added command to view current bullets to server
  • Loading branch information
moltenwolfcub committed Dec 24, 2024
1 parent e4afa9b commit 116f677
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions common/bullet.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ def decode(bytes: bytes) -> 'CommonBullet':
y = int.from_bytes(bytes[2:4])

return CommonBullet(pos=Vec2D(x, y))

def __str__(self) -> str:
return f"Bullet[pos= {self.pos}]"

def __eq__(self, other: object) -> bool:
if not isinstance(other, CommonBullet):
Expand Down
8 changes: 8 additions & 0 deletions server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,14 @@ def console_loop(self) -> None:
if len(self.game.players) == 0:
print("empty")

case "b" | "bullets":
print("BULLETS:")
for b in self.game.bullets:
print(f"- {b}")

if len(self.game.bullets) == 0:
print("empty")

case "c" | "connections":
print("CONNECTIONS:")
for c, id in self.open_connections.items():
Expand Down

0 comments on commit 116f677

Please sign in to comment.