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:
bbradson
2024-04-27 22:31:07 +02:00
parent be3dae46bb
commit d34bc77869
76 changed files with 3061 additions and 1134 deletions
@@ -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);