yl_scheduler/README.md
2024-04-02 14:27:33 +02:00

3.8 KiB

yl_scheduler

Purpose

This mod allows you to tie the execution of tasks to real life utc time.

Download

Get it from https://gitea.your-land.de/your-land/yl_scheduler

Installation

Being a template, you shouldn't install the mod itself. Your mod could look like this:

Configuration

yl_scheduler.execution_interval = 1.0

Set this to a higher value for less lag but also less precision.

yl_scheduler.save_path

Set this to where in the worldfolder you want the JSON files stored.

yl_scheduler.taskadd_privs
yl_scheduler.taskremove_privs
yl_scheduler.tasklist_privs
yl_scheduler.taskclean_privs

Set those to the list of privs you want to allow the execution of the corresponding commands

Usage

This mod targets servers, but should work in singleplayer, too. It comes with no direct content but exposes functions you can use in your mod.

Chatcommands

/scheduler_add time$function$param1, param2, param3, ...$notes

Adds a new task that executes function with params at the given time and optionally adds notes

time: At best a utc timestamp, at worst some natural time. See [### Supported Time formats]

function: A public function

parameter list: Please note parameters handed over this way are all strings, your function needs to handle that itself

notes: Optionally add notes to that task, so you don't have to guess what it is about

/scheduler_remove <UUID>

Removes the given UUID from the task list.

Example: /scheduler_remove 8d3f379f-3c13-4c2e-bb72-16f8326b636d

/scheduler_list <UUID|key=aaa>

Without parameters, lists ALL tasks - be careful, that may be a lot. Example: /scheduler_list

With parameter it lists all tasks where the UUID contains the parameter. Example: /scheduler_list 379f

With parameter key=mystring it returns all tasks where the given key contains "mystring". Example: /scheduler_list notes=changes the spawnpoint

/scheduler_clean

Cleans up the past tasks. Old tasks are permanently deleted.

Modmakers

Supported Time formats

  • utc timestamp. Example: 1712045385
  • natural time. Examples: "00:00", "09:45:00", "18" without date, "2.4.2024 18:00" or "02.04.2024 18:00"
  • professional time. Examples: "2400", "0945", "1800" without date, "20240402_1800" with date
  • YYYY-MM-DDTHH:MM:SS Examples: "2024-04-02T13:45:30"

What you leave out will be assumed. If given without seconds or minutes, both values will be 00, if given without date, it will be assumed you mean "today"

The mod will try to determine what you mean and refuse to create a task if it doesn't understand

Limitations

Some of those limitations may be addressed in a future update

  • UTC is the only supported timezone
  • No catchup scheduling! Means if multiple tasks would have fired while the server was down, they will ALL fire at the next available step!
  • Your responsibility to load the mapblocks you want to work in and similar
  • The parameter list of the /scheduler_add should support
  • There is no setting to execute the function in a safe manner, via pcall or
  • There is no setting to automatically cleanup

Alternatives

No direct alternatives, but somewhat related:

  • Snippets (Allows you to execute code at server start)
  • minetest.after (Allows you to periodically execute functions)

Supported versions

If you run yl_scheduler, but something is wrong, please file a bug. PRs also welcome.

There is no reason to believe it doesn't work anywhere, but you never know.

Allied projects

If you know a project that uses this mod tell us and we will add it to the list.

Uninstall

Remove it from your mod folder or deactivate it in your world.mt

Mods that depend on it will cease to work, if the mod is removed without proper replacement.

License

MIT

Thank you