--- a/addons/core/Scripts/Game/ERR/40_Chat/ERR_NativeCrashStartProbe.c +++ b/addons/core/Scripts/Game/ERR/40_Chat/ERR_NativeCrashStartProbe.c @@ -7,6 +7,19 @@ { if (condition) { Print("ERR SMOKE PASS: crash start " + message); return true; } Print("ERR SMOKE FAIL: crash start " + message, LogLevel.ERROR); return false; + } + // GetItems can include magazines installed in a contained pistol. Only exact + // reciprocal slots owned by this bag count toward its loose authored allowance. + protected static bool DirectBagItem(IEntity item, IEntity bag) + { + if (!item || !bag) return false; + InventoryItemComponent component = InventoryItemComponent.Cast(item.FindComponent(InventoryItemComponent)); + if (!component) return false; + InventoryStorageSlot slot = component.GetParentSlot(); + if (!slot) return false; + BaseInventoryStorageComponent storage = slot.GetStorage(); + return storage && storage.GetOwner() == bag && storage.GetSlot(slot.GetID()) == slot + && slot.GetParentContainer() == storage && slot.GetAttachedEntity() == item; } static bool Run(ERR_GameMode mode, IEntity player) { @@ -39,10 +52,14 @@ if (!Check(inventory && items.Count() > 0 && items.Count() <= 128, "finite starting stock is present")) return false; foreach (ERR_SiteStock stock : site.Definition.Stock) { + // Mirror the current shared-map Scenario FieldMap override; all other + // finite stock resources remain exactly as authored in the definition. + ResourceName expected = stock.Prefab; + if (expected == ERR_Supplies.Map()) expected = "{A46500E4A30B653B}Prefabs/Items/Equipment/ERRM_SharedFieldMap.et"; int count; foreach (IEntity item : items) - if (item && item.GetPrefabData() && item.GetPrefabData().GetPrefabName() == stock.Prefab) count++; - if (!Check(count == stock.Count, "original starting stock count " + stock.Prefab)) return false; + if (DirectBagItem(item, site.Container) && item.GetPrefabData() && item.GetPrefabData().GetPrefabName() == expected) count++; + if (!Check(count == stock.Count, "current direct salvage stock count " + expected)) return false; } if (!Check(ERR_ObjectiveText.Description(mode).Contains("salvage"), "initial objective explains the salvage bag")) return false; PrintFormat("ERR CRASH START: anchor=%1 wreck=%2 halfSize=%3 clearance=%4; on-foot static aftermath, no crash flight or multiplayer proof", site.Definition.Position, wreck.GetOrigin(), halfSize, height);