diff --git a/common/user.py b/common/user.py index c278e73..fdf3160 100644 --- a/common/user.py +++ b/common/user.py @@ -9,7 +9,7 @@ def __init__(self, type, id="NOT_DEFINED"): # self.hp = random.randint(50, 100) self.hp = 50 # self.ap = random.randint(5, 20) - self.ap = 1 + self.ap = 10 elif type == USERS.PLAYER: # self.hp = random.randint(10, 20) diff --git a/server/network/base_server.py b/server/network/base_server.py index 3076c7c..552e091 100644 --- a/server/network/base_server.py +++ b/server/network/base_server.py @@ -38,7 +38,6 @@ def _listen(self): def on_connection(self, connection, address): pass - def broadcast(self, data, without=None, type=None): """ Broadcast the data to all connections except "without". @@ -49,7 +48,7 @@ def broadcast(self, data, without=None, type=None): if client_id != without: try: self.connections[client_id].send(data, type) - except BaseException as e: + except: logger.error("Failed sending message to {} : data {}".format(self.connections[client_id], data)) def remove_connection(self, id): diff --git a/server/network/udp_server.py b/server/network/udp_server.py index 97597ad..92ae524 100644 --- a/server/network/udp_server.py +++ b/server/network/udp_server.py @@ -52,6 +52,8 @@ def on_message(self, data, address): :param address: the udp address from where the received message was sent """ if data['type'] == MSG_TYPE.PING: + if self.delay <= 0: + self.delay = 0 time.sleep(self.delay) send_udp_message(self.socket, address, MSG_TYPE.PING) else: diff --git a/test/console_control.py b/test/console_control.py index 2c9f695..e2d32db 100644 --- a/test/console_control.py +++ b/test/console_control.py @@ -85,11 +85,11 @@ def start(id, master_node=False): port = id * 10000 arguments = ['python3.6', '-m', 'server.app', - '--config', 'test/das_config_console_control.json', + '--config', 'test/das_config.json', '--log-prefix', str(id), '--port', str(port)] if master_node: - arguments.extend(['--users', 'test/das_map.json']) + arguments.extend(['--users', 'test/das_hell.json']) print("Starting Server {} with {}".format(id, arguments)) @@ -146,7 +146,10 @@ def kill(id): client = clients[id] if client is None: return - client.kill() + try: + client.kill() + except: + pass clients[id] = None @staticmethod diff --git a/test/das_hell.json b/test/das_hell.json index 9ac4183..d296f22 100644 --- a/test/das_hell.json +++ b/test/das_hell.json @@ -17,5 +17,6 @@ {"type": "d", "r": 18, "c": 3}, {"type": "d", "r": 16, "c": 7}, {"type": "d", "r": 24, "c": 19}, + {"type": "d", "r": 13, "c": 9}, {"type": "d", "r": 20, "c": 2} ]