Skip to content

Commit 5d35e4e

Browse files
committed
x
1 parent 61af7e1 commit 5d35e4e

File tree

10 files changed

+2566
-2661
lines changed

10 files changed

+2566
-2661
lines changed

lua/AI/OpAI/BaseManager.lua

Lines changed: 23 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,68 +1936,28 @@ BaseManager = ClassSimple {
19361936
}
19371937
self.AIBrain:PBMAddPlatoon(defaultBuilder)
19381938

1939-
-- T1 Air Scouts
1940-
defaultBuilder = {
1941-
BuilderName = 'BaseManager_T1AirScout_' .. self.BaseName,
1942-
PlatoonTemplate = self:CreateAirScoutPlatoon(1),
1943-
Priority = 500,
1944-
PlatoonAIFunction = { '/lua/ai/opai/BaseManagerPlatoonThreads.lua', 'BaseManagerScoutingAI' },
1945-
BuildConditions = {
1946-
{ BMBC, 'HighestFactoryLevelType', { 1, self.BaseName, 'Air' } },
1947-
{ BMBC, 'AirScoutingEnabled', { self.BaseName, } },
1948-
{ BMBC, 'BaseActive', { self.BaseName } },
1949-
},
1950-
PlatoonData = {
1951-
BaseName = self.BaseName,
1952-
},
1953-
PlatoonType = 'Air',
1954-
RequiresConstruction = true,
1955-
LocationType = self.BaseName,
1956-
InstanceCount = 1,
1957-
}
1958-
self.AIBrain:PBMAddPlatoon(defaultBuilder)
1959-
1960-
-- T2 Air Scouts
1961-
defaultBuilder = {
1962-
BuilderName = 'BaseManager_T2AirScout_' .. self.BaseName,
1963-
PlatoonTemplate = self:CreateAirScoutPlatoon(2),
1964-
Priority = 750,
1965-
PlatoonAIFunction = { '/lua/ai/opai/BaseManagerPlatoonThreads.lua', 'BaseManagerScoutingAI' },
1966-
BuildConditions = {
1967-
{ BMBC, 'HighestFactoryLevelType', { 2, self.BaseName, 'Air' } },
1968-
{ BMBC, 'AirScoutingEnabled', { self.BaseName, } },
1969-
{ BMBC, 'BaseActive', { self.BaseName } },
1970-
},
1971-
PlatoonData = {
1972-
BaseName = self.BaseName,
1973-
},
1974-
PlatoonType = 'Air',
1975-
RequiresConstruction = true,
1976-
LocationType = self.BaseName,
1977-
InstanceCount = 1,
1978-
}
1979-
self.AIBrain:PBMAddPlatoon(defaultBuilder)
1980-
1981-
-- T3 Air Scouts
1982-
defaultBuilder = {
1983-
BuilderName = 'BaseManager_T3AirScout_' .. self.BaseName,
1984-
PlatoonTemplate = self:CreateAirScoutPlatoon(3),
1985-
Priority = 1000,
1986-
PlatoonAIFunction = { '/lua/ai/opai/BaseManagerPlatoonThreads.lua', 'BaseManagerScoutingAI' },
1987-
BuildConditions = {
1988-
{ BMBC, 'HighestFactoryLevelType', { 3, self.BaseName, 'Air' } },
1989-
{ BMBC, 'AirScoutingEnabled', { self.BaseName, } },
1990-
{ BMBC, 'BaseActive', { self.BaseName } },
1991-
},
1992-
PlatoonData = {
1993-
BaseName = self.BaseName,
1994-
},
1995-
PlatoonType = 'Air',
1996-
RequiresConstruction = true,
1997-
LocationType = self.BaseName,
1998-
InstanceCount = 1,
1999-
}
2000-
self.AIBrain:PBMAddPlatoon(defaultBuilder)
1939+
-- T1-T3 Air Scouts
1940+
for i = 1, 3 do
1941+
defaultBuilder = {
1942+
BuilderName = 'BaseManager_T' .. i ..'AirScout_' .. self.BaseName,
1943+
PlatoonTemplate = self:CreateAirScoutPlatoon(i),
1944+
Priority = 250 + (i * 250), -- 500, 750, 1000
1945+
PlatoonAIFunction = { '/lua/ai/opai/BaseManagerPlatoonThreads.lua', 'BaseManagerScoutingAI' },
1946+
BuildConditions = {
1947+
{ BMBC, 'HighestFactoryLevelType', { i, self.BaseName, 'Air' } },
1948+
{ BMBC, 'AirScoutingEnabled', { self.BaseName, } },
1949+
{ BMBC, 'BaseActive', { self.BaseName } },
1950+
},
1951+
PlatoonData = {
1952+
BaseName = self.BaseName,
1953+
},
1954+
PlatoonType = 'Air',
1955+
RequiresConstruction = true,
1956+
LocationType = self.BaseName,
1957+
InstanceCount = 1,
1958+
}
1959+
self.AIBrain:PBMAddPlatoon(defaultBuilder)
1960+
end
20011961
end,
20021962

20031963
---@param self BaseManager
@@ -2097,6 +2057,7 @@ BaseManager = ClassSimple {
20972057

20982058
if techLevel == 3 then
20992059
template[3][1] = template[3][1] .. '0302'
2060+
table.insert(template, { 'uea0101', 1, 0, 'Scout', 'None' })
21002061
else
21012062
template[3][1] = template[3][1] .. '0101'
21022063
end

lua/AI/OpAI/BaseManagerPlatoonThreads.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,8 +1230,9 @@ function GetScoutingPath(bManager, unit)
12301230
currX = currX + 48
12311231
end
12321232
-- Determine which poitnts the unit can actually path to
1233+
local unitPosition = unit:GetPosition()
12331234
for k, v in possiblePoints do
1234-
if AIUtils.CheckUnitPathingEx(v, unit:GetPosition(), unit) then
1235+
if AIUtils.CheckUnitPathingEx(v, unitPosition, unit) then
12351236
TableInsert(pathablePoints, v)
12361237
end
12371238
end
@@ -1252,10 +1253,8 @@ function BaseManagerScoutingAI(platoon)
12521253
local numPoints = TableGetn(pathablePoints)
12531254
if numPoints > 0 then
12541255
platoon:Stop()
1255-
end
12561256

1257-
local count = 0
1258-
if numPoints > 0 then
1257+
local count = 0
12591258
while count < 10 do
12601259
local pickNum = Random(1, numPoints)
12611260
platoon:MoveToLocation(pathablePoints[pickNum], false)

0 commit comments

Comments
 (0)