share/hedgewars/Data/Scripts/TargetPractice.lua
changeset 14648 be8af70adf2c
parent 14594 825fe522f4f1
child 14654 8bd005067f4a
equal deleted inserted replaced
14647:c09ac49ed1de 14648:be8af70adf2c
    94 	- wind:		the initial wind (-100 to 100) (default: 0 (no wind))
    94 	- wind:		the initial wind (-100 to 100) (default: 0 (no wind))
    95 	- solidLand:	weather the terrain is indestructible (default: false)
    95 	- solidLand:	weather the terrain is indestructible (default: false)
    96 	- artillery:	if true, the hog can’t move (default: false)
    96 	- artillery:	if true, the hog can’t move (default: false)
    97 	- secGearType:	cluster of projectile gear (if present) (used to re-center camera)
    97 	- secGearType:	cluster of projectile gear (if present) (used to re-center camera)
    98 	- clanColor:	color of the (only) clan (default: -1, default first clan color)
    98 	- clanColor:	color of the (only) clan (default: -1, default first clan color)
       
    99 	- faceLeft:	if true, hog starts facing left, otherwise right (default: false)
    99 	- goalText:	A short string explaining the goal of the mission
   100 	- goalText:	A short string explaining the goal of the mission
   100 			(default: "Destroy all targets within the time!")
   101 			(default: "Destroy all targets within the time!")
   101 	- shootText:	A string which says how many times the player shot, “%d” is replaced
   102 	- shootText:	A string which says how many times the player shot, “%d” is replaced
   102 			by the number of shots. (default: "You have shot %d times.")
   103 			by the number of shots. (default: "You have shot %d times.")
   103 	- useRadar	Whether to use target radar (small circles that mark the position
   104 	- useRadar	Whether to use target radar (small circles that mark the position
   113 
   114 
   114 function TargetPracticeMission(params)
   115 function TargetPracticeMission(params)
   115 	if params.goalText == nil then params.goalText = loc("Eliminate all targets before your time runs out.|You have unlimited ammo for this mission.") end
   116 	if params.goalText == nil then params.goalText = loc("Eliminate all targets before your time runs out.|You have unlimited ammo for this mission.") end
   116 	if params.shootText == nil then params.shootText = loc("You have shot %d times.") end
   117 	if params.shootText == nil then params.shootText = loc("You have shot %d times.") end
   117 	if params.clanColor == nil then params.clanColor = -1 end
   118 	if params.clanColor == nil then params.clanColor = -1 end
       
   119 	if params.faceLeft == nil then params.faceLeft = false end
   118 	if params.wind == nil then params.wind = 0 end
   120 	if params.wind == nil then params.wind = 0 end
   119 	if params.radarTint == nil then params.radarTint = 0xFF3030FF end
   121 	if params.radarTint == nil then params.radarTint = 0xFF3030FF end
   120 	if params.useRadar == nil then params.useRadar = true end
   122 	if params.useRadar == nil then params.useRadar = true end
   121 
   123 
   122 	local solid, artillery
   124 	local solid, artillery
   156 
   158 
   157 		AddMissionTeam(params.clanColor)
   159 		AddMissionTeam(params.clanColor)
   158 
   160 
   159 		player = AddMissionHog(1)
   161 		player = AddMissionHog(1)
   160 		SetGearPosition(player, params.hog_x, params.hog_y)
   162 		SetGearPosition(player, params.hog_x, params.hog_y)
       
   163 		HogTurnLeft(player, params.faceLeft)
   161 
   164 
   162 		local won = GetMissionVar("Won")
   165 		local won = GetMissionVar("Won")
   163 		-- Unlock the target radar when the player has completed
   166 		-- Unlock the target radar when the player has completed
   164 		-- the target practice before (any score).
   167 		-- the target practice before (any score).
   165 		-- Target radar might be disabled by config, however.
   168 		-- Target radar might be disabled by config, however.