mirror of
https://github.com/akaAgar/the-universal-mission-for-dcs-world.git
synced 2026-08-25 20:35:19 +00:00
Enemy CAP respawn rate now decreases the more enemy planes are shot
This commit is contained in:
@@ -80,7 +80,7 @@ Please also note that PvP is not supported at the moment and that the mission wi
|
|||||||
- AI improvements
|
- AI improvements
|
||||||
- [ ] AI wingmen should engage tracking radars first when told to engage SAM sites, in order to disable the site ASAP
|
- [ ] AI wingmen should engage tracking radars first when told to engage SAM sites, in order to disable the site ASAP
|
||||||
- Balance improvements
|
- Balance improvements
|
||||||
- [ ] Lowered enemy CAP respawn rate
|
- [x] Enemy CAP respawn rate now decreases the more enemy planes are shot
|
||||||
- [ ] Tweaked XP requirements for medals/promotions
|
- [ ] Tweaked XP requirements for medals/promotions
|
||||||
- Bug fixes
|
- Bug fixes
|
||||||
- [ ] AWACS datalinked contacts not showing on SA pages
|
- [ ] AWACS datalinked contacts not showing on SA pages
|
||||||
|
|||||||
@@ -116,6 +116,8 @@ function TUM.initialize()
|
|||||||
if not event then return end -- No event
|
if not event then return end -- No event
|
||||||
|
|
||||||
TUM.ambientRadio.onEvent(event) -- Must be first so other (more important) radio messages will interrupt the "ambient" ones
|
TUM.ambientRadio.onEvent(event) -- Must be first so other (more important) radio messages will interrupt the "ambient" ones
|
||||||
|
TUM.airForce.onEvent(event)
|
||||||
|
TUM.ambientWorld.onEvent(event)
|
||||||
TUM.ambientWorld.onEvent(event)
|
TUM.ambientWorld.onEvent(event)
|
||||||
TUM.objectives.onEvent(event)
|
TUM.objectives.onEvent(event)
|
||||||
TUM.playerScore.onEvent(event)
|
TUM.playerScore.onEvent(event)
|
||||||
|
|||||||
@@ -6,9 +6,13 @@
|
|||||||
TUM.airForce = {}
|
TUM.airForce = {}
|
||||||
|
|
||||||
do
|
do
|
||||||
|
local SUPPRESSION_INCREASE_ON_KILL = 0.35 -- Value added to enemyCAPSuppression each time an enemy aircraft is shot down
|
||||||
|
|
||||||
local desiredUnitCount = { 4, 4 } -- Desired max number of aircraft in the air at any single time
|
local desiredUnitCount = { 4, 4 } -- Desired max number of aircraft in the air at any single time
|
||||||
local fighterGroups = { {}, {} }
|
local fighterGroups = { {}, {} }
|
||||||
|
|
||||||
|
local enemyCAPSuppression = 1
|
||||||
|
local enemyCAPSuppressionTimer = 1
|
||||||
local playerCenter = nil
|
local playerCenter = nil
|
||||||
|
|
||||||
local function getSkillLevel(side)
|
local function getSkillLevel(side)
|
||||||
@@ -65,7 +69,7 @@ do
|
|||||||
local function launchNewAircraftGroup(side, airbases)
|
local function launchNewAircraftGroup(side, airbases)
|
||||||
local groupSize = DCSEx.table.getRandom({ 1, 2, 2, 2, 2, 3, 3, 4 })
|
local groupSize = DCSEx.table.getRandom({ 1, 2, 2, 2, 2, 3, 3, 4 })
|
||||||
groupSize = math.min(groupSize, desiredUnitCount[side] - getAirborneUnitCount(side))
|
groupSize = math.min(groupSize, desiredUnitCount[side] - getAirborneUnitCount(side))
|
||||||
if groupSize <= 0 then return false end
|
if groupSize <= 0 then return false end -- No aircraft slots left
|
||||||
|
|
||||||
local faction = TUM.settings.getEnemyFaction()
|
local faction = TUM.settings.getEnemyFaction()
|
||||||
if side == TUM.settings.getPlayerCoalition() then faction = TUM.settings.getPlayerFaction() end
|
if side == TUM.settings.getPlayerCoalition() then faction = TUM.settings.getPlayerFaction() end
|
||||||
@@ -73,6 +77,17 @@ do
|
|||||||
local units = Library.factions.getUnits(faction, DCSEx.enums.unitFamily.PLANE_FIGHTER, groupSize, true)
|
local units = Library.factions.getUnits(faction, DCSEx.enums.unitFamily.PLANE_FIGHTER, groupSize, true)
|
||||||
if not units or #units == 0 then return false end -- No aircraft found
|
if not units or #units == 0 then return false end -- No aircraft found
|
||||||
|
|
||||||
|
-- If enemy CAP suppression timer > 0, decrement it by 1 but don't spawn any aircraft
|
||||||
|
if side == TUM.settings.getEnemyCoalition() then
|
||||||
|
enemyCAPSuppressionTimer = enemyCAPSuppressionTimer - 1
|
||||||
|
if enemyCAPSuppressionTimer > 0 then
|
||||||
|
TUM.log("Enemy CAP is still suppressed (suppression="..tostring(enemyCAPSuppressionTimer).."), no enemy CAP spawned.")
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
enemyCAPSuppressionTimer = enemyCAPSuppression
|
||||||
|
end
|
||||||
|
|
||||||
local launchAirbase = airbases[DCSEx.math.clamp(math.random(1, math.ceil(math.sqrt(#airbases))), 1, #airbases)]
|
local launchAirbase = airbases[DCSEx.math.clamp(math.random(1, math.ceil(math.sqrt(#airbases))), 1, #airbases)]
|
||||||
local originPt = DCSEx.math.vec3ToVec2(launchAirbase:getPoint())
|
local originPt = DCSEx.math.vec3ToVec2(launchAirbase:getPoint())
|
||||||
|
|
||||||
@@ -150,7 +165,6 @@ do
|
|||||||
randomizeDesiredAircraftCount(side)
|
randomizeDesiredAircraftCount(side)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- return launchNewAircraftGroup(side, airbases)
|
|
||||||
return launchNewAircraftGroup(side, validAirbases)
|
return launchNewAircraftGroup(side, validAirbases)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -170,6 +184,23 @@ do
|
|||||||
return updateAirForce(side)
|
return updateAirForce(side)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-------------------------------------
|
||||||
|
-- Called when an event is raised
|
||||||
|
-- @param event The DCS World event
|
||||||
|
-------------------------------------
|
||||||
|
function TUM.airForce.onEvent(event)
|
||||||
|
if not event.initiator then return end
|
||||||
|
if Object.getCategory(event.initiator) ~= Object.Category.UNIT then return end
|
||||||
|
if event.id ~= world.event.S_EVENT_UNIT_LOST then return end
|
||||||
|
|
||||||
|
local groupID = DCSEx.dcs.getGroupIDAsNumber(event.initiator:getGroup())
|
||||||
|
|
||||||
|
if DCSEx.table.contains(fighterGroups[TUM.settings.getEnemyCoalition()], groupID) then
|
||||||
|
enemyCAPSuppression = enemyCAPSuppression + SUPPRESSION_INCREASE_ON_KILL
|
||||||
|
TUM.log("Enemy CAP suppression increased to "..tostring(enemyCAPSuppression))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function TUM.airForce.create()
|
function TUM.airForce.create()
|
||||||
TUM.airForce.removeAll()
|
TUM.airForce.removeAll()
|
||||||
TUM.log("Creating friendly and enemy air forces...")
|
TUM.log("Creating friendly and enemy air forces...")
|
||||||
@@ -190,6 +221,10 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Reset enemy CAP suppression
|
||||||
|
enemyCAPSuppression = 1
|
||||||
|
enemyCAPSuppressionTimer = 1
|
||||||
|
|
||||||
fighterGroups = { {}, {} }
|
fighterGroups = { {}, {} }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user