public void SetAllowBuilding(ThingDef building, bool allow, bool sync = true) { if (building == null) { throw new ArgumentNullException(nameof(building)); } AllowedBuildings[building] = allow; if (SyncFilterAndAllowed && sync) { Sync = Utilities.SyncDirection.AllowedToFilter; foreach (var material in GetMaterialsInBuilding(building)) { if (Trigger.ParentFilter.Allows(material)) { Trigger.ThresholdFilter.SetAllow(material, allow); } } } }
public void SetAllowMineral(ThingDef mineral, bool allow, bool sync = true) { if (mineral == null) { throw new ArgumentNullException(nameof(mineral)); } AllowedMinerals[mineral] = allow; if (SyncFilterAndAllowed && sync) { Sync = Utilities.SyncDirection.AllowedToFilter; foreach (var material in GetMaterialsInMineral(mineral)) { if (Trigger.ParentFilter.Allows(material)) { Trigger.ThresholdFilter.SetAllow(material, allow); } } } }
public void SetPlantAllowed(ThingDef plant, bool allow, bool sync = true) { if (plant == null) { throw new ArgumentNullException(nameof(plant)); } AllowedPlants[plant] = allow; if (SyncFilterAndAllowed && sync) { Sync = Utilities.SyncDirection.AllowedToFilter; foreach (var material in GetMaterialsInPlant(plant)) { if (Trigger.ParentFilter.Allows(material)) { Trigger.ThresholdFilter.SetAllow(material, allow); } } } }
public void SetFishAllowed(FishDef fish, bool allow) { if (fish == null) { throw new ArgumentNullException(nameof(fish)); } if (Prefs.DevMode) { Log.Message( $"Fishing Automation: Setting fish '{fish.thingDef.LabelCap}' to {(allow ? "allowed" : "forbidden")}"); } AllowedFish[fish] = allow; if (SyncFilterAndAllowed) { Sync = Utilities.SyncDirection.AllowedToFilter; var material = fish.thingDef; if (Trigger.ParentFilter.Allows(material)) { Trigger.ThresholdFilter.SetAllow(material, allow); } } }