Пример #1
0
 public virtual bool AddItems(MechDef mechDef, SimGameState state)
 {
     if (AddIfNotPresent)
     {
         DefaultHelper.AddInventory(DefID, mechDef, Location, Type, state);
         return(true);
     }
     return(false);
 }
Пример #2
0
 public void OnInstalled(WorkOrderEntry_InstallComponent order, SimGameState state, MechDef mech)
 {
     Control.LogDebug(DType.ComponentInstall, $"- AutoReplace");
     Control.LogDebug(DType.ComponentInstall, $"-- search replace for {order.MechComponentRef.ComponentDefID}");
     if (order.PreviousLocation != ChassisLocations.None)
     {
         var location = Location == ChassisLocations.None ? order.PreviousLocation : Location;
         Control.LogDebug(DType.ComponentInstall, $"-- found, adding {ComponentDefId} to {location}");
         DefaultHelper.AddInventory(ComponentDefId, mech, location, order.MechComponentRef.ComponentDefType, state);
     }
     else
     {
         Control.LogDebug(DType.ComponentInstall, $"-- new component, not replacement needed");
     }
 }
Пример #3
0
        public void OnInstalled(WorkOrderEntry_InstallComponent order, SimGameState state, MechDef mech)
        {
            Control.LogDebug(DType.ComponentInstall, $"- AutoLinked");

            if (order.PreviousLocation != ChassisLocations.None)
            {
                foreach (var link in Links)
                {
                    Control.LogDebug(DType.ComponentInstall, $"-- removing {link.ComponentDefId} from {link.Location}");
                    DefaultHelper.RemoveInventory(link.ComponentDefId, mech, link.Location, link.ComponentDefType ?? Def.ComponentType);
                }
            }

            if (order.DesiredLocation != ChassisLocations.None)
            {
                foreach (var link in Links)
                {
                    Control.LogDebug(DType.ComponentInstall, $"-- adding {link.ComponentDefId} to {link.Location}");
                    DefaultHelper.AddInventory(link.ComponentDefId, mech, link.Location, link.ComponentDefType ?? Def.ComponentType, state);
                }
            }
        }
Пример #4
0
 public bool AddItems(MechDef mechDef, SimGameState state)
 {
     DefaultHelper.AddInventory(DefID, mechDef, Location, Type, state);
     return(true);
 }