From a75d5ac92b75198274240df2f1bfd4f04700b00d Mon Sep 17 00:00:00 2001 From: SupremeAdmiralZ <103025241+SupremeAdmiralZ@users.noreply.github.com> Date: Tue, 20 Aug 2024 17:59:28 -0400 Subject: [PATCH 1/6] Update SerializedValues.cs --- Data/Scripts/DefenseShields/Config/SerializedValues.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Data/Scripts/DefenseShields/Config/SerializedValues.cs b/Data/Scripts/DefenseShields/Config/SerializedValues.cs index 1dd459c..ed0f812 100644 --- a/Data/Scripts/DefenseShields/Config/SerializedValues.cs +++ b/Data/Scripts/DefenseShields/Config/SerializedValues.cs @@ -33,6 +33,9 @@ public class DefenseShieldsEnforcement [ProtoMember(23), DefaultValue(-1)] public float MinHP = -1f; [ProtoMember(24), DefaultValue(-1)] public float MaxRecharge = -1f; [ProtoMember(25), DefaultValue(-1)] public float MinRecharge = -1f; + [ProtoMember(26), DefaultValue(-1)] public float ShuntBonusResistance = -1f; + [ProtoMember(27), DefaultValue(-1)] public float ShuntPenResistance = -1f; + [ProtoMember(28), DefaultValue(-1)] public float MaxModulation = -1f; } [ProtoContract] From 51c14c3ea687041138e50b6e9b9656f9b83959cb Mon Sep 17 00:00:00 2001 From: SupremeAdmiralZ <103025241+SupremeAdmiralZ@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:02:24 -0400 Subject: [PATCH 2/6] Added shunt and modulation config options --- .../DefenseShields/SupportClasses/StaticUtils.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Data/Scripts/DefenseShields/SupportClasses/StaticUtils.cs b/Data/Scripts/DefenseShields/SupportClasses/StaticUtils.cs index 2f64a61..10b71db 100644 --- a/Data/Scripts/DefenseShields/SupportClasses/StaticUtils.cs +++ b/Data/Scripts/DefenseShields/SupportClasses/StaticUtils.cs @@ -32,7 +32,7 @@ public static void PrepConfigFile() const int DisableEntityBarrier = 0; const int Debug = 1; const int SuperWeapons = 1; - const int Version = 92; + const int Version = 93; const float BlockScaler = 1f; const float PowerScaler = 1f; const float SizeScaler = 7.5f; @@ -46,6 +46,9 @@ public static void PrepConfigFile() const float MinHP = 0f; const float MaxRecharge = float.MaxValue; const float MinRecharge = 0f; + const float ShuntBonusResistance = 0.16f; + const float ShuntPenResistance = 0.2f; + const float MaxModulation = 200f; var dsCfgExists = MyAPIGateway.Utilities.FileExistsInGlobalStorage("DefenseShields.cfg"); if (dsCfgExists) @@ -92,6 +95,15 @@ public static void PrepConfigFile() Session.Enforced.MinHP = !unPackedData.MinHP.Equals(-1) ? unPackedData.MinHP : MinHP; Session.Enforced.MaxRecharge = !unPackedData.MaxRecharge.Equals(-1) ? unPackedData.MaxRecharge : MaxRecharge; Session.Enforced.MinRecharge = !unPackedData.MinRecharge.Equals(-1) ? unPackedData.MinRecharge : MinRecharge; + Session.Enforced.ShuntBonusResistance = !unPackedData.ShuntBonusResistance.Equals(-1f) ? unPackedData.ShuntBonusResistance : ShuntBonusResistance; + Session.Enforced.ShuntPenResistance = !unPackedData.ShuntPenResistance.Equals(-1f) ? unPackedData.ShuntPenResistance : ShuntPenResistance; + Session.Enforced.MaxModulation = !unPackedData.MaxModulation.Equals(-1f) ? unPackedData.MaxModulation : MaxModulation; + + if (unPackedData.Version < 93) + { + Session.Enforced.ShuntBonusResistance = ShuntBonusResistance; + Session.Enforced.ShuntPenResistance = ShuntPenResistance; + Session.Enforced.MaxModulation = MaxModulation; if (unPackedData.Version < 92) { From ea50b7837ad575162d4014b0ec269744c5e43bac Mon Sep 17 00:00:00 2001 From: SupremeAdmiralZ <103025241+SupremeAdmiralZ@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:03:23 -0400 Subject: [PATCH 3/6] Added shunt and modulation config options --- Data/Scripts/DefenseShields/SupportClasses/StaticUtils.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Data/Scripts/DefenseShields/SupportClasses/StaticUtils.cs b/Data/Scripts/DefenseShields/SupportClasses/StaticUtils.cs index 10b71db..58223be 100644 --- a/Data/Scripts/DefenseShields/SupportClasses/StaticUtils.cs +++ b/Data/Scripts/DefenseShields/SupportClasses/StaticUtils.cs @@ -166,7 +166,10 @@ public static void PrepConfigFile() Session.Enforced.MinHP = MinHP; Session.Enforced.MaxRecharge = MaxRecharge; Session.Enforced.MinRecharge = MinRecharge; - + Session.Enforced.ShuntBonusResistance = ShuntBonusResistance; + Session.Enforced.ShuntPenResistance = ShuntPenResistance; + Session.Enforced.MaxModulation = MaxModulation; + WriteNewConfigFile(); Log.Line($"wrote new config file - file exists: {MyAPIGateway.Utilities.FileExistsInGlobalStorage("DefenseShields.cfg")}"); From 969bcb9768624475733d0e5522f37ff21bc1ddbe Mon Sep 17 00:00:00 2001 From: SupremeAdmiralZ <103025241+SupremeAdmiralZ@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:04:51 -0400 Subject: [PATCH 4/6] Added shunt and modulation config options --- Data/Scripts/DefenseShields/Control/ModUi.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/Scripts/DefenseShields/Control/ModUi.cs b/Data/Scripts/DefenseShields/Control/ModUi.cs index daf852a..f9e5cb5 100644 --- a/Data/Scripts/DefenseShields/Control/ModUi.cs +++ b/Data/Scripts/DefenseShields/Control/ModUi.cs @@ -71,7 +71,7 @@ internal static float GetDamage(IMyTerminalBlock block) internal static void SetDamage(IMyTerminalBlock block, float newValue) { var comp = block?.GameLogic?.GetAs(); - if (comp == null || newValue > 200 || newValue < -200) return; + if (comp == null || newValue > Session.Enforced.MaxModulation || newValue < -Session.Enforced.MaxModulation) return; if (Session.Instance.IsServer) ComputeDamage(comp, newValue); From fe53bd25b5711b20b5f004045723a09e78f14a98 Mon Sep 17 00:00:00 2001 From: SupremeAdmiralZ <103025241+SupremeAdmiralZ@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:06:16 -0400 Subject: [PATCH 5/6] Added shunt and modulation config options --- Data/Scripts/DefenseShields/API/TapiBackend.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Data/Scripts/DefenseShields/API/TapiBackend.cs b/Data/Scripts/DefenseShields/API/TapiBackend.cs index 90e5ca9..fa1eeeb 100644 --- a/Data/Scripts/DefenseShields/API/TapiBackend.cs +++ b/Data/Scripts/DefenseShields/API/TapiBackend.cs @@ -376,8 +376,8 @@ private static MyTuple TAPI_GetFaceInfoAndP var hitShuntedSide = shuntedFaceHit != -1; var shuntedFaces = Math.Abs(logic.ShieldRedirectState.X) + Math.Abs(logic.ShieldRedirectState.Y) + Math.Abs(logic.ShieldRedirectState.Z); - var shuntMod = !hitShuntedSide ? 1 - (shuntedFaces * Session.ShieldShuntBonus) : logic.DsSet.Settings.AutoManage ? 1 - Session.ShieldShuntBonus : 1f; - var preventBypassMod = MathHelper.Clamp(shuntedFaces * Session.ShieldBypassBonus, 0f, 1f); + var shuntMod = !hitShuntedSide ? 1 - (shuntedFaces * Session.Enforced.ShuntBonusResistance) : logic.DsSet.Settings.AutoManage ? 1 - Session.Enforced.ShuntBonusResistance : 1f; + var preventBypassMod = MathHelper.Clamp(shuntedFaces * Session.Enforced.ShuntPenResistance, 0f, 1f); var reinforcedPercent = hitShuntedSide ? logic.DsState.State.ShieldPercent + (shuntedFaces * 8) : logic.DsState.State.ShieldPercent; var heatedEnforcedPercent = reinforcedPercent / (1 + (logic.DsState.State.Heat * 0.005)); @@ -408,7 +408,7 @@ private static MyTuple TAPI_GetFaceInfoAndP penChance = (float)((a * Math.Pow(x, 2)) + (b * x) + c); } - return new MyTuple(false, 0, 0, logic.DsSet.Settings.AutoManage ? 1 - Session.ShieldShuntBonus : 1f, 0, penChance); + return new MyTuple(false, 0, 0, logic.DsSet.Settings.AutoManage ? 1 - Session.Enforced.ShuntBonusResistance : 1f, 0, penChance); } private static float? TAPI_PointAttackShieldCon(IMyTerminalBlock block, Vector3D pos, long attackerId, float damage, float secondaryDamage, bool energy, bool drawParticle, bool posMustBeInside = false) //inlined for performance From 37e1622daefd9da9f7eb8b75705ea3674a0e667b Mon Sep 17 00:00:00 2001 From: SupremeAdmiralZ <103025241+SupremeAdmiralZ@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:08:41 -0400 Subject: [PATCH 6/6] Added shunt and modulation config options --- Data/Scripts/DefenseShields/SupportClasses/StaticUtils.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Data/Scripts/DefenseShields/SupportClasses/StaticUtils.cs b/Data/Scripts/DefenseShields/SupportClasses/StaticUtils.cs index 58223be..dd9ef82 100644 --- a/Data/Scripts/DefenseShields/SupportClasses/StaticUtils.cs +++ b/Data/Scripts/DefenseShields/SupportClasses/StaticUtils.cs @@ -104,6 +104,7 @@ public static void PrepConfigFile() Session.Enforced.ShuntBonusResistance = ShuntBonusResistance; Session.Enforced.ShuntPenResistance = ShuntPenResistance; Session.Enforced.MaxModulation = MaxModulation; + } if (unPackedData.Version < 92) {