X-Git-Url: https://plomlompom.com/repos/berlin_corona.txt?a=blobdiff_plain;f=plomrogue%2Fgame.py;h=10fcb12b19f3c7f644d11eb8376368d99c15028c;hb=856b68988876a63409737dac77b4d4921b9a466b;hp=6e8afdf83182dded8a25c735b94dc7cdc2a7095a;hpb=534f93bc6b5d46e282401c9698430f660b149fd6;p=plomrogue2 diff --git a/plomrogue/game.py b/plomrogue/game.py index 6e8afdf..10fcb12 100755 --- a/plomrogue/game.py +++ b/plomrogue/game.py @@ -210,6 +210,22 @@ class Game(GameBase): return '/O O\\' + '| oo |' + '\\>-- 0: + t_old = self.get_thing(id_) + t = self.thing_types[type_](self, id_=id_, position=position) + if t_old: + self.things[self.things.index(t_old)] = t + else: + self.things += [t] + self.changed_fovs = True + return t + def send_gamestate(self, connection_id=None): """Send out game state data relevant to clients.""" @@ -294,8 +310,7 @@ class Game(GameBase): t = self.get_player(connection_id) if hasattr(t, 'name'): self.io.send('CHAT ' + quote(t.name + ' left the map.')) - self.things.remove(t) - self.changed_fovs = True + self.remove_thing(t) to_delete += [connection_id] for connection_id in to_delete: del self.sessions[connection_id]