openmod
openmod copied to clipboard
Run jobs on events
Example autoexec.yaml:
- name: Hardcore Mode
schedule: '@event:PlayerDeath'
task: openmod_command
args:
commands:
- 'ban {Event.Player.Id}'
enabled: false
Would require that the event bus allows you to subscribe to IEvent directly - don't know if that's currently possible. Would also need an efficient way to match "PlayerDeath" string to "PlayerDeathEvent" class. Assuming event class names must be unique, it should cache the match and not look it up again on every event.
This syntax would be better
- name: Hardcore Mode
schedule: event
task: openmod_command
args:
event: PlayerDeath
commands:
- 'ban {Event.Player.Id}'
enabled: false
I just refactored all other jobs to not use args for scheduling; e.g:
- name: OpenMod Auto Update
schedule: 'crontab'
task: openmod_command
args:
period: '0 0 * * 0'
commands:
- openmod upgrade
- openmod restart
enabled: true
became
- name: OpenMod Auto Update
schedule: '0 0 * * 0'
task: openmod_command
args:
commands:
- openmod upgrade
- openmod restart
enabled: true
See latest autoexec.yaml file.
So I think using @event:<name> would be more consistent.