public void OnTimedUpdate() { if (!_worldLoaded && ChunkQueue.CompletedInitialLoad) { return; } foreach (var colony in ServerManager.ColonyTracker.ColoniesByID.Values.Where(c => c != null)) { RecalcStockpileMaxSize(colony); if (StockpileMaxStackSize.TryGetValue(colony, out var maxStockpile)) { foreach (var itemId in colony.Stockpile.Items.Keys) { if (!maxStockpile.TryGetValue(itemId, out var max)) { if (!DefaultMax.TryGetValue(colony, out max)) { max = StorageBlockTypes[StockpileBlock.Name].GlobalStorageUpgrade; } } if (colony.Stockpile.Items[itemId] > max) { colony.Stockpile.Items[itemId] = max; } } } else { foreach (var itemId in colony.Stockpile.Items.Keys) { var max = StorageBlockTypes[StockpileBlock.Name].GlobalStorageUpgrade; if (colony.Stockpile.Items[itemId] > max) { colony.Stockpile.Items[itemId] = max; } } } colony.Stockpile.SendToOwners(); } foreach (var cKvp in CrateLocations.Values) { foreach (var inv in cKvp.Values) { inv.CaclulateTimeouts(); } } }
static void ConstructTooltip(Players.Player player, ConstructTooltipUIData data) { ItemTypes.ItemType item = BuiltinBlocks.Types.air; if (data.hoverType == Shared.ETooltipHoverType.Item && !ItemTypes.TryGetType(data.hoverItem, out item)) { return; } else if (data.hoverType == Shared.ETooltipHoverType.PlayerRecipe && !ItemTypes.TryGetType(data.hoverItem, out item)) { return; } else if (data.hoverType == Shared.ETooltipHoverType.NPCRecipe && !ItemTypes.TryGetType(data.hoverItem, out item)) { return; } else if (data.hoverType == Shared.ETooltipHoverType.Science && !ItemTypes.TryGetType(data.hoverKey, out item)) { return; } else if (data.hoverType == Shared.ETooltipHoverType.ScienceCondition && !ItemTypes.TryGetType(data.hoverKey, out item)) { return; } else if (data.hoverType == Shared.ETooltipHoverType.ScienceUnlock && !ItemTypes.TryGetType(data.hoverKey, out item)) { return; } if (item == BuiltinBlocks.Types.air) { return; } if (player.ActiveColony != null && StockpileMaxStackSize.TryGetValue(player.ActiveColony, out var itemDic) && itemDic.TryGetValue(item.ItemIndex, out var maxSize)) { data.menu.Items.Add(new HorizontalRow(new List <(IItem, int)>() { (new Label(new LabelData(GameSetup.GetNamespace("Storage.MaxStackSize"))), 200), (new Label(new LabelData(maxSize.ToString())), 60) })); } if (CrateTypes.TryGetValue(item.Name, out var crate)) { data.menu.Items.Add(new HorizontalRow(new List <(IItem, int)>() { (new Label(new LabelData(GameSetup.GetNamespace("Storage.MaxCrateStackSize"))), 200), (new Label(new LabelData(crate.MaxCrateStackSize.ToString())), 60) })); data.menu.Items.Add(new HorizontalRow(new List <(IItem, int)>() { (new Label(new LabelData(GameSetup.GetNamespace("Storage.MaxNumberOfStacks"))), 200), (new Label(new LabelData(crate.MaxNumberOfStacks.ToString())), 60) })); } if (StorageBlockTypes.TryGetValue(item.Name, out var upgrade)) { data.menu.Items.Add(new HorizontalRow(new List <(IItem, int)>() { (new Label(new LabelData(GameSetup.GetNamespace("Storage.GlobalStorageUpgrade"))), 200), (new Label(new LabelData(upgrade.GlobalStorageUpgrade.ToString())), 60) })); if (upgrade.CategoryStorageUpgrades.Count > 0) { data.menu.Items.Add(new EmptySpace(5)); data.menu.Items.Add(new Label(new LabelData(GameSetup.GetNamespace("Storage.CategoryStoreUpgrades"), ELabelAlignment.MiddleCenter, 18))); data.menu.Items.Add(new Line(UnityEngine.Color.white, 3)); foreach (var csu in upgrade.CategoryStorageUpgrades) { data.menu.Items.Add(new HorizontalRow(new List <(IItem, int)>() { (new Label(new LabelData(csu.Key)), 200), (new Label(new LabelData(csu.Value.ToString())), 60) })); } } if (upgrade.ItemStorageUpgrades.Count > 0) { data.menu.Items.Add(new EmptySpace(5)); data.menu.Items.Add(new Label(new LabelData(GameSetup.GetNamespace("Storage.ItemStoreUpgrades"), ELabelAlignment.MiddleCenter, 18))); data.menu.Items.Add(new Line(UnityEngine.Color.white, 3)); foreach (var csu in upgrade.ItemStorageUpgrades) { data.menu.Items.Add(new HorizontalRow(new List <(IItem, int)>() { (new Label(new LabelData(csu.Key, ELabelAlignment.Default, 16, LabelData.ELocalizationType.Type)), 200), (new Label(new LabelData(csu.Value.ToString())), 60) })); } } } }