- commit
- 5d60676828fd6760ea15bd6bf959235ba4e91b7f
- parent
- a2ad45eaaeb43e0d180c0f40495bbc74d66bc340
- Author
- Tobias Bengfort <tobias.bengfort@gmx.net>
- Date
- 2014-11-01 10:41
new action: get_map
Diffstat
| M | laneya/actions.py | 5 | +++++ |
| M | laneya/map.py | 8 | ++++++++ |
| M | laneya/server.py | 2 | ++ |
3 files changed, 15 insertions, 0 deletions
diff --git a/laneya/actions.py b/laneya/actions.py
@@ -35,3 +35,8 @@ def logout(): 35 35 36 36 There is no explicit login. The user is created on her initial request. 37 37 """ -1 38 -1 39 -1 40 def get_map(map_id): -1 41 """Ask the server to send a serialisation of the specified map. """ -1 42 pass
diff --git a/laneya/map.py b/laneya/map.py
@@ -54,6 +54,14 @@ class Map(object): 54 54 y=sprite.y, 55 55 entity=sprite.id) 56 56 -1 57 def encode(self): -1 58 return { -1 59 'floor_layer': self.floor_layer, -1 60 } -1 61 -1 62 def decode(self, data): -1 63 self.floor_layer = data['floor_layer'] -1 64 57 65 58 66 class Sprite(object): 59 67 """Simple base class for visible game objects."""
diff --git a/laneya/server.py b/laneya/server.py
@@ -26,6 +26,8 @@ class Server(protocol.ServerProtocolFactory): 26 26 self.users[user].kill() 27 27 del self.users[user] 28 28 print("logout %s" % user) -1 29 elif action == 'get_map': -1 30 return self.map.encode() 29 31 else: 30 32 raise protocol.InvalidError 31 33