예제 #1
0
        public static bool Load(UnityModManager.ModEntry modEntry)
        {
            ModEntry = modEntry;

            string configPath = Path.Combine(ModEntry.Path, "industries.json");

            if (!IndustryConfigManager.LoadConfig(configPath))
            {
                ModEntry.Logger.Critical("Industry configuration file not found");
                return(false);
            }

            var harmony = new Harmony("cc.foxden.dv_industry");

            harmony.PatchAll(Assembly.GetExecutingAssembly());

            return(true);
        }
예제 #2
0
        public void Initialize()
        {
            if (StationController == null)
            {
                StationController = gameObject.GetComponent <StationController>();
            }

            processes = IndustryConfigManager.GetProcesses(StationId);
            if (processes == null)
            {
                DVIndustry.ModEntry.Logger.Error($"Failed to set processes on industry at {StationId}");
                return;
            }

            // Create stockpiles for each process I/O resource
            inputStockpile  = processes.SelectMany(proc => proc.Inputs.Select(r => r.CloneEmpty())).ToArray();
            outputStockpile = processes.SelectMany(proc => proc.Outputs.Select(r => r.CloneEmpty())).ToArray();

            // Add references for all stockpiles to the map
            stockpileMap = inputStockpile.Union(outputStockpile).ToDictionary(res => res.Key, res => res);

            IndustrySaveDataManager.RegisterIndustry(this);
        }