pumpkin-api-d/src/wit/pumpkin/plugin/scheduler/imports.d
Demetrius Kanios facbde984e Initial setup
2026-09-16 21:31:34 -07:00

61 lines
2.2 KiB
D

/++
Provides functionality to schedule tasks to be executed later on the server.
+/
module wit.pumpkin.plugin.scheduler.imports;
import wit.common;
public import wit.pumpkin.plugin.scheduler.common;
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
/++
Schedules a task to be executed once after the specified number of ticks.
* `handler-id`: The unique ID of the handler to call when the task executes.
* `delay-ticks`: The number of game ticks to wait before execution (20 ticks = 1 second).
Returns a unique task ID that can be used to cancel the task.
+/
uint scheduleDelayedTask(uint handlerId, ulong delayTicks) @trusted nothrow {
auto _ret = __import_scheduleDelayedTask(handlerId, delayTicks);
return _ret;
}
/// ditto
@wasmImport!("pumpkin:plugin/scheduler@0.1.0", "schedule-delayed-task")
pragma(mangle, "__wit_import_pumpkin:plugin__scheduler@0.1.0__schedule_delayed_task")
private extern(C) uint __import_scheduleDelayedTask(uint, ulong) nothrow;
/++
Schedules a task to be executed repeatedly.
* `handler-id`: The unique ID of the handler to call when the task executes.
* `delay-ticks`: The number of game ticks to wait before the first execution.
* `period-ticks`: The number of game ticks between subsequent executions.
Returns a unique task ID that can be used to cancel the task.
+/
uint scheduleRepeatingTask(uint handlerId, ulong delayTicks, ulong periodTicks) @trusted nothrow {
auto _ret = __import_scheduleRepeatingTask(handlerId, delayTicks, periodTicks);
return _ret;
}
/// ditto
@wasmImport!("pumpkin:plugin/scheduler@0.1.0", "schedule-repeating-task")
pragma(mangle, "__wit_import_pumpkin:plugin__scheduler@0.1.0__schedule_repeating_task")
private extern(C) uint __import_scheduleRepeatingTask(uint, ulong, ulong) nothrow;
/++
Cancels a scheduled task if it hasn't finished yet.
* `task-id`: The ID of the task to cancel.
+/
void cancelTask(uint taskId) @trusted nothrow {
__import_cancelTask(taskId);
}
/// ditto
@wasmImport!("pumpkin:plugin/scheduler@0.1.0", "cancel-task")
pragma(mangle, "__wit_import_pumpkin:plugin__scheduler@0.1.0__cancel_task")
private extern(C) void __import_cancelTask(uint) nothrow;