equal
deleted
inserted
replaced
|
1 function saveCompletedStatus(planetNum) |
|
2 -- 1 2 3 4 5 6 |
|
3 -- order: moon01, fruit01, fruit02, ice01, desert01, death01 |
|
4 local status = "000000" |
|
5 if tonumber(GetCampaignVar("MainMissionsStatus")) then |
|
6 status = GetCampaignVar("MainMissionsStatus") |
|
7 end |
|
8 if i == 1 then |
|
9 status = "1"..status:sub(planetNum+1) |
|
10 elseif i == status:len() then |
|
11 status = status:sub(1,planetNum-1).."1" |
|
12 else |
|
13 status = status:sub(1,planetNum-1).."1"..status:sub(planetNum+1) |
|
14 end |
|
15 SaveCampaignVar("MainMissionsStatus",status) |
|
16 end |
|
17 |
|
18 function getCompletedStatus() |
|
19 local allStatus = "" |
|
20 if tonumber(GetCampaignVar("MainMissionsStatus")) then |
|
21 allStatus = GetCampaignVar("MainMissionsStatus") |
|
22 end |
|
23 local status = { |
|
24 moon01 = false, |
|
25 fruit01 = false, |
|
26 fruit02 = false, |
|
27 ice01 = false, |
|
28 desert01 = false, |
|
29 death01 = false |
|
30 } |
|
31 if allStatus ~= "" then |
|
32 if allStatus:sub(1,1) == "1" then |
|
33 status.moon01 = true |
|
34 end |
|
35 if allStatus:sub(2,2) == "1" then |
|
36 status.fuit01 = true |
|
37 end |
|
38 if allStatus:sub(3,3) == "1" then |
|
39 status.fruit02 = true |
|
40 end |
|
41 if allStatus:sub(4,4) == "1" then |
|
42 status.ice01 = true |
|
43 end |
|
44 if allStatus:sub(5,5) == "1" then |
|
45 status.desert01 = true |
|
46 end |
|
47 if allStatus:sub(6,6) == "1" then |
|
48 status.death01 = true |
|
49 end |
|
50 end |
|
51 return status |
|
52 end |