Skip to content

Commit

Permalink
Fix issues with release (FAForever#3923)
Browse files Browse the repository at this point in the history
ASF can no longer attack air factories, the free-resources glitch is fixed and the high priority and low priority target priorities are removed.
  • Loading branch information
Garanas authored Jun 2, 2022
1 parent 2f0b4ec commit 7314c3d
Show file tree
Hide file tree
Showing 215 changed files with 394 additions and 512 deletions.
6 changes: 1 addition & 5 deletions lua/AI/OpAI/BaseOpAI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,9 @@ OpAI = Class {
return self:SetTargettingPriorities(
{
categories.EXPERIMENTAL,
categories.SPECIALHIGHPRI,
categories.STRUCTURE * categories.DEFENSE,
categories.STRUCTURE * categories.ECONOMIC,
categories.MOBILE - categories.COMMAND,
categories.SPECIALLOWPRI,
categories.ALLUNITS - categories.COMMAND,
categories.COMMAND,

Expand All @@ -154,11 +152,9 @@ OpAI = Class {
return self:SetTargettingPriorities(
{
categories.EXPERIMENTAL,
categories.SPECIALHIGHPRI,
categories.STRUCTURE * categories.DEFENSE,
categories.STRUCTURE * categories.ECONOMIC,
categories.MOBILE - categories.COMMAND,
categories.SPECIALLOWPRI,
categories.ALLUNITS - categories.COMMAND,
}
, cat)
Expand All @@ -171,7 +167,7 @@ OpAI = Class {
end

local priList = { unpack(priTable) }
local defList = {'SPECIALHIGHPRI', 'COMMAND', 'MOBILE', 'STRUCTURE DEFENSE', 'SPECIALLOWPRI', 'ALLUNITS',}
local defList = { 'COMMAND', 'MOBILE', 'STRUCTURE DEFENSE', 'ALLUNITS',}

if categories then
--save the priorities for this category.
Expand Down
8 changes: 4 additions & 4 deletions lua/platoon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2826,7 +2826,7 @@ Platoon = Class(moho.platoon_methods) {
local aiBrain = self:GetBrain()

local atkPri = { 'STRUCTURE STRATEGIC', 'EXPERIMENTAL LAND', 'STRUCTURE SHIELD', 'COMMAND', 'STRUCTURE FACTORY',
'STRUCTURE DEFENSE', 'MOBILE TECH3 LAND', 'MOBILE TECH2 LAND', 'SPECIALLOWPRI', 'ALLUNITS' }
'STRUCTURE DEFENSE', 'MOBILE TECH3 LAND', 'MOBILE TECH2 LAND', 'ALLUNITS' }
local atkPriTable = {}
for k,v in atkPri do
table.insert(atkPriTable, ParseEntityCategory(v))
Expand Down Expand Up @@ -4082,7 +4082,7 @@ Platoon = Class(moho.platoon_methods) {
local aiBrain = self:GetBrain()

local atkPri = { 'STRUCTURE STRATEGIC EXPERIMENTAL', 'EXPERIMENTAL ARTILLERY OVERLAYINDIRECTFIRE', 'STRUCTURE STRATEGIC TECH3', 'STRUCTURE NUKE TECH3', 'EXPERIMENTAL ORBITALSYSTEM', 'EXPERIMENTAL ENERGYPRODUCTION STRUCTURE', 'STRUCTURE ANTIMISSILE TECH3', 'TECH3 MASSFABRICATION', 'TECH3 ENERGYPRODUCTION', 'STRUCTURE STRATEGIC', 'STRUCTURE DEFENSE TECH3 ANTIAIR',
'COMMAND', 'STRUCTURE DEFENSE TECH3', 'STRUCTURE DEFENSE TECH2', 'EXPERIMENTAL LAND', 'MOBILE TECH3 LAND', 'MOBILE TECH2 LAND', 'MOBILE TECH1 LAND', 'STRUCTURE FACTORY', 'SPECIALLOWPRI', 'ALLUNITS' }
'COMMAND', 'STRUCTURE DEFENSE TECH3', 'STRUCTURE DEFENSE TECH2', 'EXPERIMENTAL LAND', 'MOBILE TECH3 LAND', 'MOBILE TECH2 LAND', 'MOBILE TECH1 LAND', 'STRUCTURE FACTORY', 'ALLUNITS' }
local atkPriTable = {}
for k,v in atkPri do
table.insert(atkPriTable, ParseEntityCategory(v))
Expand Down Expand Up @@ -5309,8 +5309,8 @@ Platoon = Class(moho.platoon_methods) {
local platoonUnits = self:GetPlatoonUnits()
local PlatoonFormation = self.PlatoonData.UseFormation or 'NoFormation'
self:SetPlatoonFormationOverride(PlatoonFormation)
local atkPri = { 'SPECIALHIGHPRI', 'STRUCTURE ANTINAVY', 'MOBILE NAVAL', 'STRUCTURE NAVAL', 'COMMAND', 'EXPERIMENTAL', 'STRUCTURE STRATEGIC EXPERIMENTAL', 'ARTILLERY EXPERIMENTAL', 'STRUCTURE ARTILLERY TECH3', 'STRUCTURE NUKE TECH3', 'STRUCTURE ANTIMISSILE SILO',
'STRUCTURE DEFENSE DIRECTFIRE', 'TECH3 MASSFABRICATION', 'TECH3 ENERGYPRODUCTION', 'STRUCTURE STRATEGIC', 'STRUCTURE DEFENSE', 'STRUCTURE', 'MOBILE', 'SPECIALLOWPRI', 'ALLUNITS' }
local atkPri = { 'STRUCTURE ANTINAVY', 'MOBILE NAVAL', 'STRUCTURE NAVAL', 'COMMAND', 'EXPERIMENTAL', 'STRUCTURE STRATEGIC EXPERIMENTAL', 'ARTILLERY EXPERIMENTAL', 'STRUCTURE ARTILLERY TECH3', 'STRUCTURE NUKE TECH3', 'STRUCTURE ANTIMISSILE SILO',
'STRUCTURE DEFENSE DIRECTFIRE', 'TECH3 MASSFABRICATION', 'TECH3 ENERGYPRODUCTION', 'STRUCTURE STRATEGIC', 'STRUCTURE DEFENSE', 'STRUCTURE', 'MOBILE', 'ALLUNITS' }
local atkPriTable = {}
for k,v in atkPri do
table.insert(atkPriTable, ParseEntityCategory(v))
Expand Down
18 changes: 17 additions & 1 deletion lua/sim/Unit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ Unit = Class(moho.unit_methods) {
-- the entity that produces sound, by default ourself
self.SoundEntity = self


-- used to fix engine related bugs
self.EngineFlags = { }

-- Store size information for performance
self.Footprint = { SizeX = bp.Footprint.SizeX, SizeZ = bp.Footprint.SizeZ }
Expand Down Expand Up @@ -4236,12 +4237,27 @@ Unit = Class(moho.unit_methods) {
end
end,

--- Stuns the unit, if it isn't set to be immune by the flag unit.ImmuneToStun
---@param self Unit A reference to the unit itself, automatically set when you use the ':' notation
---@param duration boolean Stun duration in seconds
SetStunned = function(self, duration)
if not self.ImmuneToStun then
cUnit.SetStunned(self, duration)
end
end,

--- Determines whether or not this unit is actively consuming resources. There is an engine bug
--- that allows you to gain free resources by reverting the resources of the last tick to the
--- user when it is called with 'false' while the consumption is already set to 'false'
---@param self Unit A reference to the unit itself, automatically set when you use the ':' notation
---@param flag boolean A flag to determine whether our consumption should be active
SetConsumptionActive = function(self, flag)
if self.EngineFlags['SetConsumptionActive'] ~= flag then
cUnit.SetConsumptionActive(self, flag)
self.EngineFlags['SetConsumptionActive'] = flag
end
end,

--- Various callback-like functions

-- Called when the C function unit.SetConsumptionActive is called
Expand Down
26 changes: 0 additions & 26 deletions lua/system/Blueprints.lua
Original file line number Diff line number Diff line change
Expand Up @@ -716,35 +716,9 @@ function PreModBlueprints(all_bps)
-- # Adjust weapon blueprints

for i, w in bp.Weapon or {} do

-- add in weapon blueprint id
local label = w.Label or "Unlabelled"
w.BlueprintId = bp.BlueprintId .. "-" .. i .. "-" .. label

-- add in adjusted target priorities
if w.TargetPriorities then

local priorities = {}
local prioritiesHead = 1

for g, transcendentPritority in w.TranscendentPriorities or {} do
priorities[prioritiesHead] = transcendentPritority
prioritiesHead = prioritiesHead + 1
end

priorities[prioritiesHead] = 'SPECIALHIGHPRI'
prioritiesHead = prioritiesHead + 1

for _, priority in w.TargetPriorities do
priorities[prioritiesHead] = priority
prioritiesHead = prioritiesHead + 1
end

priorities[prioritiesHead] = 'SPECIALLOWPRI'
prioritiesHead = prioritiesHead + 1

w.TargetPriorities = priorities
end
end

-- # Hotfix for naval wrecks
Expand Down
5 changes: 0 additions & 5 deletions lua/system/blueprints-ai.lua
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,6 @@ function SetUnitThreatValues(unitBPs)
cache.PersonalShieldThreat = 0
end

-- Arbitrary high bonus threat for special high pri
if TableFind(bp.Categories, 'SPECIALHIGHPRI') then
cache.EconomyThreatLevel = cache.EconomyThreatLevel + 250
end

-- No one really cares about air staging, well maybe a little bit.
if bp.Transport.DockingSlots then
cache.EconomyThreatLevel = cache.EconomyThreatLevel + bp.Transport.DockingSlots
Expand Down
3 changes: 1 addition & 2 deletions units/DAA0206/DAA0206_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ UnitBlueprint {
'TRANSPORTBUILTBYTIER3FACTORY',
'AEON',
'MOBILE',
'HIGHPRIAIR',
'AIR',
'TECH2',
'BOMBER',
Expand Down Expand Up @@ -288,7 +287,7 @@ UnitBlueprint {
'TECH3 STRUCTURE',
'TECH2 STRUCTURE',
'TECH1 STRUCTURE',
'(ALLUNITS - SPECIALLOWPRI)',
'ALLUNITS',
},
TargetRestrictDisallow = 'UNTARGETABLE',
TrackingRadius = 0.5,
Expand Down
5 changes: 3 additions & 2 deletions units/DAL0310/DAL0310_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,12 @@ UnitBlueprint {
SlavedToBody = true,
SlavedToBodyArcRange = 5,
TargetCheckInterval = 0.75,
TranscendentPriorities = {'SHIELD', 'PERSONALSHIELD'},
TargetPriorities = {
'SHIELD',
'PERSONALSHIELD',
'MOBILE',
'(STRUCTURE * DEFENSE - ANTIMISSILE)',
'(ALLUNITS - SPECIALLOWPRI)',
'ALLUNITS',
},
TargetRestrictDisallow = 'UNTARGETABLE',
TrackingRadius = 1.15,
Expand Down
5 changes: 2 additions & 3 deletions units/DALK003/DALK003_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ UnitBlueprint {
RateOfFire = 0.5,
TargetCheckInterval = 1,
TargetPriorities = {
'(ALLUNITS - SPECIALLOWPRI)',
'ALLUNITS'
},
TargetRestrictDisallow = 'UNTARGETABLE',
TrackingRadius = 1.2,
Expand Down Expand Up @@ -303,14 +303,13 @@ UnitBlueprint {
SlavedToBody = false,
TargetCheckInterval = 0.3,
TargetPriorities = {
'AIR MOBILE HIGHPRIAIR',
'AIR MOBILE EXPERIMENTAL',
'AIR MOBILE TECH3 BOMBER',
'AIR MOBILE BOMBER',
'AIR MOBILE GROUNDATTACK',
'AIR MOBILE TRANSPORTATION',
'AIR MOBILE',
'(ALLUNITS - SPECIALLOWPRI)',
'ALLUNITS'
},
TargetRestrictDisallow = 'UNTARGETABLE',
TrackingRadius = 1.4,
Expand Down
8 changes: 3 additions & 5 deletions units/DEA0202/DEA0202_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,12 @@ UnitBlueprint {
SlavedToBodyArcRange = 50,
TargetCheckInterval = 1,
TargetPriorities = {
'AIR MOBILE HIGHPRIAIR',
'AIR MOBILE TECH3 BOMBER',
'AIR MOBILE BOMBER',
'AIR MOBILE GROUNDATTACK',
'AIR MOBILE TRANSPORTATION',
'AIR MOBILE',
'(ALLUNITS - SPECIALLOWPRI)',
'ALLUNITS'
},
TargetRestrictDisallow = 'UNTARGETABLE,LAND,STRUCTURE,NAVAL',
TargetRestrictOnlyAllow = 'AIR',
Expand Down Expand Up @@ -408,13 +407,12 @@ UnitBlueprint {
SlavedToBodyArcRange = 50,
TargetCheckInterval = 1,
TargetPriorities = {
'AIR MOBILE HIGHPRIAIR',
'AIR MOBILE TECH3 BOMBER',
'AIR MOBILE BOMBER',
'AIR MOBILE GROUNDATTACK',
'AIR MOBILE TRANSPORTATION',
'AIR MOBILE',
'(ALLUNITS - SPECIALLOWPRI)',
'ALLUNITS'
},
TargetRestrictDisallow = 'UNTARGETABLE,LAND,STRUCTURE,NAVAL',
TargetRestrictOnlyAllow = 'AIR',
Expand Down Expand Up @@ -493,7 +491,7 @@ UnitBlueprint {
TargetCheckInterval = 1,
TargetPriorities = {
'STRUCTURE',
'(ALLUNITS - SPECIALLOWPRI)',
'ALLUNITS'
},
TargetRestrictDisallow = 'UNTARGETABLE',
TrackingRadius = 1.25,
Expand Down
4 changes: 2 additions & 2 deletions units/DEL0204/DEL0204_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ UnitBlueprint {
'TECH2 MOBILE',
'TECH1 MOBILE',
'(STRUCTURE * DEFENSE - ANTIMISSILE)',
'(ALLUNITS - SPECIALLOWPRI)',
'ALLUNITS',
},
TargetRestrictDisallow = 'UNTARGETABLE',
TrackingRadius = 1.15,
Expand Down Expand Up @@ -365,7 +365,7 @@ UnitBlueprint {
'TECH2 MOBILE',
'TECH3 MOBILE',
'(STRUCTURE * DEFENSE - ANTIMISSILE)',
'(ALLUNITS - SPECIALLOWPRI)',
'ALLUNITS',
},
TargetRestrictDisallow = 'UNTARGETABLE',
TrackingRadius = 1.15,
Expand Down
5 changes: 2 additions & 3 deletions units/DELK002/DELK002_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ UnitBlueprint {
RateOfFire = 0.5,
TargetCheckInterval = 1,
TargetPriorities = {
'(ALLUNITS - SPECIALLOWPRI)',
'ALLUNITS'
},
TargetRestrictDisallow = 'UNTARGETABLE',
TrackingRadius = 1.2,
Expand Down Expand Up @@ -298,14 +298,13 @@ UnitBlueprint {
RateOfFire = 1,
TargetCheckInterval = 0.25,
TargetPriorities = {
'AIR MOBILE HIGHPRIAIR',
'AIR MOBILE EXPERIMENTAL',
'AIR MOBILE TECH3 BOMBER',
'AIR MOBILE BOMBER',
'AIR MOBILE GROUNDATTACK',
'AIR MOBILE TRANSPORTATION',
'AIR MOBILE',
'(ALLUNITS - SPECIALLOWPRI)',
'ALLUNITS'
},
TargetRestrictDisallow = 'UNTARGETABLE',
TrackingRadius = 1.4,
Expand Down
5 changes: 2 additions & 3 deletions units/DRA0202/DRA0202_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,12 @@ UnitBlueprint {
SlavedToBody = false,
TargetCheckInterval = 0.5,
TargetPriorities = {
'AIR MOBILE HIGHPRIAIR',
'AIR MOBILE TECH3 BOMBER',
'AIR MOBILE BOMBER',
'AIR MOBILE GROUNDATTACK',
'AIR MOBILE TRANSPORTATION',
'AIR MOBILE',
'(ALLUNITS - SPECIALLOWPRI)',
'ALLUNITS'
},
TargetRestrictDisallow = 'UNTARGETABLE,LAND,STRUCTURE,NAVAL',
TargetRestrictOnlyAllow = 'AIR',
Expand Down Expand Up @@ -396,7 +395,7 @@ UnitBlueprint {
TargetCheckInterval = 0.5,
TargetPriorities = {
'STRUCTURE',
'(ALLUNITS - SPECIALLOWPRI)',
'ALLUNITS'
},
TargetRestrictDisallow = 'UNTARGETABLE',
TrackingRadius = 0.8,
Expand Down
2 changes: 1 addition & 1 deletion units/DRL0204/DRL0204_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ UnitBlueprint {
'TECH2 MOBILE',
'TECH1 MOBILE',
'(STRUCTURE * DEFENSE - ANTIMISSILE)',
'(ALLUNITS - SPECIALLOWPRI)',
'ALLUNITS',
},
TargetRestrictDisallow = 'UNTARGETABLE',
TrackingRadius = 1.15,
Expand Down
8 changes: 3 additions & 5 deletions units/DRLK001/DRLK001_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ UnitBlueprint {
'TECH2 MOBILE',
'TECH1 MOBILE',
'(STRUCTURE * DEFENSE - ANTIMISSILE)',
'(ALLUNITS - SPECIALLOWPRI)',
'ALLUNITS'
},
TargetRestrictDisallow = 'UNTARGETABLE',
TrackingRadius = 1.4,
Expand Down Expand Up @@ -367,14 +367,13 @@ UnitBlueprint {
ReTargetOnMiss = true,
TargetCheckInterval = 0.1,
TargetPriorities = {
'AIR MOBILE HIGHPRIAIR',
'AIR MOBILE EXPERIMENTAL',
'AIR MOBILE TECH3 BOMBER',
'AIR MOBILE BOMBER',
'AIR MOBILE GROUNDATTACK',
'AIR MOBILE TRANSPORTATION',
'AIR MOBILE',
'(ALLUNITS - SPECIALLOWPRI)',
'ALLUNITS'
},
TargetRestrictDisallow = 'UNTARGETABLE',
TrackingRadius = 1.4,
Expand Down Expand Up @@ -479,13 +478,12 @@ UnitBlueprint {
RateOfFire = 1.667,
TargetCheckInterval = 0.3,
TargetPriorities = {
'AIR MOBILE HIGHPRIAIR',
'AIR MOBILE TECH3 BOMBER',
'AIR MOBILE BOMBER',
'AIR MOBILE GROUNDATTACK',
'AIR MOBILE TRANSPORTATION',
'AIR MOBILE',
'(ALLUNITS - SPECIALLOWPRI)',
'ALLUNITS'
},
TargetRestrictDisallow = 'UNTARGETABLE',
TrackingRadius = 1,
Expand Down
5 changes: 2 additions & 3 deletions units/DSLK004/DSLK004_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ UnitBlueprint {
'TECH2 MOBILE',
'TECH1 MOBILE',
'(STRUCTURE * DEFENSE - ANTIMISSILE)',
'(ALLUNITS - SPECIALLOWPRI)',
'ALLUNITS'
},
TargetRestrictDisallow = 'UNTARGETABLE',
TrackingRadius = 1.15,
Expand Down Expand Up @@ -365,14 +365,13 @@ UnitBlueprint {
RequireTime = 0,
TargetCheckInterval = 0.7,
TargetPriorities = {
'AIR MOBILE HIGHPRIAIR',
'AIR MOBILE EXPERIMENTAL',
'AIR MOBILE TECH3 BOMBER',
'AIR MOBILE BOMBER',
'AIR MOBILE GROUNDATTACK',
'AIR MOBILE TRANSPORTATION',
'AIR MOBILE',
'(ALLUNITS - SPECIALLOWPRI)',
'ALLUNITS'
},
TargetRestrictDisallow = 'UNTARGETABLE',
TrackingRadius = 1.15,
Expand Down
1 change: 0 additions & 1 deletion units/OPC1002/OPC1002_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ UnitBlueprint {
'CYBRAN',
'CIVILIAN',
'OPERATION',
'SPECIALHIGHPRI',
'MOBILE',
'VISIBLETORECON',
'RECLAIMABLE',
Expand Down
Loading

0 comments on commit 7314c3d

Please sign in to comment.