Updates and fixes

- Replaced range test for unit to range test for players.
- Ensure that players database is properly populated.
- Fixed some documentation.
- Removed smoke from trigger.
- Fixed name of RandomPointVec2 to RandomVec2 and fixed in all usages.
This commit is contained in:
FlightControl
2016-06-20 13:12:51 +02:00
parent 8a3cdc6b85
commit c8443f8798
13 changed files with 247 additions and 238 deletions

View File

@@ -152,29 +152,29 @@ function AIBALANCER:_ClientAliveMonitorScheduler()
-- If there is a CLIENT, the AI stays engaged and will not return.
-- If there is no CLIENT within the self.ReturnTresholdRange, then the unit will return to the Airbase return method selected.
local ClientInZone = { Value = false }
local PlayerInRange = { Value = false }
local RangeZone = ZONE_RADIUS:New( 'RangeZone', AIGroup:GetPointVec2(), self.ReturnTresholdRange )
self:E( RangeZone )
_DATABASE:ForEachUnit(
_DATABASE:ForEachPlayer(
--- @param Unit#UNIT RangeTestUnit
function( RangeTestUnit, RangeZone, AIGroup, ClientInZone )
self:E( { ClientInZone, RangeTestUnit.UnitName, RangeZone.ZoneName } )
function( RangeTestUnit, RangeZone, AIGroup, PlayerInRange )
self:E( { PlayerInRange, RangeTestUnit.UnitName, RangeZone.ZoneName } )
if RangeTestUnit:IsInZone( RangeZone ) == true then
self:E( "in zone" )
if RangeTestUnit:GetCoalition() ~= AIGroup:GetCoalition() then
self:E( "in range" )
ClientInZone.Value = true
PlayerInRange.Value = true
end
end
end,
--- @param Zone#ZONE_RADIUS RangeZone
-- @param Group#GROUP AIGroup
function( RangeZone, AIGroup, ClientInZone )
function( RangeZone, AIGroup, PlayerInRange )
local AIGroupTemplate = AIGroup:GetTemplate()
if ClientInZone.Value == false then
if PlayerInRange.Value == false then
if self.ToHomeAirbase == true then
local WayPointCount = #AIGroupTemplate.route.points
local SwitchWayPointCommand = AIGroup:CommandSwitchWayPoint( 1, WayPointCount, 1 )
@@ -193,7 +193,7 @@ function AIBALANCER:_ClientAliveMonitorScheduler()
end
end
end
, RangeZone, AIGroup, ClientInZone
, RangeZone, AIGroup, PlayerInRange
)
end