public void OnItemGrabbed(IMechLabDraggableItem item, MechLabPanel mechLab, MechLabLocationWidget widget) { Control.LogDebug(DType.ComponentInstall, $"- AutoReplace"); Control.LogDebug(DType.ComponentInstall, $"-- search replace for {item.ComponentRef.ComponentDefID}"); if (string.IsNullOrEmpty(ComponentDefId)) { Control.LogDebug(DType.ComponentInstall, $"-- no replacement, skipping"); return; } Control.LogDebug(DType.ComponentInstall, $"-- {widget}"); var location = Location == ChassisLocations.None ? widget.loadout.Location : Location; DefaultHelper.AddMechLab(ComponentDefId, Def.ComponentType, new MechLabHelper(mechLab), location); Control.LogDebug(DType.ComponentInstall, $"-- added {ComponentDefId} to {location}"); mechLab.ValidateLoadout(false); }
public void OnItemGrabbed(IMechLabDraggableItem item, MechLabPanel mechLab, MechLabLocationWidget widget) { Control.LogDebug(DType.ComponentInstall, $"- Category {CategoryID}"); Control.LogDebug(DType.ComponentInstall, $"-- search replace for {item.ComponentRef.ComponentDefID}"); var replace = DefaultFixer.Shared.GetReplaceFor(mechLab.activeMechDef, CategoryID, widget.loadout.Location, mechLab.sim); if (replace == null) { Control.LogDebug(DType.ComponentInstall, $"-- no replacement, skipping"); return; } DefaultHelper.AddMechLab(replace, new MechLabHelper(mechLab)); Control.LogDebug(DType.ComponentInstall, $"-- added {replace.ComponentDefID} to {replace.MountedLocation}"); mechLab.ValidateLoadout(false); }