1.5, added stuff, fixed stuff
- mod icon - fixes for new vanilla clipping issues - GenClosest optimization improving repairing, wardening, tending jobs - caching for new ListerBuildings methods - DynamicDrawManager single threading - Type.GetFields caching - StatParts analyzer category - removed duplicate steam warning and optionally window - added exception handling for debug menu, incidentworker, Graphic_Multi, InitializeComps, making all those now log what mod broke and not cause black screens or whatever
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace PerformanceFish.Hauling;
|
||||
|
||||
public class StorageDistrict
|
||||
@@ -93,11 +95,18 @@ public class StorageDistrict
|
||||
public void RemoveThing(Thing thing)
|
||||
{
|
||||
if (!StoredThingsOfDef(thing.def).Remove(thing))
|
||||
ThrowHelper.ThrowInvalidOperationException();
|
||||
{
|
||||
ThrowForInvalidRemovalAttempt(thing);
|
||||
}
|
||||
|
||||
FreeSlots = TotalSlots - --_storedThingCount;
|
||||
}
|
||||
|
||||
[DoesNotReturn]
|
||||
private void ThrowForInvalidRemovalAttempt(Thing thing)
|
||||
=> ThrowHelper.ThrowInvalidOperationException($"Failed removing thing '{
|
||||
thing}' from district at cells '{Cells.ToStringSafeEnumerable()}'");
|
||||
|
||||
public List<Thing> StoredThingsOfDef(ThingDef def) => _storedThingsByDef.GetOrAdd(def.shortHash);
|
||||
|
||||
public bool CapacityAllows(Thing t) => FreeSlots > 0 || StoredThingsOfDef(t.def).ContainsThingStackableWith(t);
|
||||
|
||||
Reference in New Issue
Block a user