X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/ledger2?a=blobdiff_plain;f=plomrogue%2Fthings.py;h=3b00d1fd79b86c183f04f21f9b3d4a965f5f575f;hb=40cc80146755188192b5f24834d997dd7c32c49c;hp=1c99737c039390938804d467d8e9a490e2dc2a67;hpb=d56384f9b6c88bab666162a0f97d7e64f2b3951c;p=plomrogue2 diff --git a/plomrogue/things.py b/plomrogue/things.py index 1c99737..3b00d1f 100644 --- a/plomrogue/things.py +++ b/plomrogue/things.py @@ -313,6 +313,7 @@ class ThingAnimate(Thing): if self.game.sessions[c_id]['thing_id'] == self.id_: self.game.io.send('DEFAULT_COLORS', c_id) self.game.io.send('CHAT "You sober up."', c_id) + break self.game.changed = True self._fov = None if self.task is None: @@ -329,15 +330,28 @@ class ThingAnimate(Thing): self.game.changed = True self.task = self.get_next_task() + def prepare_multiprocessible_fov_stencil(self): + fov_map_class = self.game.map_geometry.fov_map_class + fov_radius = 3 if self.drunk > 0 else 12 + self._fov = fov_map_class(self.game.things, self.game.maps, + self.position, fov_radius, self.game.get_map) + + def multiprocessible_fov_stencil(self): + self._fov.init_terrain() + @property def fov_stencil(self): if self._fov: return self._fov - fov_map_class = self.game.map_geometry.fov_map_class - self._fov = fov_map_class(self.game.things, self.game.maps, self.position, - 12, self.game.get_map) + # due to the pre-multiprocessing in game.send_gamestate, + # the following should actually never be called + self.prepare_multiprocessible_fov_stencil() + self.multiprocessible_fov_stencil() return self._fov + def fov_stencil_make(self): + self._fov.make() + def fov_test(self, big_yx, little_yx): test_position = self.fov_stencil.target_yx(big_yx, little_yx) if self.fov_stencil.inside(test_position):