Skip to content

Commit

Permalink
#267 Added Position reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
lxgr-linux committed May 10, 2023
1 parent 672389b commit 7c215ba
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pokete.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ def set_args(self, _si):
mvp.movemap.balls_label_rechar(self.pokes)
mvp.movemap.add_obs()

def set(self, x, y):
if super().set(x, y) == 0 and modeProvider.mode == Mode.MULTI:
connector.connector.send_pos_update(self.map.name, x, y)

def add_money(self, money):
"""Adds money
ARGS:
Expand Down
16 changes: 16 additions & 0 deletions pokete_classes/multiplayer/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,22 @@ def establish_connection(self):
)
return False

def send_pos_update(self, _map, x, y):
self.connection.sendall(
str.encode(
json.dumps(
{
"Type": 0,
"Body": {
"Map": _map,
"X": x,
"Y": y,
},
}
)
)
)

def handshake(self):
self.connection.sendall(
str.encode(
Expand Down

0 comments on commit 7c215ba

Please sign in to comment.