def start(self): sim_debugger = None self.sim_timeline = scheduling.Timeline( services.game_clock_service().now(), exception_reporter=self._on_exception, debugger=sim_debugger) self.wall_clock_timeline = scheduling.Timeline( services.server_clock_service().now(), exception_reporter=self._on_exception) self.sim_timeline.on_time_advanced.append(caches.clear_all_caches)
def remove_immediate(si): (actor, _) = SIState._get_actor_and_target_sim_from_si(si) def _remove_gen(timeline): result = yield actor.si_state._remove_gen(timeline, si, allow_yield=False) return result reset_timeline = scheduling.Timeline(services.time_service().sim_timeline.now) reset_timeline.schedule(elements.GeneratorElement(_remove_gen)) reset_timeline.simulate(reset_timeline.now) if reset_timeline.heap: logger.error('On reset, remove_immediate timeline is not empty')
def _create_save_timeline(self): self._destroy_save_timeline(self.save_timeline) self.save_timeline = scheduling.Timeline(services.time_service().sim_now)