-
Notifications
You must be signed in to change notification settings - Fork 0
/
signs.nut
42 lines (33 loc) · 828 Bytes
/
signs.nut
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
37
38
39
40
41
42
function SetConstructionSign(tile, task) {
AISign.RemoveSign(SIGN1);
if (!AIController.GetSetting("ActivitySigns")) return;
local text = task.tostring();
local space = text.find(" ");
if (space) {
text = text.slice(0, space);
}
text = text;
if (text.len() > 30) {
text = text.slice(0, 29);
}
SIGN1 = AISign.BuildSign(tile, text);
}
function SetSecondarySign(text) {
if (!AIController.GetSetting("ActivitySigns")) {
AISign.RemoveSign(SIGN2);
return;
}
if (text.len() > 30) {
text = text.slice(0, 29);
}
local tile = AISign.GetLocation(SIGN1) + AIMap.GetTileIndex(1, 1);
if (AISign.GetLocation(SIGN2) == tile) {
AISign.SetName(SIGN2, text);
} else {
AISign.RemoveSign(SIGN2);
SIGN2 = AISign.BuildSign(tile, text);
}
}
function ClearSecondarySign() {
AISign.RemoveSign(SIGN2);
}