Enable finite automatic convoy startup and scoped gunner skill
This commit is contained in:
@@ -7,7 +7,7 @@ class ERR_EnemyEquipmentRules
|
||||
if (!Replication.IsServer() || SCR_Global.IsEditMode() || !mode || mode != ERR_GameMode.Get() || !mode.Active()) return false;
|
||||
if (!group || !actor || !ERR_Actors.CanFight(actor) || ERR_Actors.Player(actor) || ERR_Actors.Group(actor) != group) return false;
|
||||
SCR_AIGroupUtilityComponent utility = group.GetGroupUtilityComponent();
|
||||
return utility && utility.IsMilitary() && group.GetPlayerCount(true) == 0 && group.GetFaction() == mode.EnemyFaction();
|
||||
return utility && utility.IsMilitary() && group.GetPlayerCount(true) == 0 && group.GetFaction() == mode.EnemyFaction() && !ERR_EnemyGunnerSkill.CapturedGroup(mode, group);
|
||||
}
|
||||
static EAISkill Floor(EAISkill skill)
|
||||
{
|
||||
@@ -22,12 +22,19 @@ modded class SCR_AICombatComponent
|
||||
protected ERR_GameMode m_ERRSkillMode;
|
||||
protected SCR_AIGroup m_ERRSkillGroup;
|
||||
protected EAISkill m_ERRPreviousSkill;
|
||||
protected EAISkill m_ERRRequestedSkill;
|
||||
void ERR_BindEnemySkill(ERR_GameMode mode, SCR_AIGroup group)
|
||||
{
|
||||
if (!ERR_EnemyEquipmentRules.Eligible(mode, group, GetOwner())) return;
|
||||
if (!m_ERRSkillMode) m_ERRPreviousSkill = GetAISkill();
|
||||
if (!m_ERRSkillMode) { m_ERRPreviousSkill = GetAISkill(); m_ERRRequestedSkill = GetAISkill(); }
|
||||
m_ERRSkillMode = mode; m_ERRSkillGroup = group;
|
||||
SetAISkill(GetAISkill());
|
||||
ERR_RefreshEnemySkill();
|
||||
}
|
||||
void ERR_RefreshEnemySkill()
|
||||
{
|
||||
if (!m_ERRSkillMode || !ERR_EnemyEquipmentRules.Eligible(m_ERRSkillMode, m_ERRSkillGroup, GetOwner())) return;
|
||||
EAISkill skill = ERR_EnemyGunnerSkill.Profile(m_ERRRequestedSkill, ERR_EnemyGunnerSkill.OriginalGunner(m_ERRSkillMode, m_ERRSkillGroup, GetOwner()));
|
||||
if (GetAISkill() != skill) super.SetAISkill(skill);
|
||||
}
|
||||
void ERR_ReleaseEnemySkill(ERR_GameMode mode)
|
||||
{
|
||||
@@ -37,7 +44,11 @@ modded class SCR_AICombatComponent
|
||||
}
|
||||
override void SetAISkill(EAISkill skill)
|
||||
{
|
||||
if (m_ERRSkillMode && ERR_EnemyEquipmentRules.Eligible(m_ERRSkillMode, m_ERRSkillGroup, GetOwner())) skill = ERR_EnemyEquipmentRules.Floor(skill);
|
||||
if (m_ERRSkillMode && ERR_EnemyEquipmentRules.Eligible(m_ERRSkillMode, m_ERRSkillGroup, GetOwner()))
|
||||
{
|
||||
m_ERRRequestedSkill = skill;
|
||||
skill = ERR_EnemyGunnerSkill.Profile(skill, ERR_EnemyGunnerSkill.OriginalGunner(m_ERRSkillMode, m_ERRSkillGroup, GetOwner()));
|
||||
}
|
||||
super.SetAISkill(skill);
|
||||
}
|
||||
override void ResetAISkill()
|
||||
@@ -203,6 +214,7 @@ class ERR_EnemyEquipment
|
||||
entry.Combat = SCR_AICombatComponent.Cast(entry.Actor.FindComponent(SCR_AICombatComponent));
|
||||
if (entry.Combat) entry.Combat.ERR_BindEnemySkill(m_Mode, entry.Group);
|
||||
}
|
||||
if (entry.Combat) entry.Combat.ERR_RefreshEnemySkill();
|
||||
entry.Check(m_Mode);
|
||||
if (entry.Optics) entry.Optics.Check(m_Mode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user