Inform the player about the mission time
Warn if too far away Spawn enemy ship in orbitmaster
parent
6ade7d66ce
commit
d555fa8834
|
@ -231,6 +231,10 @@
|
|||
"description": "Message from the ship computer",
|
||||
"message": "Primary mission objective complete"
|
||||
},
|
||||
"MISSION_INFO": {
|
||||
"description": "Message from the ship computer",
|
||||
"message": "Target area reached. Start data logging. Predicted maximum mission time {duration}."
|
||||
},
|
||||
"MISSION_TYPE_1": {
|
||||
"description": "Name of mission type",
|
||||
"message": "Reconnaissance"
|
||||
|
@ -243,6 +247,10 @@
|
|||
"description": "Name of mission type. Derived from Fighter Sweep. An aggressive mission to hunt down and destroy every enemy fighter in the allotted area.",
|
||||
"message": "Area Sweep"
|
||||
},
|
||||
"MISSION_WARNING": {
|
||||
"description": "Message from the ship computer",
|
||||
"message": "Target area too far away. Cannot complete data collection."
|
||||
},
|
||||
"OBJECTIVE_1": {
|
||||
"description": "",
|
||||
"message": "It's not necessary to attack the enemy. We want data about the defence capability and response time."
|
||||
|
|
|
@ -298,12 +298,14 @@ end
|
|||
|
||||
local missionTimer = function (mission)
|
||||
Timer:CallEvery(mission.duration, function ()
|
||||
if mission.complete then return true end -- already complete
|
||||
if mission.complete or Game.time > mission.due then return true end -- already complete or too late
|
||||
if Game.player.frameBody and Game.player.frameBody.path == mission.location then
|
||||
mission.complete = true
|
||||
mission.status = "COMPLETED"
|
||||
Comms.ImportantMessage(l.MISSION_COMPLETE)
|
||||
return true
|
||||
else
|
||||
Comms.ImportantMessage(l.MISSION_WARNING)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
@ -316,6 +318,7 @@ local onFrameChanged = function (player)
|
|||
mission.in_progress = true
|
||||
|
||||
local ships
|
||||
local planet_radius = player.frameBody:GetPhysicalRadius()
|
||||
local riskmargin = Engine.rand:Number(-0.3, 0.3) -- Add some random luck
|
||||
if mission.risk >= (1 + riskmargin) then ships = 3
|
||||
elseif mission.risk >= (0.7 + riskmargin) then ships = 2
|
||||
|
@ -350,7 +353,7 @@ local onFrameChanged = function (player)
|
|||
|
||||
local ship
|
||||
if mission.location:GetSystemBody().type == "PLANET_GAS_GIANT" then
|
||||
ship = Space.SpawnShipNear(shipdef.id, player.frameBody, 100000, 150000)
|
||||
ship = Space.SpawnShipOrbit(shipdef.id, player.frameBody, 1.2 * planet_radius, 3.5 * planet_radius)
|
||||
else
|
||||
ship = Space.SpawnShipLanded(shipdef.id, player.frameBody, math.rad(Engine.rand:Number(360)), math.rad(Engine.rand:Number(360)))
|
||||
end
|
||||
|
@ -379,7 +382,8 @@ local onFrameChanged = function (player)
|
|||
|
||||
if mission.dedication <= RECON or #mission.mercenaries == 0 then
|
||||
-- prevent a too quick fly-by
|
||||
mission.duration = player.frameBody:GetPhysicalRadius()/1000
|
||||
mission.duration = planet_radius/1000
|
||||
Comms.ImportantMessage(string.interp(l.MISSION_INFO, { duration = Format.Duration(mission.duration) }))
|
||||
missionTimer(mission)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue