require("multi") function multi:newTStep(start,reset,count,set) local c=self:newBase() think=1 c.Type='tstep' c.Priority=self.Priority_Low c.start=start or 1 local reset = reset or math.huge c.endAt=reset c.pos=start or 1 c.skip=skip or 0 c.count=count or 1*think c.funcE={} c.timer=self.clock() c.set=set or 1 c.funcS={} function c:Update(start,reset,count,set) self.start=start or self.start self.pos=self.start self.endAt=reset or self.endAt self.set=set or self.set self.count=count or self.count or 1 self.timer=self.clock() self:Resume() end function c:tofile(path) local m=bin.new() m:addBlock(self.Type) m:addBlock(self.func) m:addBlock(self.funcE) m:addBlock(self.funcS) m:addBlock({pos=self.pos,endAt=self.endAt,skip=self.skip,timer=self.timer,count=self.count,start=self.start,set=self.set}) m:addBlock(self.Active) m:tofile(path) end function c:Act() if self.clock()-self.timer>=self.set then self:Reset() if self.pos==self.start then for fe=1,#self.funcS do self.funcS[fe](self) end end for i=1,#self.func do self.func[i](self.pos,self) end self.pos=self.pos+self.count if self.pos-self.count==self.endAt then self:Pause() for fe=1,#self.funcE do self.funcE[fe](self) end self.pos=self.start end end end function c:OnStart(func) table.insert(self.funcS,func) end function c:OnStep(func) table.insert(self.func,func) end function c:OnEnd(func) table.insert(self.funcE,func) end function c:Break() self.Active=nil end function c:Reset(n) if n then self.set=n end self.timer=self.clock() self:Resume() end self:create(c) return c end