-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes to make adding scopes possible #14257
base: master
Are you sure you want to change the base?
Conversation
Redo vision obstruction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found some code quality issues. It's also unclear to me why and how exactly the behavior of the vision circle logic was changed.
@@ -425,6 +425,10 @@ void ResetInputIfPrimaryMouse(InputType inputType) | |||
{ | |||
cam.OffsetAmount = targetOffsetAmount = item.Prefab.OffsetOnSelected * item.OffsetOnSelectedMultiplier; | |||
} | |||
else if (HeldItems.FirstOrDefault(item => item.GetComponent<Holdable>()?.Aimable ?? false) is Item item2 && IsKeyDown(InputType.Aim)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pattern matching should be used instead of null coalescing here. The names item
and item2
are not very descriptive, and they're quite misleading because they're in this case the same item.
@@ -425,6 +425,10 @@ void ResetInputIfPrimaryMouse(InputType inputType) | |||
{ | |||
cam.OffsetAmount = targetOffsetAmount = item.Prefab.OffsetOnSelected * item.OffsetOnSelectedMultiplier; | |||
} | |||
else if (HeldItems.FirstOrDefault(item => item.GetComponent<Holdable>()?.Aimable ?? false) is Item item2 && IsKeyDown(InputType.Aim)) | |||
{ | |||
cam.OffsetAmount = targetOffsetAmount = item2.GetComponent<Holdable>().CameraAimOffset; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fetching the Holdable
component is done twice
float scale = (1f - ObstructVisionAmount) * scaleMultiplier; | ||
Vector2 circleOrigin = new Vector2(visionCircle.Width, visionCircle.Height) / 2f; | ||
Vector2 coneOrigin = new Vector2(0f, visionCone.Height / 2f); | ||
Vector2 coneScale = new Vector2(1f / visionCone.Width, scale / visionCone.Height * coneHeightMultiplier) * (losOffset.Length() + circleOrigin.X); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to change the behavior of the existing vision circle too. I think this needs some clarification: how and why does it change the vision circle too?
This PR does two things:
CameraAimOffset
.Mod for Testing: Mod.zip
Obstruction Rework Previews
Lighting Disabled
Lighting Disabled w/ Scope
Lighting Enabled
Lighting Enabled w/ Scope
Reworked Light Sprites
Content/Lights/lightcone.png
Content/Lights/visioncircle.png