|
|
|
@@ -54,6 +54,44 @@ class ERR_NativeTransportProbe
|
|
|
|
|
radio.Transport = null;
|
|
|
|
|
return Check(definition.Valid(), "valid authoring restored after isolated mutations");
|
|
|
|
|
}
|
|
|
|
|
// Read actual prepared stock only; this does not qualify repair/refuel use.
|
|
|
|
|
protected bool MaintenanceStock()
|
|
|
|
|
{
|
|
|
|
|
if (!Check(m_Site && m_Site.Container && m_Mode.Sites().Owns(m_Site.Container), "maintenance cache has its original site-owned container")) return false;
|
|
|
|
|
InventoryStorageManagerComponent inventory = InventoryStorageManagerComponent.Cast(m_Site.Container.FindComponent(InventoryStorageManagerComponent));
|
|
|
|
|
if (!Check(inventory != null, "maintenance cache native inventory exists")) return false;
|
|
|
|
|
array<IEntity> items = {}; ERR_Inventory.Items(inventory, items);
|
|
|
|
|
if (!Check(items.Count() <= 128, "maintenance inventory enumeration remains bounded")) return false;
|
|
|
|
|
int kits, cans;
|
|
|
|
|
foreach (IEntity item : items)
|
|
|
|
|
{
|
|
|
|
|
if (!item || !item.GetPrefabData()) continue;
|
|
|
|
|
ResourceName prefab = item.GetPrefabData().GetPrefabName();
|
|
|
|
|
if (prefab == "{C09C7C97EFA34909}Prefabs/ERR/Items/EmergencyRepairKit.et")
|
|
|
|
|
{
|
|
|
|
|
kits++;
|
|
|
|
|
SCR_ResourceComponent resource = SCR_ResourceComponent.Cast(item.FindComponent(SCR_ResourceComponent));
|
|
|
|
|
SCR_ResourceContainer supplies;
|
|
|
|
|
if (resource) supplies = resource.GetContainer(EResourceType.SUPPLIES);
|
|
|
|
|
float amount = -1, capacity = -1;
|
|
|
|
|
if (supplies) { amount = supplies.GetResourceValue(); capacity = supplies.GetMaxResourceValue(); }
|
|
|
|
|
PrintFormat("ERR MAINTENANCE STOCK: repairKit=%1 owned=%2 supplies=%3 capacity=%4", item, m_Mode.Sites().Owns(item), amount, capacity);
|
|
|
|
|
if (!Check(m_Mode.Sites().Owns(item) && supplies && Math.AbsFloat(amount - 20) <= 0.01
|
|
|
|
|
&& Math.AbsFloat(capacity - 20) <= 0.01, "original repair kit contains twenty native supply units")) return false;
|
|
|
|
|
}
|
|
|
|
|
else if (prefab == "{12D5AD21E383B768}Prefabs/Items/Fuel/Jerrycan_01/Jerrycan_01_item.et")
|
|
|
|
|
{
|
|
|
|
|
cans++;
|
|
|
|
|
SCR_FuelManagerComponent fuel = SCR_FuelManagerComponent.Cast(item.FindComponent(SCR_FuelManagerComponent));
|
|
|
|
|
float litres = -1, maximum = -1;
|
|
|
|
|
if (fuel) { litres = fuel.GetTotalFuel(); maximum = fuel.GetTotalMaxFuel(); }
|
|
|
|
|
PrintFormat("ERR MAINTENANCE STOCK: fuelCan=%1 owned=%2 litres=%3 capacity=%4", item, m_Mode.Sites().Owns(item), litres, maximum);
|
|
|
|
|
if (!Check(m_Mode.Sites().Owns(item) && fuel && Math.AbsFloat(litres - 5) <= 0.01
|
|
|
|
|
&& Math.AbsFloat(maximum - 20) <= 0.01, "original fuel can contains five litres in its native twenty-litre tank")) return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return Check(kits == 1 && cans == 2, "exactly one repair kit and two distinct original fuel cans are in the cache; consumption untested");
|
|
|
|
|
}
|
|
|
|
|
protected IEntity Character(int index)
|
|
|
|
|
{
|
|
|
|
|
IEntity actor = ERR_Actors.Spawn(m_Mode.Factions().PrisonerPrefab, ERR_Actors.Ground(m_Vehicle.GetOrigin() + Vector(-8 - index * 2, 0, 0)));
|
|
|
|
@@ -84,6 +122,7 @@ class ERR_NativeTransportProbe
|
|
|
|
|
if (!DefinitionChecks()) return -1;
|
|
|
|
|
m_Site = m_Mode.Sites().Find("everon-supply-2");
|
|
|
|
|
if (!Check(m_Site && m_Site.Transport && m_Mode.Sites().TransportCount() == 1 && m_Mode.Sites().Owns(m_Site.Transport), "exactly one authored transport belongs to the finite site service")) return -1;
|
|
|
|
|
if (!MaintenanceStock()) return -1;
|
|
|
|
|
m_Vehicle = m_Site.Transport;
|
|
|
|
|
m_Controller = CarControllerComponent.Cast(m_Vehicle.FindComponent(CarControllerComponent));
|
|
|
|
|
m_Fuel = SCR_FuelManagerComponent.Cast(m_Vehicle.FindComponent(SCR_FuelManagerComponent));
|
|
|
|
|