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,61 @@
|
||||
modded class ERR_HunterService
|
||||
{
|
||||
protected ref ERR_HunterVehicle m_ERRProbeTruck;
|
||||
void ERR_CheckTruckCrew(Vehicle vehicle)
|
||||
{
|
||||
ERR_HunterVehicle unit = new ERR_HunterVehicle(); unit.Entity = vehicle; unit.TroopTransport = true;
|
||||
unit.Group = SCR_AIGroup.Cast(ERR_Actors.Spawn(ERR_ConvoyResources.GroupPrefab(), vehicle.GetOrigin()));
|
||||
bool filled = unit.Group && FillCrew(unit);
|
||||
m_ERRProbeTruck = unit;
|
||||
PrintFormat("ERR HUNTER FLEET NATIVE CREW QUEUED: filled=%1 members=%2 seats=%3", filled, unit.Members.Count(), unit.Seats.Count());
|
||||
GetGame().GetCallqueue().CallLater(ERR_FinishTruckProbe, 2000, false);
|
||||
}
|
||||
void ERR_FinishTruckProbe()
|
||||
{
|
||||
ERR_HunterVehicle unit = m_ERRProbeTruck;
|
||||
int occupied;
|
||||
for (int i = 0; i < unit.Seats.Count() && i < unit.Members.Count(); i++)
|
||||
if (unit.Seats[i].GetOccupant() == unit.Members[i]) occupied++;
|
||||
PrintFormat("ERR HUNTER FLEET NATIVE CREW: filled=%1 members=%2 seats=%3 occupied=%4", unit.Group.GetAgentsCount() == 15, unit.Members.Count(), unit.Seats.Count(), occupied);
|
||||
foreach (IEntity actor : unit.Members) if (actor) SCR_EntityHelper.DeleteEntityAndChildren(actor);
|
||||
if (unit.Group) SCR_EntityHelper.DeleteEntityAndChildren(unit.Group);
|
||||
if (unit.Entity) SCR_EntityHelper.DeleteEntityAndChildren(unit.Entity);
|
||||
m_ERRProbeTruck = null;
|
||||
}
|
||||
}
|
||||
modded class ArmaReforgerScripted
|
||||
{
|
||||
protected ref ERR_HunterService m_ERRTruckService;
|
||||
protected bool m_ERRTruckSeatsChecked;
|
||||
protected float m_ERRTruckProbeAge;
|
||||
override void OnUpdate(BaseWorld world, float timeslice)
|
||||
{
|
||||
super.OnUpdate(world, timeslice);
|
||||
if (m_ERRTruckSeatsChecked || !m_ERRPresentedTerrainHeader) return;
|
||||
m_ERRTruckProbeAge += timeslice;
|
||||
if (m_ERRTruckProbeAge < 4 || !ERR_GameMode.Get() || !ERR_GameMode.Get().EnemyFaction()) return;
|
||||
m_ERRTruckSeatsChecked = true;
|
||||
for (int ordinal = 0; ordinal < 3; ordinal++)
|
||||
{
|
||||
IEntity vehicle = ERR_Actors.Spawn(ERR_HunterFleetRules.VehiclePrefab(ordinal), ERR_Actors.Ground(Vector(3000 + ordinal * 30, 0, 3000)));
|
||||
array<BaseCompartmentSlot> seats = {};
|
||||
bool collected = vehicle && ERR_ConvoyRules.CollectSeats(vehicle, seats);
|
||||
int drivers, turrets, cargo;
|
||||
foreach (BaseCompartmentSlot seat : seats)
|
||||
{
|
||||
if (seat.GetType() == ECompartmentType.PILOT) drivers++;
|
||||
if (seat.GetType() == ECompartmentType.TURRET) turrets++;
|
||||
if (seat.GetType() == ECompartmentType.CARGO) cargo++;
|
||||
}
|
||||
bool valid = collected && ERR_HunterFleetRules.Seats(ERR_HunterFleetRules.Transport(ordinal), drivers, turrets, cargo, seats.Count());
|
||||
PrintFormat("ERR HUNTER FLEET NATIVE: slot=%1 transport=%2 driver=%3 turrets=%4 cargo=%5 total=%6 valid=%7", ordinal, ERR_HunterFleetRules.Transport(ordinal), drivers, turrets, cargo, seats.Count(), valid);
|
||||
if (ordinal == 2 && valid)
|
||||
{
|
||||
m_ERRTruckService = new ERR_HunterService(ERR_GameMode.Get(), null);
|
||||
m_ERRTruckService.ERR_CheckTruckCrew(Vehicle.Cast(vehicle));
|
||||
continue;
|
||||
}
|
||||
if (vehicle) SCR_EntityHelper.DeleteEntityAndChildren(vehicle);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user