mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-23 02:08:17 +00:00
OPS
AUFTRAG: Trooptransport set pickup radius to 100 meters. OPSGROUP: enabled pickup radius for trooptransport auftrag ARMYGOUP: removed GetPathOnRoad as it seems unncessary
This commit is contained in:
@@ -982,6 +982,13 @@ function ARMYGROUP:onafterUpdateRoute(From, Event, To, n, N, Speed, Formation)
|
|||||||
|
|
||||||
-- Insert a point on road.
|
-- Insert a point on road.
|
||||||
if wp.action==ENUMS.Formation.Vehicle.OnRoad and (wp.coordinate or wp.roadcoord) then
|
if wp.action==ENUMS.Formation.Vehicle.OnRoad and (wp.coordinate or wp.roadcoord) then
|
||||||
|
|
||||||
|
current=self:GetClosestRoad():WaypointGround(UTILS.MpsToKmph(self.speedWp), ENUMS.Formation.Vehicle.OnRoad)
|
||||||
|
table.insert(waypoints, 2, current)
|
||||||
|
|
||||||
|
-- Removing this for now as I don't see why it is necessary and it is very CPU intensive.
|
||||||
|
-- You only need the start and end waypoint on the road. Other waypoints on the road are not necessray.
|
||||||
|
--[[
|
||||||
-- take direct line if on road is too long
|
-- take direct line if on road is too long
|
||||||
local wptable,length,valid=self:GetCoordinate():GetPathOnRoad(wp.coordinate or wp.roadcoord,true,false,false,false) or {}
|
local wptable,length,valid=self:GetCoordinate():GetPathOnRoad(wp.coordinate or wp.roadcoord,true,false,false,false) or {}
|
||||||
|
|
||||||
@@ -1004,6 +1011,7 @@ function ARMYGROUP:onafterUpdateRoute(From, Event, To, n, N, Speed, Formation)
|
|||||||
current=self:GetClosestRoad():WaypointGround(UTILS.MpsToKmph(self.speedWp), ENUMS.Formation.Vehicle.OnRoad)
|
current=self:GetClosestRoad():WaypointGround(UTILS.MpsToKmph(self.speedWp), ENUMS.Formation.Vehicle.OnRoad)
|
||||||
table.insert(waypoints, count, current)
|
table.insert(waypoints, count, current)
|
||||||
end
|
end
|
||||||
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Debug output.
|
-- Debug output.
|
||||||
@@ -1107,16 +1115,6 @@ end
|
|||||||
function ARMYGROUP:onafterOutOfAmmo(From, Event, To)
|
function ARMYGROUP:onafterOutOfAmmo(From, Event, To)
|
||||||
self:T(self.lid..string.format("Group is out of ammo at t=%.3f", timer.getTime()))
|
self:T(self.lid..string.format("Group is out of ammo at t=%.3f", timer.getTime()))
|
||||||
|
|
||||||
-- Get current task.
|
|
||||||
local task=self:GetTaskCurrent()
|
|
||||||
|
|
||||||
if task then
|
|
||||||
if task.dcstask.id=="FireAtPoint" or task.dcstask.id==AUFTRAG.SpecialTask.BARRAGE then
|
|
||||||
self:T(self.lid..string.format("Cancelling current %s task because out of ammo!", task.dcstask.id))
|
|
||||||
self:TaskCancel(task)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Fist, check if we want to rearm once out-of-ammo.
|
-- Fist, check if we want to rearm once out-of-ammo.
|
||||||
--TODO: IsMobile() check
|
--TODO: IsMobile() check
|
||||||
if self.rearmOnOutOfAmmo then
|
if self.rearmOnOutOfAmmo then
|
||||||
@@ -1140,6 +1138,16 @@ function ARMYGROUP:onafterOutOfAmmo(From, Event, To)
|
|||||||
self:__RTZ(-1)
|
self:__RTZ(-1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Get current task.
|
||||||
|
local task=self:GetTaskCurrent()
|
||||||
|
|
||||||
|
if task then
|
||||||
|
if task.dcstask.id=="FireAtPoint" or task.dcstask.id==AUFTRAG.SpecialTask.BARRAGE then
|
||||||
|
self:T(self.lid..string.format("Cancelling current %s task because out of ammo!", task.dcstask.id))
|
||||||
|
self:TaskCancel(task)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -1225,9 +1233,6 @@ end
|
|||||||
-- @param #number Formation Formation of the group.
|
-- @param #number Formation Formation of the group.
|
||||||
function ARMYGROUP:onafterRTZ(From, Event, To, Zone, Formation)
|
function ARMYGROUP:onafterRTZ(From, Event, To, Zone, Formation)
|
||||||
|
|
||||||
-- ID of current waypoint.
|
|
||||||
local uid=self:GetWaypointCurrent().uid
|
|
||||||
|
|
||||||
-- Zone.
|
-- Zone.
|
||||||
local zone=Zone or self.homezone
|
local zone=Zone or self.homezone
|
||||||
|
|
||||||
@@ -1242,6 +1247,9 @@ function ARMYGROUP:onafterRTZ(From, Event, To, Zone, Formation)
|
|||||||
|
|
||||||
local Coordinate=zone:GetRandomCoordinate()
|
local Coordinate=zone:GetRandomCoordinate()
|
||||||
|
|
||||||
|
-- ID of current waypoint.
|
||||||
|
local uid=self:GetWaypointCurrentUID()
|
||||||
|
|
||||||
-- Add waypoint after current.
|
-- Add waypoint after current.
|
||||||
local wp=self:AddWaypoint(Coordinate, nil, uid, Formation, true)
|
local wp=self:AddWaypoint(Coordinate, nil, uid, Formation, true)
|
||||||
|
|
||||||
|
|||||||
@@ -1534,7 +1534,7 @@ end
|
|||||||
-- @param Core.Set#SET_GROUP TransportGroupSet The set group(s) to be transported.
|
-- @param Core.Set#SET_GROUP TransportGroupSet The set group(s) to be transported.
|
||||||
-- @param Core.Point#COORDINATE DropoffCoordinate Coordinate where the helo will land drop off the the troops.
|
-- @param Core.Point#COORDINATE DropoffCoordinate Coordinate where the helo will land drop off the the troops.
|
||||||
-- @param Core.Point#COORDINATE PickupCoordinate Coordinate where the helo will land to pick up the the cargo. Default is the fist transport group.
|
-- @param Core.Point#COORDINATE PickupCoordinate Coordinate where the helo will land to pick up the the cargo. Default is the fist transport group.
|
||||||
-- @param #number PickupRadius Radius around the pickup coordinate in meters. Default 500 m.
|
-- @param #number PickupRadius Radius around the pickup coordinate in meters. Default 100 m.
|
||||||
-- @return #AUFTRAG self
|
-- @return #AUFTRAG self
|
||||||
function AUFTRAG:NewTROOPTRANSPORT(TransportGroupSet, DropoffCoordinate, PickupCoordinate, PickupRadius)
|
function AUFTRAG:NewTROOPTRANSPORT(TransportGroupSet, DropoffCoordinate, PickupCoordinate, PickupRadius)
|
||||||
|
|
||||||
@@ -1555,7 +1555,7 @@ function AUFTRAG:NewTROOPTRANSPORT(TransportGroupSet, DropoffCoordinate, PickupC
|
|||||||
mission.transportPickup=PickupCoordinate or mission:GetTargetCoordinate()
|
mission.transportPickup=PickupCoordinate or mission:GetTargetCoordinate()
|
||||||
mission.transportDropoff=DropoffCoordinate
|
mission.transportDropoff=DropoffCoordinate
|
||||||
|
|
||||||
mission.transportPickupRadius=PickupRadius or 500
|
mission.transportPickupRadius=PickupRadius or 100
|
||||||
|
|
||||||
mission.missionTask=mission:GetMissionTaskforMissionType(AUFTRAG.Type.TROOPTRANSPORT)
|
mission.missionTask=mission:GetMissionTaskforMissionType(AUFTRAG.Type.TROOPTRANSPORT)
|
||||||
|
|
||||||
|
|||||||
@@ -2627,6 +2627,17 @@ function OPSGROUP:GetWaypointCurrent()
|
|||||||
return self.waypoints[self.currentwp]
|
return self.waypoints[self.currentwp]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get current waypoint UID.
|
||||||
|
-- @param #OPSGROUP self
|
||||||
|
-- @return #number Current waypoint UID.
|
||||||
|
function OPSGROUP:GetWaypointCurrentUID()
|
||||||
|
local wp=self:GetWaypointCurrent()
|
||||||
|
if wp then
|
||||||
|
return wp.uid
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
--- Get coordinate of next waypoint of the group.
|
--- Get coordinate of next waypoint of the group.
|
||||||
-- @param #OPSGROUP self
|
-- @param #OPSGROUP self
|
||||||
-- @param #boolean cyclic If true, return first waypoint if last waypoint was reached.
|
-- @param #boolean cyclic If true, return first waypoint if last waypoint was reached.
|
||||||
@@ -4591,7 +4602,7 @@ function OPSGROUP:RouteToMission(mission, delay)
|
|||||||
|
|
||||||
-- Create a pickup zone around the pickup coordinate. The troops will go to a random point inside the zone.
|
-- Create a pickup zone around the pickup coordinate. The troops will go to a random point inside the zone.
|
||||||
-- This is necessary so the helos do not try to land at the exact same location where the troops wait.
|
-- This is necessary so the helos do not try to land at the exact same location where the troops wait.
|
||||||
local pradius=500
|
local pradius=mission.transportPickupRadius
|
||||||
local pickupZone=ZONE_RADIUS:New("Pickup Zone", mission.transportPickup:GetVec2(), pradius)
|
local pickupZone=ZONE_RADIUS:New("Pickup Zone", mission.transportPickup:GetVec2(), pradius)
|
||||||
|
|
||||||
-- Add task to embark for the troops.
|
-- Add task to embark for the troops.
|
||||||
|
|||||||
Reference in New Issue
Block a user