Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
89 lines
4.3 KiB
Plaintext
89 lines
4.3 KiB
Plaintext
modded class SCR_ChimeraAIAgent
|
|
{
|
|
void ProbeReleasePrison() { ERR_PrisonPhaseChanged(ERR_Phase.PRISON, ERR_Phase.RADIO_SEARCH); SetPermanentLOD(0); ActivateAI(); }
|
|
}
|
|
modded class ERR_HunterService
|
|
{
|
|
ERR_HunterVehicle ProbeUnit()
|
|
{
|
|
vector position, angles;
|
|
if (!ERR_SupplyConvoySystem.ApproachDirected("6870 0 3500", position, angles, 500)) return null;
|
|
ERR_HunterVehicle unit = new ERR_HunterVehicle(); unit.Source = "native-gun-team";
|
|
unit.Entity = Vehicle.Cast(ERR_Actors.Spawn(ERR_HunterFleetRules.VehiclePrefab(0), position, angles));
|
|
unit.Group = SCR_AIGroup.Cast(ERR_Actors.Spawn(ERR_ConvoyResources.GroupPrefab(), position));
|
|
if (!FillCrew(unit)) return null;
|
|
unit.Group.SetPermanentLOD(0); unit.Group.ActivateAI();
|
|
array<AIAgent> agents = {}; unit.Group.GetAgents(agents);
|
|
foreach (AIAgent agent : agents) { agent.SetPermanentLOD(0); agent.ActivateAI(); }
|
|
return unit;
|
|
}
|
|
}
|
|
modded class ERR_HunterTactics
|
|
{
|
|
void ProbeBegin()
|
|
{
|
|
Unit.Group.SetPermanentLOD(0); Unit.Group.ActivateAI();
|
|
foreach (IEntity member : Unit.Members)
|
|
{
|
|
AIControlComponent control = AIControlComponent.Cast(member.FindComponent(AIControlComponent));
|
|
SCR_ChimeraAIAgent agent = SCR_ChimeraAIAgent.Cast(control.GetControlAIAgent()); if (agent) agent.ProbeReleasePrison();
|
|
}
|
|
Delivered = true; State = 2; Deadline = GetGame().GetWorld().GetWorldTime() + 45000; NextRetry = Deadline;
|
|
Stage = Unit.Entity.GetOrigin(); Approach = ERR_Actors.Ground(Stage + "40 0 0"); Sector = ERR_Actors.Ground(Stage + "65 0 20");
|
|
Attack.ReportPosition = Stage + "200 0 0"; Attack.Forward = "1 0 0"; Attack.Teams.Insert(this);
|
|
SCR_AIGroupUtilityComponent utility = Unit.Group.GetGroupUtilityComponent();
|
|
SCR_AIVehicleUsageComponent usage = SCR_AIVehicleUsageComponent.Cast(Unit.Entity.FindComponent(SCR_AIVehicleUsageComponent));
|
|
utility.m_VehicleMgr.TryAddVehicle(usage); utility.AddUsableVehicle(usage);
|
|
vector transform[4]; Unit.Entity.GetTransform(transform); Attack.ReportPosition = Stage - transform[2] * 200;
|
|
bool aligned = TryAlign();
|
|
bool issued = aligned;
|
|
if (aligned) { State = 8; Deadline = GetGame().GetWorld().GetWorldTime() + 20000; }
|
|
else issued = Board(false);
|
|
PrintFormat("ERR GUN TEAM ALIGN: requested=%1 facing=%2", aligned, FacingSector());
|
|
PrintFormat("ERR GUN TEAM START: board=%1 loaded=%2 split=%3", issued, ERR_HunterGunTeam.LoadedGunner(Unit) != null, m_GunTeam != null);
|
|
}
|
|
bool ProbeFacing() { return FacingSector(); }
|
|
bool ProbeSplit() { return m_GunTeam != null; }
|
|
}
|
|
modded class ArmaReforgerScripted
|
|
{
|
|
protected ref ERR_HunterService m_ProbeService;
|
|
protected ref ERR_HunterVehicle m_ProbeUnit;
|
|
protected ref ERR_HunterAttack m_ProbeAttack;
|
|
protected ref ERR_HunterTactics m_ProbeTactics;
|
|
protected float m_ProbeAge;
|
|
protected float m_ProbeNext;
|
|
protected bool m_ProbeDone;
|
|
override void OnUpdate(BaseWorld world, float timeslice)
|
|
{
|
|
super.OnUpdate(world, timeslice);
|
|
if (m_ProbeDone || !ERR_GameMode.Get() || !ERR_GameMode.Get().EnemyFaction()) return;
|
|
m_ProbeAge += timeslice;
|
|
if (m_ProbeAge < 5) return;
|
|
if (!m_ProbeService)
|
|
{
|
|
m_ProbeService = new ERR_HunterService(ERR_GameMode.Get(), null); m_ProbeUnit = m_ProbeService.ProbeUnit();
|
|
if (!m_ProbeUnit) { Print("ERR GUN TEAM FAILED creation"); m_ProbeDone = true; }
|
|
return;
|
|
}
|
|
if (m_ProbeAge < 10) return;
|
|
if (!m_ProbeTactics)
|
|
{
|
|
m_ProbeAttack = new ERR_HunterAttack(); m_ProbeAttack.Started = world.GetWorldTime();
|
|
m_ProbeTactics = new ERR_HunterTactics(ERR_GameMode.Get(), m_ProbeUnit, m_ProbeAttack, 1); m_ProbeTactics.ProbeBegin();
|
|
}
|
|
m_ProbeTactics.Tick(ERR_HQ.Get(), world.GetWorldTime());
|
|
if (m_ProbeAge >= m_ProbeNext)
|
|
{
|
|
m_ProbeNext = m_ProbeAge + 5;
|
|
PrintFormat("ERR GUN TEAM PROGRESS: state=%1 driverDistance=%2 passengerDistance=%3 gunnerSeated=%4 split=%5 footReady=%6 facing=%7", m_ProbeTactics.State, vector.DistanceXZ(m_ProbeUnit.Driver.GetOrigin(), m_ProbeUnit.Entity.GetOrigin()), vector.DistanceXZ(m_ProbeUnit.Members[2].GetOrigin(), m_ProbeUnit.Entity.GetOrigin()), m_ProbeUnit.Seats[1].GetOccupant() == m_ProbeUnit.Members[1], m_ProbeTactics.ProbeSplit(), m_ProbeTactics.Aboard(false), m_ProbeTactics.ProbeFacing());
|
|
}
|
|
if (m_ProbeAge > 145)
|
|
{
|
|
m_ProbeTactics.Stop();
|
|
PrintFormat("ERR GUN TEAM COMPLETE: holdReleased=%1", !ERR_ConvoyMountedCrew.Retain(m_ProbeUnit.Members[1], m_ProbeUnit.Entity));
|
|
m_ProbeDone = true;
|
|
}
|
|
}
|
|
}
|