Add dotnet format as pre-commit hook

This commit is contained in:
Liza 2023-02-07 21:49:53 +01:00
parent 8911ef5227
commit e13cf9409c
Signed by: liza
GPG Key ID: 7199F8D727D55F67
2 changed files with 12 additions and 5 deletions

7
.githooks/pre-commit Normal file
View File

@ -0,0 +1,7 @@
#!/bin/sh
#
# Use with:
#
# $> git config core.hooksPath .githooks
#
dotnet format SliceIsRight.sln

View File

@ -35,7 +35,7 @@ namespace SliceIsRight
[PluginService]
private ClientState ClientState { get; set; }
private const ushort GoldSaucerTerritoryId = 144;
private bool IsInGoldSaucer { get; set; }
@ -69,7 +69,7 @@ namespace SliceIsRight
if (!ClientState.IsLoggedIn || !IsInGoldSaucer || ObjectTable == null)
return;
for (int index = 0; index < ObjectTable.Length; ++ index)
for (int index = 0; index < ObjectTable.Length; ++index)
{
GameObject? obj = ObjectTable[index];
if (obj == null || DistanceToPlayer(obj.Position) > MaxDistance)
@ -122,7 +122,7 @@ namespace SliceIsRight
break;
case 2010779:
//default:
//default:
DrawFilledCircleWorld(obj, radius ?? 11f, COLOUR_RED);
break;
}
@ -158,7 +158,7 @@ namespace SliceIsRight
onScreen |= GameGui.WorldToScreen(new Vector3(center.X + radius * (float)Math.Sin(Math.PI / segmentCount * index), center.Y, center.Z + radius * (float)Math.Cos(Math.PI / segmentCount * index)), out Vector2 vector2);
ImGui.GetWindowDrawList().PathLineTo(vector2);
}
if (onScreen)
ImGui.GetWindowDrawList().PathFillConvex(colour);
else
@ -187,7 +187,7 @@ namespace SliceIsRight
Vector3 farCenter = new Vector3(nearCenter.X + lengthSlice * (float)Math.Sin(rotation), nearCenter.Y, nearCenter.Z + lengthSlice * (float)Math.Cos(rotation));
bool onScreen = false;
foreach (Vector3 v in new[]{ far2, farCenter, far1, near1, nearCenter, near2})
foreach (Vector3 v in new[] { far2, farCenter, far1, near1, nearCenter, near2 })
{
onScreen |= GameGui.WorldToScreen(v, out Vector2 nextVertex);
if ((nextVertex.X > 0 & nextVertex.X < displaySize.X) || (nextVertex.Y > 0 & nextVertex.Y < displaySize.Y))