Integrate physical radio calls and finite vehicle maintenance

This commit is contained in:
2026-09-20 06:37:17 +02:00
parent 963cab50c0
commit 915476f709
152 changed files with 26426 additions and 28 deletions
+3 -1
View File
@@ -57,7 +57,7 @@ ERR_ScenarioDefinition {
}
ERR_SiteDefinition {
Id "everon-supply-2"
Label "Western supply cache"
Label "Western supply cache (vehicle maintenance)"
Kind 4
Prefab "{7C3D16C17C24D351}Prefabs/ERR/SupplySite.et"
Position 5960 0 7220
@@ -80,6 +80,8 @@ ERR_ScenarioDefinition {
MaximumTerrainRange 1
}
Stock {
ERR_SiteStock { Prefab "{C09C7C97EFA34909}Prefabs/ERR/Items/EmergencyRepairKit.et" Count 1 }
ERR_SiteStock { Prefab "{12D5AD21E383B768}Prefabs/Items/Fuel/Jerrycan_01/Jerrycan_01_item.et" Count 2 }
ERR_SiteStock { Prefab "{FA5C25BF66A53DCF}Prefabs/Weapons/Rifles/AK74/Rifle_AK74.et" Count 4 }
ERR_SiteStock { Prefab "{BBB50A815A2F916B}Prefabs/Weapons/Magazines/Magazine_545x39_AK_30rnd_Ball.et" Count 8 }
ERR_SiteStock { Prefab "{C3F1FA1E2EC2B345}Prefabs/Items/Medicine/FieldDressing_01/FieldDressing_USSR_01.et" Count 6 }
@@ -0,0 +1,22 @@
GenericEntity : "{33B2DFDCD0EBA3DB}Prefabs/Items/Equipment/Kits/RepairKit_01/RepairKit_01_wrench.et" {
components {
InventoryItemComponent "{5222EB4D0C73006B}" {
Attributes SCR_ItemAttributeCollection "{5222EB4D0A2B466B}" {
ItemDisplayName SCR_InventoryUIInfo "{5222EB4D07D865FA}" {
Name "Emergency repair kit"
Description "Equip the wrench, approach a damaged vehicle part and use its repair action. Includes 20 finite supplies; vanilla emergency repair limits apply. Supplies do not regenerate."
}
}
}
SCR_ResourceComponent "{5E4A9574582A1D38}" {
m_aContainers {
SCR_ResourceContainer "{D42B6E62D20C2264}" {
m_eResourceRights ALL
m_eStorageType CARGO_PROP
m_fResourceValueCurrent 20
m_fResourceValueMax 20
}
}
}
}
}
@@ -0,0 +1,9 @@
MetaFileClass {
Name "{C09C7C97EFA34909}Prefabs/ERR/Items/EmergencyRepairKit.et"
Configurations {
ResourceClass PC {
}
ResourceClass HEADLESS : PC {
}
}
}
@@ -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));