share/hedgewars/Data/Scripts/SimpleMission.lua
changeset 13057 8b44518d1002
parent 13055 5ceb8b0632c4
child 13059 2f21d92eae27
equal deleted inserted replaced
13056:b1a230d21a48 13057:8b44518d1002
   120 				blowing up a crate which you should have collected.ed.
   120 				blowing up a crate which you should have collected.ed.
   121 	- customNonGoals	Table of non-goals, the player loses if one of them is achieved
   121 	- customNonGoals	Table of non-goals, the player loses if one of them is achieved
   122 	- customGoalCheck	When to check goals and non-goals. Values: "instant" (default), "turnStart", "turnEnd"
   122 	- customGoalCheck	When to check goals and non-goals. Values: "instant" (default), "turnStart", "turnEnd"
   123 
   123 
   124 	- missionTitle:		The name of the mission (highly recommended)
   124 	- missionTitle:		The name of the mission (highly recommended)
       
   125 	- missionIcon:		Icon of the mission panel, see documentation of ShowMission in the Lua API
   125 	- goalText:		A short string explaining the goal of the mission (use this if you set custom goals).
   126 	- goalText:		A short string explaining the goal of the mission (use this if you set custom goals).
   126 
   127 
   127 	GOAL TYPES:
   128 	GOAL TYPES:
   128 	- type			name of goal type
   129 	- type			name of goal type
   129 	- failText		Optional. For non-goals, this text will be shown in the stats if mission fails due to this non-goal
   130 	- failText		Optional. For non-goals, this text will be shown in the stats if mission fails due to this non-goal
   247 -- This function generates the mission. See above for the meaning of params.
   248 -- This function generates the mission. See above for the meaning of params.
   248 function SimpleMission(params)
   249 function SimpleMission(params)
   249 	if params.missionTitle == nil then
   250 	if params.missionTitle == nil then
   250 		params.missionTitle = loc("Scenario")
   251 		params.missionTitle = loc("Scenario")
   251 	end
   252 	end
       
   253 	if params.missionIcon == nil then
       
   254 		params.missionIcon = 1 -- target icon
       
   255 	end
   252 	if params.goalText == nil then
   256 	if params.goalText == nil then
   253 		params.goalText = loc("Defeat the enemy!")
   257 		params.goalText = loc("Defeat the enemy!")
   254 	end
   258 	end
   255 	if params.customGoalCheck == nil and (params.customGoals ~= nil or params.customNonGoals ~= nil) then
   259 	if params.customGoalCheck == nil and (params.customGoals ~= nil or params.customNonGoals ~= nil) then
   256 		params.customGoalCheck = "instant"
   260 		params.customGoalCheck = "instant"
   743 				params.goalText = params.goalText .. "|" .. string.format(loc("Mines time: %.1fs"), MinesTime/1000)
   747 				params.goalText = params.goalText .. "|" .. string.format(loc("Mines time: %.1fs"), MinesTime/1000)
   744 			else
   748 			else
   745 				params.goalText = params.goalText .. "|" .. string.format(loc("Mines time: %.2fs"), MinesTime/1000)
   749 				params.goalText = params.goalText .. "|" .. string.format(loc("Mines time: %.2fs"), MinesTime/1000)
   746 			end
   750 			end
   747 		end
   751 		end
   748 		ShowMission(params.missionTitle, loc("Scenario"), params.goalText, 1, 5000) 
   752 		ShowMission(params.missionTitle, loc("Scenario"), params.goalText, params.missionIcon, 5000) 
   749 
   753 
   750 		-- Spawn objects
   754 		-- Spawn objects
   751 
   755 
   752 		if params.gears ~= nil then
   756 		if params.gears ~= nil then
   753 			for listGearID, gv in pairs(params.gears) do
   757 			for listGearID, gv in pairs(params.gears) do