Capture current mission, AI, map and administration development
Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
modded class ArmaReforgerScripted
|
||||
{
|
||||
protected int m_ERRScopeProbeStage;
|
||||
protected float m_ERRScopeProbeWait;
|
||||
protected IEntity m_ERRScopeProbeEntity;
|
||||
protected ref ERR_ObserverScopeDisplay m_ERRScopeProbeDisplay;
|
||||
override void OnUpdate(BaseWorld world, float timeslice)
|
||||
{
|
||||
super.OnUpdate(world, timeslice);
|
||||
ERR_GameMode mode = ERR_GameMode.Get();
|
||||
if (!mode || !mode.Active() || m_ERRScopeProbeStage >= 6 || world.GetWorldTime() < m_ERRScopeProbeWait) return;
|
||||
PlayerController pc = GetPlayerController();
|
||||
if (!pc || !pc.GetControlledEntity()) return;
|
||||
if (m_ERRScopeProbeStage == 0)
|
||||
{
|
||||
EntitySpawnParams params = new EntitySpawnParams(); params.TransformMode = ETransformMode.WORLD;
|
||||
params.Transform[3] = GetCameraManager().CurrentCamera().GetOrigin() + "0 0 3";
|
||||
m_ERRScopeProbeEntity = SpawnEntityPrefabLocal(Resource.Load("{C850A33226B8F9C1}Prefabs/Weapons/Attachments/Optics/Optic_PSO1/Optic_PSO1.et"), world, params);
|
||||
m_ERRScopeProbeDisplay = new ERR_ObserverScopeDisplay();
|
||||
m_ERRScopeProbeStage = 1; m_ERRScopeProbeWait = world.GetWorldTime() + 2000; return;
|
||||
}
|
||||
SCR_2DOpticsComponent optic = SCR_2DOpticsComponent.Cast(m_ERRScopeProbeEntity.FindComponent(SCR_2DOpticsComponent));
|
||||
if (m_ERRScopeProbeStage == 1)
|
||||
{
|
||||
if (!optic || !m_ERRScopeProbeDisplay.RenderScope(optic, m_ERRScopeProbeEntity, 12, "1 0 0"))
|
||||
{ Print("ERR SCOPE FAIL: native scope display creation", LogLevel.ERROR); m_ERRScopeProbeStage = 6; return; }
|
||||
Print("ERR SCOPE PASS: native PSO reticle display created");
|
||||
m_ERRScopeProbeStage = 2; m_ERRScopeProbeWait = world.GetWorldTime() + 3000; return;
|
||||
}
|
||||
if (m_ERRScopeProbeStage == 2)
|
||||
{
|
||||
Widget root = m_ERRScopeProbeDisplay.GetRootWidget();
|
||||
float width, height;
|
||||
if (root) root.GetScreenSize(width, height);
|
||||
PrintFormat("ERR SCOPE ROOT: exists=%1 width=%2 height=%3", root != null, width, height);
|
||||
System.MakeScreenshot("$logs:err-scope-pso");
|
||||
m_ERRScopeProbeStage = 3; m_ERRScopeProbeWait = world.GetWorldTime() + 1000; return;
|
||||
}
|
||||
if (m_ERRScopeProbeStage == 3)
|
||||
{
|
||||
m_ERRScopeProbeDisplay.Close();
|
||||
if ((m_ERRScopeProbeEntity.GetFlags() & EntityFlags.VISIBLE) == 0) Print("ERR SCOPE FAIL: visibility restore", LogLevel.ERROR);
|
||||
else Print("ERR SCOPE PASS: close restored optic visibility");
|
||||
if (!m_ERRScopeProbeDisplay.RenderScope(optic, m_ERRScopeProbeEntity, 6, "1 0 1")) Print("ERR SCOPE FAIL: scope reopen", LogLevel.ERROR);
|
||||
else Print("ERR SCOPE PASS: scope reopened at new zoom with illumination");
|
||||
m_ERRScopeProbeStage = 4; m_ERRScopeProbeWait = world.GetWorldTime() + 3000; return;
|
||||
}
|
||||
if (m_ERRScopeProbeStage == 4)
|
||||
{
|
||||
System.MakeScreenshot("$logs:err-scope-zoom");
|
||||
m_ERRScopeProbeStage = 5; m_ERRScopeProbeWait = world.GetWorldTime() + 1000; return;
|
||||
}
|
||||
m_ERRScopeProbeDisplay.Close(); delete m_ERRScopeProbeEntity; m_ERRScopeProbeDisplay = null;
|
||||
Print("ERR SCOPE COMPLETE"); m_ERRScopeProbeStage = 6;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user