-
Notifications
You must be signed in to change notification settings - Fork 0
KestrelAPI
These are the basic achievement system functions of Kestrel. The main Kestrel object is a singleton which is created when the game first loads, and is never (read: should never) be destroyed.
Returns: achievement struct
| Parameter | Type | Description |
|---|---|---|
| name | string | The name of the achievement to add |
| description | string | The description of the achievement |
| notify_callback | function | A function callback which takes a data blob and evaluates whether the achievement should be unlocked or not |
| id | * | An identifier for the achievement; defaults to a numeric index |
Add an achievement to the system with a name and description. Strictly speaking, names do not have to be unique, although it is probably a good idea for them to be so.
The callback function is a function which runs whenever the achievement system is updated to see if the achievement in question should be unlocked or not. The function should take a single data parameter, and return a true or false value; for examples and more information, see the page on Kestrel Callbacks.
The id is a value to differentiate achievements in the system from each other. IDs must be unique. If you do not provide one, the system will create a numerical one for you. You can mix and match your own IDs with the auto-generated ones created by the system, but I do not recommend doing this. IDs that carry meaning are preferable, eg ACH_MADE_SOME_TOAST, ACH_MADE_MORE_TOAST, ACH_MASTER_OF_THE_TOAST vs 0, 1, 2.