From 319c5de24ceea901465135b62374200652eede8f Mon Sep 17 00:00:00 2001 From: Joel Meador Date: Mon, 4 Jun 2018 01:19:34 -0400 Subject: [PATCH] add support for dashed lines to all line type we touch, and set to my normal defaults in mod.json --- BTMLColorLOSMod/LineSetting.cs | 3 +- .../WeaponRangeIndicators_DrawLine_Patch.cs | 31 +++++++++++++++++-- BTMLColorLOSMod/mod.json | 12 +++---- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/BTMLColorLOSMod/LineSetting.cs b/BTMLColorLOSMod/LineSetting.cs index ceb6e0d..9cde0a9 100644 --- a/BTMLColorLOSMod/LineSetting.cs +++ b/BTMLColorLOSMod/LineSetting.cs @@ -15,8 +15,7 @@ public float[][] colors Colors.Clear(); foreach (var colorValues in value) { - Colors.Add(SettingsColorHelper.ColorFromValues( - colorValues[0], colorValues[1], colorValues[2], colorValues[3])); + Colors.Add(SettingsColorHelper.ColorFromValues(colorValues[0], colorValues[1], colorValues[2], colorValues[3])); } } } diff --git a/BTMLColorLOSMod/WeaponRangeIndicators_DrawLine_Patch.cs b/BTMLColorLOSMod/WeaponRangeIndicators_DrawLine_Patch.cs index 5f08485..860185f 100644 --- a/BTMLColorLOSMod/WeaponRangeIndicators_DrawLine_Patch.cs +++ b/BTMLColorLOSMod/WeaponRangeIndicators_DrawLine_Patch.cs @@ -156,10 +156,25 @@ public static class WeaponRangeIndicators_DrawLine_Patch "GetShotQuality", new object[] { selectedActor, position, rotation, target }); line.material.color = Color.white; line.endColor = line.startColor = Color.Lerp(Color.clear, ModSettings.Direct.Color, shotQuality); + // PoC follows for a very high contrast line to help color blind players +// line.endColor = line.startColor = Color.black; +// LineRenderer line8080 = +// (LineRenderer)ReflectionHelper.InvokePrivateMethode(__instance, "getLine", +// new object[] { }); +// line8080.positionCount = 2; +// line8080.SetPosition(0, vector); +// line8080.material = __instance.MaterialOutOfRange; +// line8080.endColor = line8080.startColor = Color.white; +// line8080.material.color = Color.white; +// line8080.startWidth = line8080.endWidth = ModSettings.Direct.Thickness * 1.5f; +// line8080.SetPosition(1, vector2); + if (ModSettings.Direct.Dashed) + { + line.material = __instance.MaterialOutOfRange; + line.material.color = line.endColor; + } } - - line.startWidth = __instance.LOSWidthBegin; - line.endWidth = __instance.LOSWidthEnd; + line.startWidth = line.endWidth = ModSettings.Direct.Thickness; } line.SetPosition(1, vector2); @@ -188,6 +203,11 @@ public static class WeaponRangeIndicators_DrawLine_Patch line.material.color = Color.white; line.startColor = line.endColor = ModSettings.ObstructedAttackerSide.Color; line.startWidth = line.endWidth = ModSettings.ObstructedAttackerSide.Thickness; + if (ModSettings.ObstructedAttackerSide.Dashed) + { + line.material = __instance.MaterialOutOfRange; + line.material.color = line.endColor; + } } LineRenderer line2 = @@ -202,6 +222,11 @@ public static class WeaponRangeIndicators_DrawLine_Patch line2.material.color = Color.white; line2.startColor = line2.endColor = ModSettings.ObstructedTargetSide.Color; line2.startWidth = line2.endWidth = ModSettings.ObstructedTargetSide.Thickness; + if (ModSettings.ObstructedTargetSide.Dashed) + { + line2.material = __instance.MaterialOutOfRange; + line2.material.color = line2.endColor; + } } else { diff --git a/BTMLColorLOSMod/mod.json b/BTMLColorLOSMod/mod.json index 3fa4bec..5c586a4 100644 --- a/BTMLColorLOSMod/mod.json +++ b/BTMLColorLOSMod/mod.json @@ -13,13 +13,11 @@ "ConflictsWith": [], "Settings": { - "debug": true, - "nextColorKeyBinding": { "active": true, "keys": ["shift", "i"] }, - + "direct": { "active": true, "colors": [ @@ -28,7 +26,7 @@ [ 0, 0, 255, 255], [ 0, 0, 0, 255] ], - "dashed": true, + "dashed": false, "thickness": 1 }, "indirect": { @@ -43,14 +41,14 @@ "thickness": 1.75 }, "obstructedAttackerSide": { - "active": true, + "active": false, "colors": [ [ 0, 64, 255, 255], [ 0, 0, 255, 255], [ 0, 255, 0, 255], [255, 0, 0, 255] ], - "dashed": true, + "dashed": false, "thickness": 1 }, "obstructedTargetSide": { @@ -61,7 +59,7 @@ [ 0, 0, 255, 255], [ 0, 255, 0, 255] ], - "dashed": true, + "dashed": false, "thickness": 1.25 } }