コード例 #1
0
        private void Update()
        {
            var constructable = GetComponentInParent <Constructable>();

            if (!_initialized && constructable._constructed && transform.parent != null)
            {
                Initialize();
            }

            if (!_initialized || !constructable._constructed)
            {
                //Log.Info("Not Constructed");
            }

            SystemHandler();

            _passedTime += DayNightCycle.main.deltaTime;

            if (_passedTime >= _damageTimeInSeconds)
            {
                ApplyDamage();
            }

            AISolutionsData.UpdateTime();

            ProducePower();
        }
コード例 #2
0
        public static void Patch()
        {
            var assembly = Assembly.GetExecutingAssembly();

            QuickLogger.Info("Started patching. Version: " + QuickLogger.GetAssemblyVersion(assembly));

#if DEBUG
            QuickLogger.DebugLogsEnabled = true;
            QuickLogger.Debug("Debug logs enabled");
            //TODO remove on release
            //AIWindSurferBuildable.PatchSMLHelper();
#endif

            try
            {
                LoadAssetBundle();

                AddItemsToTechFabricator();

                AISolutionsData.PatchHelper();
                AIJetStreamT242Buildable.PatchSMLHelper();
                AIMarineMonitorBuildable.PatchSMLHelper();

                var harmony = HarmonyInstance.Create("com.aijetstreamt242.fcstudios");
                harmony.PatchAll(Assembly.GetExecutingAssembly());

                QuickLogger.Info("Finished patching");

                QuickLogger.Debug("Unload Bundle");
                //Bundle.Unload(false);
                QuickLogger.Debug("Bundle Unloaded");
            }
            catch (Exception ex)
            {
                QuickLogger.Error(ex.Message);
            }
        }
コード例 #3
0
 private static void Postfix()
 {
     AISolutionsData.UpdateTime();
 }
コード例 #4
0
        /// <summary>
        /// Execute to start the creation process to load the items into the game
        /// </summary>

        public static void Patch()
        {
            //Set Rotation
            AISolutionsData.ChangeRotation();

            HarmonyInstance = HarmonyInstance.Create($"com.FCStudios.{Information.ModName}");
            HarmonyInstance.PatchAll(Assembly.GetExecutingAssembly());

            SolarPanel_Patcher.AddEventHandlerIfMissing(AlertSolorPanelAwake);
            //BuilderToolConstruct_Patcher.AddEventHandlerIfMissing(AlertedNewBuilderBuild);
            //PowerFXSetTarget_Patcher.AddEventHandlerIfMissing(AlertedSetTarget);

            //Load the language
            JetStreamT242ModStrings = LoadLanguage <JetStreamT242ModStrings>(Information.JetStreamTurbineName) as JetStreamT242ModStrings;
            MarineMonitorModStrings = LoadLanguage <MarineMonitorModStrings>(Information.MarineTurbinesMonitorName) as MarineMonitorModStrings;
            DeepDrillerModStrings   = LoadLanguage <DeepDrillerModStrings>(Information.DeepDrillerName) as DeepDrillerModStrings;

            bool FCSTechWorkBench = TechTypeHandler.ModdedTechTypeExists("FCSTechWorkBench");

            if (!FCSTechWorkBench)
            {
                Log.Error($"Mod FCS WorkBench is needed!");
                //throw new PatchTerminatedException("Error finding FCS Work Bench");
            }

            if (!FindAllowedModules())
            {
                Log.Error($"Allowed modules not found!");

                //throw new PatchTerminatedException("Error finding all allow modules in FCS Work Bench");
            }

            //Load Configuration
            bool loaded = LoadConfigs();

            if (!loaded)
            {
                throw new PatchTerminatedException("Error loading Configuration");
            }

            var item     = DeepDrillConfig.BiomeOres["safeshallows"];
            var techType = item[1].ToTechType();

            Log.Info($"Found TechType: {techType}");

            // == Get the Prefabs == //
            if (GetPrefabs())
            {
                // === Create the jetStream == //
                if (JetStreamT242ModStrings != null)
                {
                    var jetStream = new JetStreamT242(Information.JetStreamTurbineName, Information.JetStreamTurbineFriendly,
                                                      JetStreamT242ModStrings.Description);
                    jetStream.Register();
                    jetStream.Patch();
                    JETSTREAMT242_PREFAB_OBJECT = jetStream;
                }
                else
                {
                    throw new PatchTerminatedException("Error JetStreamT242ModStrings is null");
                }

                // === Create the MarineTurbinesMonitor == //
                if (MarineMonitorModStrings != null)
                {
                    var monitor = new MarineTurbinesMonitor(Information.MarineTurbinesMonitorName, Information.MarineTurbinesMonitorFriendly,
                                                            MarineMonitorModStrings.Description);
                    monitor.Register();
                    monitor.Patch();
                    MONITOR_PREFAB_OBJECT = monitor;
                }
                else
                {
                    throw new PatchTerminatedException("Error MarineMonitorModStrings is null");
                }

                // === Create the DeepDriller == //
                if (DeepDrillerModStrings != null)
                {
                    var driller = new DeepDriller(Information.DeepDrillerName, Information.DeepDrillerFriendly,
                                                  DeepDrillerModStrings.Description);
                    driller.Register();
                    driller.Patch();
                    DEEP_DRILLER_PREFAB_OBJECT = driller;
                }
                else
                {
                    throw new PatchTerminatedException("Error DeepDrillerModStrings is null");
                }

                //var file = Path.Combine(Information.LANGUAGEDIRECTORY, $"{Information.MarineTurbinesMonitorName}.json");
                //var file = Information.GetConfigFile(Information.DeepDrillerName);

                //var data = JsonConvert.SerializeObject(new DeepDrillerCfg(), Formatting.Indented);

                //File.WriteAllText(file, data);
            }
            else
            {
                throw new PatchTerminatedException("Error loading finding a prefab");
            }
        }