Skip to content

Commit

Permalink
add support for dashed lines to all line type we touch, and set to my…
Browse files Browse the repository at this point in the history
… normal defaults in mod.json
  • Loading branch information
janxious committed Jun 4, 2018
1 parent 756810c commit 319c5de
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
3 changes: 1 addition & 2 deletions BTMLColorLOSMod/LineSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
}
}
}
Expand Down
31 changes: 28 additions & 3 deletions BTMLColorLOSMod/WeaponRangeIndicators_DrawLine_Patch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 =
Expand All @@ -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
{
Expand Down
12 changes: 5 additions & 7 deletions BTMLColorLOSMod/mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@
"ConflictsWith": [],

"Settings": {
"debug": true,

"nextColorKeyBinding": {
"active": true,
"keys": ["shift", "i"]
},

"direct": {
"active": true,
"colors": [
Expand All @@ -28,7 +26,7 @@
[ 0, 0, 255, 255],
[ 0, 0, 0, 255]
],
"dashed": true,
"dashed": false,
"thickness": 1
},
"indirect": {
Expand All @@ -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": {
Expand All @@ -61,7 +59,7 @@
[ 0, 0, 255, 255],
[ 0, 255, 0, 255]
],
"dashed": true,
"dashed": false,
"thickness": 1.25
}
}
Expand Down

0 comments on commit 319c5de

Please sign in to comment.