Skip to content

Commit d1199cd

Browse files
committed
Update docs to new architecture
1 parent 253bd83 commit d1199cd

File tree

1 file changed

+10
-10
lines changed
  • common/src/main/kotlin/com/lambda/task

1 file changed

+10
-10
lines changed

common/src/main/kotlin/com/lambda/task/Task.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,21 @@ import org.apache.commons.lang3.time.DurationFormatUtils
2323
import java.awt.Color
2424

2525
/**
26-
* A [Task] represents a time-critical activity that executes a suspending action function.
27-
* It is designed to automate in-game activities without the need for strict event-based programming,
28-
* thanks to the use of suspending functions which allow for linear coding.
26+
* A [Task] represents a time-critical activity.
27+
* It automates in-game activities through event-based programming, leveraging game events to control task flow.
2928
*
3029
* [Result] is the type of the result that the task will return when it completes successfully.
3130
* In case the task should not return any result, [Unit] can be used as the type.
3231
*
33-
* A [Task] can have event listeners, but they are only active while the action function is running.
32+
* A [Task] can have event listeners that are active while the task is running.
33+
* The task will attempt to execute its subtasks sequentially, and can either keep listening
34+
* or stop receiving events while the subtasks are running.
3435
*
3536
* It supports a builder pattern, allowing you to chain configuration methods like [withDelay],
3637
* [withTimeout], [withMaxAttempts], [withRepeats], [onSuccess], [onRetry], [onTimeout], [onFailure], and [onRepeat]
3738
* to construct a [Task] instance.
3839
* This makes it easy to build complex flows of nested tasks.
3940
*
40-
* CAUTION: When implementing the [onAction] function,
41-
* ensure that the function adheres to thread safety measures.
42-
* This includes avoiding write operations on non-synchronized in-game data
43-
* unless explicitly running on the game thread using `runSafeOnGameThread { ... }`.
44-
*
4541
* @property delay The delay before the task starts, in milliseconds.
4642
* @property timeout The maximum time that the task is allowed to run, in milliseconds.
4743
* @property tries The maximum number of attempts to execute the task before it is considered failed.
@@ -125,8 +121,12 @@ abstract class Task<Result>(
125121
}
126122
}
127123

124+
/**
125+
* "Typo" in name is used to force the dsl style green
126+
* (color is based on name hash, don't ask me who came up with this)
127+
*/
128128
@DslMarker
129-
annotation class Ta5kBuilder // Name is used to force the dsl style yellow (name hash)
129+
annotation class Ta5kBuilder
130130

131131
@Ta5kBuilder
132132
open fun SafeContext.onStart() {}

0 commit comments

Comments
 (0)