TaskService
Noir.Services.TaskService: NoirService
A service for easily delaying or repeating tasks.
Handles tick iteration processes.
Used internally.
Handles tasks.
Used internally.
Add a task to the TaskService.
Used internally.
Parameters
callback
: functionduration
: numberarguments
: tableisRepeating
: booleantaskType
: NoirTaskTypestartedAt
: number
Returns
NoirTask
Returns whether or not a task type is valid.
Used internally.
Parameters
taskType
: string
Returns
boolean
Returns the current time in seconds.
Equivalent to: server.getTimeMillisec() / 1000
Returns
number
Creates and adds a task to the TaskService using the task type "Time"
.
This is less accurate than the other task types as it uses time to determine when to run the task. This is more convenient though.
Parameters
callback
: functionduration
: number - In secondsarguments
: table|nilisRepeating
: boolean|nil
Returns
NoirTask
β οΈ | Deprecated. Do not use.
This is deprecated. Please use :AddTimeTask()
.
Parameters
callback
: functionduration
: number - In secondsarguments
: table|nilisRepeating
: boolean|nil
Returns
NoirTask
Creates and adds a task to the TaskService using the task type "Ticks"
.
This is more accurate as it uses ticks to determine when to run the task.
It is highly recommended to multiply any calculations by Noir.Services.TaskService.DeltaTicks
to account for when all players sleep.
Parameters
callback
: functionduration
: integer - In ticksarguments
: table|nilisRepeating
: boolean|nil
Returns
NoirTask
Converts seconds to ticks, accounting for TPS.
Parameters
seconds
: integer
Returns
integer
Converts ticks to seconds, accounting for TPS.
Parameters
ticks
: integer
Returns
number
Returns all active tasks.
Parameters
copy
: boolean|nil
Returns
table<integer, NoirTask>
Removes a task.
Parameters
task
: NoirTask
Iterate a table over how many necessary ticks in chunks of x.
Useful for iterating through large tables without freezes due to taking too long in a tick.
Works for sequential and non-sequential tables, although order is NOT guaranteed.
Parameters
tbl
: table<integer, any>chunkSize
: integer - How many values to iterate per tickcallback
: fun(value: - any, currentTick: integer|nil, completed: boolean|nil)currentTick
andcompleted
are never nil. They are marked as so to mark the paramters as optional
Returns
NoirTickIterationProcess
Get all active tick iteration processes.
Parameters
copy
: boolean|nil
Returns
table<integer, NoirTickIterationProcess>
Removes a tick iteration process.
Parameters
tickIterationProcess
: NoirTickIterationProcess
Last updated