def create_timer(self, interval, callback, data, flags): def timer_callback(): # XXX: call this enter_frame instead? self.sys.runtime.amx._dummy_frame() self.sys.runtime.call_function(callback, data) # TODO: repeating timers self._timers.append((engine_time() + interval, timer_callback))
def create_timer(self, interval, callback, data, flags): handle_id = self.sys.handles.new_handle(None) # TODO: uhh, actual timer objects def timer_callback(): # XXX: call this enter_frame instead? # self.sys.runtime.amx._dummy_frame() return self.sys.runtime.call_function(callback, handle_id, data) # TODO: repeating timers self._timers.append((engine_time() + interval, timer_callback)) return handle_id
def create_timer(self, interval, callback, data, flags): handle_id = self.sys.handles.new_handle( None) # TODO: uhh, actual timer objects def timer_callback(): # XXX: call this enter_frame instead? # self.sys.runtime.amx._dummy_frame() return self.sys.runtime.call_function(callback, handle_id, data) # TODO: repeating timers self._timers.append((engine_time() + interval, timer_callback)) return handle_id
def tick(self): self.last_tick = engine_time()