This repository has been archived by the owner on Aug 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement backpack logic * Serialise backpack and update artefact serialisation * Run Black * Start implement log collector * Show both worker and avatar logs to console * Add log collector and socketio tests * Create BACKPACK_SIZE attribute * Merge branch 'development' into implement_backpack # Conflicts: # aimmo/__init__.py * Fix test and type backpack * Bring back previous PR changes * Move things around * Fix tests * Move log clearing to game runner and avatar manager * Add LogCollector docstring * Run Black * Refactor Mock classes and use pytest * Merge in_backpack and pickup_action_applied * Make worker logs a list too * rewrite ui for console log to better distinguish individual logs Signed-off-by: Niket Shah <masterniket@gmail.com> * Use core-js@3 Signed-off-by: Niket Shah <masterniket@gmail.com> * remove debugging console logs Signed-off-by: Niket Shah <masterniket@gmail.com> * use core-js@3 Signed-off-by: Niket Shah <masterniket@gmail.com> * Fix and add tests for new console log implementation Signed-off-by: Niket Shah <masterniket@gmail.com> * remove horizontal scroll overflow check for console logs Signed-off-by: Niket Shah <masterniket@gmail.com> * refactor overflow detecting logic Signed-off-by: Niket Shah <masterniket@gmail.com> * Remove obsolete snapshot test
- Loading branch information
1 parent
38b7617
commit 372406c
Showing
56 changed files
with
1,855 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
class LogCollector: | ||
""" | ||
This class aggregates: | ||
- the worker logs (logs coming from the worker) | ||
- the avatar logs (logs outputted by the game under certain conditions) | ||
These logs are concatenated to form the `player_logs`. | ||
""" | ||
|
||
def __init__(self, worker_manager, avatar_manager): | ||
super(LogCollector, self).__init__() | ||
|
||
self.worker_manager = worker_manager | ||
self.avatar_manager = avatar_manager | ||
|
||
def collect_logs(self, user_id): | ||
worker = self.worker_manager.player_id_to_worker[user_id] | ||
avatar = self.avatar_manager.get_avatar(user_id) | ||
|
||
player_logs = "" | ||
for worker_log in worker.logs: | ||
player_logs += worker_log | ||
|
||
if len(avatar.logs) > 0: | ||
player_logs += "\n" | ||
player_logs += "\n".join(avatar.logs) | ||
|
||
return player_logs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.