From 281b1d4efd69e5106108e3119ded66b28f0fa000 Mon Sep 17 00:00:00 2001 From: Denis Belan Date: Sat, 20 Nov 2021 13:00:27 +0300 Subject: [PATCH 1/8] remove PreValidateDrop as unused --- ActivatableEquipment/Main.cs | 72 +----------------------------------- 1 file changed, 1 insertion(+), 71 deletions(-) diff --git a/ActivatableEquipment/Main.cs b/ActivatableEquipment/Main.cs index 630cf08..f8c3f73 100644 --- a/ActivatableEquipment/Main.cs +++ b/ActivatableEquipment/Main.cs @@ -454,7 +454,7 @@ public AoEExplosion() { } public enum DamageActivationType { Threshhold, Single, Level } [CustomComponent("ActivatableComponent")] - public partial class ActivatableComponent : SimpleCustomComponent, IPreValidateDrop { + public partial class ActivatableComponent : SimpleCustomComponent { public static string CAEComponentActiveStatName = "CAEComnonentActive"; public static string CAEComponentActiveRounds = "CAEComnonentActiveRounds"; public static string CAEComponentActivedRound = "CAEComnonentActivedRound"; @@ -1327,76 +1327,6 @@ public static void toggleComponentActivation(MechComponent component) { ActivatableComponent.deactivateComponent(component); } } - - public string PreValidateDrop(MechLabItemSlotElement item, LocationHelper location, MechLabHelper mechlab) { - Log.Debug?.Write("PreValidateDrop\n"); - if (this.MechTonnageWeightMult > CustomActivatableEquipment.Core.Epsilon) { - float self_tonnage = (float)Math.Ceiling((double)this.Def.Tonnage); - float upLimit = (float)Math.Ceiling((double)(self_tonnage * this.MechTonnageWeightMult)); - float downLimit = (float)Math.Ceiling((double)((self_tonnage - 1f) * this.MechTonnageWeightMult)); - Log.Debug?.Write(" checking on tonnage. mech : " + downLimit + " - " + upLimit + "\n"); - if ((mechlab.MechLab.activeMechDef.Chassis.Tonnage <= downLimit) || (mechlab.MechLab.activeMechDef.Chassis.Tonnage > upLimit)) { - string result = "This component is not sutable for this chassis. Tonnage must be " + (downLimit + 1f) + "-" + upLimit; - return result; - } - } - if (this.MechTonnageSlotsMult > CustomActivatableEquipment.Core.Epsilon) { - float self_tonnage = this.Def.InventorySize; - float upLimit = (float)Math.Ceiling((double)(self_tonnage * this.MechTonnageSlotsMult)); - float downLimit = (float)Math.Ceiling((double)((self_tonnage - 1f) * this.MechTonnageSlotsMult)); - Log.Debug?.Write(" checking on tonnage. mech : " + downLimit + " - " + upLimit + "\n"); - if ((mechlab.MechLab.activeMechDef.Chassis.Tonnage <= downLimit) || (mechlab.MechLab.activeMechDef.Chassis.Tonnage > upLimit)) { - string result = "This component is not sutable for this chassis. Tonnage must be " + (downLimit + 1f) + "-" + upLimit; - return result; - } - } - if ((this.EngineTonnageWeightMult > CustomActivatableEquipment.Core.Epsilon) || (this.EngineTonnageSlotsMult > CustomActivatableEquipment.Core.Epsilon)) { - Log.Debug?.Write(" checking on engine weight\n"); - List components = mechlab.MechLab.activeMechInventory; - float engineTonnage = 0f; - foreach (var comp in components) { - if (comp.Def.IsCategory("EnginePart")) { - engineTonnage += comp.Def.Tonnage; - }; - } - if (engineTonnage < CustomActivatableEquipment.Core.Epsilon) { - return string.Empty; - } - if (this.EngineTonnageWeightMult > CustomActivatableEquipment.Core.Epsilon) { - float self_tonnage = (float)Math.Ceiling((double)this.Def.Tonnage); - float upLimit = (float)Math.Ceiling((double)(self_tonnage * this.EngineTonnageWeightMult)); - float downLimit = (float)Math.Ceiling((double)((self_tonnage - 1f) * this.EngineTonnageWeightMult)); - Log.Debug?.Write(" checking on tonnage. engine : " + downLimit + " - " + upLimit + "\n"); - if ((engineTonnage <= downLimit) || (engineTonnage > upLimit)) { - string result = "This component is not sutable for this chassis. Engine tonnage must be " + (downLimit + 1f) + "-" + upLimit; - return result; - } - } - if (this.EngineTonnageSlotsMult > CustomActivatableEquipment.Core.Epsilon) { - float self_tonnage = this.Def.InventorySize; - float upLimit = (float)Math.Ceiling((double)(self_tonnage * this.EngineTonnageSlotsMult)); - float downLimit = (float)Math.Ceiling((double)((self_tonnage - 1f) * this.EngineTonnageSlotsMult)); - Log.Debug?.Write(" checking on tonnage. engine : " + downLimit + " - " + upLimit + "\n"); - if ((engineTonnage <= downLimit) || (engineTonnage > upLimit)) { - string result = "This component is not sutable for this chassis. Engine tonnage must be " + (downLimit + 1f) + "-" + upLimit; - return result; - } - } - } - if (this.NoUniqueCheck == false) { - foreach (var comp in mechlab.MechLab.activeMechInventory) { - ActivatableComponent activatable = comp.Def.GetComponent(); - if (activatable != null) { - if (activatable.ButtonName == this.ButtonName) { - string result = "This mech already have component of the same type"; - return result; - } - } - } - } - return string.Empty; - //mechlab.MechLab.activeMechDef. - } } public enum AuraUpdateFix { None, From ba029ca01e38489557b19e8130b12fa5c7168e50 Mon Sep 17 00:00:00 2001 From: Denis Belan Date: Sat, 4 Dec 2021 21:32:27 +0300 Subject: [PATCH 2/8] fix CTD --- ActivatableEquipment/Auras.cs | 1 + .../CustomActivatableEquipment.csproj | 32 ++++++++++--------- ActivatableEquipment/packages.config | 4 +++ 3 files changed, 22 insertions(+), 15 deletions(-) create mode 100644 ActivatableEquipment/packages.config diff --git a/ActivatableEquipment/Auras.cs b/ActivatableEquipment/Auras.cs index 4879c80..70e849b 100644 --- a/ActivatableEquipment/Auras.cs +++ b/ActivatableEquipment/Auras.cs @@ -82,6 +82,7 @@ public static void Postfix(AbstractActor __instance) { public static class AbstractActor_ProcessAddedMark { public static void Postfix(AbstractActor __instance) { AuraActorBody body = __instance.bodyAura(); + if (body == null) { return; } List auras = body.affectedAurasEffects.Keys.ToList(); foreach (AuraBubble aura in auras) { if (aura.Def.RemoveOnSensorLock && __instance.IsSensorLocked) { diff --git a/ActivatableEquipment/CustomActivatableEquipment.csproj b/ActivatableEquipment/CustomActivatableEquipment.csproj index 724a88a..09cec49 100644 --- a/ActivatableEquipment/CustomActivatableEquipment.csproj +++ b/ActivatableEquipment/CustomActivatableEquipment.csproj @@ -40,26 +40,28 @@ - ..\..\Mods\ModTek\0Harmony.dll + ..\..\..\SteamLibrary\steamapps\common\BATTLETECH\BattleTech_Data\Managed\0Harmony.dll - ..\..\BattleTech_Data\Managed\Assembly-CSharp.dll + ..\..\..\SteamLibrary\steamapps\common\BATTLETECH\BattleTech_Data\Managed\Assembly-CSharp.dll - ..\..\BattleTech_Data\Managed\Assembly-CSharp-firstpass.dll + ..\..\..\SteamLibrary\steamapps\common\BATTLETECH\BattleTech_Data\Managed\Assembly-CSharp-firstpass.dll - D:\Games\BATTLETECH\Mods\CustomAmmoCategories\CustomAmmoCategories.dll + ..\..\..\SteamLibrary\steamapps\common\BATTLETECH\Mods\CustomAmmoCategories\CustomAmmoCategories.dll - D:\Games\BATTLETECH\Mods\CustomComponents\CustomComponents.dll + ..\..\..\SteamLibrary\steamapps\common\BATTLETECH\Mods\CustomComponents\CustomComponents.dll - ..\..\Mods\CustomLocalSettings\CustomLocalSettings.dll + ..\..\..\SteamLibrary\steamapps\common\BATTLETECH\Mods\CustomLocalSettings\CustomLocalSettings.dll + + + ..\..\..\SteamLibrary\steamapps\common\BATTLETECH\BattleTech_Data\Managed\DOTweenPro.dll - - ..\..\BattleTech_Data\Managed\InControl.dll + ..\..\..\SteamLibrary\steamapps\common\BATTLETECH\BattleTech_Data\Managed\InControl.dll False @@ -72,26 +74,26 @@ - ..\..\BattleTech_Data\Managed\Unity.TextMeshPro.dll + ..\..\..\SteamLibrary\steamapps\common\BATTLETECH\BattleTech_Data\Managed\Unity.TextMeshPro.dll - ..\..\BattleTech_Data\Managed\UnityEngine.dll + ..\..\..\SteamLibrary\steamapps\common\BATTLETECH\BattleTech_Data\Managed\UnityEngine.dll - ..\..\BattleTech_Data\Managed\UnityEngine.CoreModule.dll + ..\..\..\SteamLibrary\steamapps\common\BATTLETECH\BattleTech_Data\Managed\UnityEngine.CoreModule.dll - ..\..\BattleTech_Data\Managed\UnityEngine.ParticleSystemModule.dll + ..\..\..\SteamLibrary\steamapps\common\BATTLETECH\BattleTech_Data\Managed\UnityEngine.ParticleSystemModule.dll - ..\..\BattleTech_Data\Managed\UnityEngine.PhysicsModule.dll + ..\..\..\SteamLibrary\steamapps\common\BATTLETECH\BattleTech_Data\Managed\UnityEngine.PhysicsModule.dll False - ..\..\BattleTech_Data\Managed\UnityEngine.TextRenderingModule.dll + ..\..\..\SteamLibrary\steamapps\common\BATTLETECH\BattleTech_Data\Managed\UnityEngine.TextRenderingModule.dll - ..\..\BattleTech_Data\Managed\UnityEngine.UI.dll + ..\..\..\SteamLibrary\steamapps\common\BATTLETECH\BattleTech_Data\Managed\UnityEngine.UI.dll diff --git a/ActivatableEquipment/packages.config b/ActivatableEquipment/packages.config new file mode 100644 index 0000000..5eaa239 --- /dev/null +++ b/ActivatableEquipment/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file From dd46e0f9eeac34d15917daf928316d7142d69175 Mon Sep 17 00:00:00 2001 From: Denis Belan Date: Sat, 4 Dec 2021 21:38:30 +0300 Subject: [PATCH 3/8] Update CustomActivatableEquipment.csproj --- ActivatableEquipment/CustomActivatableEquipment.csproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ActivatableEquipment/CustomActivatableEquipment.csproj b/ActivatableEquipment/CustomActivatableEquipment.csproj index b893673..a9ca1fd 100644 --- a/ActivatableEquipment/CustomActivatableEquipment.csproj +++ b/ActivatableEquipment/CustomActivatableEquipment.csproj @@ -57,6 +57,10 @@ $(BattleTechGameDir)\Mods\CustomLocalSettings\CustomLocalSettings.dll + + False + $(BattleTechGameDir)\BattleTech_Data\Managed\DOTweenPro.dll + $(BattleTechGameDir)\BattleTech_Data\Managed\InControl.dll From ffcfb83a8cc858a2b2c4737447fcfd7381cb2138 Mon Sep 17 00:00:00 2001 From: Denis Belan Date: Sat, 10 Sep 2022 20:22:21 +0300 Subject: [PATCH 4/8] Add directory props --- Directory.Build.props | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Directory.Build.props diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..751f1c3 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,15 @@ + + + + E:\SteamLibrary\steamapps\common\BATTLETECH + + + + $(BattleTechGameDir)\Mods\MechEngineer + + $(BattleTechGameDir)\Mods\CustomComponents + + From 619bc43dcd9a2111192f07cbeaab4c975a4030cd Mon Sep 17 00:00:00 2001 From: Denis Belan Date: Sat, 10 Sep 2022 20:26:05 +0300 Subject: [PATCH 5/8] fix for solution --- .../CustomActivatableEquipment.csproj | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ActivatableEquipment/CustomActivatableEquipment.csproj b/ActivatableEquipment/CustomActivatableEquipment.csproj index 644506e..fdf61a2 100644 --- a/ActivatableEquipment/CustomActivatableEquipment.csproj +++ b/ActivatableEquipment/CustomActivatableEquipment.csproj @@ -42,7 +42,7 @@ - $(BattleTechGameDir)\Mods\ModTek\0Harmony.dll + $(BattleTechGameDir)\BattleTech_Data\Managed\0Harmony.dll $(BattleTechGameDir)\BattleTech_Data\Managed\Assembly-CSharp.dll @@ -51,16 +51,15 @@ $(BattleTechGameDir)\BattleTech_Data\Managed\Assembly-CSharp-firstpass.dll - $(BattleTechGameDir)\Mods\Core\CustomAmmoCategories\CustomAmmoCategories.dll + $(BattleTechGameDir)\Mods\CustomAmmoCategories\CustomAmmoCategories.dll - $(BattleTechGameDir)\Mods\Core\CustomComponents\CustomComponents.dll + $(BattleTechGameDir)\Mods\CustomComponents\CustomComponents.dll - $(BattleTechGameDir)\Mods\Core\CustomLocalSettings\CustomLocalSettings.dll + $(BattleTechGameDir)\Mods\CustomLocalSettings\CustomLocalSettings.dll - - False + $(BattleTechGameDir)\BattleTech_Data\Managed\DOTweenPro.dll From 02b33216b5aa778f29944eb1d6e10e6fead61602 Mon Sep 17 00:00:00 2001 From: Denis Belan Date: Fri, 23 Sep 2022 20:06:08 +0300 Subject: [PATCH 6/8] Fix IRBTModUtils reference --- ActivatableEquipment/CustomActivatableEquipment.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ActivatableEquipment/CustomActivatableEquipment.csproj b/ActivatableEquipment/CustomActivatableEquipment.csproj index c8576e9..35d5a48 100644 --- a/ActivatableEquipment/CustomActivatableEquipment.csproj +++ b/ActivatableEquipment/CustomActivatableEquipment.csproj @@ -66,7 +66,7 @@ $(BattleTechGameDir)\BattleTech_Data\Managed\InControl.dll - ..\..\..\Mods\Core\IRBTModUtils\IRBTModUtils.dll + $(BattleTechGameDir)\Mods\IRBTModUtils\IRBTModUtils.dll False From 5bb84916a58b9a8cd604dbe0cd9fafb00e4f188d Mon Sep 17 00:00:00 2001 From: Denis Belan Date: Sun, 6 Nov 2022 21:36:01 +0300 Subject: [PATCH 7/8] fix references in project files --- .../CustomActivatableEquipment.csproj | 11 +++++------ ComponentRefInjector/ComponentRefInjector.csproj | 8 ++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/ActivatableEquipment/CustomActivatableEquipment.csproj b/ActivatableEquipment/CustomActivatableEquipment.csproj index b07d3b4..d9f68c6 100644 --- a/ActivatableEquipment/CustomActivatableEquipment.csproj +++ b/ActivatableEquipment/CustomActivatableEquipment.csproj @@ -42,11 +42,11 @@ - ..\..\..\Mods\ModTek\AssembliesOverride\0Harmony.dll + $(BattleTechGameDir)\Mods\ModTek\AssembliesOverride\0Harmony.dll False - ..\..\..\Mods\.modtek\AssembliesInjected\Assembly-CSharp.dll + $(BattleTechGameDir)\Mods\.modtek\AssembliesInjected\Assembly-CSharp.dll $(BattleTechGameDir)\BattleTech_Data\Managed\Assembly-CSharp-firstpass.dll @@ -64,9 +64,8 @@ $(BattleTechGameDir)\BattleTech_Data\Managed\DOTweenPro.dll - ..\..\..\Mods\Core\CustomPrewarm\CustomPrewarm.dll + $(BattleTechGameDir)\Mods\CustomPrewarm\CustomPrewarm.dll - $(BattleTechGameDir)\BattleTech_Data\Managed\InControl.dll @@ -103,11 +102,11 @@ $(BattleTechGameDir)\BattleTech_Data\Managed\UnityEngine.TextRenderingModule.dll - ..\..\..\BattleTech_Data\Managed\UnityEngine.UI.dll + $(BattleTechGameDir)\BattleTech_Data\Managed\UnityEngine.UI.dll False - ..\..\..\BattleTech_Data\Managed\UnityEngine.UIModule.dll + $(BattleTechGameDir)\BattleTech_Data\Managed\UnityEngine.UIModule.dll diff --git a/ComponentRefInjector/ComponentRefInjector.csproj b/ComponentRefInjector/ComponentRefInjector.csproj index 18fd4fe..07855ee 100644 --- a/ComponentRefInjector/ComponentRefInjector.csproj +++ b/ComponentRefInjector/ComponentRefInjector.csproj @@ -32,16 +32,16 @@ - ..\..\..\Mods\ModTek\Mono.Cecil.dll + $(BattleTechGameDir)\Mods\ModTek\Mono.Cecil.dll - ..\..\..\Mods\ModTek\Mono.Cecil.Mdb.dll + $(BattleTechGameDir)\Mods\ModTek\Mono.Cecil.Mdb.dll - ..\..\..\Mods\ModTek\Mono.Cecil.Pdb.dll + $(BattleTechGameDir)\Mods\ModTek\Mono.Cecil.Pdb.dll - ..\..\..\Mods\ModTek\Mono.Cecil.Rocks.dll + $(BattleTechGameDir)\Mods\ModTek\Mono.Cecil.Rocks.dll From 865b132d8d60107913be5f9e17a0014a5a56e64a Mon Sep 17 00:00:00 2001 From: Denis Belan Date: Mon, 7 Nov 2022 18:26:01 +0300 Subject: [PATCH 8/8] Modified copy paths --- ActivatableEquipment/CustomActivatableEquipment.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ActivatableEquipment/CustomActivatableEquipment.csproj b/ActivatableEquipment/CustomActivatableEquipment.csproj index d9f68c6..f459aaa 100644 --- a/ActivatableEquipment/CustomActivatableEquipment.csproj +++ b/ActivatableEquipment/CustomActivatableEquipment.csproj @@ -147,11 +147,11 @@ - if exist "$(BattleTechGameDir)\Mods\Core\ActivatableEquipment" ( + if exist "$(BattleTechGameDir)\Mods\CustomActivatableEquipment" ( echo %25BattleTechGameDir%25 - xcopy "$(TargetPath)" "$(BattleTechGameDir)\Mods\Core\ActivatableEquipment" /y - xcopy /Y /S /E "$(ProjectDir)..\AdditionalFiles\Localization" "$(BattleTechGameDir)\Mods\Core\ActivatableEquipment\Localization" - xcopy /Y "$(ProjectDir)..\AdditionalFiles\Readme.txt" "$(BattleTechGameDir)\Mods\Core\ActivatableEquipment" + xcopy "$(TargetPath)" "$(BattleTechGameDir)\Mods\CustomActivatableEquipment" /y + xcopy /Y /S /E "$(ProjectDir)..\AdditionalFiles\Localization" "$(BattleTechGameDir)\Mods\CustomActivatableEquipment\Localization" + xcopy /Y "$(ProjectDir)..\AdditionalFiles\Readme.txt" "$(BattleTechGameDir)\Mods\CustomActivatableEquipment" ) if exist "$(BattleTechGameDir)\Mods\Core\CustomActivatableEquipment" ( echo %25BattleTechGameDir%25