share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/global_functions.lua
branchspacecampaign
changeset 9636 e1921235fc78
parent 9630 df942cfac4e6
child 9718 563a34cd8398
equal deleted inserted replaced
9635:ea454f8a1593 9636:e1921235fc78
     1 function saveCompletedStatus(planetNum)
     1 function saveCompletedStatus(planetNum)
     2 	--        1       2        3        4      5         6
     2 	--        1       2        3        4      5         6        7
     3 	-- order: moon01, fruit01, fruit02, ice01, desert01, death01
     3 	-- order: moon01, fruit01, fruit02, ice01, desert01, death01, final
     4 	local status = "000000"
     4 	local status = "0000000"
     5 	if tonumber(GetCampaignVar("MainMissionsStatus")) then
     5 	if tonumber(GetCampaignVar("MainMissionsStatus")) then
     6 		status = GetCampaignVar("MainMissionsStatus")
     6 		status = GetCampaignVar("MainMissionsStatus")
     7 	end
     7 	end
     8 	if i == 1 then
     8 	if i == 1 then
     9 		status = "1"..status:sub(planetNum+1)
     9 		status = "1"..status:sub(planetNum+1)
    24 		moon01 = false,
    24 		moon01 = false,
    25 		fruit01 = false,
    25 		fruit01 = false,
    26 		fruit02 = false,
    26 		fruit02 = false,
    27 		ice01 = false,
    27 		ice01 = false,
    28 		desert01 = false,
    28 		desert01 = false,
    29 		death01 = false
    29 		death01 = false,
       
    30 		final = false
    30 	}
    31 	}
    31 	if allStatus ~= "" then
    32 	if allStatus ~= "" then
    32 		if allStatus:sub(1,1) == "1" then
    33 		if allStatus:sub(1,1) == "1" then
    33 			status.moon01 = true
    34 			status.moon01 = true
    34 		end
    35 		end
    44 		if allStatus:sub(5,5) == "1" then
    45 		if allStatus:sub(5,5) == "1" then
    45 			status.desert01 = true
    46 			status.desert01 = true
    46 		end
    47 		end
    47 		if allStatus:sub(6,6) == "1" then
    48 		if allStatus:sub(6,6) == "1" then
    48 			status.death01 = true
    49 			status.death01 = true
       
    50 		end
       
    51 		if allStatus:sub(7,7) == "1" then
       
    52 			status.final = true
    49 		end
    53 		end
    50 	end
    54 	end
    51 	return status
    55 	return status
    52 end
    56 end
    53 
    57