static bool Prefix(ref bool __result, IntVec3 c, Map map, Thing storable) { Comp_StorageInput comp = c.GetStorageComponent <Comp_StorageInput>(map); if (comp != null) { __result = comp.GetSlotGroup().Settings.AllowedToAccept(storable); return(false); } return(true); }
public void Notify_ComponentDeSpawned(Comp_CoordinatedAbstract component) { Type type = component.GetType(); if (typeof(Comp_StorageInput).IsAssignableFrom(type)) { Comp_StorageInput comp = (Comp_StorageInput)component; SlotGroup slotGroup = comp.GetSlotGroup(); List <IntVec3> cells; if (slotGroup != null && map_slotGroup_inputCells.TryGetValue(slotGroup, out cells)) { foreach (var cell in comp.specificCells) { cells.Remove(cell); } if (cells.Count == 0) { map_slotGroup_inputCells.Remove(slotGroup); } } inputs.Remove(comp); unconnectedInputs.Remove(comp); map.slotGroupManager.Notify_GroupChangedPriority(); } else if (typeof(Comp_StorageOutput).IsAssignableFrom(type)) { outputs.Remove((Comp_StorageOutput)component); previousRootCell = IntVec3.Invalid; } else if (typeof(Comp_StorageAbstract).IsAssignableFrom(type)) { Comp_StorageAbstract comp = (Comp_StorageAbstract)component; storages.Remove(comp); foreach (var reservation in reservations.ToList()) { if (reservation.storage == comp) { reservations.Remove(reservation); } } } foreach (var cell in component.specificCells) { List <Comp_CoordinatedAbstract> compsInCell; map_cell_comps.TryGetValue(cell, out compsInCell); compsInCell.Remove(component); if (compsInCell.Count == 0) { map_cell_comps.Remove(cell); } } }
public void Notify_ComponentSpawned(Comp_CoordinatedAbstract component) { Type type = component.GetType(); if (typeof(Comp_StorageInput).IsAssignableFrom(type)) { Comp_StorageInput comp = (Comp_StorageInput)component; inputs.Add(comp); SlotGroup slotGroup = comp.GetSlotGroup(); if (slotGroup != null) { List <IntVec3> cells; if (!map_slotGroup_inputCells.TryGetValue(slotGroup, out cells)) { cells = new List <IntVec3>(); map_slotGroup_inputCells.Add(slotGroup, cells); } cells.AddRange(comp.specificCells); } else { unconnectedInputs.Add(comp); } map.slotGroupManager.Notify_GroupChangedPriority(); } else if (typeof(Comp_StorageOutput).IsAssignableFrom(type)) { outputs.Add((Comp_StorageOutput)component); previousRootCell = IntVec3.Invalid; } else if (typeof(Comp_StorageAbstract).IsAssignableFrom(type)) { storages.Add((Comp_StorageAbstract)component); } foreach (var cell in component.specificCells) { List <Comp_CoordinatedAbstract> compsInCell; if (!map_cell_comps.TryGetValue(cell, out compsInCell)) { compsInCell = new List <Comp_CoordinatedAbstract>(); map_cell_comps.Add(cell, compsInCell); } compsInCell.Add(component); } }