Make trim and windage angular so they hold at every range
This commit is contained in:
@@ -75,6 +75,9 @@ Press F1 to open the console, then use these commands:
|
||||
| `scopewind 20` | Set the windage, -200 to 200. Positive moves hits right, negative moves hits left. The default is 0 |
|
||||
| `scopedebug` | Toggle a debug readout above the range |
|
||||
|
||||
Trim and windage are angle adjustments, so a setting that is right at one range
|
||||
stays right at every range.
|
||||
|
||||
The zoom, trim and windage are saved to `UserData\RifleScope.txt` in your game
|
||||
folder. Setting the zoom to 1 keeps vanilla zoom and the normal scope view,
|
||||
without the red dot.
|
||||
|
||||
+4
-2
@@ -23,6 +23,7 @@ public class RifleScope : SonsMod
|
||||
private const float DefaultTrimCm = 50f;
|
||||
private const float MaxTrimCm = 200f;
|
||||
private const float MaxWindCm = 200f;
|
||||
private const float TrimReferenceRange = 50f;
|
||||
private const int MilDotCount = 10;
|
||||
private const float MilDotSize = 0.4f;
|
||||
private const float MinDotPx = 7f;
|
||||
@@ -196,8 +197,9 @@ public class RifleScope : SonsMod
|
||||
}
|
||||
|
||||
CenterPoint(cam, out var point);
|
||||
point -= cam.transform.up * (_trimCm * 0.01f);
|
||||
point += cam.transform.right * (_windCm * 0.01f);
|
||||
var scale = Vector3.Distance(cam.transform.position, point) / TrimReferenceRange;
|
||||
point -= cam.transform.up * (_trimCm * 0.01f * scale);
|
||||
point += cam.transform.right * (_windCm * 0.01f * scale);
|
||||
var dir = point - _projectile.position;
|
||||
if (dir.sqrMagnitude < 0.0001f)
|
||||
return;
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
<LangVersion>latest</LangVersion>
|
||||
<AssemblyName>RifleScope</AssemblyName>
|
||||
<RootNamespace>RifleScope</RootNamespace>
|
||||
<Version>1.0.0</Version>
|
||||
<Version>1.0.1</Version>
|
||||
<NoWarn>CS0436;CS1701;CS1702;MSB3277;MSB3106</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
"id": "RifleScope",
|
||||
"name": "RifleScope",
|
||||
"author": "JustinOros",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "Stronger rifle scope magnification and a crosshair reticle",
|
||||
"gameVersion": "1.0.0",
|
||||
"platform": "Client",
|
||||
|
||||
Reference in New Issue
Block a user