public UncategorizedFilteredStorage( KMonoBehaviour root, Tag[] required_tags, Tag[] forbidden_tags, IUserControlledCapacity capacity_control, bool use_logic_meter, ChoreType fetch_chore_type) { this.root = root; this.requiredTags = required_tags; this.forbiddenTags = forbidden_tags; this.capacityControl = capacity_control; this.useLogicMeter = use_logic_meter; this.choreType = fetch_chore_type; root.Subscribe(-1697596308, new Action <object>(OnStorageChanged)); root.Subscribe(-543130682, new Action <object>(OnUserSettingsChanged)); this.filterable = root.FindOrAdd <UncategorizedFilterable>(); filterable.OnFilterChanged += new Action <Tag[]>(OnFilterChanged); this.storage = root.GetComponent <Storage>(); storage.Subscribe(644822890, new Action <object>(OnOnlyFetchMarkedItemsSettingChanged)); if (capacityStatusItem == null) { capacityStatusItem = new StatusItem("StorageLocker", "BUILDING", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 129022); capacityStatusItem.resolveStringCallback = (str, data) => { UncategorizedFilteredStorage filteredStorage = (UncategorizedFilteredStorage)data; float amountStored = filteredStorage.GetAmountStored(); float b = filteredStorage.storage.capacityKg; string newValue1 = Util.FormatWholeNumber(amountStored <= b - filteredStorage.storage.storageFullMargin || amountStored >= b ? Mathf.Floor(amountStored) : b); IUserControlledCapacity component = filteredStorage.root.GetComponent <IUserControlledCapacity>(); if (component != null) { b = Mathf.Min(component.UserMaxCapacity, b); } string newValue2 = Util.FormatWholeNumber(b); str = str.Replace("{Stored}", newValue1); str = str.Replace("{Capacity}", newValue2); str = component == null?str.Replace("{Units}", (string)GameUtil.GetCurrentMassUnit(false)) : str.Replace("{Units}", (string)component.CapacityUnits); return(str); }; noFilterStatusItem = new StatusItem("NoStorageFilterSet", "BUILDING", "status_item_no_filter_set", StatusItem.IconType.Custom, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 129022); } root.GetComponent <KSelectable>().SetStatusItem(Db.Get().StatusItemCategories.Main, capacityStatusItem, this); }
private const int ARTIFACT_RADIUS = 5; // all artifacts have radius forced to 5 protected override void OnPrefabInit() { filteredStorage = new UncategorizedFilteredStorage(this, null, null, this, true, Db.Get().ChoreTypes.StorageFetch); }