Пример #1
0
        /// <summary>
        /// Starts all patching code in SMLHelper.
        /// If <seealso cref="IsPatched"/> is <c>true</c> then this method is skipped to avoid duplicate patching.
        /// </summary>
        /// <seealso cref="OnStartedPatching"/>
        /// <seealso cref="OnFinishedPatching"/>
        public void Patch()
        {
            if (this.IsPatched)
            {
                return; // Already patched. Skip.
            }
            OnStartedPatching?.Invoke();

            // Because invocation order isn't guaranteed by event handlers,
            // we make sure the TechType is patched first before anything else that might require it.
            this.TechType = TechTypeHandler.Singleton.AddTechType(ModName, this.ClassID, this.FriendlyName, this.Description, false);

            CorePatchEvents.Invoke();

            this.IsPatched = true;

            OnFinishedPatching?.Invoke();
        }
Пример #2
0
        /// <summary>
        /// Starts all patching code in SMLHelper.
        /// If <seealso cref="IsPatched"/> is <c>true</c> then this method is skipped to avoid duplicate patching.
        /// </summary>
        /// <seealso cref="OnStartedPatching"/>
        /// <seealso cref="OnFinishedPatching"/>
        public void Patch()
        {
            if (IsPatched)
            {
                return; // Already patched. Skip.
            }

            OnStartedPatching?.Invoke();

            // Because invocation order isn't guaranteed by event handlers,
            // we make sure the TechType is patched first before anything else that might require it.
            PatchTechType();

            CorePatchEvents.Invoke();

            IsPatched = true;

            OnFinishedPatching?.Invoke();
        }