public void Reclaim(bool respectReserved = true, List <ThingCount> chosen = null) { if (this.IsOperational && this.CanAutoCollect) { float powerAvailable = 0; if (this.UsesPower && Settings.EnableEnergyBuffer) { powerAvailable = this.compPowerTrader.PowerNet.CurrentEnergyGainRate() / CompPower.WattsToWattDaysPerTick; if (powerAvailable <= Settings.DesiredEnergyBuffer) { return; } powerAvailable -= Settings.DesiredEnergyBuffer; } foreach (Thing t in BuildingUtil.FindThingsOfTypeNextTo(base.Map, base.Position, 1)) { if (chosen == null || !this.ChosenContains(t, chosen)) { if (this.UsesPower && Settings.EnableEnergyBuffer) { float newWeight = this.storedWeight + this.GetThingWeight(t, t.stackCount); if (newWeight * Settings.EnergyFactor > powerAvailable) { continue; } } this.Add(t); } } } }
public void ForceReclaim() { if (base.Map == null) { return; } foreach (Thing t in BuildingUtil.FindThingsOfTypeNextTo(base.Map, base.Position, 1)) { if (!(t is Building_InfiniteStorage) && t != this && t.def.category == ThingCategory.Item) { this.Add(t, true); } } }