Exemple #1
0
        public override void Update(DwarfTime Time)
        {
            HandleStockpilesTimer.Update(Time);

            if (HandleStockpilesTimer.HasTriggered)
            {
                foreach (var blacklist in BlacklistResources)
                {
                    foreach (var resource in Resources.Enumerate())
                    {
                        if (resource.ResourceType.HasValue(out var resourceType))
                        {
                            if (resourceType.Tags.Any(tag => tag == blacklist))
                            {
                                var transferTask = new TransferResourcesTask(World, this, resource);
                                if (World.TaskManager.HasTask(transferTask))
                                {
                                    continue;
                                }
                                World.TaskManager.AddTask(transferTask);
                            }
                        }
                    }
                }
            }

            HandleBoxes();

            base.Update(Time);
        }
Exemple #2
0
        public override void Update(DwarfTime Time)
        {
            HandleStockpilesTimer.Update(Time);

            if (HandleStockpilesTimer.HasTriggered)
            {
                foreach (var blacklist in BlacklistResources)
                {
                    foreach (var resourcePair in Resources.Resources)
                    {
                        if (resourcePair.Value.Count == 0)
                        {
                            continue;
                        }

                        var resourceType = Library.GetResourceType(resourcePair.Key);

                        if (resourceType.Tags.Any(tag => tag == blacklist))
                        {
                            var transferTask = new TransferResourcesTask(World, ID, resourcePair.Value.CloneResource());
                            if (World.TaskManager.HasTask(transferTask))
                            {
                                continue;
                            }
                            World.TaskManager.AddTask(transferTask);
                        }
                    }
                }
            }

            base.Update(Time);
        }