-
-
Notifications
You must be signed in to change notification settings - Fork 531
/
cam1-1s.js
79 lines (69 loc) · 1.93 KB
/
cam1-1s.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
include("script/campaign/libcampaign.js");
var cheat;
var powModVideoPlayed;
const mis_Labels = {
startPos: {x: 13, y: 52},
lz: {x: 10, y: 51, x2: 12, y2: 53},
trPlace: {x: 11, y: 52},
trExit: {x: 1, y: 32}
};
function eventChat(from, to, message)
{
if (camIsCheating() && message === "let me win")
{
cheat = true;
}
}
//Video if player does not yet have power module built
function resPowModVideo()
{
powModVideoPlayed = true;
camPlayVideos({video: "MB1_B2_MSG", type: MISS_MSG});
}
//Sector clear commander!
function secondVideo()
{
camPlayVideos({video: "SB1_1_MSG", type: MISS_MSG});
}
//Has player built the power module?
function powerModuleBuilt()
{
const gens = enumStruct(CAM_HUMAN_PLAYER, POWER_GEN, false);
for (let x = 0, l = gens.length; x < l; ++x)
{
if ((gens[x].modules > 0) && (gens[x].status === BUILT))
{
return true;
}
}
return false;
}
//Only way to pass this mission is to build a power module or be in cheat mode.
function checkForPowerModule()
{
if (cheat || powerModuleBuilt())
{
camSetupTransporter(mis_Labels.trPlace.x, mis_Labels.trPlace.y, mis_Labels.trExit.x, mis_Labels.trExit.y);
setMissionTime((tweakOptions.classicTimers) ? camMinutesToSeconds(15) : camChangeOnDiff(camMinutesToSeconds(25))); // 25 min for offworld
secondVideo();
if (powModVideoPlayed)
{
removeTimer("checkForPowerModule");
}
}
}
function eventStartLevel()
{
centreView(mis_Labels.startPos.x, mis_Labels.startPos.y);
setNoGoArea(mis_Labels.lz.x, mis_Labels.lz.y, mis_Labels.lz.x2, mis_Labels.lz.y2, CAM_HUMAN_PLAYER);
setMissionTime((tweakOptions.classicTimers) ? -1 : camChangeOnDiff(camMinutesToSeconds(10))); // 10 min for building module.
camSetStandardWinLossConditions(CAM_VICTORY_PRE_OFFWORLD, cam_levels.alpha3.offWorld);
cheat = false;
powModVideoPlayed = false;
if (!powerModuleBuilt())
{
resPowModVideo();
setTimer("checkForPowerModule", camSecondsToMilliseconds(3));
}
checkForPowerModule();
}