-
Notifications
You must be signed in to change notification settings - Fork 2
/
staff-tools.js
36 lines (30 loc) · 1.06 KB
/
staff-tools.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Sample script that adds functions for manipulating staff
var hireNewHandyman = function () {
// These are arguments to the game action.
const args = {
autoPosition: true,
staffType: 0, // 0: handyman, 1: mechanic, 2: security, 3: entertainer
entertainerType: 0,
staffOrders: (1 << 0) | (1 << 2) // Set the handyman to sweep and empty bins. See STAFF_ORDERS in openrct2/entity/Staff.h
};
// This function receives the result of the game action.
const callback = function (result) {
if (result.error === 0) {
console.log("Hired a new handyman with ID " + result.peep + ".");
} else {
console.log("Failed to hire a new handyman!");
}
};
context.executeAction("staffhire", args, callback);
}
var main = function () {
// Add menu item under the map icon on the top toolbar
ui.registerMenuItem("Hire new handyman", hireNewHandyman);
};
registerPlugin({
name: 'Staff Tools',
version: '1.0',
authors: ['OpenRCT2'],
type: 'remote',
main: main
});