Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
92 lines
3.9 KiB
Plaintext
92 lines
3.9 KiB
Plaintext
modded class ERR_KnownMines
|
|
{
|
|
float m_ERRTrace;
|
|
protected override void Tick()
|
|
{
|
|
super.Tick();
|
|
float now = GetGame().GetWorld().GetWorldTime();
|
|
if (now < m_ERRTrace) return;
|
|
m_ERRTrace = now + 5000;
|
|
foreach (ERR_MineDetour d : m_Detours)
|
|
if (d.Actor) PrintFormat("ERR MINE DIAG STEER pos=%1 stepDist=%2 final=%3 goal=%4 action=%5", d.Actor.GetOrigin(), vector.DistanceXZ(d.Actor.GetOrigin(), d.Step), d.FinalLeg, d.Goal, d.Utility.GetCurrentAction());
|
|
}
|
|
}
|
|
modded class ERR_RoadblockMine
|
|
{
|
|
protected ref SCR_AIBehaviorBase m_ERRCrossing;
|
|
protected vector m_ERRGoal;
|
|
protected float m_ERRMinimum = 999;
|
|
protected bool m_ERRCrossStarted;
|
|
protected override void OnArmed()
|
|
{
|
|
super.OnArmed();
|
|
GetGame().GetCallqueue().CallLater(ERR_Cross, 2000, false);
|
|
}
|
|
protected void ERR_Cross()
|
|
{
|
|
if (!m_Actor || !m_Mine || !m_Utility) return;
|
|
AIAgent agent = SCR_AIUtils.GetAIAgent(m_Actor); agent.SetPermanentLOD(0); agent.ActivateAI();
|
|
vector away = m_Position - m_Actor.GetOrigin(); away[1] = 0; away.Normalize();
|
|
m_ERRGoal = ERR_Actors.Ground(m_Position + away * 25);
|
|
m_ERRCrossing = new SCR_AIMoveIndividuallyBehavior(m_Utility, null, m_ERRGoal, 1000, 0, null, 1);
|
|
m_Utility.AddAction(m_ERRCrossing); m_ERRCrossStarted = true;
|
|
PrintFormat("ERR MINE DIAG CROSS START actor=%1 mine=%2 goal=%3", m_Actor.GetOrigin(), m_Position, m_ERRGoal);
|
|
GetGame().GetCallqueue().CallLater(ERR_CrossSample, 100, true);
|
|
}
|
|
protected void ERR_CrossSample()
|
|
{
|
|
if (!m_Actor || !ERR_Actors.Alive(m_Actor)) { Print("ERR MINE DIAG CROSS FAIL: guard died"); GetGame().GetCallqueue().Remove(ERR_CrossSample); return; }
|
|
m_ERRMinimum = Math.Min(m_ERRMinimum, vector.DistanceXZ(m_Actor.GetOrigin(), m_Position));
|
|
if (vector.DistanceXZ(m_Actor.GetOrigin(), m_ERRGoal) < 3)
|
|
{
|
|
PrintFormat("ERR MINE DIAG CROSS PASS closest=%1 mineStillArmed=%2", m_ERRMinimum, m_Trigger.IsActivated());
|
|
GetGame().GetCallqueue().Remove(ERR_CrossSample); m_ERRCrossing.Complete();
|
|
}
|
|
}
|
|
void ERR_Diag()
|
|
{
|
|
vector actor;
|
|
if (m_Actor) actor = m_Actor.GetOrigin();
|
|
if (m_Actor && m_Utility)
|
|
{
|
|
AIAgent agent = SCR_AIUtils.GetAIAgent(m_Actor);
|
|
if (agent) PrintFormat("ERR MINE DIAG ACTION lod=%1 active=%2 current=%3 executing=%4 requested=%5", agent.GetLOD(), agent.IsAIActivated(), m_Utility.GetCurrentAction(), m_Utility.GetExecutedAction(), m_Action);
|
|
}
|
|
if (m_ERRCrossStarted) PrintFormat("ERR MINE DIAG CROSS progress=%1 closest=%2", vector.DistanceXZ(actor, m_ERRGoal), m_ERRMinimum);
|
|
bool armed;
|
|
if (m_Trigger) armed = m_Trigger.IsActivated();
|
|
PrintFormat("ERR MINE DIAG JOB state=%1 stopped=%2 actor=%3 site=%4 dist=%5 armed=%6 owned=%7", m_State, m_Stopped, actor, m_Position, vector.DistanceXZ(actor, m_Position), armed, Owned());
|
|
}
|
|
}
|
|
modded class ERR_RoadblockMining
|
|
{
|
|
float m_ERRDiag;
|
|
override void Tick(array<ref ERR_HQUnit> units, array<IEntity> attempted, float now)
|
|
{
|
|
super.Tick(units, attempted, now);
|
|
if (now < m_ERRDiag) return;
|
|
m_ERRDiag = now + 10000;
|
|
PrintFormat("ERR MINE DIAG TICK posts=%1 units=%2", m_Posts.Count(), units.Count());
|
|
foreach (ERR_RoadblockMinePost post : m_Posts)
|
|
{
|
|
PrintFormat("ERR MINE DIAG POST attempts=%1 jobs=%2", post.Attempts, post.Jobs.Count());
|
|
foreach (ERR_RoadblockMine job : post.Jobs) job.ERR_Diag();
|
|
if (!post.Jobs.IsEmpty()) post.Attempts = 4; // Fixture: reserve the surviving engineer for the crossing trial.
|
|
}
|
|
}
|
|
}
|
|
modded class ArmaReforgerScripted
|
|
{
|
|
float m_ERRMineElapsed;
|
|
bool m_ERRMineDone;
|
|
float m_ERRMineNext;
|
|
override void OnUpdate(BaseWorld world, float timeslice)
|
|
{
|
|
super.OnUpdate(world, timeslice);
|
|
if (m_ERRMineDone || !ERR_GameMode.Get() || !ERR_GameMode.Get().Active()) return;
|
|
m_ERRMineElapsed += timeslice;
|
|
if (m_ERRMineElapsed >= m_ERRMineNext) { m_ERRMineNext = m_ERRMineElapsed + 1; ERR_GameMode.Get().Command().Tick(world.GetWorldTime()); }
|
|
if (m_ERRMineElapsed >= 200) { Print("ERR MINE DIAG COMPLETE"); m_ERRMineDone = true; }
|
|
}
|
|
}
|