120 lines
4.4 KiB
C
120 lines
4.4 KiB
C
#ifdef WORKBENCH
|
|
class ERR_CrashProbeSites : ERR_CrashSites
|
|
{
|
|
protected int m_Captured;
|
|
protected SCR_ManualCamera m_Camera;
|
|
void ERR_CrashProbeSites(ERR_GameMode mode) { m_Mode = mode; }
|
|
protected override bool Ready() { return true; }
|
|
protected override bool Survey(out vector point, out float heading)
|
|
{
|
|
if(Count()==0 && m_Attempts==1)
|
|
{
|
|
point="11180.619 0 11534.291";heading=0;float floor;
|
|
if(Separated(point) && m_Terrain.Clear(point,heading,11,0.6,floor,5)) {point=ERR_Actors.Ground(point);return true;}
|
|
}
|
|
return super.Survey(point,heading);
|
|
}
|
|
protected override bool Create(vector point, float heading)
|
|
{
|
|
m_HeliChance = 0;
|
|
if (Count() == 0) m_HeliChance = 100;
|
|
return super.Create(point, heading);
|
|
}
|
|
void Begin()
|
|
{
|
|
m_Mode.Settings().Set("crashSiteCount",2);
|
|
m_Mode.Settings().Set("crashRifleCount",6); m_Mode.Settings().Set("crashMagazineCount",8);
|
|
m_Mode.Settings().Set("crashAntiAirChancePercent",100); m_Mode.Settings().Set("crashRocketChancePercent",100);
|
|
Start();
|
|
GetGame().GetCallqueue().CallLater(Check,1000,true);
|
|
}
|
|
void Fail(string text)
|
|
{
|
|
Print("ERR SMOKE FAIL: crash sites " + text,LogLevel.ERROR);
|
|
GetGame().GetCallqueue().Remove(Check); Stop();
|
|
}
|
|
void Check()
|
|
{
|
|
PrintFormat("ERR CRASH PROGRESS: count=%1 captured=%2 stopped=%3 consumed=%4 attempts=%5 item=%6",Count(),m_Captured,m_Stopped,m_Consumed,m_Attempts,m_ItemIndex);
|
|
Print("ERR CRASH TERRAIN: " + m_Terrain.Rejection());
|
|
if(m_Skipped>0){Fail("unexpected skipped slot");return;}
|
|
if(Count()<=m_Captured || !At(m_Captured).Ready)return;
|
|
ERR_CrashSite site=At(m_Captured);
|
|
if(!site.Wreck || Vehicle.Cast(site.Wreck) || site.Wreck.FindComponent(VehicleControllerComponent)){Fail("repairable vehicle");return;}
|
|
ParticleEffectEntity smoke=ParticleEffectEntity.Cast(site.Smoke);
|
|
if(!smoke || !smoke.HasActiveParticles()){Fail("inactive smoke");return;}
|
|
if(site.Stock.Count()!=58){Fail("maximum crate stock count="+site.Stock.Count().ToString());return;}
|
|
int rifles, mags, rockets, aa;
|
|
foreach(IEntity item:site.Stock)
|
|
{
|
|
string path=item.GetPrefabData().GetPrefabName();
|
|
if(path.Contains("Rifle_"))rifles++;
|
|
if(path.Contains("Magazine_"))mags++;
|
|
if(path.Contains("Ammo_Rocket"))rockets++;
|
|
if(path.Contains("FIM92_Stinger.et"))
|
|
{
|
|
aa++;if(!ERR_EnemyLoadoutCatalog.Loaded(item)){Fail("unloaded AA");return;}
|
|
}
|
|
}
|
|
if(rifles!=6 || mags!=48 || rockets!=2 || aa!=1){Fail("weapon/ammo composition");return;}
|
|
PrintFormat("ERR SMOKE PASS: crash %1 maximum crate: rifles=%2 magazines=%3 rockets=%4 AA=%5 static wreck and active smoke",m_Captured,rifles,mags,rockets,aa);
|
|
if(!m_Camera)
|
|
{
|
|
EntitySpawnParams params=new EntitySpawnParams();
|
|
m_Camera=SCR_ManualCamera.Cast(GetGame().SpawnEntity(SCR_ManualCamera,GetGame().GetWorld(),params));
|
|
GetGame().GetCameraManager().SetCamera(m_Camera);
|
|
}
|
|
vector camera[4];vector eye=site.Position+"18 10 22";
|
|
Math3D.DirectionAndUpMatrix(vector.Direction(eye,site.Position+"0 2 0"),"0 1 0",camera);camera[3]=eye;m_Camera.SetWorldTransform(camera);m_Camera.SetVerticalFOV(65);
|
|
PrintFormat("ERR CONTENT STAGE: %1",m_Captured+2);
|
|
m_Captured++;
|
|
if(m_Captured==2)GetGame().GetCallqueue().CallLater(Done,5000,false);
|
|
}
|
|
void Done()
|
|
{
|
|
GetGame().GetCallqueue().Remove(Check);
|
|
if(Count()!=2 || !m_Stopped){Fail("finite completion");return;}
|
|
ERR_AdminMenu.Open();
|
|
GetGame().GetCallqueue().CallLater(MenuDone,5000,false);
|
|
}
|
|
void MenuDone()
|
|
{
|
|
Print("ERR SMOKE COMPLETE: crash sites and finite maximum loot");
|
|
}
|
|
}
|
|
modded class SCR_RespawnSystemComponent
|
|
{
|
|
override void UpdateLoadingPlaceholder(float dt)
|
|
{
|
|
super.UpdateLoadingPlaceholder(dt);
|
|
if(m_wLoadingPlaceholder)m_wLoadingPlaceholder.SetVisible(false);
|
|
}
|
|
}
|
|
modded class ERR_AdminMenu
|
|
{
|
|
override void OnMenuOpen()
|
|
{
|
|
super.OnMenuOpen(); ShowPage(ERR_AdminPage.CRASH_SITES);
|
|
if(!ERR_ProbeNavigation(ERR_AdminPage.CRASH_SITES))Print("ERR SMOKE FAIL: crash menu bounds",LogLevel.ERROR);
|
|
Print("ERR CONTENT STAGE: 4");
|
|
}
|
|
}
|
|
modded class ERR_GameMode
|
|
{
|
|
protected ref ERR_CrashProbeSites m_CrashProbe;
|
|
protected override void StartScenario() {}
|
|
override bool Active() { return m_CrashProbe != null; }
|
|
protected override void EOnInit(IEntity owner)
|
|
{
|
|
super.EOnInit(owner);
|
|
if(SCR_Global.IsEditMode() || !Replication.IsServer())return;
|
|
GetGame().GetCallqueue().CallLater(CrashBegin,7000,false);
|
|
}
|
|
void CrashBegin()
|
|
{
|
|
|
|
m_CrashProbe=new ERR_CrashProbeSites(this);m_CrashProbe.Begin();OnStop().Insert(m_CrashProbe.Stop);
|
|
}
|
|
}
|
|
#endif
|