author
int64 658
755k
| date
stringlengths 19
19
| timezone
int64 -46,800
43.2k
| hash
stringlengths 40
40
| message
stringlengths 5
490
| mods
list | language
stringclasses 20
values | license
stringclasses 3
values | repo
stringlengths 5
68
| original_message
stringlengths 12
491
|
---|---|---|---|---|---|---|---|---|---|
664,866 | 23.05.2022 20:19:12 | -7,200 | d1e2adb1b019e12c96c68cd7b31267d685f8deb4 | use polar slider path in graphics calculations | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableSlider.Calculations.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableSlider.Calculations.cs",
"diff": "@@ -22,67 +22,33 @@ private void updatePath()\nif (time < startTime)\nreturn;\n- int nodeIndex = 0;\nbool capAdded = false;\n+ var polarPath = HitObject.Path;\n- generatePathSegmnt(ref nodeIndex, ref capAdded, time, startTime, midTime);\n- nodeIndex--;\n- var pos = path.Vertices.Any() ? path.Vertices[^1].Xy : Vector2.Zero;\n- generatePathSegmnt(ref nodeIndex, ref capAdded, time, midTime, endTime);\n-\n- path.Position = pos;\n- path.OriginPosition = path.PositionInBoundingBox(pos);\n- }\n-\n- private void generatePathSegmnt(ref int nodeIndex, ref bool capAdded, double time, double startTime, double endTime)\n- {\n- var nodes = HitObject.Path.Nodes;\n- if (nodeIndex >= nodes.Count)\n- return;\n-\n- while (nodeIndex + 1 < nodes.Count && nodes[nodeIndex + 1].Time <= startTime)\n- nodeIndex++;\n-\n- const double delta_time = 20;\n- const double max_angle_per_ms = 5;\nvar radius = TauPlayfield.BaseSize.X / 2;\n-\nfloat distanceAt ( double t ) => inversed\n? (float)( 2 * radius - ( time - t ) / HitObject.TimePreempt * radius )\n: (float)( ( time - t ) / HitObject.TimePreempt * radius );\n- void addVertex(double t, double angle)\n- {\n+ void addVertex ( double t, double angle ) {\nvar p = Extensions.GetCircularPosition( distanceAt( t ), (float)angle );\nvar index = (int)( t / trackingCheckpointInterval );\n+\npath.AddVertex( new Vector3( p.X, p.Y, trackingCheckpoints.ValueAtOrLastOr( index, true ) ? 1 : 0 ) );\n}\n- do\n- {\n- var prevNode = nodes[nodeIndex];\n- var nextNode = nodeIndex + 1 < nodes.Count ? nodes[nodeIndex + 1] : prevNode;\n-\n- var from = Math.Max(startTime, prevNode.Time);\n- var to = Math.Min(endTime, nextNode.Time);\n- var duration = nextNode.Time - prevNode.Time;\n-\n- var deltaAngle = Extensions.GetDeltaAngle(nextNode.Angle, prevNode.Angle);\n- var anglePerMs = duration != 0 ? deltaAngle / duration : 0;\n- var timeStep = Math.Min(delta_time, Math.Abs(max_angle_per_ms / anglePerMs));\n+ foreach ( var segment in polarPath.SegmentsBetween( (float)startTime, (float)endTime ) ) {\n+ foreach ( var node in segment.Split( excludeFirst: capAdded ) ) {\n+ addVertex( node.Time, node.Angle );\n+ }\n+ capAdded = true;\n+ }\n- if (!capAdded)\n- addVertex(from, prevNode.Angle + anglePerMs * (from - prevNode.Time));\n- for (var t = from + timeStep; t < to; t += timeStep)\n- addVertex(t, prevNode.Angle + anglePerMs * (t - prevNode.Time));\n- if (duration != 0)\n- addVertex(to, prevNode.Angle + anglePerMs * (to - prevNode.Time));\n- else\n- addVertex(to, nextNode.Angle);\n+ var midNode = polarPath.NodeAt( (float)midTime );\n+ var pos = Extensions.GetCircularPosition( distanceAt( midNode.Time ), midNode.Angle );\n- capAdded = true;\n- nodeIndex++;\n- } while (nodeIndex < nodes.Count && nodes[nodeIndex].Time < endTime);\n+ path.Position = pos;\n+ path.OriginPosition = path.PositionInBoundingBox(pos);\n}\nprivate bool checkIfTracking()\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/PolarSliderPath.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/PolarSliderPath.cs",
"diff": "using Newtonsoft.Json;\nusing osu.Framework.Bindables;\nusing osu.Framework.Caching;\n+using osu.Framework.Graphics.Containers;\n+using osuTK.Graphics.ES20;\nnamespace osu.Game.Rulesets.Tau.Objects\n{\n@@ -70,139 +72,10 @@ public NodesEnumerable NodesBetween(float start, float end)\nreturn new(nodeIndex + 1, end, this);\n}\n- public struct NodesEnumerable : IEnumerable<SliderNode>\n- {\n- int index;\n- float endTime;\n- PolarSliderPath path;\n-\n- public NodesEnumerable(int index, float endTime, PolarSliderPath path)\n- {\n- this.index = index;\n- this.endTime = endTime;\n- this.path = path;\n- }\n-\n- public Enumerator GetEnumerator() => new(index, endTime, path);\n-\n- IEnumerator<SliderNode> IEnumerable<SliderNode>.GetEnumerator()\n- {\n- var index = this.index - 1;\n- while (index + 1 < path.Nodes.Count && path.Nodes[index + 1].Time < endTime)\n- {\n- index++;\n- yield return path.Nodes[index];\n- }\n- }\n-\n- IEnumerator IEnumerable.GetEnumerator()\n- => ((IEnumerable<SliderNode>)this).GetEnumerator();\n-\n- public ref struct Enumerator\n- {\n- int index;\n- float endTime;\n- PolarSliderPath path;\n-\n- public Enumerator(int index, float endTime, PolarSliderPath path)\n- {\n- this.index = index - 1;\n- this.endTime = endTime;\n- this.path = path;\n- }\n-\n- public bool MoveNext()\n- {\n- if (index + 1 < path.Nodes.Count && path.Nodes[index + 1].Time < endTime) {\n- index++;\n- return true;\n- }\n- return false;\n- }\n-\n- public SliderNode Current => path.Nodes[index];\n- }\n- }\n-\npublic SegmentsEnumerable SegmentsBetween (float start, float end)\n{\nseekTo(start);\n- return new(nodeIndex, start, end, this);\n- }\n-\n- public struct SegmentsEnumerable : IEnumerable<SliderSegment>\n- {\n- int index;\n- float startTime;\n- float endTime;\n- PolarSliderPath path;\n-\n- public SegmentsEnumerable(int index, float startTime, float endTime, PolarSliderPath path)\n- {\n- this.index = index;\n- this.startTime = startTime;\n- this.endTime = endTime;\n- this.path = path;\n- }\n-\n- IEnumerator<SliderSegment> IEnumerable<SliderSegment>.GetEnumerator ()\n- {\n- foreach (var i in this)\n- yield return i;\n- }\n-\n- IEnumerator IEnumerable.GetEnumerator ()\n- => ((IEnumerable<SliderSegment>)this).GetEnumerator();\n-\n- public Enumerator GetEnumerator() => new(index, startTime, endTime, path);\n-\n- public struct Enumerator\n- {\n- int index;\n- float startTime;\n- float endTime;\n- PolarSliderPath path;\n-\n- public Enumerator(int index, float startTime, float endTime, PolarSliderPath path)\n- {\n- this.index = index - 1;\n- this.startTime = startTime;\n- this.endTime = endTime;\n- this.path = path;\n- }\n-\n- public bool MoveNext()\n- {\n- if (index + 2 < path.Nodes.Count && path.Nodes[index + 1].Time <= endTime)\n- {\n- index++;\n- return true;\n- }\n- return false;\n- }\n-\n- public SliderSegment Current\n- {\n- get\n- {\n- var from = path.Nodes[index];\n- var to = path.Nodes[index + 1];\n- var deltaAngle = Extensions.GetDeltaAngle(to.Angle, from.Angle);\n- var duration = to.Time - from.Time;\n-\n- if (to.Time > endTime && duration != 0)\n- {\n- to = new(endTime, from.Angle + deltaAngle * (endTime - from.Time) / duration);\n- }\n- if (from.Time < startTime && duration != 0)\n- {\n- from = new(startTime, from.Angle + deltaAngle * (startTime - from.Time) / duration);\n- }\n-\n- return new(from, to);\n- }\n- }\n- }\n+ return new(Math.Max( nodeIndex - 1, 0 ), start, end, this);\n}\n/// <summary>\n@@ -311,6 +184,185 @@ public SliderSegment(SliderNode from, SliderNode to)\nTo = to;\n}\n+ public SegmentNodesEnumerable Split (float timeStep = 20, float maxAnglePerMs = 5, bool excludeFirst = false, bool excludeLast = false)\n+ {\n+ var duration = Duration;\n+ var delta = DeltaAngle;\n+ int steps;\n+ if ( duration == 0 ) {\n+ steps = (int)MathF.Ceiling(MathF.Abs( delta ) / maxAnglePerMs);\n+ }\n+ else {\n+ var anglePerMs = delta / duration;\n+ timeStep = Math.Min( timeStep, Math.Abs( maxAnglePerMs / anglePerMs ) );\n+ steps = (int)MathF.Ceiling( duration / timeStep );\n+ }\n+\n+ steps += 2;\n+ return new(\n+ excludeFirst ? new( From.Time + duration / steps, From.Angle + delta / steps ) : From,\n+ excludeLast ? new( To.Time - duration / steps, To.Angle - delta / steps ) : To,\n+ steps - ( excludeFirst ? 1 : 0 ) - ( excludeLast ? 1 : 0 )\n+ );\n+ }\n+\npublic override string ToString() => $\"({From}) -> ({To})\";\n}\n+\n+ public struct NodesEnumerable : IEnumerable<SliderNode> {\n+ int index;\n+ float endTime;\n+ PolarSliderPath path;\n+\n+ public NodesEnumerable ( int index, float endTime, PolarSliderPath path ) {\n+ this.index = index;\n+ this.endTime = endTime;\n+ this.path = path;\n+ }\n+\n+ public Enumerator GetEnumerator () => new( index, endTime, path );\n+\n+ IEnumerator<SliderNode> IEnumerable<SliderNode>.GetEnumerator () {\n+ foreach ( var i in this )\n+ yield return i;\n+ }\n+\n+ IEnumerator IEnumerable.GetEnumerator ()\n+ => ( (IEnumerable<SliderNode>)this ).GetEnumerator();\n+\n+ public struct Enumerator {\n+ int index;\n+ float endTime;\n+ PolarSliderPath path;\n+\n+ public Enumerator ( int index, float endTime, PolarSliderPath path ) {\n+ this.index = index - 1;\n+ this.endTime = endTime;\n+ this.path = path;\n+ }\n+\n+ public bool MoveNext () {\n+ if ( index + 1 < path.Nodes.Count && path.Nodes[index + 1].Time < endTime ) {\n+ index++;\n+ return true;\n+ }\n+ return false;\n+ }\n+\n+ public SliderNode Current => path.Nodes[index];\n+ }\n+ }\n+\n+ public struct SegmentsEnumerable : IEnumerable<SliderSegment> {\n+ int index;\n+ float startTime;\n+ float endTime;\n+ PolarSliderPath path;\n+\n+ public SegmentsEnumerable ( int index, float startTime, float endTime, PolarSliderPath path ) {\n+ this.index = index;\n+ this.startTime = startTime;\n+ this.endTime = endTime;\n+ this.path = path;\n+ }\n+\n+ IEnumerator<SliderSegment> IEnumerable<SliderSegment>.GetEnumerator () {\n+ foreach ( var i in this )\n+ yield return i;\n+ }\n+\n+ IEnumerator IEnumerable.GetEnumerator ()\n+ => ( (IEnumerable<SliderSegment>)this ).GetEnumerator();\n+\n+ public Enumerator GetEnumerator () => new( index, startTime, endTime, path );\n+\n+ public struct Enumerator {\n+ int index;\n+ float startTime;\n+ float endTime;\n+ PolarSliderPath path;\n+\n+ public Enumerator ( int index, float startTime, float endTime, PolarSliderPath path ) {\n+ this.index = index - 1;\n+ this.startTime = startTime;\n+ this.endTime = endTime;\n+ this.path = path;\n+ }\n+\n+ public bool MoveNext () {\n+ if ( index + 2 < path.Nodes.Count && path.Nodes[index + 1].Time <= endTime ) {\n+ index++;\n+ return true;\n+ }\n+ return false;\n+ }\n+\n+ public SliderSegment Current {\n+ get {\n+ var from = path.Nodes[index];\n+ var to = path.Nodes[index + 1];\n+ var deltaAngle = Extensions.GetDeltaAngle( to.Angle, from.Angle );\n+ var duration = to.Time - from.Time;\n+\n+ if ( to.Time > endTime && duration != 0 ) {\n+ to = new( endTime, from.Angle + deltaAngle * ( endTime - from.Time ) / duration );\n+ }\n+ if ( from.Time < startTime && duration != 0 ) {\n+ from = new( startTime, from.Angle + deltaAngle * ( startTime - from.Time ) / duration );\n+ }\n+\n+ return new( from, to );\n+ }\n+ }\n+ }\n+ }\n+\n+ public struct SegmentNodesEnumerable : IEnumerable<SliderNode> {\n+ SliderNode from;\n+ SliderNode to;\n+ int steps;\n+\n+ public SegmentNodesEnumerable ( SliderNode from, SliderNode to, int steps ) {\n+ this.from = from;\n+ this.to = to;\n+ this.steps = steps;\n+ }\n+\n+ public Enumerator GetEnumerator () => new( from, to, steps );\n+\n+ IEnumerator<SliderNode> IEnumerable<SliderNode>.GetEnumerator () {\n+ foreach ( var i in this )\n+ yield return i;\n+ }\n+\n+ IEnumerator IEnumerable.GetEnumerator ()\n+ => ( (IEnumerable<SliderNode>)this ).GetEnumerator();\n+\n+ public struct Enumerator {\n+ SliderNode from;\n+ int steps;\n+ int current = -1;\n+ float span;\n+ float timeSpan;\n+\n+ public Enumerator ( SliderNode from, SliderNode to, int steps ) {\n+ this.from = from;\n+ this.steps = steps;\n+ if ( steps <= 1 ) {\n+ span = 0;\n+ timeSpan = 0;\n+ }\n+ else {\n+ span = Extensions.GetDeltaAngle( to.Angle, from.Angle ) / ( steps - 1 );\n+ timeSpan = ( to.Time - from.Time ) / ( steps - 1 );\n+ }\n+ }\n+\n+ public bool MoveNext () {\n+ return ++current < steps;\n+ }\n+\n+ public SliderNode Current => new( from.Time + timeSpan * current, from.Angle + span * current );\n+ }\n+ }\n}\n"
}
]
| C# | MIT License | taulazer/tau | use polar slider path in graphics calculations |
664,859 | 23.05.2022 14:28:14 | 14,400 | f648b5da50f2a82c57e49e1e1951cbdbc9543f30 | Add AngleAt method | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/PolarSliderPath.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/PolarSliderPath.cs",
"diff": "@@ -22,22 +22,27 @@ public class PolarSliderPath\npublic readonly BindableList<SliderNode> Nodes = new();\nprivate readonly Cached pathCache = new();\n- public PolarSliderPath () {\n- Nodes.BindCollectionChanged((_, _) => {\n+ public PolarSliderPath()\n+ {\n+ Nodes.BindCollectionChanged((_, _) =>\n+ {\n// TODO ensure the list is sorted\ninvalidate();\n});\n}\n+\npublic PolarSliderPath(IEnumerable<SliderNode> nodes)\n{\nNodes.AddRange(nodes);\n- Nodes.BindCollectionChanged((_, _) => {\n+ Nodes.BindCollectionChanged((_, _) =>\n+ {\n// TODO ensure the list is sorted\ninvalidate();\n});\n}\nprivate double calculatedLength;\n+\n/// <summary>\n/// The distance of the path (in degrees)\n/// </summary>\n@@ -52,6 +57,7 @@ public double CalculatedDistance\n// we are expecting the inputs to be similar, and as such caching the current seeker position speeds the process up\nint nodeIndex;\n+\n/// <summary>\n/// Seeks the <see cref=\"nodeIndex\"/> such that the node at <see cref=\"nodeIndex\"/> is before or at <paramref name=\"time\"/>\n/// and the next node is after <paramref name=\"time\"/> unless there are no more nodes to seek in a given direction.\n@@ -99,6 +105,9 @@ public SliderNode NodeAt(float time)\nreturn new(time, from.Angle + delta * (time - from.Time) / (to.Time - from.Time));\n}\n+ public float AngleAt(float time)\n+ => NodeAt(time).Angle;\n+\nprivate void invalidate()\n{\npathCache.Invalidate();\n@@ -124,6 +133,7 @@ private void calculateLength()\nreturn;\nfloat lastAngle = Nodes[0].Angle;\n+\nforeach (var node in Nodes)\n{\ncalculatedLength += Math.Abs(Extensions.GetDeltaAngle(node.Angle, lastAngle));\n@@ -138,9 +148,11 @@ public float CalculateLazyDistance(float halfTolerance)\nvar length = 0f;\nfloat lastAngle = Nodes[0].Angle;\n+\nforeach (var node in Nodes)\n{\nvar delta = Extensions.GetDeltaAngle(node.Angle, lastAngle);\n+\nif (MathF.Abs(delta) > halfTolerance)\n{\nlastAngle += delta - (delta > 0 ? halfTolerance : -halfTolerance);\n@@ -187,10 +199,13 @@ public SegmentNodesEnumerable Split (float timeStep = 20, float maxAnglePerMs =\nvar duration = Duration;\nvar delta = DeltaAngle;\nint steps;\n- if ( duration == 0 ) {\n+\n+ if (duration == 0)\n+ {\nsteps = (int)MathF.Ceiling(MathF.Abs(delta) / maxAnglePerMs);\n}\n- else {\n+ else\n+ {\nvar anglePerMs = delta / duration;\ntimeStep = Math.Min(timeStep, Math.Abs(maxAnglePerMs / anglePerMs));\nsteps = (int)MathF.Ceiling(duration / timeStep);\n@@ -207,12 +222,14 @@ public SegmentNodesEnumerable Split (float timeStep = 20, float maxAnglePerMs =\npublic override string ToString() => $\"({From}) -> ({To})\";\n}\n- public struct NodesEnumerable : IEnumerable<SliderNode> {\n+ public struct NodesEnumerable : IEnumerable<SliderNode>\n+ {\nint index;\nfloat endTime;\nPolarSliderPath path;\n- public NodesEnumerable ( int index, float endTime, PolarSliderPath path ) {\n+ public NodesEnumerable(int index, float endTime, PolarSliderPath path)\n+ {\nthis.index = index;\nthis.endTime = endTime;\nthis.path = path;\n@@ -220,7 +237,8 @@ public struct NodesEnumerable : IEnumerable<SliderNode> {\npublic Enumerator GetEnumerator() => new(index, endTime, path);\n- IEnumerator<SliderNode> IEnumerable<SliderNode>.GetEnumerator () {\n+ IEnumerator<SliderNode> IEnumerable<SliderNode>.GetEnumerator()\n+ {\nforeach (var i in this)\nyield return i;\n}\n@@ -228,22 +246,27 @@ public struct NodesEnumerable : IEnumerable<SliderNode> {\nIEnumerator IEnumerable.GetEnumerator()\n=> ((IEnumerable<SliderNode>)this).GetEnumerator();\n- public struct Enumerator {\n+ public struct Enumerator\n+ {\nint index;\nfloat endTime;\nPolarSliderPath path;\n- public Enumerator ( int index, float endTime, PolarSliderPath path ) {\n+ public Enumerator(int index, float endTime, PolarSliderPath path)\n+ {\nthis.index = index - 1;\nthis.endTime = endTime;\nthis.path = path;\n}\n- public bool MoveNext () {\n- if ( index + 1 < path.Nodes.Count && path.Nodes[index + 1].Time < endTime ) {\n+ public bool MoveNext()\n+ {\n+ if (index + 1 < path.Nodes.Count && path.Nodes[index + 1].Time < endTime)\n+ {\nindex++;\nreturn true;\n}\n+\nreturn false;\n}\n@@ -251,20 +274,23 @@ public struct Enumerator {\n}\n}\n- public struct SegmentsEnumerable : IEnumerable<SliderSegment> {\n+ public struct SegmentsEnumerable : IEnumerable<SliderSegment>\n+ {\nint index;\nfloat startTime;\nfloat endTime;\nPolarSliderPath path;\n- public SegmentsEnumerable ( int index, float startTime, float endTime, PolarSliderPath path ) {\n+ public SegmentsEnumerable(int index, float startTime, float endTime, PolarSliderPath path)\n+ {\nthis.index = index;\nthis.startTime = startTime;\nthis.endTime = endTime;\nthis.path = path;\n}\n- IEnumerator<SliderSegment> IEnumerable<SliderSegment>.GetEnumerator () {\n+ IEnumerator<SliderSegment> IEnumerable<SliderSegment>.GetEnumerator()\n+ {\nforeach (var i in this)\nyield return i;\n}\n@@ -274,38 +300,48 @@ IEnumerator IEnumerable.GetEnumerator ()\npublic Enumerator GetEnumerator() => new(index, startTime, endTime, path);\n- public struct Enumerator {\n+ public struct Enumerator\n+ {\nint index;\nfloat startTime;\nfloat endTime;\nPolarSliderPath path;\n- public Enumerator ( int index, float startTime, float endTime, PolarSliderPath path ) {\n+ public Enumerator(int index, float startTime, float endTime, PolarSliderPath path)\n+ {\nthis.index = index - 1;\nthis.startTime = startTime;\nthis.endTime = endTime;\nthis.path = path;\n}\n- public bool MoveNext () {\n- if ( index + 2 < path.Nodes.Count && path.Nodes[index + 1].Time <= endTime ) {\n+ public bool MoveNext()\n+ {\n+ if (index + 2 < path.Nodes.Count && path.Nodes[index + 1].Time <= endTime)\n+ {\nindex++;\nreturn true;\n}\n+\nreturn false;\n}\n- public SliderSegment Current {\n- get {\n+ public SliderSegment Current\n+ {\n+ get\n+ {\nvar from = path.Nodes[index];\nvar to = path.Nodes[index + 1];\nvar deltaAngle = Extensions.GetDeltaAngle(to.Angle, from.Angle);\nvar duration = to.Time - from.Time;\n- if ( to.Time > endTime && duration != 0 ) {\n+ if (to.Time > endTime && duration != 0)\n+ {\nto = new(endTime, from.Angle + deltaAngle * (endTime - from.Time) / duration);\n}\n- if ( from.Time < startTime && duration != 0 ) {\n+\n+ if (from.Time < startTime && duration != 0)\n+ {\nfrom = new(startTime, from.Angle + deltaAngle * (startTime - from.Time) / duration);\n}\n@@ -315,12 +351,14 @@ public struct Enumerator {\n}\n}\n- public struct SegmentNodesEnumerable : IEnumerable<SliderNode> {\n+ public struct SegmentNodesEnumerable : IEnumerable<SliderNode>\n+ {\nSliderNode from;\nSliderNode to;\nint steps;\n- public SegmentNodesEnumerable ( SliderNode from, SliderNode to, int steps ) {\n+ public SegmentNodesEnumerable(SliderNode from, SliderNode to, int steps)\n+ {\nthis.from = from;\nthis.to = to;\nthis.steps = steps;\n@@ -328,7 +366,8 @@ public struct SegmentNodesEnumerable : IEnumerable<SliderNode> {\npublic Enumerator GetEnumerator() => new(from, to, steps);\n- IEnumerator<SliderNode> IEnumerable<SliderNode>.GetEnumerator () {\n+ IEnumerator<SliderNode> IEnumerable<SliderNode>.GetEnumerator()\n+ {\nforeach (var i in this)\nyield return i;\n}\n@@ -336,27 +375,33 @@ public struct SegmentNodesEnumerable : IEnumerable<SliderNode> {\nIEnumerator IEnumerable.GetEnumerator()\n=> ((IEnumerable<SliderNode>)this).GetEnumerator();\n- public struct Enumerator {\n+ public struct Enumerator\n+ {\nSliderNode from;\nint steps;\nint current = -1;\nfloat span;\nfloat timeSpan;\n- public Enumerator ( SliderNode from, SliderNode to, int steps ) {\n+ public Enumerator(SliderNode from, SliderNode to, int steps)\n+ {\nthis.from = from;\nthis.steps = steps;\n- if ( steps <= 1 ) {\n+\n+ if (steps <= 1)\n+ {\nspan = 0;\ntimeSpan = 0;\n}\n- else {\n+ else\n+ {\nspan = Extensions.GetDeltaAngle(to.Angle, from.Angle) / (steps - 1);\ntimeSpan = (to.Time - from.Time) / (steps - 1);\n}\n}\n- public bool MoveNext () {\n+ public bool MoveNext()\n+ {\nreturn ++current < steps;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Slider.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Slider.cs",
"diff": "@@ -88,7 +88,7 @@ protected override void CreateNestedHitObjects(CancellationToken cancellationTok\nforeach (var e in sliderEvents)\n{\n- var currentAngle = Path.NodeAt((float)(e.Time - StartTime)).Angle;\n+ float currentAngle = Path.AngleAt((float)(e.Time - StartTime));\nswitch (e.Type)\n{\n"
}
]
| C# | MIT License | taulazer/tau | Add AngleAt method |
664,859 | 23.05.2022 15:34:32 | 14,400 | 2158461b986fad0b4e1d73097d50b4a1a2b04838 | Apply lazy slider travel distance | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauAngledDifficultyHitObject.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauAngledDifficultyHitObject.cs",
"diff": "@@ -12,6 +12,8 @@ public class TauAngledDifficultyHitObject : TauDifficultyHitObject\n/// </summary>\npublic double TravelDistance { get; private set; }\n+ public double LazyTravelDistance { get; private set; }\n+\n/// <summary>\n/// The time taken to travel through <see cref=\"TravelDistance\"/>, with a minimum value of 25ms for a non-zero distance.\n/// </summary>\n@@ -41,6 +43,7 @@ public TauAngledDifficultyHitObject(HitObject hitObject, HitObject lastObject, d\nif (hitObject is Slider slider)\n{\nTravelDistance = slider.Path.CalculatedDistance;\n+ LazyTravelDistance = slider.Path.CalculateLazyDistance((float)(AngleRange / 2));\nTravelTime = slider.Duration;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"diff": "@@ -43,7 +43,7 @@ protected override double StrainValueOf(DifficultyHitObject current)\nif (AllowedObjectTypes.Any(t => t == typeof(Slider)) && tauLastObj.BaseObject is Slider && tauLastObj.TravelDistance < tauCurrObj.AngleRange)\n{\n- double travelVelocity = tauLastObj.TravelDistance / tauLastObj.TravelTime; // calculate the slider velocity from slider head to slider end.\n+ double travelVelocity = tauLastObj.LazyTravelDistance / tauLastObj.TravelTime; // calculate the slider velocity from slider head to slider end.\ndouble movementVelocity = tauCurrObj.Distance / tauCurrObj.StrainTime; // calculate the movement velocity from slider end to current object\ncurrVelocity = Math.Max(currVelocity, movementVelocity + travelVelocity); // take the larger total combined velocity.\n"
}
]
| C# | MIT License | taulazer/tau | Apply lazy slider travel distance |
664,859 | 24.05.2022 12:00:54 | 14,400 | 96bfd0d64a3516ed04aa77be1298940ed50eb375 | Clean aim skill | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"diff": "@@ -12,7 +12,7 @@ public class Aim : StrainDecaySkill\n{\nprivate Type[] AllowedObjectTypes;\n- protected override int HistoryLength => 2;\n+ protected override int HistoryLength => 10;\nprotected override double SkillMultiplier => 50;\nprivate const double slider_multiplier = 1.5;\nprotected override double StrainDecayBase => 0.2;\n@@ -23,46 +23,44 @@ public Aim(Mod[] mods, params Type[] allowedObjectTypes)\nAllowedObjectTypes = allowedObjectTypes;\n}\n- protected override double StrainValueOf(DifficultyHitObject current)\n+ private double calculateStrain(TauAngledDifficultyHitObject current, TauAngledDifficultyHitObject last)\n{\n- if (Previous.Count <= 1)\n- return 0;\n+ double velocity = current.Distance / current.StrainTime;\n- if (current is not TauAngledDifficultyHitObject || Previous[0] is not TauAngledDifficultyHitObject)\n- return 0;\n+ if (!AllowedObjectTypes.Any(t => t == typeof(Slider) && last.BaseObject is Slider))\n+ return velocity;\n- var tauCurrObj = (TauAngledDifficultyHitObject)current;\n- var tauLastObj = (TauAngledDifficultyHitObject)Previous[0]; // TODO: \"Last Object\" should be the last available angled hit object.\n+ // Slider calculation\n- if (tauCurrObj.Distance == 0)\n- return 0;\n+ if (!(last.TravelDistance >= current.AngleRange))\n+ return velocity;\n+\n+ double travelVelocity = last.LazyTravelDistance / last.TravelTime;\n+ double movementVelocity = current.Distance / current.StrainTime;\n- if (!(tauCurrObj.Distance >= tauCurrObj.AngleRange)) return 0;\n+ velocity = Math.Max(velocity, movementVelocity + travelVelocity);\n+ velocity += (last.TravelDistance / last.TravelTime) * slider_multiplier;\n- double currVelocity = tauCurrObj.Distance / tauCurrObj.StrainTime;\n+ return velocity;\n+ }\n- if (AllowedObjectTypes.Any(t => t == typeof(Slider)) && tauLastObj.BaseObject is Slider && tauLastObj.TravelDistance < tauCurrObj.AngleRange)\n+ protected override double StrainValueOf(DifficultyHitObject current)\n{\n- double travelVelocity = tauLastObj.LazyTravelDistance / tauLastObj.TravelTime; // calculate the slider velocity from slider head to slider end.\n- double movementVelocity = tauCurrObj.Distance / tauCurrObj.StrainTime; // calculate the movement velocity from slider end to current object\n+ if (Previous.Count <= 1 || current is not TauAngledDifficultyHitObject)\n+ return 0;\n- currVelocity = Math.Max(currVelocity, movementVelocity + travelVelocity); // take the larger total combined velocity.\n- }\n+ // Get the last available angled hit object in the history.\n+ var prevAngled = Previous.Where(p => p is TauAngledDifficultyHitObject);\n+ if (!prevAngled.Any())\n+ return 0;\n- double sliderBonus = 0;\n- double aimStrain = currVelocity;\n+ var tauCurrObj = (TauAngledDifficultyHitObject)current;\n+ var tauLastObj = (TauAngledDifficultyHitObject)prevAngled.First();\n- // Sliders should be treated as beats if their travel distance is short enough.\n- if (tauLastObj.TravelTime != 0 && tauLastObj.TravelDistance >= tauCurrObj.AngleRange)\n- {\n- // Reward sliders based on velocity.\n- sliderBonus = tauLastObj.TravelDistance / tauLastObj.TravelTime;\n- }\n+ if (tauCurrObj.Distance == 0 || !(tauCurrObj.Distance >= tauCurrObj.AngleRange))\n+ return 0;\n- // Add in additional slider velocity bonus.\n- if (AllowedObjectTypes.Any(t => t == typeof(Slider)))\n- aimStrain += sliderBonus * slider_multiplier;\n- return aimStrain;\n+ return calculateStrain(tauCurrObj, tauLastObj);\n}\n#region PP Calculation\n@@ -72,9 +70,7 @@ public static double ComputePerformance(TauPerformanceContext context)\ndouble rawAim = context.DifficultyAttributes.AimDifficulty;\ndouble aimValue = Math.Pow(5.0 * Math.Max(1.0, rawAim / 0.0675) - 4.0, 3.0) / 100000.0; // TODO: Figure values here.\n- double lengthBonus = 0.95 +\n- 0.4 * Math.Min(1.0, context.TotalHits / 2000.0) +\n- (context.TotalHits > 2000 ? Math.Log10(context.TotalHits / 2000.0) * 0.5 : 0.0); // TODO: Figure values here.\n+ double lengthBonus = 0.95 + 0.4 * Math.Min(1.0, context.TotalHits / 2000.0) + (context.TotalHits > 2000 ? Math.Log10(context.TotalHits / 2000.0) * 0.5 : 0.0); // TODO: Figure values here.\naimValue *= lengthBonus;\nTauDifficultyAttributes attributes = context.DifficultyAttributes;\n@@ -88,8 +84,7 @@ public static double ComputePerformance(TauPerformanceContext context)\n// Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses.\nif (context.EffectiveMissCount > 0)\n- aimValue *= 0.97 *\n- Math.Pow(1 - Math.Pow(context.EffectiveMissCount / context.TotalHits, 0.775), context.EffectiveMissCount); // TODO: Figure values here.\n+ aimValue *= 0.97 * Math.Pow(1 - Math.Pow(context.EffectiveMissCount / context.TotalHits, 0.775), context.EffectiveMissCount); // TODO: Figure values here.\n// We assume 15% of sliders in a map are difficult since there's no way to tell from the performance calculator.\ndouble estimateDifficultSliders = attributes.SliderCount * 0.15;\n@@ -98,8 +93,7 @@ public static double ComputePerformance(TauPerformanceContext context)\n{\ndouble estimateSliderEndsDropped = Math.Clamp(Math.Min(context.CountOk + context.CountMiss, attributes.MaxCombo - context.ScoreMaxCombo), 0,\nestimateDifficultSliders);\n- double sliderNerfFactor = (1 - attributes.SliderFactor) * Math.Pow(1 - estimateSliderEndsDropped / estimateDifficultSliders, 3) +\n- attributes.SliderFactor;\n+ double sliderNerfFactor = (1 - attributes.SliderFactor) * Math.Pow(1 - estimateSliderEndsDropped / estimateDifficultSliders, 3) + attributes.SliderFactor;\naimValue *= sliderNerfFactor;\n}\n"
}
]
| C# | MIT License | taulazer/tau | Clean aim skill |
664,862 | 28.05.2022 05:23:44 | -36,000 | 880fe005765adf0231c794317e84f6f0ba9a8c2d | Add Basic Complexity calculations | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Complexity.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Complexity.cs",
"diff": "@@ -129,6 +129,27 @@ private double repetitionPenalty(int notesSince)\nprivate HitType getHitType(TauDifficultyHitObject hitObject)\n=> hitObject.BaseObject is AngledTauHitObject ? HitType.Angled : HitType.HardBeat;\n+ #region PP Calculations\n+\n+ public static double CalculatePerformance(TauPerformanceContext context)\n+ {\n+ double rawComplexity = context.DifficultyAttributes.ComplexityDifficulty;\n+\n+ double complexityValue = Math.Pow(5.0 * Math.Max(1.0, rawComplexity / 0.0675) - 4.0, 3.0) / 100000.0;\n+\n+ // Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses.\n+ if (context.EffectiveMissCount > 0)\n+ complexityValue *= 0.97 * Math.Pow(1 - Math.Pow(context.EffectiveMissCount / context.TotalHits, 0.775), context.EffectiveMissCount); // TODO: Figure values here.\n+\n+ double lengthBonus =\n+ 0.95 + 0.4 * Math.Min(1.0, context.TotalHits / 2000.0) + (context.TotalHits > 2000 ? Math.Log10(context.TotalHits / 2000.0) * 0.5 : 0.0);\n+ complexityValue *= lengthBonus;\n+\n+ return complexityValue;\n+ }\n+\n+ #endregion\n+\nprivate enum HitType\n{\nAngled,\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Speed.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Speed.cs",
"diff": "@@ -205,9 +205,6 @@ public static double ComputePerformance(TauPerformanceContext context)\n// Scale the speed value with accuracy and OD.\nspeedValue *= (0.95 + Math.Pow(attributes.OverallDifficulty, 2) / 750) * Math.Pow(context.Accuracy, (14.5 - Math.Max(attributes.OverallDifficulty, 8)) / 2);\n- // Scale the speed value with # of 50s to punish doubletapping.\n- //speedValue *= Math.Pow(0.98, context.CountOk < context.TotalHits / 500.0 ? 0 : context.CountMeh - context.TotalHits / 500.0);\n-\nreturn speedValue;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/TauPerformanceAttribute.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/TauPerformanceAttribute.cs",
"diff": "@@ -15,6 +15,9 @@ public class TauPerformanceAttribute : PerformanceAttributes\n[JsonProperty(\"accuracy\")]\npublic double Accuracy { get; set; }\n+ [JsonProperty(\"complexity\")]\n+ public double Complexity { get; set; }\n+\n[JsonProperty(\"effective_miss_count\")]\npublic double EffectiveMissCount { get; set; }\n@@ -28,6 +31,7 @@ public override IEnumerable<PerformanceDisplayAttribute> GetAttributesForDisplay\nyield return new PerformanceDisplayAttribute(nameof(Aim), \"Aim\", Aim);\nyield return new PerformanceDisplayAttribute(nameof(Accuracy), \"Accuracy\", Accuracy);\nyield return new PerformanceDisplayAttribute(nameof(Speed), \"Speed\", Speed);\n+ yield return new PerformanceDisplayAttribute(nameof(Complexity), \"Complexity\", Complexity);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/TauPerformanceCalculator.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/TauPerformanceCalculator.cs",
"diff": "@@ -21,7 +21,9 @@ public TauPerformanceCalculator()\nprotected override PerformanceAttributes CreatePerformanceAttributes(ScoreInfo score, DifficultyAttributes attributes)\n{\nvar tauAttributes = (TauDifficultyAttributes)attributes;\n+\ncontext = new TauPerformanceContext(score, tauAttributes);\n+ double effectiveMissCount = context.EffectiveMissCount = calculateEffectiveMissCount(context);\n// Mod multipliers here, let's just set to default osu! value.\ndouble multiplier = 1.12;\n@@ -29,13 +31,13 @@ protected override PerformanceAttributes CreatePerformanceAttributes(ScoreInfo s\ndouble aimValue = Aim.ComputePerformance(context);\ndouble speedValue = Speed.ComputePerformance(context);\ndouble accuracyValue = computeAccuracy(context);\n- double effectiveMissCount = calculateEffectiveMissCount(context);\n+ double complexityValue = Complexity.CalculatePerformance(context);\nif (score.Mods.Any(m => m is TauModNoFail))\nmultiplier *= Math.Max(0.90, 1.0 - 0.02 * effectiveMissCount);\ndouble totalValue = Math.Pow(\n- Math.Pow(aimValue, 1.1) + Math.Pow(accuracyValue, 1.1) + Math.Pow(speedValue, 1.1),\n+ Math.Pow(aimValue, 1.1) + Math.Pow(accuracyValue, 1.1) + Math.Pow(speedValue, 1.1) + Math.Pow(complexityValue, 1.1),\n1.0 / 1.1\n) *\nmultiplier;\n@@ -45,6 +47,7 @@ protected override PerformanceAttributes CreatePerformanceAttributes(ScoreInfo s\nAim = aimValue,\nSpeed = speedValue,\nAccuracy = accuracyValue,\n+ Complexity = complexityValue,\nTotal = totalValue,\nEffectiveMissCount = effectiveMissCount\n};\n@@ -105,8 +108,7 @@ public struct TauPerformanceContext\npublic int CountOk => Score.Statistics.GetValueOrDefault(HitResult.Ok);\npublic int CountMiss => Score.Statistics.GetValueOrDefault(HitResult.Miss);\n- public double EffectiveMissCount => 0.0;\n-\n+ public double EffectiveMissCount { get; set; }\npublic int TotalHits => CountGreat + CountOk + CountMiss;\npublic ScoreInfo Score { get; set; }\n@@ -116,5 +118,6 @@ public TauPerformanceContext(ScoreInfo score, TauDifficultyAttributes attributes\n{\nScore = score;\nDifficultyAttributes = attributes;\n+ EffectiveMissCount = 0.0;\n}\n}\n"
}
]
| C# | MIT License | taulazer/tau | Add Basic Complexity calculations |
664,859 | 28.05.2022 13:18:46 | 14,400 | 089aebe52dff52527463066957c58131bc4cb299 | piss and balls | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau.sln",
"new_path": "osu.Game.Rulesets.Tau.sln",
"diff": "@@ -12,6 +12,8 @@ Project(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"Solution Files\", \"Solution\n.editorconfig = .editorconfig\nEndProjectSection\nEndProject\n+Project(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"osu.Game.Rulesets.Tau.Game\", \"osu.Game.Rulesets.Tau.Game\\osu.Game.Rulesets.Tau.Game.csproj\", \"{33D1FE6D-7087-4E64-AE77-354E9DDDB997}\"\n+EndProject\nGlobal\nGlobalSection(SolutionConfigurationPlatforms) = preSolution\nDebug|Any CPU = Debug|Any CPU\n@@ -31,6 +33,12 @@ Global\n{B4577C85-CB83-462A-BCE3-22FFEB16311D}.Release|Any CPU.Build.0 = Release|Any CPU\n{B4577C85-CB83-462A-BCE3-22FFEB16311D}.VisualTests|Any CPU.ActiveCfg = Debug|Any CPU\n{B4577C85-CB83-462A-BCE3-22FFEB16311D}.VisualTests|Any CPU.Build.0 = Debug|Any CPU\n+ {33D1FE6D-7087-4E64-AE77-354E9DDDB997}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n+ {33D1FE6D-7087-4E64-AE77-354E9DDDB997}.Debug|Any CPU.Build.0 = Debug|Any CPU\n+ {33D1FE6D-7087-4E64-AE77-354E9DDDB997}.Release|Any CPU.ActiveCfg = Release|Any CPU\n+ {33D1FE6D-7087-4E64-AE77-354E9DDDB997}.Release|Any CPU.Build.0 = Release|Any CPU\n+ {33D1FE6D-7087-4E64-AE77-354E9DDDB997}.VisualTests|Any CPU.ActiveCfg = Debug|Any CPU\n+ {33D1FE6D-7087-4E64-AE77-354E9DDDB997}.VisualTests|Any CPU.Build.0 = Debug|Any CPU\nEndGlobalSection\nGlobalSection(SolutionProperties) = preSolution\nHideSolutionNode = FALSE\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauAngledDifficultyHitObject.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauAngledDifficultyHitObject.cs",
"diff": "using System;\n+using System.Collections.Generic;\n+using osu.Game.Rulesets.Difficulty.Preprocessing;\nusing osu.Game.Rulesets.Objects;\nusing osu.Game.Rulesets.Tau.Objects;\nusing osu.Game.Rulesets.Tau.UI;\n@@ -21,23 +23,29 @@ public class TauAngledDifficultyHitObject : TauDifficultyHitObject\nprivate readonly TauCachedProperties properties;\n+ public new AngledTauHitObject BaseObject => (AngledTauHitObject)base.BaseObject;\n+\npublic double AngleRange => properties.AngleRange.Value;\n- public readonly double Distance;\n+ public double Distance;\n- public TauAngledDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, TauCachedProperties properties)\n- : base(hitObject, lastObject, clockRate)\n+ public TauAngledDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, TauCachedProperties properties,\n+ List<DifficultyHitObject> objects)\n+ : base(hitObject, lastObject, clockRate, objects)\n{\nthis.properties = properties;\n- if (hitObject is AngledTauHitObject firstAngled && lastObject is AngledTauHitObject lastAngled)\n+ var lastAngled = GetPrevious<TauAngledDifficultyHitObject>();\n+\n+ if (hitObject is AngledTauHitObject firstAngled && lastAngled != null)\n{\nfloat offset = 0;\n- if (lastAngled is IHasOffsetAngle offsetAngle)\n+ if (lastAngled.BaseObject is IHasOffsetAngle offsetAngle)\noffset = offsetAngle.GetOffsetAngle();\n- Distance = Math.Abs(Extensions.GetDeltaAngle(firstAngled.Angle, (lastAngled.Angle + offset).Normalize()));\n+ Distance = Math.Abs(Math.Max(0, Extensions.GetDeltaAngle(firstAngled.Angle, (lastAngled.BaseObject.Angle + offset)) - AngleRange / 2));\n+ StrainTime = Math.Max(StrainTime, (hitObject.StartTime - lastAngled.StartTime) / clockRate);\n}\nif (hitObject is Slider slider)\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauDifficultyHitObject.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauDifficultyHitObject.cs",
"diff": "using System;\n+using System.Collections.Generic;\n+using System.Linq;\nusing osu.Game.Rulesets.Difficulty.Preprocessing;\nusing osu.Game.Rulesets.Objects;\nusing osu.Game.Rulesets.Tau.Objects;\n@@ -13,16 +15,28 @@ public class TauDifficultyHitObject : DifficultyHitObject\npublic new TauHitObject LastObject => (TauHitObject)base.LastObject;\n+ protected readonly List<DifficultyHitObject> Objects;\n+\n/// <summary>\n/// Milliseconds elapsed since the start time of the previous <see cref=\"TauDifficultyHitObject\"/>, with a minimum of 25ms.\n/// </summary>\n- public readonly double StrainTime;\n+ public double StrainTime;\n- public TauDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate)\n+ public TauDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List<DifficultyHitObject> objects)\n: base(hitObject, lastObject, clockRate)\n{\n+ Objects = objects;\n+\n// Capped to 25ms to prevent difficulty calculation breaking from simultaneous objects.\nStrainTime = Math.Max(DeltaTime, min_delta_time);\n}\n+\n+ protected T GetPrevious<T>()\n+ where T : DifficultyHitObject\n+ {\n+ var type = typeof(T);\n+\n+ return (T)Objects.LastOrDefault(o => o.GetType() == type);\n+ }\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"diff": "@@ -17,6 +17,8 @@ public class Aim : StrainDecaySkill\nprivate const double slider_multiplier = 1.5;\nprotected override double StrainDecayBase => 0.2;\n+ private double velocityMultiplier = 75;\n+\npublic Aim(Mod[] mods, Type[] allowedHitObjects)\n: base(mods)\n{\n@@ -25,7 +27,7 @@ public Aim(Mod[] mods, Type[] allowedHitObjects)\nprivate double calculateStrain(TauAngledDifficultyHitObject current, TauAngledDifficultyHitObject last)\n{\n- double velocity = current.Distance / current.StrainTime;\n+ double velocity = (current.Distance / Math.Pow(current.StrainTime, 2)) * velocityMultiplier;\nif (!allowedHitObjects.Any(t => t == typeof(Slider) && last.BaseObject is Slider))\nreturn velocity;\n@@ -35,11 +37,11 @@ private double calculateStrain(TauAngledDifficultyHitObject current, TauAngledDi\nif (!(last.TravelDistance >= current.AngleRange))\nreturn velocity;\n- double travelVelocity = last.LazyTravelDistance / last.TravelTime;\n- double movementVelocity = current.Distance / current.StrainTime;\n+ double travelVelocity = (last.LazyTravelDistance / Math.Pow(last.TravelTime, 2)) * velocityMultiplier;\n+ double movementVelocity = (current.Distance / Math.Pow(current.StrainTime, 2)) * velocityMultiplier;\nvelocity = Math.Max(velocity, movementVelocity + travelVelocity);\n- velocity += (last.TravelDistance / last.TravelTime) * slider_multiplier;\n+ velocity += ((last.LazyTravelDistance / Math.Pow(last.TravelTime, 2)) * velocityMultiplier) * slider_multiplier;\nreturn velocity;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/TauDifficultyCalculator.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/TauDifficultyCalculator.cs",
"diff": "@@ -80,15 +80,26 @@ protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(I\nproperties.SetRange(beatmap.Difficulty.CircleSize);\nTauHitObject lastObject = null;\n+ var objects = new List<DifficultyHitObject>();\nforeach (var hitObject in beatmap.HitObjects.Cast<TauHitObject>())\n{\nif (lastObject != null)\n{\nif (hitObject is AngledTauHitObject)\n- yield return new TauAngledDifficultyHitObject(hitObject, lastObject, clockRate, properties);\n+ {\n+ var obj = new TauAngledDifficultyHitObject(hitObject, lastObject, clockRate, properties, objects);\n+ yield return obj;\n+\n+ objects.Add(obj);\n+ }\nelse\n- yield return new TauDifficultyHitObject(hitObject, lastObject, clockRate);\n+ {\n+ var obj = new TauDifficultyHitObject(hitObject, lastObject, clockRate, objects);\n+ yield return obj;\n+\n+ objects.Add(obj);\n+ }\n}\nlastObject = hitObject;\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/TauRuleset.cs",
"new_path": "osu.Game.Rulesets.Tau/TauRuleset.cs",
"diff": "@@ -174,7 +174,7 @@ private void load(FontStore store, GameHost host)\n// Please try to avoid this at all costs.\n//\n// ~ Nora\n- store.AddStore(new GlyphStore(\n+ store.AddStore(new RawCachingGlyphStore(\nnew ResourceStore<byte[]>(ruleset.CreateResourceStore()),\n\"Fonts/tauFont\",\nhost.CreateTextureLoaderStore(ruleset.CreateResourceStore())));\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/UI/TauPlayfield.cs",
"new_path": "osu.Game.Rulesets.Tau/UI/TauPlayfield.cs",
"diff": "@@ -111,7 +111,7 @@ protected override void OnNewDrawableHitObject(DrawableHitObject drawableHitObje\nprivate ValidationResult checkPaddlePosition(float angle)\n{\n- var angleDiff = Extensions.GetDeltaAngle(Cursor.DrawablePaddle.Rotation, angle);\n+ var angleDiff = Extensions.GetDeltaAngle(Cursor?.DrawablePaddle?.Rotation ?? 0, angle);\nreturn new ValidationResult(Math.Abs(angleDiff) <= tauCachedProperties.AngleRange.Value / 2, angleDiff);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/UI/TauPlayfieldAdjustmentContainer.cs",
"new_path": "osu.Game.Rulesets.Tau/UI/TauPlayfieldAdjustmentContainer.cs",
"diff": "@@ -10,11 +10,11 @@ public class TauPlayfieldAdjustmentContainer : PlayfieldAdjustmentContainer\nprotected override Container<Drawable> Content => content;\nprivate readonly Container content;\n- public TauPlayfieldAdjustmentContainer()\n+ public TauPlayfieldAdjustmentContainer(float scale = 0.6f)\n{\nAnchor = Anchor.Centre;\nOrigin = Anchor.Centre;\n- Size = new Vector2(.6f);\n+ Size = new Vector2(scale);\nFillMode = FillMode.Fit;\nFillAspectRatio = 1;\n"
}
]
| C# | MIT License | taulazer/tau | piss and balls |
664,859 | 28.05.2022 15:28:13 | 14,400 | 617738b2de49a0515256ec8cf5a1e84f5eb50716 | Fix incorrect StartTime.
Previously it was getting the non-clockrated start time | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauAngledDifficultyHitObject.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauAngledDifficultyHitObject.cs",
"diff": "@@ -45,7 +45,7 @@ public class TauAngledDifficultyHitObject : TauDifficultyHitObject\noffset = offsetAngle.GetOffsetAngle();\nDistance = Math.Abs(Math.Max(0, Extensions.GetDeltaAngle(firstAngled.Angle, (lastAngled.BaseObject.Angle + offset)) - AngleRange / 2));\n- StrainTime = Math.Max(StrainTime, (hitObject.StartTime - lastAngled.StartTime) / clockRate);\n+ StrainTime = Math.Max(StrainTime, StartTime - lastAngled.StartTime);\n}\nif (hitObject is Slider slider)\n"
}
]
| C# | MIT License | taulazer/tau | Fix incorrect StartTime.
Previously it was getting the non-clockrated start time |
664,859 | 28.05.2022 15:28:26 | 14,400 | 4a8cadadf33c70f248e2313e7abd854dd0dbfce8 | Clean up object lists | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauAngledDifficultyHitObject.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauAngledDifficultyHitObject.cs",
"diff": "using System;\n-using System.Collections.Generic;\n-using osu.Game.Rulesets.Difficulty.Preprocessing;\nusing osu.Game.Rulesets.Objects;\nusing osu.Game.Rulesets.Tau.Objects;\nusing osu.Game.Rulesets.Tau.UI;\n@@ -29,14 +27,11 @@ public class TauAngledDifficultyHitObject : TauDifficultyHitObject\npublic double Distance;\n- public TauAngledDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, TauCachedProperties properties,\n- List<DifficultyHitObject> objects)\n- : base(hitObject, lastObject, clockRate, objects)\n+ public TauAngledDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, TauCachedProperties properties, TauAngledDifficultyHitObject lastAngled)\n+ : base(hitObject, lastObject, clockRate)\n{\nthis.properties = properties;\n- var lastAngled = GetPrevious<TauAngledDifficultyHitObject>();\n-\nif (hitObject is AngledTauHitObject firstAngled && lastAngled != null)\n{\nfloat offset = 0;\n@@ -52,7 +47,7 @@ public class TauAngledDifficultyHitObject : TauDifficultyHitObject\n{\nTravelDistance = slider.Path.CalculatedDistance;\nLazyTravelDistance = slider.Path.CalculateLazyDistance((float)(AngleRange / 2));\n- TravelTime = slider.Duration;\n+ TravelTime = slider.Duration / clockRate;\n}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauDifficultyHitObject.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauDifficultyHitObject.cs",
"diff": "using System;\n-using System.Collections.Generic;\n-using System.Linq;\nusing osu.Game.Rulesets.Difficulty.Preprocessing;\nusing osu.Game.Rulesets.Objects;\nusing osu.Game.Rulesets.Tau.Objects;\n@@ -15,28 +13,16 @@ public class TauDifficultyHitObject : DifficultyHitObject\npublic new TauHitObject LastObject => (TauHitObject)base.LastObject;\n- protected readonly List<DifficultyHitObject> Objects;\n-\n/// <summary>\n/// Milliseconds elapsed since the start time of the previous <see cref=\"TauDifficultyHitObject\"/>, with a minimum of 25ms.\n/// </summary>\npublic double StrainTime;\n- public TauDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List<DifficultyHitObject> objects)\n+ public TauDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate)\n: base(hitObject, lastObject, clockRate)\n{\n- Objects = objects;\n-\n// Capped to 25ms to prevent difficulty calculation breaking from simultaneous objects.\nStrainTime = Math.Max(DeltaTime, min_delta_time);\n}\n-\n- protected T GetPrevious<T>()\n- where T : DifficultyHitObject\n- {\n- var type = typeof(T);\n-\n- return (T)Objects.LastOrDefault(o => o.GetType() == type);\n- }\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/TauDifficultyCalculator.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/TauDifficultyCalculator.cs",
"diff": "@@ -80,6 +80,7 @@ protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(I\nproperties.SetRange(beatmap.Difficulty.CircleSize);\nTauHitObject lastObject = null;\n+ TauAngledDifficultyHitObject lastAngled = null;\nvar objects = new List<DifficultyHitObject>();\nforeach (var hitObject in beatmap.HitObjects.Cast<TauHitObject>())\n@@ -88,22 +89,19 @@ protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(I\n{\nif (hitObject is AngledTauHitObject)\n{\n- var obj = new TauAngledDifficultyHitObject(hitObject, lastObject, clockRate, properties, objects);\n- yield return obj;\n-\n+ var obj = new TauAngledDifficultyHitObject(hitObject, lastObject, clockRate, properties, lastAngled);\nobjects.Add(obj);\n- }\n- else\n- {\n- var obj = new TauDifficultyHitObject(hitObject, lastObject, clockRate, objects);\n- yield return obj;\n- objects.Add(obj);\n+ lastAngled = obj;\n}\n+ else\n+ objects.Add(new TauDifficultyHitObject(hitObject, lastObject, clockRate));\n}\nlastObject = hitObject;\n}\n+\n+ return objects;\n}\nprotected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate)\n"
}
]
| C# | MIT License | taulazer/tau | Clean up object lists |
664,862 | 30.05.2022 18:10:29 | -36,000 | b92fabf562f826731870e3204df1db7bfc9f9f6a | Format and document some classes. | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauAngledDifficultyHitObject.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauAngledDifficultyHitObject.cs",
"diff": "using osu.Game.Rulesets.Tau.Objects;\nusing osu.Game.Rulesets.Tau.UI;\n-namespace osu.Game.Rulesets.Tau.Difficulty.Preprocessing\n-{\n+namespace osu.Game.Rulesets.Tau.Difficulty.Preprocessing;\n+\npublic class TauAngledDifficultyHitObject : TauDifficultyHitObject\n{\n/// <summary>\n@@ -12,6 +12,9 @@ public class TauAngledDifficultyHitObject : TauDifficultyHitObject\n/// </summary>\npublic double TravelDistance { get; private set; }\n+ /// <summary>\n+ /// Normalised distance between the start and end position of this <see cref=\"TauAngledDifficultyHitObject\"/> in the shortest span possible to account for slider cheesing.\n+ /// </summary>\npublic double LazyTravelDistance { get; private set; }\n/// <summary>\n@@ -48,4 +51,3 @@ public TauAngledDifficultyHitObject(HitObject hitObject, HitObject lastObject, d\n}\n}\n}\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauDifficultyHitObject.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauDifficultyHitObject.cs",
"diff": "using osu.Game.Rulesets.Objects;\nusing osu.Game.Rulesets.Tau.Objects;\n-namespace osu.Game.Rulesets.Tau.Difficulty.Preprocessing\n-{\n+namespace osu.Game.Rulesets.Tau.Difficulty.Preprocessing;\n+\npublic class TauDifficultyHitObject : DifficultyHitObject\n{\nprivate const int min_delta_time = 25;\npublic new TauHitObject BaseObject => (TauHitObject)base.BaseObject;\n- public new TauHitObject LastObject => (TauHitObject)base.LastObject;\n-\n/// <summary>\n/// Milliseconds elapsed since the start time of the previous <see cref=\"TauDifficultyHitObject\"/>, with a minimum of 25ms.\n/// </summary>\n@@ -25,4 +23,3 @@ public TauDifficultyHitObject(HitObject hitObject, HitObject lastObject, double\nStrainTime = Math.Max(DeltaTime, min_delta_time);\n}\n}\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"diff": "using osu.Game.Rulesets.Tau.Difficulty.Preprocessing;\nusing osu.Game.Rulesets.Tau.Objects;\n-namespace osu.Game.Rulesets.Tau.Difficulty.Skills\n-{\n+namespace osu.Game.Rulesets.Tau.Difficulty.Skills;\n+\npublic class Aim : StrainDecaySkill\n{\nprivate readonly Type[] allowedHitObjects;\n@@ -65,19 +65,24 @@ protected override double StrainValueOf(DifficultyHitObject current)\n#region PP Calculation\n+ /// <summary>\n+ /// Calculates the computed Aim skill performance value using the AimDifficulty, length bonus, miss count check and slider nerf values based on the play.\n+ /// </summary>\n+ /// <param name=\"context\">The performance context for the play.</param>\npublic static double ComputePerformance(TauPerformanceContext context)\n{\ndouble rawAim = context.DifficultyAttributes.AimDifficulty;\n- double aimValue = Math.Pow(5.0 * Math.Max(1.0, rawAim / 0.0675) - 4.0, 3.0) / 100000.0; // TODO: Figure values here.\n+ double aimValue = Math.Pow(5.0 * Math.Max(1.0, rawAim / 0.0675) - 4.0, 3.0) / 100000.0;\n- double lengthBonus = 0.95 + 0.4 * Math.Min(1.0, context.TotalHits / 2000.0) + (context.TotalHits > 2000 ? Math.Log10(context.TotalHits / 2000.0) * 0.5 : 0.0); // TODO: Figure values here.\n+ // Length bonus is added on for beatmaps with more than 2,000 hitobjects.\n+ double lengthBonus = 0.95 + 0.4 * Math.Min(1.0, context.TotalHits / 2000.0) + (context.TotalHits > 2000 ? Math.Log10(context.TotalHits / 2000.0) * 0.5 : 0.0);\naimValue *= lengthBonus;\naimValue *= computeArFactor(context) * lengthBonus;\n// Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses.\nif (context.EffectiveMissCount > 0)\n- aimValue *= 0.97 * Math.Pow(1 - Math.Pow(context.EffectiveMissCount / context.TotalHits, 0.775), context.EffectiveMissCount); // TODO: Figure values here.\n+ aimValue *= 0.97 * Math.Pow(1 - Math.Pow(context.EffectiveMissCount / context.TotalHits, 0.775), context.EffectiveMissCount);\nif (context.DifficultyAttributes.SliderCount > 0)\naimValue *= computeSliderNerf(context);\n@@ -85,6 +90,10 @@ public static double ComputePerformance(TauPerformanceContext context)\nreturn aimValue * context.Accuracy;\n}\n+ /// <summary>\n+ /// Calculates an additional factor based on the Approach Rate of the beatmap.\n+ /// </summary>\n+ /// <param name=\"context\">The performance context for the play.</param>\nprivate static double computeArFactor(TauPerformanceContext context)\n{\nvar attributes = context.DifficultyAttributes;\n@@ -99,6 +108,10 @@ private static double computeArFactor(TauPerformanceContext context)\nreturn 1.0 + approachRateFactor;\n}\n+ /// <summary>\n+ /// Estimates and buffs 15% of all sliders in the beatmap if the player has completed them correctly.\n+ /// </summary>\n+ /// <param name=\"context\">The performance context for the play.</param>\nprivate static double computeSliderNerf(TauPerformanceContext context)\n{\nvar attributes = context.DifficultyAttributes;\n@@ -113,4 +126,3 @@ private static double computeSliderNerf(TauPerformanceContext context)\n#endregion\n}\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Complexity.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Complexity.cs",
"diff": "using osu.Game.Rulesets.Tau.Difficulty.Preprocessing;\nusing osu.Game.Rulesets.Tau.Objects;\n-namespace osu.Game.Rulesets.Tau.Difficulty.Skills\n-{\n+namespace osu.Game.Rulesets.Tau.Difficulty.Skills;\n+\npublic class Complexity : StrainDecaySkill\n{\nprotected override double SkillMultiplier => 50;\n@@ -139,8 +139,9 @@ public static double CalculatePerformance(TauPerformanceContext context)\n// Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses.\nif (context.EffectiveMissCount > 0)\n- complexityValue *= 0.97 * Math.Pow(1 - Math.Pow(context.EffectiveMissCount / context.TotalHits, 0.775), context.EffectiveMissCount); // TODO: Figure values here.\n+ complexityValue *= 0.97 * Math.Pow(1 - Math.Pow(context.EffectiveMissCount / context.TotalHits, 0.775), context.EffectiveMissCount);\n+ // Length bonus is added on for beatmaps with more than 2,000 hitobjects.\ndouble lengthBonus =\n0.95 + 0.4 * Math.Min(1.0, context.TotalHits / 2000.0) + (context.TotalHits > 2000 ? Math.Log10(context.TotalHits / 2000.0) * 0.5 : 0.0);\ncomplexityValue *= lengthBonus;\n@@ -156,4 +157,3 @@ private enum HitType\nHardBeat\n}\n}\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Speed.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Speed.cs",
"diff": "using osu.Game.Rulesets.Tau.Mods;\nusing osu.Game.Rulesets.Tau.Objects;\n-namespace osu.Game.Rulesets.Tau.Difficulty.Skills\n-{\n+namespace osu.Game.Rulesets.Tau.Difficulty.Skills;\n+\npublic class Speed : TauStrainSkill\n{\nprivate const double single_spacing_threshold = 125;\n@@ -180,6 +180,7 @@ public static double ComputePerformance(TauPerformanceContext context)\nTauDifficultyAttributes attributes = context.DifficultyAttributes;\ndouble speedValue = Math.Pow(5.0 * Math.Max(1.0, attributes.SpeedDifficulty / 0.0675) - 4.0, 3.0) / 100000.0;\n+ // Length bonus is added on for beatmaps with more than 2,000 hitobjects.\ndouble lengthBonus =\n0.95 + 0.4 * Math.Min(1.0, context.TotalHits / 2000.0) + (context.TotalHits > 2000 ? Math.Log10(context.TotalHits / 2000.0) * 0.5 : 0.0);\nspeedValue *= lengthBonus;\n@@ -214,4 +215,3 @@ public static double ComputePerformance(TauPerformanceContext context)\n#endregion\n}\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/TauDifficultyAttributes.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/TauDifficultyAttributes.cs",
"diff": "@@ -46,7 +46,7 @@ public class TauDifficultyAttributes : DifficultyAttributes\npublic double DrainRate { get; set; }\n/// <summary>\n- /// The number of notes in the beatmap.\n+ /// The number of regular beats in the beatmap.\n/// </summary>\npublic int NotesCount { get; set; }\n@@ -56,7 +56,7 @@ public class TauDifficultyAttributes : DifficultyAttributes\npublic int SliderCount { get; set; }\n/// <summary>\n- /// The number of sliders in the beatmap.\n+ /// The number of hard beats in the beatmap.\n/// </summary>\npublic int HardBeatCount { get; set; }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/TauDifficultyCalculator.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/TauDifficultyCalculator.cs",
"diff": "using osu.Game.Rulesets.Tau.Scoring;\nusing osu.Game.Rulesets.Tau.UI;\n-namespace osu.Game.Rulesets.Tau.Difficulty\n-{\n+namespace osu.Game.Rulesets.Tau.Difficulty;\n+\npublic class TauDifficultyCalculator : DifficultyCalculator\n{\nprivate readonly TauCachedProperties properties = new();\n@@ -110,4 +110,3 @@ protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clo\n};\n}\n}\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/TauPerformanceAttribute.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/TauPerformanceAttribute.cs",
"diff": "@@ -32,6 +32,5 @@ public override IEnumerable<PerformanceDisplayAttribute> GetAttributesForDisplay\nyield return new PerformanceDisplayAttribute(nameof(Accuracy), \"Accuracy\", Accuracy);\nyield return new PerformanceDisplayAttribute(nameof(Speed), \"Speed\", Speed);\nyield return new PerformanceDisplayAttribute(nameof(Complexity), \"Complexity\", Complexity);\n-\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/TauPerformanceCalculator.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/TauPerformanceCalculator.cs",
"diff": "@@ -76,7 +76,7 @@ private double computeAccuracy(TauPerformanceContext context)\n// Considering to use derivation from perfect accuracy in a probabilistic manner - assume normal distribution.\ndouble accuracyValue = Math.Pow(1.52163, context.DifficultyAttributes.OverallDifficulty) * Math.Pow(betterAccuracyPercentage, 24) * 2.83;\n- // Bonus for many hitcircles - it's harder to keep good accuracy up for longer.\n+ // Bonus for many (over 1,000) hitcircles - it's harder to keep good accuracy up for longer.\naccuracyValue *= Math.Min(1.15, Math.Pow(amountHitObjectsWithAccuracy / 1000.0, 0.3));\nreturn accuracyValue;\n}\n"
}
]
| C# | MIT License | taulazer/tau | Format and document some classes. |
664,859 | 30.05.2022 10:32:52 | 14,400 | 46fb3a27390be972ce6c955556bc41e4b0731a12 | Fix(?) incorrect accuracy miss scale | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/TauPerformanceCalculator.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/TauPerformanceCalculator.cs",
"diff": "@@ -63,8 +63,8 @@ private double computeAccuracy(TauPerformanceContext context)\nint amountHitObjectsWithAccuracy = context.DifficultyAttributes.NotesCount;\nif (amountHitObjectsWithAccuracy > 0)\n- betterAccuracyPercentage = ((context.CountGreat - (context.TotalHits - amountHitObjectsWithAccuracy)) * 6 + context.CountOk * 2) /\n- (double)(amountHitObjectsWithAccuracy * 6);\n+ betterAccuracyPercentage = ((context.CountGreat - (context.TotalHits - amountHitObjectsWithAccuracy)) * 3 + context.CountOk) /\n+ (double)(amountHitObjectsWithAccuracy * 3);\nelse\nbetterAccuracyPercentage = 0;\n"
}
]
| C# | MIT License | taulazer/tau | Fix(?) incorrect accuracy miss scale |
664,859 | 01.06.2022 10:23:02 | 14,400 | 496f8bb3a58743194e00d94f2b058b71a9dbd3f3 | Apply smooth weight to velocity | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"diff": "@@ -13,7 +13,7 @@ public class Aim : StrainDecaySkill\nprivate readonly Type[] allowedHitObjects;\nprotected override int HistoryLength => 10;\n- protected override double SkillMultiplier => 50;\n+ protected override double SkillMultiplier => 20;\nprivate const double slider_multiplier = 1.5;\nprotected override double StrainDecayBase => 0.2;\n@@ -23,9 +23,13 @@ public Aim(Mod[] mods, Type[] allowedHitObjects)\nthis.allowedHitObjects = allowedHitObjects;\n}\n+ // https://www.desmos.com/calculator/xvfmj66s1o\n+ private double calculateVelocity(double distance, double time)\n+ => distance / (Math.Pow(time / 100, 2) + 20);\n+\nprivate double calculateStrain(TauAngledDifficultyHitObject current, TauAngledDifficultyHitObject last)\n{\n- double velocity = current.Distance / current.StrainTime;\n+ double velocity = calculateVelocity(current.Distance, current.StrainTime);\nif (!allowedHitObjects.Any(t => t == typeof(Slider) && last.BaseObject is Slider))\nreturn velocity;\n@@ -36,7 +40,7 @@ private double calculateStrain(TauAngledDifficultyHitObject current, TauAngledDi\nreturn velocity;\ndouble travelVelocity = last.LazyTravelDistance / last.TravelTime;\n- double movementVelocity = current.Distance / current.StrainTime;\n+ double movementVelocity = calculateVelocity(current.Distance, current.StrainTime);\nvelocity = Math.Max(velocity, movementVelocity + travelVelocity);\nvelocity += (last.LazyTravelDistance / last.TravelTime) * slider_multiplier;\n"
}
]
| C# | MIT License | taulazer/tau | Apply smooth weight to velocity |
664,859 | 01.06.2022 16:34:33 | 14,400 | 44b893f464952595e3ceb4aeb19336a5aa9233f2 | More velocity tweaks | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"diff": "@@ -13,7 +13,7 @@ public class Aim : StrainDecaySkill\nprivate readonly Type[] allowedHitObjects;\nprotected override int HistoryLength => 10;\n- protected override double SkillMultiplier => 20;\n+ protected override double SkillMultiplier => 27;\nprivate const double slider_multiplier = 1.5;\nprotected override double StrainDecayBase => 0.2;\n@@ -23,9 +23,9 @@ public Aim(Mod[] mods, Type[] allowedHitObjects)\nthis.allowedHitObjects = allowedHitObjects;\n}\n- // https://www.desmos.com/calculator/xvfmj66s1o\n+ // https://www.desmos.com/calculator/2edrdrqwqk\nprivate double calculateVelocity(double distance, double time)\n- => distance / (Math.Pow(time / 100, 2) + 20);\n+ => distance / (Math.Pow(Math.Pow(time, 1.35) / 150, 2) * 0.55 + 25);\nprivate double calculateStrain(TauAngledDifficultyHitObject current, TauAngledDifficultyHitObject last)\n{\n"
}
]
| C# | MIT License | taulazer/tau | More velocity tweaks |
664,859 | 02.06.2022 10:24:57 | 14,400 | f91e33dfdb605bf95169f866fa161816134bf2de | Final aim tweak | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"diff": "@@ -23,9 +23,9 @@ public Aim(Mod[] mods, Type[] allowedHitObjects)\nthis.allowedHitObjects = allowedHitObjects;\n}\n- // https://www.desmos.com/calculator/2edrdrqwqk\n+ // https://www.desmos.com/calculator/5yu0ov3zka\nprivate double calculateVelocity(double distance, double time)\n- => distance / (Math.Pow(Math.Pow(time, 1.35) / 150, 2) * 0.55 + 25);\n+ => distance / (Math.Pow((Math.Pow(time, 1.4) - 77) / 100, 2) * 0.1 + 25);\nprivate double calculateStrain(TauAngledDifficultyHitObject current, TauAngledDifficultyHitObject last)\n{\n"
}
]
| C# | MIT License | taulazer/tau | Final aim tweak |
664,859 | 03.06.2022 05:16:46 | 14,400 | c6e082ddd5b0ed0a750dfa2aed4c069c10dd6b68 | Apply new velocity graph to sliders | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauAngledDifficultyHitObject.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauAngledDifficultyHitObject.cs",
"diff": "@@ -23,6 +23,8 @@ public class TauAngledDifficultyHitObject : TauDifficultyHitObject\npublic new AngledTauHitObject BaseObject => (AngledTauHitObject)base.BaseObject;\n+ public TauAngledDifficultyHitObject LastAngled;\n+\npublic double AngleRange => properties.AngleRange.Value;\npublic double Distance;\n@@ -31,6 +33,7 @@ public TauAngledDifficultyHitObject(HitObject hitObject, HitObject lastObject, d\n: base(hitObject, lastObject, clockRate)\n{\nthis.properties = properties;\n+ LastAngled = lastAngled;\nif (hitObject is AngledTauHitObject firstAngled && lastAngled != null)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"diff": "@@ -13,8 +13,8 @@ public class Aim : StrainDecaySkill\nprivate readonly Type[] allowedHitObjects;\nprotected override int HistoryLength => 10;\n- protected override double SkillMultiplier => 27;\n- private const double slider_multiplier = 1.5;\n+ protected override double SkillMultiplier => 19;\n+ private const double slider_multiplier = 1.2;\nprotected override double StrainDecayBase => 0.2;\npublic Aim(Mod[] mods, Type[] allowedHitObjects)\n@@ -39,32 +39,24 @@ private double calculateStrain(TauAngledDifficultyHitObject current, TauAngledDi\nif (!(last.TravelDistance >= current.AngleRange))\nreturn velocity;\n- double travelVelocity = last.LazyTravelDistance / last.TravelTime;\n+ double travelVelocity = calculateVelocity(last.LazyTravelDistance, last.TravelTime);\ndouble movementVelocity = calculateVelocity(current.Distance, current.StrainTime);\nvelocity = Math.Max(velocity, movementVelocity + travelVelocity);\n- velocity += (last.LazyTravelDistance / last.TravelTime) * slider_multiplier;\n+ velocity += calculateVelocity(last.LazyTravelDistance, last.TravelTime) * slider_multiplier;\nreturn velocity;\n}\nprotected override double StrainValueOf(DifficultyHitObject current)\n{\n- if (Previous.Count <= 1 || current is not TauAngledDifficultyHitObject)\n+ if (Previous.Count <= 1 || current is not TauAngledDifficultyHitObject tauCurrObj || tauCurrObj.LastAngled == null)\nreturn 0;\n- // Get the last available angled hit object in the history.\n- var prevAngled = Previous.Where(p => p is TauAngledDifficultyHitObject);\n- if (!prevAngled.Any())\n- return 0;\n-\n- var tauCurrObj = (TauAngledDifficultyHitObject)current;\n- var tauLastObj = (TauAngledDifficultyHitObject)prevAngled.First();\n-\nif (tauCurrObj.Distance == 0 || !(tauCurrObj.Distance >= tauCurrObj.AngleRange))\nreturn 0;\n- return calculateStrain(tauCurrObj, tauLastObj);\n+ return calculateStrain(tauCurrObj, tauCurrObj.LastAngled);\n}\n#region PP Calculation\n"
}
]
| C# | MIT License | taulazer/tau | Apply new velocity graph to sliders |
664,859 | 03.06.2022 05:37:06 | 14,400 | 8ff94019125e96ec84eb2fde221c0a36c65fc66a | Simplify if distance check | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"diff": "@@ -36,7 +36,7 @@ private double calculateStrain(TauAngledDifficultyHitObject current, TauAngledDi\n// Slider calculation\n- if (!(last.TravelDistance >= current.AngleRange))\n+ if (last.TravelDistance < current.AngleRange)\nreturn velocity;\ndouble travelVelocity = calculateVelocity(last.LazyTravelDistance, last.TravelTime);\n@@ -53,7 +53,7 @@ protected override double StrainValueOf(DifficultyHitObject current)\nif (Previous.Count <= 1 || current is not TauAngledDifficultyHitObject tauCurrObj || tauCurrObj.LastAngled == null)\nreturn 0;\n- if (tauCurrObj.Distance == 0 || !(tauCurrObj.Distance >= tauCurrObj.AngleRange))\n+ if (tauCurrObj.Distance < tauCurrObj.AngleRange)\nreturn 0;\nreturn calculateStrain(tauCurrObj, tauCurrObj.LastAngled);\n"
}
]
| C# | MIT License | taulazer/tau | Simplify if distance check |
664,859 | 04.06.2022 10:23:52 | 14,400 | cb8724398527eae6d57842b57ec9563f6fbed033 | Fix some angled hitobjects having incorrect distance | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauAngledDifficultyHitObject.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauAngledDifficultyHitObject.cs",
"diff": "@@ -46,7 +46,7 @@ public class TauAngledDifficultyHitObject : TauDifficultyHitObject\nif (lastAngled.BaseObject is IHasOffsetAngle offsetAngle)\noffset = offsetAngle.GetOffsetAngle();\n- Distance = Math.Abs(Math.Max(0, Extensions.GetDeltaAngle(firstAngled.Angle, (lastAngled.BaseObject.Angle + offset)) - AngleRange / 2));\n+ Distance = Math.Abs(Extensions.GetDeltaAngle(firstAngled.Angle, (lastAngled.BaseObject.Angle + offset)) - AngleRange / 2);\nStrainTime = Math.Max(StrainTime, StartTime - lastAngled.StartTime);\n}\n"
}
]
| C# | MIT License | taulazer/tau | Fix some angled hitobjects having incorrect distance |
664,859 | 04.06.2022 10:25:40 | 14,400 | 3e3aacd99fb70ab18a55d0bd32344b245b8edfe0 | re-balance skills | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"diff": "@@ -13,7 +13,7 @@ public class Aim : StrainDecaySkill\nprivate readonly Type[] allowedHitObjects;\nprotected override int HistoryLength => 10;\n- protected override double SkillMultiplier => 19;\n+ protected override double SkillMultiplier => 11;\nprivate const double slider_multiplier = 1.2;\nprotected override double StrainDecayBase => 0.2;\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Speed.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Speed.cs",
"diff": "@@ -26,7 +26,7 @@ public class Speed : TauStrainSkill\nprivate double currentRhythm;\nprotected override int ReducedSectionCount => 5;\n- protected override double DifficultyMultiplier => 1.04;\n+ protected override double DifficultyMultiplier => 1.25;\nprotected override int HistoryLength => 32;\npublic Speed(Mod[] mods, double hitWindowGreat)\n"
}
]
| C# | MIT License | taulazer/tau | re-balance skills |
664,859 | 15.06.2022 17:53:46 | 14,400 | 176edcde6ca174bedd6f86b6aa7a09becad3d55c | Move to block-scoped namespace | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Evaluators/AimEvaluator.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Evaluators/AimEvaluator.cs",
"diff": "using osu.Game.Rulesets.Tau.Difficulty.Preprocessing;\nusing osu.Game.Rulesets.Tau.Objects;\n-namespace osu.Game.Rulesets.Tau.Difficulty.Evaluators;\n-\n+namespace osu.Game.Rulesets.Tau.Difficulty.Evaluators\n+{\npublic static class AimEvaluator\n{\nprivate const double slider_multiplier = 1.2;\n@@ -93,3 +93,4 @@ private static double computeSliderNerf(TauPerformanceContext context)\nreturn (1 - attributes.SliderFactor) * Math.Pow(1 - estimateSliderEndsDropped / estimateDifficultSliders, 3) + attributes.SliderFactor;\n}\n}\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Evaluators/ComplexityEvaluator.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Evaluators/ComplexityEvaluator.cs",
"diff": "using osu.Game.Rulesets.Tau.Difficulty.Preprocessing;\nusing osu.Game.Rulesets.Tau.Objects;\n-namespace osu.Game.Rulesets.Tau.Difficulty.Evaluators;\n-\n+namespace osu.Game.Rulesets.Tau.Difficulty.Evaluators\n+{\npublic static class ComplexityEvaluator\n{\n/// <summary>\n@@ -142,3 +142,4 @@ private enum HitType\nHardBeat\n}\n}\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Evaluators/RhythmEvaluator.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Evaluators/RhythmEvaluator.cs",
"diff": "using osu.Game.Rulesets.Tau.Difficulty.Preprocessing;\nusing osu.Game.Rulesets.Tau.Objects;\n-namespace osu.Game.Rulesets.Tau.Difficulty.Evaluators;\n-\n+namespace osu.Game.Rulesets.Tau.Difficulty.Evaluators\n+{\npublic static class RhythmEvaluator\n{\nprivate const int history_time_max = 5000; // 5 seconds of calculatingRhythmBonus max.\n@@ -100,3 +100,4 @@ public static double EvaluateDifficulty(DifficultyHitObject current, double grea\nreturn Math.Sqrt(4 + rhythmComplexitySum * rhythm_multiplier) / 2; //produces multiplier that can be applied to strain. range [1, infinity) (not really though)\n}\n}\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Evaluators/SpeedEvaluator.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Evaluators/SpeedEvaluator.cs",
"diff": "using osu.Game.Rulesets.Tau.Difficulty.Preprocessing;\nusing osu.Game.Rulesets.Tau.Mods;\n-namespace osu.Game.Rulesets.Tau.Difficulty.Evaluators;\n-\n+namespace osu.Game.Rulesets.Tau.Difficulty.Evaluators\n+{\npublic static class SpeedEvaluator\n{\nprivate const double single_spacing_threshold = 125;\n@@ -87,3 +87,4 @@ public static double EvaluatePerformance(TauPerformanceContext context)\n? 1.0\n: Math.Min(Math.Pow(context.ScoreMaxCombo, 0.8) / Math.Pow(context.DifficultyAttributes.MaxCombo, 0.8), 1.0);\n}\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauAngledDifficultyHitObject.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauAngledDifficultyHitObject.cs",
"diff": "using osu.Game.Rulesets.Tau.Objects;\nusing osu.Game.Rulesets.Tau.UI;\n-namespace osu.Game.Rulesets.Tau.Difficulty.Preprocessing;\n-\n+namespace osu.Game.Rulesets.Tau.Difficulty.Preprocessing\n+{\npublic class TauAngledDifficultyHitObject : TauDifficultyHitObject\n{\n/// <summary>\n@@ -60,3 +60,4 @@ public class TauAngledDifficultyHitObject : TauDifficultyHitObject\n}\n}\n}\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauDifficultyHitObject.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauDifficultyHitObject.cs",
"diff": "using osu.Game.Rulesets.Objects;\nusing osu.Game.Rulesets.Tau.Objects;\n-namespace osu.Game.Rulesets.Tau.Difficulty.Preprocessing;\n-\n+namespace osu.Game.Rulesets.Tau.Difficulty.Preprocessing\n+{\npublic class TauDifficultyHitObject : DifficultyHitObject\n{\nprivate const int min_delta_time = 25;\n@@ -24,3 +24,4 @@ public TauDifficultyHitObject(HitObject hitObject, HitObject lastObject, double\nStrainTime = Math.Max(DeltaTime, min_delta_time);\n}\n}\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"diff": "using osu.Game.Rulesets.Tau.Difficulty.Evaluators;\nusing osu.Game.Rulesets.Tau.Difficulty.Preprocessing;\n-namespace osu.Game.Rulesets.Tau.Difficulty.Skills;\n-\n+namespace osu.Game.Rulesets.Tau.Difficulty.Skills\n+{\npublic class Aim : StrainDecaySkill\n{\nprivate readonly Type[] allowedHitObjects;\n@@ -31,3 +31,4 @@ protected override double StrainValueOf(DifficultyHitObject current)\nreturn AimEvaluator.EvaluateDifficulty(tauCurrObj, tauCurrObj.LastAngled, allowedHitObjects);\n}\n}\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Complexity.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Complexity.cs",
"diff": "using osu.Game.Rulesets.Mods;\nusing osu.Game.Rulesets.Tau.Difficulty.Evaluators;\n-namespace osu.Game.Rulesets.Tau.Difficulty.Skills;\n-\n+namespace osu.Game.Rulesets.Tau.Difficulty.Skills\n+{\npublic class Complexity : StrainDecaySkill\n{\nprotected override double SkillMultiplier => 50;\n@@ -19,3 +19,4 @@ public Complexity(Mod[] mods)\nprotected override double StrainValueOf(DifficultyHitObject current)\n=> ComplexityEvaluator.EvaluateDifficulty(current);\n}\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Speed.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Speed.cs",
"diff": "using osu.Game.Rulesets.Mods;\nusing osu.Game.Rulesets.Tau.Difficulty.Evaluators;\n-namespace osu.Game.Rulesets.Tau.Difficulty.Skills;\n-\n+namespace osu.Game.Rulesets.Tau.Difficulty.Skills\n+{\npublic class Speed : TauStrainSkill\n{\nprivate double skillMultiplier => 510;\n@@ -39,3 +39,4 @@ protected override double CalculateInitialStrain(double time, DifficultyHitObjec\nprivate double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000);\n}\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/TauStrainSkill.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/TauStrainSkill.cs",
"diff": "using System.Linq;\nusing osu.Framework.Utils;\n-namespace osu.Game.Rulesets.Tau.Difficulty.Skills;\n-\n+namespace osu.Game.Rulesets.Tau.Difficulty.Skills\n+{\npublic abstract class TauStrainSkill : StrainSkill\n{\n/// <summary>\n@@ -59,3 +59,4 @@ public override double DifficultyValue()\nreturn difficulty * DifficultyMultiplier;\n}\n}\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/TauDifficultyCalculator.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/TauDifficultyCalculator.cs",
"diff": "using osu.Game.Rulesets.Tau.Scoring;\nusing osu.Game.Rulesets.Tau.UI;\n-namespace osu.Game.Rulesets.Tau.Difficulty;\n-\n+namespace osu.Game.Rulesets.Tau.Difficulty\n+{\npublic class TauDifficultyCalculator : DifficultyCalculator\n{\nprivate readonly TauCachedProperties properties = new();\n@@ -119,3 +119,4 @@ protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clo\n};\n}\n}\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/TauPerformanceAttribute.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/TauPerformanceAttribute.cs",
"diff": "using Newtonsoft.Json;\nusing osu.Game.Rulesets.Difficulty;\n-namespace osu.Game.Rulesets.Tau.Difficulty;\n-\n+namespace osu.Game.Rulesets.Tau.Difficulty\n+{\npublic class TauPerformanceAttribute : PerformanceAttributes\n{\n[JsonProperty(\"aim\")]\n@@ -34,3 +34,4 @@ public override IEnumerable<PerformanceDisplayAttribute> GetAttributesForDisplay\nyield return new PerformanceDisplayAttribute(nameof(Complexity), \"Complexity\", Complexity);\n}\n}\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/TauPerformanceCalculator.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/TauPerformanceCalculator.cs",
"diff": "using osu.Game.Rulesets.Tau.Mods;\nusing osu.Game.Scoring;\n-namespace osu.Game.Rulesets.Tau.Difficulty;\n-\n+namespace osu.Game.Rulesets.Tau.Difficulty\n+{\npublic class TauPerformanceCalculator : PerformanceCalculator\n{\nprivate TauPerformanceContext context;\n@@ -121,3 +121,4 @@ public TauPerformanceContext(ScoreInfo score, TauDifficultyAttributes attributes\nEffectiveMissCount = 0.0;\n}\n}\n+}\n"
}
]
| C# | MIT License | taulazer/tau | Move to block-scoped namespace |
664,859 | 15.06.2022 17:57:11 | 14,400 | b4e93bda63908af153594849bb6f1f97a4545103 | Make non-instanced properties constants | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Speed.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Speed.cs",
"diff": "@@ -7,8 +7,8 @@ namespace osu.Game.Rulesets.Tau.Difficulty.Skills\n{\npublic class Speed : TauStrainSkill\n{\n- private double skillMultiplier => 510;\n- private double strainDecayBase => 0.3;\n+ private const double skill_multiplier = 510;\n+ private const double strain_decay_base = 0.3;\nprivate readonly double greatWindow;\n@@ -27,7 +27,7 @@ public Speed(Mod[] mods, double hitWindowGreat)\nprotected override double StrainValueAt(DifficultyHitObject current)\n{\ncurrentStrain *= strainDecay(current.DeltaTime);\n- currentStrain += SpeedEvaluator.EvaluateDifficulty(current, greatWindow) * skillMultiplier;\n+ currentStrain += SpeedEvaluator.EvaluateDifficulty(current, greatWindow) * skill_multiplier;\ncurrentRhythm = RhythmEvaluator.EvaluateDifficulty(current, greatWindow);\n@@ -37,6 +37,6 @@ protected override double StrainValueAt(DifficultyHitObject current)\nprotected override double CalculateInitialStrain(double time, DifficultyHitObject current)\n=> (currentStrain * currentRhythm) * strainDecay(time - current.Previous(0).StartTime);\n- private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000);\n+ private double strainDecay(double ms) => Math.Pow(strain_decay_base, ms / 1000);\n}\n}\n"
}
]
| C# | MIT License | taulazer/tau | Make non-instanced properties constants |
664,859 | 15.06.2022 18:10:12 | 14,400 | 4d788f4153f45762ba00484e6f3902c8d5ba664e | Add difficulty adjustment mods override | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/TauDifficultyCalculator.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/TauDifficultyCalculator.cs",
"diff": "@@ -118,5 +118,31 @@ protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clo\nnew Complexity(mods)\n};\n}\n+\n+ protected override Mod[] DifficultyAdjustmentMods => new Mod[]\n+ {\n+ // Diff. Reduction\n+ new TauModEasy(),\n+ new TauModHalfTime(),\n+ new TauModDaycore(),\n+\n+ // Diff. Increase\n+ new TauModHardRock(),\n+ new TauModDoubleTime(),\n+ new TauModNightcore(),\n+\n+ // Automation\n+ new TauModRelax(),\n+\n+ // Conversion\n+ new TauModDifficultyAdjust(),\n+ new TauModLite(),\n+\n+ // Fun\n+ new ModWindUp(),\n+ new ModWindDown(),\n+ new ModAdaptiveSpeed(),\n+ new TauModImpossibleSliders()\n+ };\n}\n}\n"
}
]
| C# | MIT License | taulazer/tau | Add difficulty adjustment mods override |
664,859 | 28.06.2022 13:19:21 | 14,400 | 0e82fcfe3a9c584e05c53c1068e8e30e97161c8d | Use new `AddTextureSource`. | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/TauRuleset.cs",
"new_path": "osu.Game.Rulesets.Tau/TauRuleset.cs",
"diff": "@@ -173,7 +173,7 @@ private void load(FontStore store, GameHost host)\n// Please try to avoid this at all costs.\n//\n// ~ Nora\n- store.AddStore(new GlyphStore(\n+ store.AddTextureSource(new GlyphStore(\nnew ResourceStore<byte[]>(ruleset.CreateResourceStore()),\n\"Fonts/tauFont\",\nhost.CreateTextureLoaderStore(ruleset.CreateResourceStore())));\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/osu.Game.Rulesets.Tau.csproj",
"new_path": "osu.Game.Rulesets.Tau/osu.Game.Rulesets.Tau.csproj",
"diff": "<None Remove=\"Resources\\Shaders\\sh_DepthMask.vs\" />\n</ItemGroup>\n<ItemGroup>\n- <PackageReference Include=\"ppy.osu.Game\" Version=\"2022.515.0\" />\n+ <PackageReference Include=\"ppy.osu.Game\" Version=\"2022.628.0\" />\n</ItemGroup>\n<ItemGroup>\n<Compile Update=\"Objects\\Drawables\\DrawableSlider.Calculations.cs\">\n"
}
]
| C# | MIT License | taulazer/tau | Use new `AddTextureSource`. |
664,859 | 28.06.2022 16:06:23 | 14,400 | 347f450f6c871ed9507fa04147af78ef9e78e227 | Remove unnecessary half angled range subtraction in distance | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauAngledDifficultyHitObject.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauAngledDifficultyHitObject.cs",
"diff": "@@ -49,7 +49,7 @@ public class TauAngledDifficultyHitObject : TauDifficultyHitObject\nif (lastAngled.BaseObject is IHasOffsetAngle offsetAngle)\noffset = offsetAngle.GetOffsetAngle();\n- Distance = Math.Abs(Extensions.GetDeltaAngle(firstAngled.Angle, (lastAngled.BaseObject.Angle + offset)) - AngleRange / 2);\n+ Distance = Math.Abs(Extensions.GetDeltaAngle(firstAngled.Angle, (lastAngled.BaseObject.Angle + offset)));\nStrainTime = Math.Max(StrainTime, StartTime - lastAngled.StartTime);\n}\n"
}
]
| C# | MIT License | taulazer/tau | Remove unnecessary half angled range subtraction in distance |
664,859 | 28.06.2022 16:06:45 | 14,400 | b1e5ab90dd8e5a73a65b44c1453aaae81b025d69 | remove check if travel distance is smaller than angle range | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Evaluators/AimEvaluator.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Evaluators/AimEvaluator.cs",
"diff": "@@ -18,9 +18,6 @@ public static double EvaluateDifficulty(TauAngledDifficultyHitObject current, Ta\n// Slider calculation\n- if (last.TravelDistance < current.AngleRange)\n- return velocity;\n-\ndouble travelVelocity = calculateVelocity(last.LazyTravelDistance, last.TravelTime);\ndouble movementVelocity = calculateVelocity(current.Distance, current.StrainTime);\n"
}
]
| C# | MIT License | taulazer/tau | remove check if travel distance is smaller than angle range |
664,859 | 28.06.2022 16:07:34 | 14,400 | ec1eb6bb45ef5b931467bf27c9535ec43ab1b4eb | Adjust skill multipliers and lower general diff. multiplier slightly | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"diff": "@@ -11,7 +11,7 @@ public class Aim : StrainDecaySkill\n{\nprivate readonly Type[] allowedHitObjects;\n- protected override double SkillMultiplier => 11;\n+ protected override double SkillMultiplier => 10;\nprotected override double StrainDecayBase => 0.2;\npublic Aim(Mod[] mods, Type[] allowedHitObjects)\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Speed.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Speed.cs",
"diff": "@@ -16,7 +16,7 @@ public class Speed : TauStrainSkill\nprivate double currentRhythm;\nprotected override int ReducedSectionCount => 5;\n- protected override double DifficultyMultiplier => 1.25;\n+ protected override double DifficultyMultiplier => 1.20;\npublic Speed(Mod[] mods, double hitWindowGreat)\n: base(mods)\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/TauDifficultyCalculator.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/TauDifficultyCalculator.cs",
"diff": "@@ -21,7 +21,7 @@ public class TauDifficultyCalculator : DifficultyCalculator\nprivate readonly TauCachedProperties properties = new();\nprivate double hitWindowGreat;\n- private const double difficulty_multiplier = 0.0825;\n+ private const double difficulty_multiplier = 0.0820;\npublic TauDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)\n: base(ruleset, beatmap)\n"
}
]
| C# | MIT License | taulazer/tau | Adjust skill multipliers and lower general diff. multiplier slightly |
664,859 | 28.06.2022 16:18:03 | 14,400 | 85a6d1562e9fb97e2b23262a771ca092a13bd956 | Rearrange overrides in TauRuleset | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/TauRuleset.cs",
"new_path": "osu.Game.Rulesets.Tau/TauRuleset.cs",
"diff": "@@ -38,15 +38,15 @@ public class TauRuleset : Ruleset\npublic override string ShortName => SHORT_NAME;\npublic override string PlayingVerb => \"Slicing beats\";\n- public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => new TauDrawableRuleset(this, beatmap, mods);\n- public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new TauBeatmapConverter(this, beatmap);\n- public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => new TauDifficultyCalculator(RulesetInfo, beatmap);\npublic override IRulesetConfigManager CreateConfig(SettingsStore settings) => new TauRulesetConfigManager(settings, RulesetInfo);\n- public override RulesetSettingsSubsection CreateSettings() => new TauSettingsSubsection(this);\n- public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new TauReplayFrame();\n+ public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new TauBeatmapConverter(this, beatmap);\n+ public override IBeatmapProcessor CreateBeatmapProcessor(IBeatmap beatmap) => new BeatmapProcessor(beatmap);\n+ public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => new TauDrawableRuleset(this, beatmap, mods);\npublic override ScoreProcessor CreateScoreProcessor() => new TauScoreProcessor(this);\n+ public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new TauReplayFrame();\n+ public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => new TauDifficultyCalculator(RulesetInfo, beatmap);\npublic override PerformanceCalculator CreatePerformanceCalculator() => new TauPerformanceCalculator();\n- public override IBeatmapProcessor CreateBeatmapProcessor(IBeatmap beatmap) => new BeatmapProcessor(beatmap);\n+ public override RulesetSettingsSubsection CreateSettings() => new TauSettingsSubsection(this);\npublic override Drawable CreateIcon() => new TauIcon(this);\n"
}
]
| C# | MIT License | taulazer/tau | Rearrange overrides in TauRuleset |
664,859 | 28.06.2022 16:18:16 | 14,400 | a9276734bda9a7e2e355570da7649cdeb9f5fd8a | Comment out performance calculator | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/TauRuleset.cs",
"new_path": "osu.Game.Rulesets.Tau/TauRuleset.cs",
"diff": "@@ -45,7 +45,7 @@ public class TauRuleset : Ruleset\npublic override ScoreProcessor CreateScoreProcessor() => new TauScoreProcessor(this);\npublic override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new TauReplayFrame();\npublic override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => new TauDifficultyCalculator(RulesetInfo, beatmap);\n- public override PerformanceCalculator CreatePerformanceCalculator() => new TauPerformanceCalculator();\n+ // public override PerformanceCalculator CreatePerformanceCalculator() => new TauPerformanceCalculator();\npublic override RulesetSettingsSubsection CreateSettings() => new TauSettingsSubsection(this);\npublic override Drawable CreateIcon() => new TauIcon(this);\n"
}
]
| C# | MIT License | taulazer/tau | Comment out performance calculator |
664,859 | 04.07.2022 14:37:58 | 14,400 | effe79f241a961479ffc7eb15c481cbfa932e1c6 | Increase amount of slider ticks
This decelerates the health drain so that more maps are possible without being constantly on the edge of failure. | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Beatmaps/TauBeatmapConverter.cs",
"new_path": "osu.Game.Rulesets.Tau/Beatmaps/TauBeatmapConverter.cs",
"diff": "@@ -147,8 +147,8 @@ private TauHitObject convertToSlider(HitObject original, IHasCombo comboData, IH\n// prior to v8, speed multipliers don't adjust for how many ticks are generated over the same distance.\n// this results in more (or less) ticks being generated in <v8 maps for the same time duration.\nslider.TickDistanceMultiplier = beatmap.BeatmapInfo.BeatmapVersion < 8\n- ? 4f / legacyControlPointInfo.DifficultyPointAt(original.StartTime).SliderVelocity\n- : 4;\n+ ? 1f / legacyControlPointInfo.DifficultyPointAt(original.StartTime).SliderVelocity\n+ : 1;\n}\nreturn slider;\n@@ -207,8 +207,8 @@ private TauHitObject convertToSliderSpinner(HitObject original, IHasCombo comboD\n// prior to v8, speed multipliers don't adjust for how many ticks are generated over the same distance.\n// this results in more (or less) ticks being generated in <v8 maps for the same time duration.\nslider.TickDistanceMultiplier = beatmap.BeatmapInfo.BeatmapVersion < 8\n- ? 4f / legacyControlPointInfo.DifficultyPointAt(original.StartTime).SliderVelocity\n- : 4;\n+ ? 1f / legacyControlPointInfo.DifficultyPointAt(original.StartTime).SliderVelocity\n+ : 1;\n}\nreturn slider;\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Slider.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Slider.cs",
"diff": "@@ -63,7 +63,7 @@ public IList<HitSampleInfo> CreateSlidingSamples()\n/// An extra multiplier that affects the number of <see cref=\"SliderTick\"/>s generated by this <see cref=\"Slider\"/>.\n/// An increase in this value increases <see cref=\"TickDistance\"/>, which reduces the number of ticks generated.\n/// </summary>\n- public double TickDistanceMultiplier = 4;\n+ public double TickDistanceMultiplier = 1;\n[JsonIgnore]\npublic IList<HitSampleInfo> TailSamples { get; private set; }\n"
}
]
| C# | MIT License | taulazer/tau | Increase amount of slider ticks
This decelerates the health drain so that more maps are possible without being constantly on the edge of failure. |
664,859 | 04.07.2022 14:40:32 | 14,400 | f423dcf35cf5084e84630fe4a811e860787b2dad | Fallback to the playfield's accent color if the hit result colour results in white (default) | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau.Tests/TestSceneKiaiEffects.cs",
"new_path": "osu.Game.Rulesets.Tau.Tests/TestSceneKiaiEffects.cs",
"diff": "@@ -54,27 +54,6 @@ public void TestEffect(bool isInversed)\nAddStep(\"Add hard beat result\",\n() => KiaiContainer.OnNewResult(\nnew DrawableHardBeat(new HardBeat()), new JudgementResult(new HardBeat(), new TauJudgement()) { Type = HitResult.Great }));\n-\n- var rotation = 0f;\n-\n- AddStep(\"Update slider angle\", () =>\n- {\n- Scheduler.AddDelayed(() =>\n- {\n- KiaiContainer.UpdateSliderPosition(rotation++);\n- }, 10, true);\n- });\n-\n- AddUntilStep(\"Wait until finished\", () =>\n- {\n- if (!(rotation >= 45))\n- return false;\n-\n- Scheduler.CancelDelayedTasks();\n- rotation = 0;\n-\n- return true;\n- });\n}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/UI/Effects/KiaiEffect.cs",
"new_path": "osu.Game.Rulesets.Tau/UI/Effects/KiaiEffect.cs",
"diff": "using osu.Game.Graphics;\nusing osu.Game.Rulesets.Judgements;\nusing osu.Game.Rulesets.Objects.Drawables;\n+using osu.Game.Rulesets.Scoring;\nusing osu.Game.Rulesets.Tau.Objects;\nusing osu.Game.Rulesets.Tau.UI.Cursor;\nusing osuTK;\n+using osuTK.Graphics;\nnamespace osu.Game.Rulesets.Tau.UI.Effects\n{\n@@ -47,32 +49,13 @@ public void OnNewResult(DrawableHitObject judgedObject, JudgementResult result)\nemitter.ApplyAnimations();\n}\n- /// <summary>\n- /// Creates 2 particles for the emitter.\n- /// Note that this is mainly used in high frequencies and should primarily be made with a higher initialSize.\n- /// </summary>\n- /// <param name=\"angle\">The angle to position the particles at.</param>\n- public void UpdateSliderPosition(float angle)\n- {\n- var emitter = Get(e => e.Apply(new Emitter.EmitterSettings\n- {\n- Amount = 2,\n- Angle = angle,\n- Inversed = properties?.InverseModEnabled?.Value ?? false,\n- Colour = TauPlayfield.AccentColour.Value\n- }));\n-\n- AddInternal(emitter);\n- emitter.ApplyAnimations();\n- }\n-\nprivate Emitter getEmitterForAngle(float angle, JudgementResult result)\n=> Get(e => e.Apply(new Emitter.EmitterSettings\n{\nAmount = 10,\nAngle = angle,\nInversed = properties?.InverseModEnabled?.Value ?? false,\n- Colour = colour.ForHitResult(result.Type)\n+ Colour = hitResultColorOrDefault(result.Type, TauPlayfield.AccentColour.Value)\n}));\nprivate Emitter getEmitterForHardBeat(JudgementResult result)\n@@ -81,8 +64,14 @@ private Emitter getEmitterForHardBeat(JudgementResult result)\nAmount = 64,\nIsCircular = true,\nInversed = properties?.InverseModEnabled?.Value ?? false,\n- Colour = colour.ForHitResult(result.Type)\n+ Colour = hitResultColorOrDefault(result.Type, TauPlayfield.AccentColour.Value)\n}));\n+\n+ private Color4 hitResultColorOrDefault(HitResult type, Color4 fallback)\n+ {\n+ var col = colour.ForHitResult(type);\n+ return col == Color4.White ? fallback : col;\n+ }\n}\n/// <summary>\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/UI/Effects/KiaiEffectContainer.cs",
"new_path": "osu.Game.Rulesets.Tau/UI/Effects/KiaiEffectContainer.cs",
"diff": "@@ -66,11 +66,5 @@ public void OnNewResult(DrawableHitObject judgedObject, JudgementResult result)\nclassicEffect.OnNewResult(judgedObject, result);\nturbulenceEffect.OnNewResult(judgedObject, result);\n}\n-\n- public void UpdateSliderPosition(float angle)\n- {\n- classicEffect.UpdateSliderPosition(angle);\n- turbulenceEffect.UpdateSliderPosition(angle);\n- }\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/UI/EffectsContainer.cs",
"new_path": "osu.Game.Rulesets.Tau/UI/EffectsContainer.cs",
"diff": "@@ -80,7 +80,6 @@ public void TrackSlider(float angle, DrawableSlider slider)\nreturn;\ncurrentTrackingTime = 0;\n- sliderEffects.UpdateSliderPosition(angle);\nvisualizer.UpdateAmplitudes(angle, 0.15f);\n}\n}\n"
}
]
| C# | MIT License | taulazer/tau | Fallback to the playfield's accent color if the hit result colour results in white (default) |
664,859 | 12.07.2022 18:11:18 | 14,400 | c1fc73dc0de8dce5a7876a01a5c7969ad94ed453 | Halve total ticks in slider | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Beatmaps/TauBeatmapConverter.cs",
"new_path": "osu.Game.Rulesets.Tau/Beatmaps/TauBeatmapConverter.cs",
"diff": "@@ -147,8 +147,8 @@ private TauHitObject convertToSlider(HitObject original, IHasCombo comboData, IH\n// prior to v8, speed multipliers don't adjust for how many ticks are generated over the same distance.\n// this results in more (or less) ticks being generated in <v8 maps for the same time duration.\nslider.TickDistanceMultiplier = beatmap.BeatmapInfo.BeatmapVersion < 8\n- ? 1f / legacyControlPointInfo.DifficultyPointAt(original.StartTime).SliderVelocity\n- : 1;\n+ ? 2f / legacyControlPointInfo.DifficultyPointAt(original.StartTime).SliderVelocity\n+ : 2;\n}\nreturn slider;\n@@ -207,8 +207,8 @@ private TauHitObject convertToSliderSpinner(HitObject original, IHasCombo comboD\n// prior to v8, speed multipliers don't adjust for how many ticks are generated over the same distance.\n// this results in more (or less) ticks being generated in <v8 maps for the same time duration.\nslider.TickDistanceMultiplier = beatmap.BeatmapInfo.BeatmapVersion < 8\n- ? 1f / legacyControlPointInfo.DifficultyPointAt(original.StartTime).SliderVelocity\n- : 1;\n+ ? 2f / legacyControlPointInfo.DifficultyPointAt(original.StartTime).SliderVelocity\n+ : 2;\n}\nreturn slider;\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Slider.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Slider.cs",
"diff": "@@ -63,7 +63,7 @@ public IList<HitSampleInfo> CreateSlidingSamples()\n/// An extra multiplier that affects the number of <see cref=\"SliderTick\"/>s generated by this <see cref=\"Slider\"/>.\n/// An increase in this value increases <see cref=\"TickDistance\"/>, which reduces the number of ticks generated.\n/// </summary>\n- public double TickDistanceMultiplier = 1;\n+ public double TickDistanceMultiplier = 2;\n[JsonIgnore]\npublic IList<HitSampleInfo> TailSamples { get; private set; }\n"
}
]
| C# | MIT License | taulazer/tau | Halve total ticks in slider |
664,859 | 12.07.2022 18:13:22 | 14,400 | 8a618cb1ad08cd52c0e27f9990f93addf34f9b1d | Make slider ticks act as "small ticks" | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Judgements/TauTickJudgement.cs",
"new_path": "osu.Game.Rulesets.Tau/Judgements/TauTickJudgement.cs",
"diff": "@@ -5,6 +5,6 @@ namespace osu.Game.Rulesets.Tau.Judgements\n{\npublic class TauTickJudgement : Judgement\n{\n- public override HitResult MaxResult => HitResult.LargeTickHit;\n+ public override HitResult MaxResult => HitResult.SmallTickHit;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableSliderTick.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableSliderTick.cs",
"diff": "@@ -21,7 +21,7 @@ public DrawableSliderTick(SliderTick hitObject)\nprotected override void CheckForResult(bool userTriggered, double timeOffset)\n{\nif (HitObject.StartTime <= Time.Current)\n- ApplyResult(r => r.Type = DrawableSlider.Tracking.Value ? HitResult.LargeTickHit : HitResult.LargeTickMiss);\n+ ApplyResult(r => r.Type = DrawableSlider.Tracking.Value ? HitResult.SmallTickHit : HitResult.SmallTickMiss);\n}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Scoring/TauHitWindow.cs",
"new_path": "osu.Game.Rulesets.Tau/Scoring/TauHitWindow.cs",
"diff": "@@ -10,8 +10,8 @@ public override bool IsHitResultAllowed(HitResult result)\nHitResult.Great\nor HitResult.Ok\nor HitResult.Miss\n- or HitResult.LargeTickHit\n- or HitResult.LargeTickMiss => true,\n+ or HitResult.SmallTickHit\n+ or HitResult.SmallTickMiss => true,\n_ => false\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/TauRuleset.cs",
"new_path": "osu.Game.Rulesets.Tau/TauRuleset.cs",
"diff": "@@ -45,7 +45,7 @@ public class TauRuleset : Ruleset\npublic override ScoreProcessor CreateScoreProcessor() => new TauScoreProcessor(this);\npublic override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new TauReplayFrame();\npublic override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => new TauDifficultyCalculator(RulesetInfo, beatmap);\n- // public override PerformanceCalculator CreatePerformanceCalculator() => new TauPerformanceCalculator();\n+ public override PerformanceCalculator CreatePerformanceCalculator() => new TauPerformanceCalculator();\npublic override RulesetSettingsSubsection CreateSettings() => new TauSettingsSubsection(this);\npublic override Drawable CreateIcon() => new TauIcon(this);\n@@ -96,15 +96,15 @@ protected override IEnumerable<HitResult> GetValidHitResults()\nHitResult.Ok,\nHitResult.Miss,\n- HitResult.LargeTickHit,\n- HitResult.LargeTickMiss\n+ HitResult.SmallTickHit,\n+ HitResult.SmallTickMiss\n};\n}\npublic override string GetDisplayNameForHitResult(HitResult result)\n=> result switch\n{\n- HitResult.LargeTickHit => \"Ticks\",\n+ HitResult.SmallTickHit => \"Ticks\",\n_ => base.GetDisplayNameForHitResult(result)\n};\n"
}
]
| C# | MIT License | taulazer/tau | Make slider ticks act as "small ticks" |
664,859 | 31.07.2022 14:45:10 | 14,400 | df041c73ba49d199d8e789fb43963709b9f52a36 | Make hit lighting our own separate setting | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau.Tests/TestSceneDrawableJudgement.cs",
"new_path": "osu.Game.Rulesets.Tau.Tests/TestSceneDrawableJudgement.cs",
"diff": "using System.Linq;\nusing NUnit.Framework;\nusing osu.Framework.Allocation;\n+using osu.Framework.Bindables;\nusing osu.Framework.Extensions;\n+using osu.Framework.Extensions.ObjectExtensions;\nusing osu.Framework.Graphics;\nusing osu.Framework.Graphics.Containers;\nusing osu.Framework.Graphics.Pooling;\nusing osu.Framework.Testing;\n-using osu.Game.Configuration;\nusing osu.Game.Rulesets.Judgements;\nusing osu.Game.Rulesets.Objects;\nusing osu.Game.Rulesets.Scoring;\n+using osu.Game.Rulesets.Tau.Configuration;\nusing osu.Game.Rulesets.Tau.Objects.Drawables;\nusing osu.Game.Skinning;\n@@ -19,8 +21,7 @@ namespace osu.Game.Rulesets.Tau.Tests\n{\npublic class TestSceneDrawableJudgement : TauSkinnableTestScene\n{\n- [Resolved]\n- private OsuConfigManager config { get; set; }\n+ private readonly BindableBool hitLighting = new BindableBool();\nprivate readonly List<DrawablePool<TestDrawableTauJudgement>> pools;\n@@ -34,10 +35,17 @@ public TestSceneDrawableJudgement()\n}\n}\n+ [BackgroundDependencyLoader]\n+ private void load()\n+ {\n+ var config = (TauRulesetConfigManager)RulesetConfigs.GetConfigFor(Ruleset.Value.CreateInstance()).AsNonNull();\n+ config.BindWith(TauRulesetSettings.HitLighting, hitLighting);\n+ }\n+\n[Test]\npublic void TestHitLightingDisabled()\n{\n- AddStep(\"hit Lighting disabled\", () => config.SetValue(OsuSetting.HitLighting, false));\n+ AddStep(\"hit Lighting disabled\", () => hitLighting.Value = false);\nshowResult(HitResult.Great);\n@@ -49,7 +57,7 @@ public void TestHitLightingDisabled()\n[Test]\npublic void TestHitLightingEnabled()\n{\n- AddStep(\"hit Lighting enabled\", () => config.SetValue(OsuSetting.HitLighting, true));\n+ AddStep(\"hit Lighting enabled\", () => hitLighting.Value = true);\nshowResult(HitResult.Great);\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Configuration/TauRulesetConfigManager.cs",
"new_path": "osu.Game.Rulesets.Tau/Configuration/TauRulesetConfigManager.cs",
"diff": "@@ -17,6 +17,7 @@ protected override void InitialiseDefaults()\nSetDefault(TauRulesetSettings.ShowEffects, true);\nSetDefault(TauRulesetSettings.ShowVisualizer, true);\nSetDefault(TauRulesetSettings.ShowSliderEffects, true);\n+ SetDefault(TauRulesetSettings.HitLighting, false);\nSetDefault(TauRulesetSettings.KiaiType, KiaiType.Turbulence);\nSetDefault(TauRulesetSettings.PlayfieldDim, 0.7f, 0, 1, 0.01f);\nSetDefault(TauRulesetSettings.NotesSize, 16f, 10, 25, 1f);\n@@ -28,6 +29,7 @@ public enum TauRulesetSettings\nShowEffects,\nShowVisualizer,\nShowSliderEffects, // There's no real reason to have a toggle for showing Kiai effects, as that's already handled under KiaiType\n+ HitLighting,\nKiaiType,\nPlayfieldDim,\nNotesSize,\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/UI/TauSettingsSubsection.cs",
"new_path": "osu.Game.Rulesets.Tau/UI/TauSettingsSubsection.cs",
"diff": "@@ -45,6 +45,11 @@ private void load()\nLabelText = \"Show Visualizer\",\nCurrent = config.GetBindable<bool>(TauRulesetSettings.ShowVisualizer)\n},\n+ new SettingsCheckbox\n+ {\n+ LabelText = \"Hit Lighting\",\n+ Current = config.GetBindable<bool>(TauRulesetSettings.HitLighting)\n+ },\nkiaiType = new SettingsEnumDropdown<KiaiType>()\n{\nLabelText = \"Kiai Type\",\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/osu.Game.Rulesets.Tau.csproj",
"new_path": "osu.Game.Rulesets.Tau/osu.Game.Rulesets.Tau.csproj",
"diff": "<None Remove=\"Resources\\Shaders\\sh_DepthMask.vs\" />\n</ItemGroup>\n<ItemGroup>\n- <PackageReference Include=\"ppy.osu.Game\" Version=\"2022.628.0\" />\n+ <PackageReference Include=\"ppy.osu.Game\" Version=\"2022.731.1\" />\n</ItemGroup>\n<ItemGroup>\n<Compile Update=\"Objects\\Drawables\\DrawableSlider.Calculations.cs\">\n"
}
]
| C# | MIT License | taulazer/tau | Make hit lighting our own separate setting |
664,859 | 09.08.2022 14:04:13 | 14,400 | 457803aaf980260dd18a8644170a4994e186e16d | Create tau localisations | [
{
"change_type": "MODIFY",
"old_path": ".editorconfig",
"new_path": ".editorconfig",
"diff": "@@ -193,3 +193,6 @@ insert_final_newline = true\nindent_style = space\nindent_size = 2\ntrim_trailing_whitespace = true\n+\n+# The number of words to use in the source string to generate the target member name. Defaults to all words in the string.\n+dotnet_diagnostic.OLOC001.words_in_name = 5\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "osu.Game.Rulesets.Tau.Localisation/osu.Game.Rulesets.Tau.Localisation.csproj",
"diff": "+<Project Sdk=\"Microsoft.NET.Sdk\">\n+\n+ <PropertyGroup>\n+ <TargetFramework>net6.0</TargetFramework>\n+ <ImplicitUsings>enable</ImplicitUsings>\n+ <Nullable>enable</Nullable>\n+ </PropertyGroup>\n+\n+ <ItemGroup>\n+ <!-- Resolves references to LocalisableString. -->\n+ <PackageReference Include=\"ppy.osu.Framework\" Version=\"2021.611.0\">\n+ <PrivateAssets>all</PrivateAssets>\n+ </PackageReference>\n+ </ItemGroup>\n+\n+</Project>\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau.sln",
"new_path": "osu.Game.Rulesets.Tau.sln",
"diff": "@@ -12,6 +12,8 @@ Project(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"Solution Files\", \"Solution\n.editorconfig = .editorconfig\nEndProjectSection\nEndProject\n+Project(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"osu.Game.Rulesets.Tau.Localisation\", \"osu.Game.Rulesets.Tau.Localisation\\osu.Game.Rulesets.Tau.Localisation.csproj\", \"{5E2A5383-1789-44F6-A54D-2F4A5484115C}\"\n+EndProject\nGlobal\nGlobalSection(SolutionConfigurationPlatforms) = preSolution\nDebug|Any CPU = Debug|Any CPU\n@@ -31,6 +33,12 @@ Global\n{B4577C85-CB83-462A-BCE3-22FFEB16311D}.Release|Any CPU.Build.0 = Release|Any CPU\n{B4577C85-CB83-462A-BCE3-22FFEB16311D}.VisualTests|Any CPU.ActiveCfg = Debug|Any CPU\n{B4577C85-CB83-462A-BCE3-22FFEB16311D}.VisualTests|Any CPU.Build.0 = Debug|Any CPU\n+ {5E2A5383-1789-44F6-A54D-2F4A5484115C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n+ {5E2A5383-1789-44F6-A54D-2F4A5484115C}.Debug|Any CPU.Build.0 = Debug|Any CPU\n+ {5E2A5383-1789-44F6-A54D-2F4A5484115C}.Release|Any CPU.ActiveCfg = Release|Any CPU\n+ {5E2A5383-1789-44F6-A54D-2F4A5484115C}.Release|Any CPU.Build.0 = Release|Any CPU\n+ {5E2A5383-1789-44F6-A54D-2F4A5484115C}.VisualTests|Any CPU.ActiveCfg = Debug|Any CPU\n+ {5E2A5383-1789-44F6-A54D-2F4A5484115C}.VisualTests|Any CPU.Build.0 = Debug|Any CPU\nEndGlobalSection\nGlobalSection(SolutionProperties) = preSolution\nHideSolutionNode = FALSE\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/UI/TauSettingsSubsection.cs",
"new_path": "osu.Game.Rulesets.Tau/UI/TauSettingsSubsection.cs",
"diff": "using osu.Framework.Localisation;\nusing osu.Game.Overlays.Settings;\nusing osu.Game.Rulesets.Tau.Configuration;\n+using osu.Game.Rulesets.Tau.Localisation;\nnamespace osu.Game.Rulesets.Tau.UI\n{\n@@ -32,39 +33,39 @@ private void load()\n{\nshowEffects = new SettingsCheckbox\n{\n- LabelText = \"Show Effects\",\n+ LabelText = SettingStrings.ShowEffects,\nCurrent = config.GetBindable<bool>(TauRulesetSettings.ShowEffects)\n},\nshowSliderEffects = new SettingsCheckbox\n{\n- LabelText = \"Show Slider Effects\",\n+ LabelText = SettingStrings.ShowSliderEffects,\nCurrent = config.GetBindable<bool>(TauRulesetSettings.ShowSliderEffects)\n},\nshowVisualizer = new SettingsCheckbox\n{\n- LabelText = \"Show Visualizer\",\n+ LabelText = SettingStrings.ShowVisualizer,\nCurrent = config.GetBindable<bool>(TauRulesetSettings.ShowVisualizer)\n},\nnew SettingsCheckbox\n{\n- LabelText = \"Hit Lighting\",\n+ LabelText = SettingStrings.HitLighting,\nCurrent = config.GetBindable<bool>(TauRulesetSettings.HitLighting)\n},\nkiaiType = new SettingsEnumDropdown<KiaiType>()\n{\n- LabelText = \"Kiai Type\",\n+ LabelText = SettingStrings.KiaiType,\nCurrent = config.GetBindable<KiaiType>(TauRulesetSettings.KiaiType)\n},\nnew SettingsSlider<float>\n{\n- LabelText = \"Playfield Dim\",\n+ LabelText = SettingStrings.PlayfieldDim,\nCurrent = config.GetBindable<float>(TauRulesetSettings.PlayfieldDim),\nKeyboardStep = 0.01f,\nDisplayAsPercentage = true\n},\nnew SettingsSlider<float>\n{\n- LabelText = \"Notes Size\",\n+ LabelText = SettingStrings.NotesSize,\nCurrent = config.GetBindable<float>(TauRulesetSettings.NotesSize),\nKeyboardStep = 1f\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/osu.Game.Rulesets.Tau.csproj",
"new_path": "osu.Game.Rulesets.Tau/osu.Game.Rulesets.Tau.csproj",
"diff": "<None Remove=\"Resources\\Shaders\\sh_DepthMask.vs\" />\n</ItemGroup>\n<ItemGroup>\n+ <PackageReference Include=\"ppy.LocalisationAnalyser\" Version=\"2022.809.0\">\n+ <PrivateAssets>all</PrivateAssets>\n+ <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>\n+ </PackageReference>\n<PackageReference Include=\"ppy.osu.Game\" Version=\"2022.731.1\" />\n</ItemGroup>\n<ItemGroup>\n<DependentUpon>DrawableSlider.Graphics.cs</DependentUpon>\n</Compile>\n</ItemGroup>\n+ <ItemGroup>\n+ <ProjectReference Include=\"..\\osu.Game.Rulesets.Tau.Localisation\\osu.Game.Rulesets.Tau.Localisation.csproj\" />\n+ </ItemGroup>\n</Project>\n"
}
]
| C# | MIT License | taulazer/tau | Create tau localisations |
664,859 | 09.08.2022 15:33:19 | 14,400 | 3b8b6435f991b10f6c49dccf93774b716b4bed84 | Remove localisation analyzer | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/osu.Game.Rulesets.Tau.csproj",
"new_path": "osu.Game.Rulesets.Tau/osu.Game.Rulesets.Tau.csproj",
"diff": "<None Remove=\"Resources\\Shaders\\sh_DepthMask.vs\" />\n</ItemGroup>\n<ItemGroup>\n- <PackageReference Include=\"ppy.LocalisationAnalyser\" Version=\"2022.809.0\">\n- <PrivateAssets>all</PrivateAssets>\n- <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>\n- </PackageReference>\n<PackageReference Include=\"ppy.osu.Game\" Version=\"2022.731.1\" />\n</ItemGroup>\n<ItemGroup>\n"
}
]
| C# | MIT License | taulazer/tau | Remove localisation analyzer |
664,859 | 09.08.2022 16:10:13 | 14,400 | ecb55ff337974c6aeae5828573be1ff2cc1c577d | Apply IRenderer changes | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Mods/TauModFlashlight.cs",
"new_path": "osu.Game.Rulesets.Tau/Mods/TauModFlashlight.cs",
"diff": "using osu.Framework.Allocation;\nusing osu.Framework.Bindables;\nusing osu.Framework.Graphics;\n-using osu.Framework.Graphics.Batches;\n-using osu.Framework.Graphics.OpenGL.Vertices;\nusing osu.Framework.Graphics.Primitives;\n+using osu.Framework.Graphics.Rendering;\n+using osu.Framework.Graphics.Rendering.Vertices;\nusing osu.Framework.Graphics.Shaders;\n-using osu.Framework.Graphics.Textures;\nusing osu.Framework.Input;\nusing osu.Framework.Input.Events;\nusing osu.Game.Beatmaps.Timing;\n@@ -233,17 +232,12 @@ private class FlashlightDrawNode : DrawNode\nprivate float rotation;\nprivate float flashlightDim;\n- private readonly VertexBatch<PositionAndColourVertex> quadBatch = new QuadBatch<PositionAndColourVertex>(1, 1);\n- private readonly Action<TexturedVertex2D> addAction;\n+ private IVertexBatch<PositionAndColourVertex> quadBatch;\n+ private Action<TexturedVertex2D> addAction;\npublic FlashlightDrawNode(Flashlight source)\n: base(source)\n{\n- addAction = v => quadBatch.Add(new PositionAndColourVertex\n- {\n- Position = v.Position,\n- Colour = v.Colour\n- });\n}\npublic override void ApplyState()\n@@ -258,9 +252,19 @@ public override void ApplyState()\nflashlightDim = Source.FlashlightDim;\n}\n- public override void Draw(Action<TexturedVertex2D> vertexAction)\n+ public override void Draw(IRenderer renderer)\n+ {\n+ base.Draw(renderer);\n+\n+ if (quadBatch == null)\n{\n- base.Draw(vertexAction);\n+ quadBatch ??= renderer.CreateQuadBatch<PositionAndColourVertex>(1, 1);\n+ addAction = v => quadBatch.Add(new PositionAndColourVertex\n+ {\n+ Position = v.Position,\n+ Colour = v.Colour\n+ });\n+ }\nshader.Bind();\n@@ -269,7 +273,7 @@ public override void Draw(Action<TexturedVertex2D> vertexAction)\nshader.GetUniform<float>(\"rotation\").UpdateValue(ref rotation);\nshader.GetUniform<float>(\"flashlightDim\").UpdateValue(ref flashlightDim);\n- DrawQuad(Texture.WhitePixel, screenSpaceDrawQuad, DrawColourInfo.Colour, vertexAction: addAction);\n+ renderer.DrawQuad(renderer.WhitePixel, screenSpaceDrawQuad, DrawColourInfo.Colour, vertexAction: addAction);\nshader.Unbind();\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Mods/TauModHidden.cs",
"new_path": "osu.Game.Rulesets.Tau/Mods/TauModHidden.cs",
"diff": "using osu.Framework.Allocation;\nusing osu.Framework.Extensions;\nusing osu.Framework.Graphics;\n-using osu.Framework.Graphics.Batches;\nusing osu.Framework.Graphics.Containers;\n-using osu.Framework.Graphics.OpenGL.Vertices;\nusing osu.Framework.Graphics.Primitives;\n+using osu.Framework.Graphics.Rendering;\n+using osu.Framework.Graphics.Rendering.Vertices;\nusing osu.Framework.Graphics.Shaders;\n-using osu.Framework.Graphics.Textures;\nusing osu.Game.Graphics.OpenGL.Vertices;\nusing osu.Game.Rulesets.Mods;\nusing osu.Game.Rulesets.Objects.Drawables;\nusing osu.Game.Rulesets.Tau.UI;\nusing osu.Game.Rulesets.UI;\nusing osuTK;\n-using osuTK.Graphics.ES30;\nusing Container = osu.Framework.Graphics.Containers.Container;\nnamespace osu.Game.Rulesets.Tau.Mods\n@@ -72,7 +70,7 @@ public PlayfieldMaskingContainer(Drawable content, MaskingMode mode)\nRelativeSizeAxes = Axes.Both;\n- InternalChild = new BufferedContainer(new[] { RenderbufferInternalFormat.DepthComponent16 })\n+ InternalChild = new BufferedContainer(new[] { RenderBufferFormat.D16 })\n{\nRelativeSizeAxes = Axes.Both,\nSize = new Vector2(1.5f),\n@@ -160,17 +158,12 @@ private class PlayfieldMaskDrawNode : DrawNode\nprivate Vector2 aperturePosition;\nprivate Vector2 apertureSize;\n- private readonly VertexBatch<PositionAndColourVertex> quadBatch = new QuadBatch<PositionAndColourVertex>(1, 1);\n- private readonly Action<TexturedVertex2D> addAction;\n+ private IVertexBatch<PositionAndColourVertex> quadBatch;\n+ private Action<TexturedVertex2D> addAction;\npublic PlayfieldMaskDrawNode(PlayfieldMaskDrawable source)\n: base(source)\n{\n- addAction = v => quadBatch.Add(new PositionAndColourVertex\n- {\n- Position = v.Position,\n- Colour = v.Colour\n- });\n}\npublic override void ApplyState()\n@@ -183,16 +176,26 @@ public override void ApplyState()\napertureSize = Source.ApertureSize * DrawInfo.Matrix.ExtractScale().Xy;\n}\n- public override void Draw(Action<TexturedVertex2D> vertexAction)\n+ public override void Draw(IRenderer renderer)\n+ {\n+ base.Draw(renderer);\n+\n+ if (quadBatch == null)\n{\n- base.Draw(vertexAction);\n+ quadBatch ??= renderer.CreateQuadBatch<PositionAndColourVertex>(1, 1);\n+ addAction = v => quadBatch.Add(new PositionAndColourVertex\n+ {\n+ Position = v.Position,\n+ Colour = v.Colour\n+ });\n+ }\nshader.Bind();\nshader.GetUniform<Vector2>(\"aperturePos\").UpdateValue(ref aperturePosition);\nshader.GetUniform<Vector2>(\"apertureSize\").UpdateValue(ref apertureSize);\n- DrawQuad(Texture.WhitePixel, screenSpaceDrawQuad, DrawColourInfo.Colour, vertexAction: addAction);\n+ renderer.DrawQuad(renderer.WhitePixel, screenSpaceDrawQuad, DrawColourInfo.Colour, vertexAction: addAction);\nshader.Unbind();\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableSlider.Graphics.SliderPathDrawNode.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableSlider.Graphics.SliderPathDrawNode.cs",
"diff": "using System.Runtime.InteropServices;\nusing osu.Framework.Extensions.Color4Extensions;\nusing osu.Framework.Graphics;\n-using osu.Framework.Graphics.Batches;\nusing osu.Framework.Graphics.Colour;\n-using osu.Framework.Graphics.OpenGL;\n-using osu.Framework.Graphics.OpenGL.Vertices;\nusing osu.Framework.Graphics.Primitives;\n+using osu.Framework.Graphics.Rendering;\n+using osu.Framework.Graphics.Rendering.Vertices;\nusing osu.Framework.Graphics.Shaders;\nusing osu.Framework.Graphics.Textures;\nusing osu.Game.Rulesets.Tau.Allocation;\n@@ -70,9 +69,8 @@ public struct SliderTexturedVertex2D : IEquatable<SliderTexturedVertex2D>, IVert\n// We multiply the size param by 3 such that the amount of vertices is a multiple of the amount of vertices\n// per primitive (triangles in this case). Otherwise overflowing the batch will result in wrong\n// grouping of vertices into primitives.\n- private readonly LinearBatch<SliderTexturedVertex2D> halfCircleBatch = new(max_resolution * 100 * 3, 10, PrimitiveType.Triangles);\n-\n- private readonly QuadBatch<SliderTexturedVertex2D> quadBatch = new(200, 10);\n+ private IVertexBatch<SliderTexturedVertex2D> halfCircleBatch;\n+ private IVertexBatch<SliderTexturedVertex2D> quadBatch;\npublic SliderPathDrawNode(SliderPath source)\n: base(source)\n@@ -326,25 +324,28 @@ private void updateVertexBuffer()\n}\n}\n- public override void Draw(Action<TexturedVertex2D> vertexAction)\n+ public override void Draw(IRenderer renderer)\n{\n- base.Draw(vertexAction);\n+ base.Draw(renderer);\n+\n+ halfCircleBatch ??= renderer.CreateLinearBatch<SliderTexturedVertex2D>(max_resolution * 100 * 3, 10, PrimitiveTopology.Triangles);\n+ quadBatch ??= renderer.CreateQuadBatch<SliderTexturedVertex2D>(200, 10);\nif (texture?.Available != true || segments.Length == 0)\nreturn;\nbool value = true;\n- GLWrapper.PushDepthInfo(new DepthInfo(depthTest: true, writeDepth: true, function: DepthFunction.Always));\n+ renderer.PushDepthInfo(new DepthInfo(depthTest: true, writeDepth: true, function: DepthFunction.Always));\nmaskShader.Bind();\nmaskShader.GetUniform<bool>(\"writeDepth\").UpdateValue(ref value);\nforeach (var i in innerTicks)\n{\n- DrawQuad(Texture.WhitePixel, i, Color4.Transparent);\n+ renderer.DrawQuad(renderer.WhitePixel, i, Color4.Transparent);\n}\nmaskShader.Unbind();\n- GLWrapper.PopDepthInfo();\n+ renderer.PopDepthInfo();\nshader.Bind();\nshader.GetUniform<Vector2>(\"centerPos\").UpdateValue(ref centerPos);\n@@ -352,32 +353,32 @@ public override void Draw(Action<TexturedVertex2D> vertexAction)\nshader.GetUniform<float>(\"fadeRange\").UpdateValue(ref fadeRange);\nshader.GetUniform<Vector4>(\"hitColor\").UpdateValue(ref hitColour);\nshader.GetUniform<bool>(\"reverse\").UpdateValue(ref reverse);\n- texture.TextureGL.Bind();\n+ texture.Bind();\nupdateVertexBuffer();\nshader.Unbind();\n- GLWrapper.PushDepthInfo(new DepthInfo(depthTest: true, writeDepth: true, function: DepthFunction.Always));\n+ renderer.PushDepthInfo(new DepthInfo(depthTest: true, writeDepth: true, function: DepthFunction.Always));\nmaskShader.Bind();\nvalue = false;\nmaskShader.GetUniform<bool>(\"writeDepth\").UpdateValue(ref value);\nforeach (var i in innerTicks)\n{\n- DrawQuad(Texture.WhitePixel, i, Color4.Transparent);\n+ renderer.DrawQuad(renderer.WhitePixel, i, Color4.Transparent);\n}\nmaskShader.Unbind();\n- GLWrapper.PopDepthInfo();\n+ renderer.PopDepthInfo();\n}\nprotected override void Dispose(bool isDisposing)\n{\nbase.Dispose(isDisposing);\n- halfCircleBatch.Dispose();\n- quadBatch.Dispose();\n+ halfCircleBatch?.Dispose();\n+ quadBatch?.Dispose();\nsegments.Dispose();\nticks.Dispose();\ninnerTicks.Dispose();\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableSlider.Graphics.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableSlider.Graphics.cs",
"diff": "using osu.Framework.Graphics;\nusing osu.Framework.Graphics.Lines;\nusing osu.Framework.Graphics.Primitives;\n+using osu.Framework.Graphics.Rendering;\nusing osu.Framework.Graphics.Shaders;\nusing osu.Framework.Graphics.Textures;\nusing osuTK;\n@@ -18,7 +19,7 @@ public partial class DrawableSlider\n{\npublic const float FADE_RANGE = 120;\n- private static Texture generateSmoothPathTexture(float radius, Func<float, Color4> colourAt)\n+ private static Texture generateSmoothPathTexture(IRenderer renderer, float radius, Func<float, Color4> colourAt)\n{\nconst float aa_portion = 0.02f;\nint textureWidth = (int)radius * 2;\n@@ -33,7 +34,7 @@ private static Texture generateSmoothPathTexture(float radius, Func<float, Color\nraw[i, 0] = new Rgba32(colour.R, colour.G, colour.B, colour.A * Math.Min(progress / aa_portion, 1));\n}\n- var texture = new Texture(textureWidth, 1, true);\n+ var texture = renderer.CreateTexture(textureWidth, 1, true);\ntexture.SetData(new TextureUpload(raw));\nreturn texture;\n}\n@@ -215,8 +216,10 @@ public SliderPath()\n}\n[BackgroundDependencyLoader]\n- private void load(ShaderManager shaders)\n+ private void load(IRenderer renderer, ShaderManager shaders)\n{\n+ texture = renderer.WhitePixel;\n+\ndepthMaskShader = shaders.Load(\"DepthMask\", \"DepthMask\");\nhitFadeTextureShader = shaders.Load(\"SliderPositionAndColour\", \"Slider\");\n}\n@@ -287,7 +290,7 @@ private List<(Line, float)> generateSegments()\npublic Texture Texture\n{\n- get => texture ?? Texture.WhitePixel;\n+ get => texture;\nset\n{\nif (texture == value)\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableSlider.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableSlider.cs",
"diff": "using osu.Framework.Caching;\nusing osu.Framework.Graphics;\nusing osu.Framework.Graphics.Containers;\n+using osu.Framework.Graphics.Rendering;\nusing osu.Framework.Graphics.Shapes;\nusing osu.Framework.Platform;\nusing osu.Framework.Utils;\n@@ -129,12 +130,12 @@ private float convertNoteSizeToSliderSize(float beatSize)\n=> Interpolation.ValueAt(beatSize, 2f, 7f, 10f, 25f);\n[BackgroundDependencyLoader]\n- private void load(GameHost host)\n+ private void load(IRenderer renderer, GameHost host)\n{\nNoteSize.BindValueChanged(value => path.PathRadius = convertNoteSizeToSliderSize(value.NewValue), true);\nhost.DrawThread.Scheduler.AddDelayed(() => drawCache.Invalidate(), 0, true);\n- path.Texture = properties.SliderTexture ??= generateSmoothPathTexture(path.PathRadius, _ => Color4.White);\n+ path.Texture = properties.SliderTexture ??= generateSmoothPathTexture(renderer, path.PathRadius, _ => Color4.White);\n}\n[Resolved]\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/UI/Effects/PlayfieldVisualizer.cs",
"new_path": "osu.Game.Rulesets.Tau/UI/Effects/PlayfieldVisualizer.cs",
"diff": "using osu.Framework.Allocation;\nusing osu.Framework.Bindables;\nusing osu.Framework.Graphics;\n-using osu.Framework.Graphics.Batches;\nusing osu.Framework.Graphics.Colour;\n-using osu.Framework.Graphics.OpenGL.Vertices;\nusing osu.Framework.Graphics.Primitives;\n+using osu.Framework.Graphics.Rendering;\n+using osu.Framework.Graphics.Rendering.Vertices;\nusing osu.Framework.Graphics.Shaders;\nusing osu.Framework.Graphics.Textures;\nusing osu.Framework.Utils;\n@@ -55,14 +55,12 @@ public class PlayfieldVisualizer : Drawable\nprivate readonly float[] amplitudes = new float[bars_per_visualiser];\nprivate IShader shader;\n- private readonly Texture texture;\n+ private Texture texture;\nprivate readonly Bindable<bool> showVisualizer = new(true);\npublic PlayfieldVisualizer()\n{\n- texture = Texture.WhitePixel;\n-\nBlending = BlendingParameters.Additive;\nRelativeSizeAxes = Axes.Both;\nFillMode = FillMode.Fit;\n@@ -74,8 +72,9 @@ public PlayfieldVisualizer()\n}\n[BackgroundDependencyLoader(true)]\n- private void load(ShaderManager shaders, TauRulesetConfigManager config)\n+ private void load(IRenderer renderer, ShaderManager shaders, TauRulesetConfigManager config)\n{\n+ texture = renderer.WhitePixel;\nshader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED);\nconfig?.BindWith(TauRulesetSettings.ShowVisualizer, showVisualizer);\n@@ -169,7 +168,7 @@ private class PlayfieldVisualizerDrawNode : DrawNode\nprivate Color4 colour;\nprivate float[] data;\n- private readonly QuadBatch<TexturedVertex2D> vertexBatch = new(100, 10);\n+ private IVertexBatch<TexturedVertex2D> vertexBatch;\npublic PlayfieldVisualizerDrawNode(PlayfieldVisualizer source)\n: base(source)\n@@ -187,9 +186,11 @@ public override void ApplyState()\ndata = Source.amplitudes;\n}\n- public override void Draw(Action<TexturedVertex2D> vertexAction)\n+ public override void Draw(IRenderer renderer)\n{\n- base.Draw(vertexAction);\n+ base.Draw(renderer);\n+\n+ vertexBatch ??= renderer.CreateQuadBatch<TexturedVertex2D>(100, 10);\nshader.Bind();\n@@ -227,8 +228,7 @@ public override void Draw(Action<TexturedVertex2D> vertexAction)\nVector2Extensions.Transform(barPosition + bottomOffset + amplitudeOffset, DrawInfo.Matrix)\n);\n- DrawQuad(\n- texture,\n+ renderer.DrawQuad(texture,\nrectangle,\ncolourInfo,\nnull,\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/UI/TauResumeOverlay.cs",
"new_path": "osu.Game.Rulesets.Tau/UI/TauResumeOverlay.cs",
"diff": "using osu.Framework.Extensions.Color4Extensions;\nusing osu.Framework.Graphics;\nusing osu.Framework.Graphics.Containers;\n+using osu.Framework.Graphics.Rendering;\nusing osu.Framework.Graphics.Shapes;\nusing osu.Framework.Graphics.Textures;\nusing osu.Framework.Graphics.UserInterface;\n@@ -109,16 +110,20 @@ public TauClickToResumeContainer()\n{\nRelativeSizeAxes = Axes.Both;\nColour = Color4Extensions.FromHex(@\"FF0040\");\n- Texture = generateTexture(0.25f);\n}\n- private Texture generateTexture(float opacity)\n+ [BackgroundDependencyLoader]\n+ private void load(IRenderer renderer)\n+ {\n+ Texture = generateTexture(renderer, 0.25f);\n+ }\n+\n+ private Texture generateTexture(IRenderer renderer, float opacity)\n{\nconst int width = 128;\nvar image = new Image<Rgba32>(width, 1);\n-\n- var gradientTextureHorizontal = new Texture(1, width, true);\n+ var gradientTextureHorizontal = renderer.CreateTexture(1, width, true);\nimage.ProcessPixelRows(rows =>\n{\n"
}
]
| C# | MIT License | taulazer/tau | Apply IRenderer changes |
664,859 | 09.08.2022 16:19:59 | 14,400 | 9be9e11006a1c620f3be285e9631912573c8fc37 | add more pointless badges | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "[](https://github.com/Altenhh/tau/LICENSE)\n\n\n+[](https://github.com/taulazer/tau/actions/workflows/ci.yml)\n+[](https://crowdin.com/project/tau)\n[](https://discord.gg/7Y8GXAa)\n*An [osu!](https://github.com/ppy/osu) ruleset. Sweeping beats with your scythe.*\n"
}
]
| C# | MIT License | taulazer/tau | add more pointless badges |
664,859 | 09.08.2022 20:49:05 | 14,400 | 7f0f502dc83d5497d014a5a93792d2ea2c4f539c | Add more localizable strings | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Beatmaps/TauBeatmap.cs",
"new_path": "osu.Game.Rulesets.Tau/Beatmaps/TauBeatmap.cs",
"diff": "using System.Linq;\nusing osu.Framework.Graphics.Sprites;\nusing osu.Game.Beatmaps;\n+using osu.Game.Rulesets.Tau.Localisation;\nusing osu.Game.Rulesets.Tau.Objects;\nusing osuTK;\n@@ -19,7 +20,7 @@ public override IEnumerable<BeatmapStatistic> GetStatistics()\n{\nnew BeatmapStatistic\n{\n- Name = \"Beat count\",\n+ Name = BeatmapStrings.BeatCount,\nContent = beats.ToString(),\nCreateIcon = () => new SpriteIcon\n{\n@@ -29,13 +30,13 @@ public override IEnumerable<BeatmapStatistic> GetStatistics()\n},\nnew BeatmapStatistic\n{\n- Name = \"Slider count\",\n+ Name = BeatmapStrings.SliderCount,\nContent = sliders.ToString(),\nCreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Sliders)\n},\nnew BeatmapStatistic\n{\n- Name = \"Hard Beat count\",\n+ Name = BeatmapStrings.HardBeatCount,\nContent = hardBeats.ToString(),\nCreateIcon = () => new SpriteIcon\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Localisation/Translations/Settings.resx",
"new_path": "osu.Game.Rulesets.Tau/Localisation/Translations/Settings.resx",
"diff": "<data name=\"notes_size\" xml:space=\"preserve\">\n<value>Notes Size</value>\n</data>\n+ <data name=\"hit_lighting\" xml:space=\"preserve\">\n+ <value>Hit Lighting</value>\n+ </data>\n</root>\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/TauInputManager.cs",
"new_path": "osu.Game.Rulesets.Tau/TauInputManager.cs",
"diff": "using osu.Framework.Input.Bindings;\nusing osu.Framework.Input.Events;\nusing osu.Framework.Input.StateChanges.Events;\n+using osu.Framework.Localisation;\n+using osu.Game.Rulesets.Tau.Localisation;\nusing osu.Game.Rulesets.UI;\nnamespace osu.Game.Rulesets.Tau\n@@ -66,9 +68,16 @@ protected override bool Handle(UIEvent e)\npublic enum TauAction\n{\n+ [LocalisableDescription(typeof(InputStrings), nameof(InputStrings.LeftButton))]\nLeftButton,\n+\n+ [LocalisableDescription(typeof(InputStrings), nameof(InputStrings.RightButton))]\nRightButton,\n+\n+ [LocalisableDescription(typeof(InputStrings), nameof(InputStrings.HardButton1))]\nHardButton1,\n+\n+ [LocalisableDescription(typeof(InputStrings), nameof(InputStrings.HardButton2))]\nHardButton2,\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/osu.Game.Rulesets.Tau.csproj",
"new_path": "osu.Game.Rulesets.Tau/osu.Game.Rulesets.Tau.csproj",
"diff": "<EmbeddedResource Update=\"Localisation\\Translations\\Settings.*.resx\">\n<DependentUpon>Settings.resx</DependentUpon>\n</EmbeddedResource>\n+ <EmbeddedResource Update=\"Localisation\\Translations\\Inputs.resx\">\n+ <Generator>ResXFileCodeGenerator</Generator>\n+ <LastGenOutput>Inputs.Designer.cs</LastGenOutput>\n+ </EmbeddedResource>\n</ItemGroup>\n<ItemGroup>\n<None Remove=\"Resources\\Shaders\\sh_DepthMask.fs\" />\n<None Remove=\"Resources\\Shaders\\sh_DepthMask.vs\" />\n</ItemGroup>\n<ItemGroup>\n+ <PackageReference Include=\"ppy.LocalisationAnalyser\" Version=\"2022.809.0\">\n+ <PrivateAssets>all</PrivateAssets>\n+ <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>\n+ </PackageReference>\n<PackageReference Include=\"ppy.osu.Game\" Version=\"2022.810.0\" />\n</ItemGroup>\n<ItemGroup>\n"
}
]
| C# | MIT License | taulazer/tau | Add more localizable strings |
664,859 | 09.08.2022 21:06:25 | 14,400 | 6a53fd6999ce0c239816f1056059d8bf50c9c9c4 | why do i keep forgetting this | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Localisation/Translations/Beatmap.fr.resx",
"new_path": "osu.Game.Rulesets.Tau/Localisation/Translations/Beatmap.fr.resx",
"diff": "</xsd:element>\n</xsd:schema>\n<data name=\"beat_count\" xml:space=\"preserve\">\n- <value>test</value>\n+ <value>Beat count</value>\n</data>\n<data name=\"slider_count\" xml:space=\"preserve\">\n<value>Slider count</value>\n"
}
]
| C# | MIT License | taulazer/tau | why do i keep forgetting this |
664,859 | 13.08.2022 13:12:12 | 14,400 | 6f7d687f4f9be93f647c309ef9547b8822bb8049 | Limit max paddle number to 4 | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Mods/TauModDual.cs",
"new_path": "osu.Game.Rulesets.Tau/Mods/TauModDual.cs",
"diff": "@@ -15,6 +15,6 @@ public class TauModDual : Mod\npublic override bool HasImplementation => true;\n[SettingSource(\"Paddle count\")]\n- public BindableNumber<int> PaddleCount { get; } = new(2) { MinValue = 2, MaxValue = 8 };\n+ public BindableNumber<int> PaddleCount { get; } = new(2) { MinValue = 2, MaxValue = 4 };\n}\n}\n"
}
]
| C# | MIT License | taulazer/tau | Limit max paddle number to 4 |
664,859 | 13.08.2022 13:12:53 | 14,400 | 1f2ac661e34cb75591e7f807e05c614f0dccd962 | Remove diff. increase in inverse mod | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Mods/TauModInverse.cs",
"new_path": "osu.Game.Rulesets.Tau/Mods/TauModInverse.cs",
"diff": "@@ -17,7 +17,7 @@ public class TauModInverse : Mod, IApplicableToHitObject, IApplicableToDrawableR\npublic override ModType Type => ModType.Fun;\npublic override IconUsage? Icon => TauIcons.ModInverse;\npublic override string Description => @\"Beats will appear outside of the playfield.\";\n- public override double ScoreMultiplier => 1.09;\n+ public override double ScoreMultiplier => 1;\npublic override Type[] IncompatibleMods => new[] { typeof(TauModHidden) };\nprivate const float preempt_scale = 2;\n"
}
]
| C# | MIT License | taulazer/tau | Remove diff. increase in inverse mod |
664,859 | 13.08.2022 13:22:51 | 14,400 | e57437f020f591ad8e0d2149590384372c6d2f23 | Add extension method to fetch mod | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Replays/ShowoffAutoGenerator.cs",
"new_path": "osu.Game.Rulesets.Tau/Replays/ShowoffAutoGenerator.cs",
"diff": "@@ -31,10 +31,10 @@ public ShowoffAutoGenerator(IBeatmap beatmap, IReadOnlyList<Mod> mods)\nprops.SetRange(beatmap.Difficulty.CircleSize);\npaddleHalfSize = (float)(props.AngleRange.Value / 2) * 0.65f; // it doesnt look good if we catch with the literal edge\n- if (mods.OfType<TauModDual>().FirstOrDefault() is { } dual)\n+ if (mods.GetMod(out TauModDual dual))\npaddleCount = dual.PaddleCount.Value;\n- if (mods.OfType<TauModRoundabout>().FirstOrDefault() is { } round)\n+ if (mods.GetMod(out TauModRoundabout round))\nrotationDirection = round.Direction.Value;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/UI/TauCursor.cs",
"new_path": "osu.Game.Rulesets.Tau/UI/TauCursor.cs",
"diff": "@@ -47,7 +47,7 @@ private void load(IReadOnlyList<Mod> mods)\nrotationLock = mods.OfType<TauModRoundabout>().FirstOrDefault()?.Direction.Value;\n- if (mods.OfType<TauModDual>().FirstOrDefault() is { } dual)\n+ if (mods.GetMod(out TauModDual dual))\n{\nfor (int i = 1; i < dual.PaddleCount.Value; i++)\n{\n"
}
]
| C# | MIT License | taulazer/tau | Add extension method to fetch mod |
664,859 | 13.08.2022 14:27:18 | 14,400 | 340b21ec03cfcf14dbc1266c517a9e0f805700ee | Add test scenes for new mods | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau.Tests/Mods/TestSceneFadeOut.cs",
"new_path": "osu.Game.Rulesets.Tau.Tests/Mods/TestSceneFadeOut.cs",
"diff": "@@ -22,7 +22,7 @@ protected override TestPlayer CreatePlayer(Ruleset ruleset)\n[Test]\npublic void TestFadeOutMod()\n{\n- CreateTest(null);\n+ CreateTest();\nPlayfieldMaskingContainer pmc = null;\n"
}
]
| C# | MIT License | taulazer/tau | Add test scenes for new mods |
664,859 | 13.08.2022 14:27:32 | 14,400 | bab90a9fe54c5001fbe57740229dedba258f7c6c | Fix errors from unit tests | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/UI/EffectsContainer.cs",
"new_path": "osu.Game.Rulesets.Tau/UI/EffectsContainer.cs",
"diff": "@@ -42,6 +42,8 @@ public EffectsContainer()\nprivate void load(TauRulesetConfigManager config, IReadOnlyList<Mod> mods)\n{\nvisualizer.AccentColour = TauPlayfield.ACCENT_COLOUR.Value.Opacity(0.25f);\n+\n+ if (mods != null)\nvisualizer.ApplyFade = mods.Any(x => x is TauModTraceable);\nconfig?.BindWith(TauRulesetSettings.ShowEffects, showEffects);\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/UI/TauPlayfield.cs",
"new_path": "osu.Game.Rulesets.Tau/UI/TauPlayfield.cs",
"diff": "@@ -113,6 +113,7 @@ private ValidationResult checkPaddlePosition(float angle)\n{\nfloat angleDiff = Extensions.GetDeltaAngle(Cursor.DrawablePaddle.Rotation, angle);\n+ if (Cursor.AdditionalPaddles != null)\nforeach (var i in Cursor.AdditionalPaddles)\n{\nfloat diff = Extensions.GetDeltaAngle(i.Rotation, angle);\n"
}
]
| C# | MIT License | taulazer/tau | Fix errors from unit tests |
664,859 | 13.08.2022 14:44:41 | 14,400 | 01e7c1ce640d51c77a4ad104f690572435c124ae | Update description for dual | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Mods/TauModDual.cs",
"new_path": "osu.Game.Rulesets.Tau/Mods/TauModDual.cs",
"diff": "@@ -8,7 +8,7 @@ public class TauModDual : Mod\n{\npublic override string Name => \"Dual\";\npublic override string Acronym => \"DL\";\n- public override string Description => \"Play with multiple paddles.\";\n+ public override string Description => \"When one isn't enough\";\npublic override double ScoreMultiplier => 1;\npublic override ModType Type => ModType.Fun;\n"
}
]
| C# | MIT License | taulazer/tau | Update description for dual |
664,859 | 13.08.2022 14:45:17 | 14,400 | 9ccb5d565e391914142713ef5c527cfd7a9b3fef | Set value and default for dual | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Mods/TauModDual.cs",
"new_path": "osu.Game.Rulesets.Tau/Mods/TauModDual.cs",
"diff": "@@ -15,6 +15,12 @@ public class TauModDual : Mod\npublic override bool HasImplementation => true;\n[SettingSource(\"Paddle count\")]\n- public BindableNumber<int> PaddleCount { get; } = new(2) { MinValue = 2, MaxValue = 4 };\n+ public BindableNumber<int> PaddleCount { get; } = new()\n+ {\n+ Value = 2,\n+ Default = 2,\n+ MinValue = 2,\n+ MaxValue = 4\n+ };\n}\n}\n"
}
]
| C# | MIT License | taulazer/tau | Set value and default for dual |
664,862 | 15.08.2022 22:21:14 | -36,000 | 104b0b2610479f14c7b5335dc7af8c1dfe88c6ba | Add Acronym and descriptions to FO and FI | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Mods/TauModFadeIn.cs",
"new_path": "osu.Game.Rulesets.Tau/Mods/TauModFadeIn.cs",
"diff": "@@ -5,6 +5,11 @@ namespace osu.Game.Rulesets.Tau.Mods\npublic class TauModFadeIn : TauModHidden\n{\npublic override IconUsage? Icon => TauIcons.ModFadeIn;\n+\n+ public override string Acronym => \"FI\";\n+\n+ // Modification from osu!mania's description of Hidden mod.\n+ public override string Description => \"Beats appear out of nowhere!\";\nprotected override MaskingMode Mode => MaskingMode.FadeIn;\nprotected override float InitialCoverage => 0.25f;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Mods/TauModFadeOut.cs",
"new_path": "osu.Game.Rulesets.Tau/Mods/TauModFadeOut.cs",
"diff": "@@ -5,6 +5,10 @@ namespace osu.Game.Rulesets.Tau.Mods\npublic class TauModFadeOut : TauModHidden\n{\npublic override IconUsage? Icon => TauIcons.ModFadeOut;\n+ public override string Acronym => \"FO\";\n+\n+ // Modification from osu!mania's description of Hidden mod.\n+ public override string Description => \"Beats fade out before you hit them!\";\nprotected override MaskingMode Mode => MaskingMode.FadeOut;\nprotected override float InitialCoverage => 0.4f;\n}\n"
}
]
| C# | MIT License | taulazer/tau | Add Acronym and descriptions to FO and FI |
664,862 | 15.08.2022 22:22:20 | -36,000 | 3cb49b49df570018da705dfa0f6ab2b801e7366e | Buff score multiplier for Flashlight.
Fade Out + Fade In give the same multiplier as Flashlight even though Flashlight is harder. | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Mods/TauModFlashlight.cs",
"new_path": "osu.Game.Rulesets.Tau/Mods/TauModFlashlight.cs",
"diff": "@@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Tau.Mods\n{\npublic class TauModFlashlight : TauModFlashlight<TauHitObject>\n{\n- public override double ScoreMultiplier => 1.12;\n+ public override double ScoreMultiplier => 1.2;\npublic override float DefaultFlashlightSize => 0;\n"
}
]
| C# | MIT License | taulazer/tau | Buff score multiplier for Flashlight.
Fade Out + Fade In give the same multiplier as Flashlight even though Flashlight is harder. |
664,862 | 16.08.2022 10:46:58 | -36,000 | 851f07179df78d4ece7bd65699e66c35c833820c | Changed flashlight multiplier to something a bit saner | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Mods/TauModFlashlight.cs",
"new_path": "osu.Game.Rulesets.Tau/Mods/TauModFlashlight.cs",
"diff": "@@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Tau.Mods\n{\npublic class TauModFlashlight : TauModFlashlight<TauHitObject>\n{\n- public override double ScoreMultiplier => 1.2;\n+ public override double ScoreMultiplier => 1.55;\npublic override float DefaultFlashlightSize => 0;\n"
}
]
| C# | MIT License | taulazer/tau | Changed flashlight multiplier to something a bit saner |
664,862 | 16.08.2022 11:28:16 | -36,000 | 39a81b1d442b61bc14822244263f701310ef6ce2 | rounded to 1.16
Unsure about how lazer would display such a multiplier | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Mods/TauModFlashlight.cs",
"new_path": "osu.Game.Rulesets.Tau/Mods/TauModFlashlight.cs",
"diff": "@@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Tau.Mods\n{\npublic class TauModFlashlight : TauModFlashlight<TauHitObject>\n{\n- public override double ScoreMultiplier => 1.155;\n+ public override double ScoreMultiplier => 1.16;\npublic override float DefaultFlashlightSize => 0;\n"
}
]
| C# | MIT License | taulazer/tau | rounded to 1.16
Unsure about how lazer would display such a multiplier |
664,859 | 21.08.2022 22:05:40 | 14,400 | 7081f1873053518b4c482b6b123c347c368ca3cc | Add lenience mod | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableTauHitObject.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableTauHitObject.cs",
"diff": "@@ -75,7 +75,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)\nprotected virtual void ApplyCustomResult(JudgementResult result) { }\n- public bool OnPressed(KeyBindingPressEvent<TauAction> e)\n+ public virtual bool OnPressed(KeyBindingPressEvent<TauAction> e)\n{\nif (Judged)\nreturn false;\n@@ -83,7 +83,7 @@ public bool OnPressed(KeyBindingPressEvent<TauAction> e)\nreturn Actions.Contains(e.Action) && UpdateResult(true);\n}\n- public void OnReleased(KeyBindingReleaseEvent<TauAction> e)\n+ public virtual void OnReleased(KeyBindingReleaseEvent<TauAction> e)\n{\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/TauRuleset.cs",
"new_path": "osu.Game.Rulesets.Tau/TauRuleset.cs",
"diff": "@@ -57,7 +57,8 @@ public override IEnumerable<Mod> GetModsFor(ModType type)\n{\nnew TauModEasy(),\nnew TauModNoFail(),\n- new MultiMod(new TauModHalfTime(), new TauModDaycore())\n+ new MultiMod(new TauModHalfTime(), new TauModDaycore()),\n+ new TauModLenience()\n},\nModType.DifficultyIncrease => new Mod[]\n{\n"
}
]
| C# | MIT License | taulazer/tau | Add lenience mod |
664,859 | 22.08.2022 11:02:42 | 14,400 | b124edf19fed13090a40e2f4ce689191d1b414aa | Update depth stencil function name | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableSlider.Graphics.SliderPathDrawNode.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableSlider.Graphics.SliderPathDrawNode.cs",
"diff": "@@ -335,7 +335,7 @@ public override void Draw(IRenderer renderer)\nreturn;\nbool value = true;\n- renderer.PushDepthInfo(new DepthInfo(depthTest: true, writeDepth: true, function: DepthFunction.Always));\n+ renderer.PushDepthInfo(new DepthInfo(depthTest: true, writeDepth: true, function: DepthStencilFunction.Always));\nmaskShader.Bind();\nmaskShader.GetUniform<bool>(\"writeDepth\").UpdateValue(ref value);\n@@ -359,7 +359,7 @@ public override void Draw(IRenderer renderer)\nshader.Unbind();\n- renderer.PushDepthInfo(new DepthInfo(depthTest: true, writeDepth: true, function: DepthFunction.Always));\n+ renderer.PushDepthInfo(new DepthInfo(depthTest: true, writeDepth: true, function: DepthStencilFunction.Always));\nmaskShader.Bind();\nvalue = false;\nmaskShader.GetUniform<bool>(\"writeDepth\").UpdateValue(ref value);\n"
}
]
| C# | MIT License | taulazer/tau | Update depth stencil function name |
664,859 | 23.08.2022 00:13:17 | 14,400 | a78ade88e4e9fcfcc4ed230389f01166baec0a94 | Add strict hard beats as a mod | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Beatmaps/TauBeatmapConverter.cs",
"new_path": "osu.Game.Rulesets.Tau/Beatmaps/TauBeatmapConverter.cs",
"diff": "@@ -22,6 +22,7 @@ public class TauBeatmapConverter : BeatmapConverter<TauHitObject>\nprotected override Beatmap<TauHitObject> CreateBeatmap() => new TauBeatmap();\npublic bool CanConvertToHardBeats { get; set; } = true;\n+ public bool HardBeatsAreStrict { get; set; } = false;\npublic bool CanConvertToSliders { get; set; } = true;\npublic bool CanConvertImpossibleSliders { get; set; }\npublic int SliderDivisor { get; set; } = 4;\n@@ -71,12 +72,13 @@ private float nextAngle(float target)\nprivate TauHitObject convertToNonSlider(HitObject original)\n{\n- bool isHard = (original is IHasPathWithRepeats tmp ? tmp.NodeSamples[0] : original.Samples).Any(s => s.Name == HitSampleInfo.HIT_FINISH);\nvar comboData = original as IHasCombo;\nvar sample = original is IHasPathWithRepeats c ? c.NodeSamples[0] : null;\n- if (isHard && CanConvertToHardBeats)\n+ if (original.IsHardBeat() && CanConvertToHardBeats && !HardBeatsAreStrict)\nreturn convertToHardBeat(original, comboData, sample);\n+ if (original.IsHardBeat() && CanConvertToHardBeats)\n+ return convertToStrictHardBeat(original, comboData, sample);\nreturn convertToBeat(original, comboData, sample);\n}\n@@ -110,6 +112,16 @@ private TauHitObject convertToHardBeat(HitObject original, IHasCombo comboData,\nComboOffset = comboData?.ComboOffset ?? 0,\n};\n+ private TauHitObject convertToStrictHardBeat(HitObject original, IHasCombo comboData, IList<HitSampleInfo> samples = null)\n+ => new StrictHardBeat\n+ {\n+ Samples = samples ?? original.Samples,\n+ StartTime = original.StartTime,\n+ Angle = nextAngle(getHitObjectAngle(original)),\n+ NewCombo = comboData?.NewCombo ?? false,\n+ ComboOffset = comboData?.ComboOffset ?? 0,\n+ };\n+\nprivate TauHitObject convertToSlider(HitObject original, IHasCombo comboData, IHasPathWithRepeats data, IBeatmap beatmap)\n{\nfloat? startLockedAngle = lastLockedAngle;\n@@ -262,5 +274,12 @@ public static class TauBeatmapConverterExtensions\n/// <param name=\"target\">The target <see cref=\"HitObject\"/> position.</param>\npublic static float GetHitObjectAngle(this Vector2 target)\n=> TauBeatmapConverter.STANDARD_PLAYFIELD_CENTER.GetDegreesFromPosition(target);\n+\n+ /// <summary>\n+ /// Determines whether the hit object should be considered as an emphasis.\n+ /// </summary>\n+ /// <param name=\"original\">The original hit object.</param>\n+ public static bool IsHardBeat(this HitObject original)\n+ => (original is IHasPathWithRepeats tmp ? tmp.NodeSamples[0] : original.Samples).Any(s => s.Name == HitSampleInfo.HIT_FINISH);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/TauRuleset.cs",
"new_path": "osu.Game.Rulesets.Tau/TauRuleset.cs",
"diff": "@@ -67,6 +67,7 @@ public override IEnumerable<Mod> GetModsFor(ModType type)\nnew MultiMod(new TauModDoubleTime(), new TauModNightcore()),\nnew MultiMod(new TauModFadeOut(), new TauModFadeIn()),\nnew TauModFlashlight(),\n+ new TauModStrict()\n},\nModType.Automation => new Mod[]\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/UI/TauPlayfield.cs",
"new_path": "osu.Game.Rulesets.Tau/UI/TauPlayfield.cs",
"diff": "using osu.Framework.Graphics.Containers;\nusing osu.Framework.Graphics.Pooling;\nusing osu.Game.Rulesets.Judgements;\n+using osu.Game.Rulesets.Mods;\nusing osu.Game.Rulesets.Objects;\nusing osu.Game.Rulesets.Objects.Drawables;\nusing osu.Game.Rulesets.Scoring;\n@@ -76,10 +77,11 @@ public TauPlayfield()\n}\n[BackgroundDependencyLoader]\n- private void load()\n+ private void load(IReadOnlyList<Mod> mods)\n{\nRegisterPool<Beat, DrawableBeat>(10);\nRegisterPool<HardBeat, DrawableHardBeat>(5);\n+ RegisterPool<StrictHardBeat, DrawableStrictHardBeat>(5);\nRegisterPool<Slider, DrawableSlider>(5);\nRegisterPool<SliderHeadBeat, DrawableSliderHead>(5);\n@@ -106,6 +108,10 @@ protected override void OnNewDrawableHitObject(DrawableHitObject drawableHitObje\ncase DrawableBeat beat:\nbeat.CheckValidation = checkPaddlePosition;\nbreak;\n+\n+ case DrawableStrictHardBeat st:\n+ st.CheckValidation = checkPaddlePosition;\n+ break;\n}\n}\n"
}
]
| C# | MIT License | taulazer/tau | Add strict hard beats as a mod |
664,859 | 23.08.2022 00:24:52 | 14,400 | 440ac9f8d11923530e0aab072bac80971bd02a86 | Allow relax to hit strict hard beats | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Mods/TauModRelax.cs",
"new_path": "osu.Game.Rulesets.Tau/Mods/TauModRelax.cs",
"diff": "@@ -63,6 +63,7 @@ private void checkNormal(Playfield playfield, IEnumerable<DrawableHitObject<TauH\n{\nbool requiresHold = false;\nbool requiresHit = false;\n+ bool requiresHard = false;\ndouble time = playfield.Clock.CurrentTime;\nforeach (var h in hitObjects)\n@@ -87,6 +88,10 @@ private void checkNormal(Playfield playfield, IEnumerable<DrawableHitObject<TauH\nrequiresHold |= slider.IsWithinPaddle();\nbreak;\n+\n+ case DrawableStrictHardBeat strict:\n+ handleAngled(strict, true);\n+ break;\n}\n}\n@@ -96,18 +101,30 @@ private void checkNormal(Playfield playfield, IEnumerable<DrawableHitObject<TauH\nchangeNormalState(true, time);\n}\n+ if (requiresHard)\n+ {\n+ changeHardBeatState(false, time);\n+ changeHardBeatState(true, time);\n+ }\n+\n+ if (hardBeat.isDown && time - lastStateChangeTime > AutoGenerator.KEY_UP_DELAY)\n+ changeHardBeatState(false, time);\n+\nif (requiresHold)\nchangeNormalState(true, time);\nelse if (normal.isDown && time - lastStateChangeTime > AutoGenerator.KEY_UP_DELAY)\nchangeNormalState(false, time);\n- void handleAngled<T>(DrawableAngledTauHitObject<T> obj)\n+ void handleAngled<T>(DrawableAngledTauHitObject<T> obj, bool isHard = false)\nwhere T : AngledTauHitObject\n{\nif (!obj.IsWithinPaddle())\nreturn;\nDebug.Assert(obj.HitObject.HitWindows != null);\n+ if (isHard)\n+ requiresHard |= obj.HitObject.HitWindows.CanBeHit(time - obj.HitObject.StartTime);\n+ else\nrequiresHit |= obj.HitObject.HitWindows.CanBeHit(time - obj.HitObject.StartTime);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableAngledTauHitObject.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableAngledTauHitObject.cs",
"diff": "@@ -50,7 +50,7 @@ protected override JudgementResult CreateResult(Judgement judgement)\nprotected override bool CheckForValidation() => IsWithinPaddle();\n- public bool IsWithinPaddle() => CheckValidation != null && CheckValidation((HitObject.Angle + GetCurrentOffset()).Normalize()).IsValid;\n+ public virtual bool IsWithinPaddle() => CheckValidation != null && CheckValidation((HitObject.Angle + GetCurrentOffset()).Normalize()).IsValid;\nprotected override void ApplyCustomResult(JudgementResult result)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableStrictHardBeat.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableStrictHardBeat.cs",
"diff": "@@ -47,13 +47,13 @@ protected override void OnApply()\npiece.AngleRange.Value = HitObject.Range;\n}\n- protected override bool CheckForValidation()\n+ public override bool IsWithinPaddle()\n{\nif (CheckValidation == null)\nreturn false;\n- var firstResult = CheckValidation((HitObject.Angle + (float)(HitObject.Range / 2) + (float)HitObject.Range).Normalize());\n- var secondResult = CheckValidation((HitObject.Angle + (float)(HitObject.Range / 2)).Normalize());\n+ var firstResult = CheckValidation((HitObject.Angle + GetCurrentOffset() + (float)HitObject.Range).Normalize());\n+ var secondResult = CheckValidation((HitObject.Angle + GetCurrentOffset()).Normalize());\nreturn firstResult.IsValid && secondResult.IsValid;\n}\n"
}
]
| C# | MIT License | taulazer/tau | Allow relax to hit strict hard beats |
664,859 | 23.08.2022 01:33:32 | 14,400 | 4bc8ed1f15fbc5c6a9ace179ebb4584639fd9c6e | Add hard beat type to sliders | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Beatmaps/TauBeatmapConverter.cs",
"new_path": "osu.Game.Rulesets.Tau/Beatmaps/TauBeatmapConverter.cs",
"diff": "@@ -184,6 +184,7 @@ TauHitObject convertToNonSlider()\nPath = new PolarSliderPath(nodes),\nNewCombo = comboData?.NewCombo ?? false,\nComboOffset = comboData?.ComboOffset ?? 0,\n+ IsHard = HardBeatsAreStrict && original.IsHardBeat()\n};\nif (beatmap.ControlPointInfo is LegacyControlPointInfo legacyControlPointInfo)\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Mods/TauModRelax.cs",
"new_path": "osu.Game.Rulesets.Tau/Mods/TauModRelax.cs",
"diff": "@@ -83,8 +83,18 @@ private void checkNormal(Playfield playfield, IEnumerable<DrawableHitObject<TauH\nbreak;\ncase DrawableSlider slider:\n- if (!slider.SliderHead.IsHit)\n- handleAngled(slider.SliderHead);\n+ switch (slider.SliderHead)\n+ {\n+ case DrawableSliderHead head:\n+ if (!head.IsHit)\n+ handleAngled(head);\n+ break;\n+\n+ case DrawableSliderHardBeat head:\n+ if (!head.IsHit)\n+ handleAngled(head, true);\n+ break;\n+ }\nrequiresHold |= slider.IsWithinPaddle();\nbreak;\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableSlider.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableSlider.cs",
"diff": "@@ -26,14 +26,22 @@ namespace osu.Game.Rulesets.Tau.Objects.Drawables\n{\npublic partial class DrawableSlider : DrawableAngledTauHitObject<Slider>\n{\n- public DrawableSliderHead SliderHead => headContainer.Child;\n+ public Drawable SliderHead => headContainer.Child;\nprivate readonly BindableFloat size = new(16f);\npublic float PathDistance = TauPlayfield.BASE_SIZE.X / 2;\n+ protected override TauAction[] Actions => HitObject.IsHard\n+ ? new[]\n+ {\n+ TauAction.HardButton1,\n+ TauAction.HardButton2\n+ }\n+ : base.Actions;\n+\nprivate readonly SliderPath path;\n- private readonly Container<DrawableSliderHead> headContainer;\n+ private readonly Container headContainer;\nprivate readonly Container<DrawableSliderTick> tickContainer;\nprivate readonly Container<DrawableSliderRepeat> repeatContainer;\nprivate readonly CircularContainer maskingContainer;\n@@ -77,7 +85,7 @@ public DrawableSlider(Slider obj)\n},\n}\n},\n- headContainer = new Container<DrawableSliderHead> { RelativeSizeAxes = Axes.Both },\n+ headContainer = new Container { RelativeSizeAxes = Axes.Both },\ntickContainer = new Container<DrawableSliderTick> { RelativeSizeAxes = Axes.Both },\nrepeatContainer = new Container<DrawableSliderRepeat> { RelativeSizeAxes = Axes.Both },\nslidingSample = new PausableSkinnableSound { Looping = true }\n@@ -98,6 +106,10 @@ protected override void AddNestedHitObject(DrawableHitObject hitObject)\nheadContainer.Child = head;\nbreak;\n+ case DrawableSliderHardBeat head:\n+ headContainer.Child = head;\n+ break;\n+\ncase DrawableSliderRepeat repeat:\nrepeatContainer.Add(repeat);\nbreak;\n@@ -113,6 +125,7 @@ protected override DrawableHitObject CreateNestedHitObject(HitObject hitObject)\n{\nSliderRepeat repeat => new DrawableSliderRepeat(repeat),\nSliderHeadBeat head => new DrawableSliderHead(head),\n+ SliderHardBeat head => new DrawableSliderHardBeat(head),\nSliderTick tick => new DrawableSliderTick(tick),\n_ => base.CreateNestedHitObject(hitObject)\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableSliderHead.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableSliderHead.cs",
"diff": "@@ -8,7 +8,7 @@ public DrawableSliderHead()\n{\n}\n- public DrawableSliderHead(Beat hitObject)\n+ public DrawableSliderHead(SliderHeadBeat hitObject)\n: base(hitObject)\n{\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableStrictHardBeat.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableStrictHardBeat.cs",
"diff": "@@ -52,12 +52,14 @@ public override bool IsWithinPaddle()\nif (CheckValidation == null)\nreturn false;\n- var firstResult = CheckValidation((HitObject.Angle + GetCurrentOffset() + (float)HitObject.Range).Normalize());\n- var secondResult = CheckValidation((HitObject.Angle + GetCurrentOffset()).Normalize());\n+ var firstResult = CheckValidation((HitObject.Angle + GetSliderOffset() + GetCurrentOffset()).Normalize());\n+ var secondResult = CheckValidation((HitObject.Angle + GetSliderOffset() - GetCurrentOffset()).Normalize());\nreturn firstResult.IsValid && secondResult.IsValid;\n}\n+ protected virtual float GetSliderOffset() => 0;\n+\nprotected override float GetCurrentOffset()\n=> (float)(HitObject.Range / 2);\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableTauJudgement.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableTauJudgement.cs",
"diff": "@@ -48,6 +48,7 @@ protected override void PrepareForUse()\nDrawableAngledTauHitObject<Slider> { HitObject: IHasOffsetAngle ang } => ang.GetAbsoluteAngle(),\n// TODO: This should NOT be here.\nDrawableAngledTauHitObject<Beat> { HitObject: IHasOffsetAngle ang } => ang.GetAbsoluteAngle(),\n+ DrawableSliderHardBeat s => s.GetAbsoluteAngle(),\nDrawableBeat b => b.HitObject.Angle,\n_ => 0f\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Drawables/Pieces/StrictHardBeatPiece.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Drawables/Pieces/StrictHardBeatPiece.cs",
"diff": "using osu.Framework.Graphics;\nusing osu.Framework.Graphics.UserInterface;\nusing osu.Framework.Utils;\n-using osu.Game.Rulesets.Tau.UI;\nusing osuTK;\nusing osuTK.Graphics;\n@@ -24,18 +23,27 @@ public StrictHardBeatPiece()\nFillMode = FillMode.Fit;\nInnerRadius = 1f;\n- NoteSize.BindValueChanged(val => InnerRadius = convertNoteSizeToThickness(val.NewValue), true);\nAngleRange.BindValueChanged(val =>\n{\nCurrent.Value = val.NewValue / 360;\n- Rotation = (float)(val.NewValue / 2);\n+ Rotation = -(float)(val.NewValue / 2);\n}, true);\n}\nprivate float toNormalized(float value)\n- => value / TauPlayfield.BASE_SIZE.X;\n+ => value / DrawWidth;\nprivate float convertNoteSizeToThickness(float noteSize)\n=> Interpolation.ValueAt(noteSize, toNormalized(20f), toNormalized(50f), 10f, 25f);\n+\n+ protected override void Update()\n+ {\n+ base.Update();\n+\n+ if (!IsLoaded || NoteSize.Value == 0 || DrawWidth == 0)\n+ return;\n+\n+ InnerRadius = convertNoteSizeToThickness(NoteSize.Value);\n+ }\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Slider.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Slider.cs",
"diff": "@@ -21,6 +21,8 @@ public double Duration\npublic double EndTime => StartTime + Duration;\n+ public bool IsHard { get; set; }\n+\npublic override IList<HitSampleInfo> AuxiliarySamples => CreateSlidingSamples().Concat(TailSamples).ToArray();\npublic IList<HitSampleInfo> CreateSlidingSamples()\n@@ -39,7 +41,7 @@ public IList<HitSampleInfo> CreateSlidingSamples()\n}\n[JsonIgnore]\n- public SliderHeadBeat HeadBeat { get; protected set; }\n+ public AngledTauHitObject HeadBeat { get; protected set; }\n[JsonIgnore]\npublic PolarSliderPath Path { get; set; }\n@@ -93,6 +95,14 @@ protected override void CreateNestedHitObjects(CancellationToken cancellationTok\nswitch (e.Type)\n{\ncase SliderEventType.Head:\n+ if (IsHard)\n+ AddNested(HeadBeat = new SliderHardBeat\n+ {\n+ ParentSlider = this,\n+ StartTime = StartTime,\n+ Angle = Path.Nodes[0].Angle\n+ });\n+ else\nAddNested(HeadBeat = new SliderHeadBeat\n{\nParentSlider = this,\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/UI/TauPlayfield.cs",
"new_path": "osu.Game.Rulesets.Tau/UI/TauPlayfield.cs",
"diff": "using osu.Framework.Graphics.Containers;\nusing osu.Framework.Graphics.Pooling;\nusing osu.Game.Rulesets.Judgements;\n-using osu.Game.Rulesets.Mods;\nusing osu.Game.Rulesets.Objects;\nusing osu.Game.Rulesets.Objects.Drawables;\nusing osu.Game.Rulesets.Scoring;\n@@ -77,7 +76,7 @@ public TauPlayfield()\n}\n[BackgroundDependencyLoader]\n- private void load(IReadOnlyList<Mod> mods)\n+ private void load()\n{\nRegisterPool<Beat, DrawableBeat>(10);\nRegisterPool<HardBeat, DrawableHardBeat>(5);\n@@ -85,6 +84,7 @@ private void load(IReadOnlyList<Mod> mods)\nRegisterPool<Slider, DrawableSlider>(5);\nRegisterPool<SliderHeadBeat, DrawableSliderHead>(5);\n+ RegisterPool<SliderHardBeat, DrawableSliderHardBeat>(5);\nRegisterPool<SliderRepeat, DrawableSliderRepeat>(5);\nRegisterPool<SliderTick, DrawableSliderTick>(10);\n}\n"
}
]
| C# | MIT License | taulazer/tau | Add hard beat type to sliders |
664,859 | 23.08.2022 02:29:30 | 14,400 | 6a0a5fc0fb331a182f1f130cc72e0d2d9bbfdb3b | Allow relax to hit slider hard beats | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Mods/TauModRelax.cs",
"new_path": "osu.Game.Rulesets.Tau/Mods/TauModRelax.cs",
"diff": "@@ -55,15 +55,18 @@ public void Update(Playfield playfield)\nif (hasReplay)\nreturn;\n- checkNormal(playfield, playfield.HitObjectContainer.AliveObjects.OfType<DrawableHitObject<TauHitObject>>().Where(o => o is not DrawableHardBeat));\n- checkHardBeat(playfield, playfield.HitObjectContainer.AliveObjects.OfType<DrawableHardBeat>());\n+ checkNormal(playfield,\n+ playfield.HitObjectContainer.AliveObjects.OfType<DrawableHitObject<TauHitObject>>()\n+ .Where(o => o is not DrawableHardBeat && o is not DrawableStrictHardBeat));\n+ checkHardBeat(playfield,\n+ playfield.HitObjectContainer.AliveObjects.OfType<DrawableHitObject<TauHitObject>>()\n+ .Where(o => o is DrawableHardBeat or DrawableStrictHardBeat or DrawableSlider));\n}\nprivate void checkNormal(Playfield playfield, IEnumerable<DrawableHitObject<TauHitObject>> hitObjects)\n{\nbool requiresHold = false;\nbool requiresHit = false;\n- bool requiresHard = false;\ndouble time = playfield.Clock.CurrentTime;\nforeach (var h in hitObjects)\n@@ -83,24 +86,13 @@ private void checkNormal(Playfield playfield, IEnumerable<DrawableHitObject<TauH\nbreak;\ncase DrawableSlider slider:\n- switch (slider.SliderHead)\n+ if (slider.SliderHead is DrawableSliderHead head)\n{\n- case DrawableSliderHead head:\nif (!head.IsHit)\nhandleAngled(head);\n- break;\n-\n- case DrawableSliderHardBeat head:\n- if (!head.IsHit)\n- handleAngled(head, true);\n- break;\n+ requiresHold = slider.IsWithinPaddle();\n}\n- requiresHold |= slider.IsWithinPaddle();\n- break;\n-\n- case DrawableStrictHardBeat strict:\n- handleAngled(strict, true);\nbreak;\n}\n}\n@@ -111,50 +103,57 @@ private void checkNormal(Playfield playfield, IEnumerable<DrawableHitObject<TauH\nchangeNormalState(true, time);\n}\n- if (requiresHard)\n- {\n- changeHardBeatState(false, time);\n- changeHardBeatState(true, time);\n- }\n-\n- if (hardBeat.isDown && time - lastStateChangeTime > AutoGenerator.KEY_UP_DELAY)\n- changeHardBeatState(false, time);\n-\nif (requiresHold)\nchangeNormalState(true, time);\nelse if (normal.isDown && time - lastStateChangeTime > AutoGenerator.KEY_UP_DELAY)\nchangeNormalState(false, time);\n- void handleAngled<T>(DrawableAngledTauHitObject<T> obj, bool isHard = false)\n+ void handleAngled<T>(DrawableAngledTauHitObject<T> obj)\nwhere T : AngledTauHitObject\n{\nif (!obj.IsWithinPaddle())\nreturn;\nDebug.Assert(obj.HitObject.HitWindows != null);\n- if (isHard)\n- requiresHard |= obj.HitObject.HitWindows.CanBeHit(time - obj.HitObject.StartTime);\n- else\nrequiresHit |= obj.HitObject.HitWindows.CanBeHit(time - obj.HitObject.StartTime);\n}\n}\n- private void checkHardBeat(Playfield playfield, IEnumerable<DrawableHardBeat> hitObjects)\n+ private void checkHardBeat(Playfield playfield, IEnumerable<DrawableHitObject<TauHitObject>> hitObjects)\n{\nbool requiresHit = false;\n+ bool requiresHold = false;\ndouble time = playfield.Clock.CurrentTime;\n- foreach (var hb in hitObjects)\n+ foreach (var h in hitObjects)\n{\n// we are not yet close enough to the object.\n- if (time < hb.HitObject.StartTime - relax_leniency)\n+ if (time < h.HitObject.StartTime - relax_leniency)\nbreak;\n- if (hb.IsHit)\n+ if (h.IsHit || (h.HitObject is IHasDuration hasEnd && time > hasEnd.EndTime))\ncontinue;\n- Debug.Assert(hb.HitObject.HitWindows != null);\n- requiresHit |= hb.HitObject.HitWindows.CanBeHit(time - hb.HitObject.StartTime);\n+ switch (h)\n+ {\n+ case DrawableHardBeat hb:\n+ handleObject(hb);\n+ break;\n+\n+ case DrawableStrictHardBeat strict:\n+ handleAngled(strict);\n+ break;\n+\n+ case DrawableSlider slider:\n+ if (slider.SliderHead is DrawableSliderHardBeat shb)\n+ {\n+ if (!shb.IsHit)\n+ handleAngled(shb);\n+ requiresHold = slider.IsWithinPaddle();\n+ }\n+\n+ break;\n+ }\n}\nif (requiresHit)\n@@ -163,8 +162,27 @@ private void checkHardBeat(Playfield playfield, IEnumerable<DrawableHardBeat> hi\nchangeHardBeatState(true, time);\n}\n- if (hardBeat.isDown && time - lastStateChangeTime > AutoGenerator.KEY_UP_DELAY)\n+ if (requiresHold)\n+ changeHardBeatState(true, time);\n+ else if (hardBeat.isDown && time - lastStateChangeTime > AutoGenerator.KEY_UP_DELAY)\nchangeHardBeatState(false, time);\n+\n+ void handleAngled<T>(DrawableAngledTauHitObject<T> obj)\n+ where T : AngledTauHitObject\n+ {\n+ if (!obj.IsWithinPaddle())\n+ return;\n+\n+ Debug.Assert(obj.HitObject.HitWindows != null);\n+ requiresHit |= obj.HitObject.HitWindows.CanBeHit(time - obj.HitObject.StartTime);\n+ }\n+\n+ void handleObject<T>(DrawableTauHitObject<T> obj)\n+ where T : TauHitObject\n+ {\n+ Debug.Assert(obj.HitObject.HitWindows != null);\n+ requiresHit |= obj.HitObject.HitWindows.CanBeHit(time - obj.HitObject.StartTime);\n+ }\n}\nprivate void changeState(bool down, double time, ref (bool isDown, bool wasLeft) hitObject, TauAction left, TauAction right)\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableSliderHardBeat.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableSliderHardBeat.cs",
"diff": "@@ -13,7 +13,7 @@ public DrawableSliderHardBeat()\npublic DrawableSliderHardBeat(SliderHardBeat hitObject)\n: base(hitObject)\n{\n- Scale = new Vector2(1.05f);\n+ Scale = new Vector2(1.025f);\n}\nprotected override float GetSliderOffset() => DrawableSlider.HitObject.Angle;\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableTauJudgement.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableTauJudgement.cs",
"diff": "@@ -49,6 +49,7 @@ protected override void PrepareForUse()\n// TODO: This should NOT be here.\nDrawableAngledTauHitObject<Beat> { HitObject: IHasOffsetAngle ang } => ang.GetAbsoluteAngle(),\nDrawableSliderHardBeat s => s.GetAbsoluteAngle(),\n+ DrawableStrictHardBeat s => s.HitObject.Angle,\nDrawableBeat b => b.HitObject.Angle,\n_ => 0f\n};\n"
}
]
| C# | MIT License | taulazer/tau | Allow relax to hit slider hard beats |
664,859 | 23.08.2022 02:34:29 | 14,400 | cb6adf0ccd452adf415c4c9579ea6850782f5d8f | Fix sizing issue with inverse mod | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableStrictHardBeat.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableStrictHardBeat.cs",
"diff": "using osu.Game.Rulesets.Objects.Drawables;\nusing osu.Game.Rulesets.Tau.Objects.Drawables.Pieces;\nusing osu.Game.Rulesets.Tau.UI;\n-using osuTK;\nusing osuTK.Graphics;\nnamespace osu.Game.Rulesets.Tau.Objects.Drawables\n@@ -73,9 +72,9 @@ protected override void UpdateInitialTransforms()\nthis.FadeIn(HitObject.TimeFadeIn);\nif (properties != null && properties.InverseModEnabled.Value)\n- this.ResizeTo(2);\n+ piece.ResizeTo(2);\n- piece.ResizeTo(Vector2.One, HitObject.TimePreempt);\n+ piece.ResizeTo(1, HitObject.TimePreempt);\n}\n[Resolved]\n"
}
]
| C# | MIT License | taulazer/tau | Fix sizing issue with inverse mod |
664,859 | 23.08.2022 07:32:41 | 14,400 | 6c120e9e4c4c4c96cc8964bb2ba7fb351cfa45a7 | Autoplay strict hard beat handling | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Replays/TauAutoGenerator.cs",
"new_path": "osu.Game.Rulesets.Tau/Replays/TauAutoGenerator.cs",
"diff": "@@ -128,7 +128,7 @@ private void moveToHitObject(TauHitObject h, Vector2 targetPos, Easing easing)\nprivate void addHitObjectClickFrames(TauHitObject h, Vector2 startPosition)\n{\nvar action = buttonIndex1 % 2 == 0 ? TauAction.LeftButton : TauAction.RightButton;\n- if (h is HardBeat)\n+ if (h is HardBeat or StrictHardBeat)\naction = buttonIndex2 % 2 == 0 ? TauAction.HardButton1 : TauAction.HardButton2;\nvar startFrame = new TauReplayFrame(h.StartTime, startPosition, action);\n@@ -150,7 +150,7 @@ private void addHitObjectClickFrames(TauHitObject h, Vector2 startPosition)\n{\nif (previousActions.Contains(action))\n{\n- if (h is HardBeat)\n+ if (h is HardBeat or StrictHardBeat)\naction = action == TauAction.HardButton1 ? TauAction.HardButton2 : TauAction.HardButton1;\nelse\naction = action == TauAction.LeftButton ? TauAction.RightButton : TauAction.LeftButton;\n@@ -181,6 +181,9 @@ private void addHitObjectClickFrames(TauHitObject h, Vector2 startPosition)\nif (h is Slider s)\n{\n+ if (s.IsHard)\n+ action = buttonIndex2 % 2 == 0 ? TauAction.HardButton1 : TauAction.HardButton2;\n+\nforeach (var node in s.Path.Nodes)\n{\nvar pos = getGameplayPositionFromAngle(s.GetAbsoluteAngle(node));\n"
}
]
| C# | MIT License | taulazer/tau | Autoplay strict hard beat handling |
664,859 | 23.08.2022 07:49:46 | 14,400 | 6ecc2b28d66de987d81fdce95848585027119d5f | Apply strict hard beat into difficulty calculation | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Evaluators/AimEvaluator.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Evaluators/AimEvaluator.cs",
"diff": "@@ -13,7 +13,7 @@ public static double EvaluateDifficulty(TauAngledDifficultyHitObject current, Ta\n{\ndouble velocity = calculateVelocity(current.Distance, current.StrainTime);\n- if (!allowedHitObjects.Any(t => t == typeof(Slider) && last.BaseObject is Slider))\n+ if (allowedHitObjects.Any(t => t == typeof(Slider) && last.BaseObject is not Slider))\nreturn velocity;\n// Slider calculation\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Evaluators/ComplexityEvaluator.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Evaluators/ComplexityEvaluator.cs",
"diff": "@@ -134,7 +134,15 @@ private static double repetitionPenalty(int notesSince)\n=> Math.Min(1.0, 0.032 * notesSince);\nprivate static HitType getHitType(TauDifficultyHitObject hitObject)\n- => hitObject.BaseObject is AngledTauHitObject ? HitType.Angled : HitType.HardBeat;\n+ {\n+ if (hitObject.BaseObject is StrictHardBeat)\n+ return HitType.HardBeat;\n+\n+ if (hitObject.BaseObject.NestedHitObjects.Count > 0 && hitObject.BaseObject.NestedHitObjects[0] is SliderHardBeat)\n+ return HitType.HardBeat;\n+\n+ return hitObject.BaseObject is AngledTauHitObject ? HitType.Angled : HitType.HardBeat;\n+ }\nprivate enum HitType\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauAngledDifficultyHitObject.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Preprocessing/TauAngledDifficultyHitObject.cs",
"diff": "@@ -47,10 +47,14 @@ public class TauAngledDifficultyHitObject : TauDifficultyHitObject\nfloat offset = 0;\nif (lastAngled.BaseObject is IHasOffsetAngle offsetAngle)\n- offset = offsetAngle.GetOffsetAngle();\n+ offset += offsetAngle.GetOffsetAngle();\nDistance = Math.Abs(Extensions.GetDeltaAngle(firstAngled.Angle, (lastAngled.BaseObject.Angle + offset)));\nStrainTime = Math.Max(StrainTime, StartTime - lastAngled.StartTime);\n+\n+ // Have to aim the entirety of the strict hard beat, so let's increase the distance manually\n+ if (lastAngled.BaseObject is StrictHardBeat strict)\n+ Distance += (float)(strict.Range / 2);\n}\nif (hitObject is Slider slider)\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/TauDifficultyCalculator.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/TauDifficultyCalculator.cs",
"diff": "@@ -112,8 +112,8 @@ protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clo\nhitWindowGreat = hitWindows.WindowFor(HitResult.Great) / clockRate;\nreturn new Skill[]\n{\n- new Aim(mods, new[] { typeof(Beat), typeof(SliderRepeat), typeof(Slider) }),\n- new Aim(mods, new[] { typeof(Beat) }),\n+ new Aim(mods, new[] { typeof(Beat), typeof(StrictHardBeat), typeof(SliderRepeat), typeof(Slider) }),\n+ new Aim(mods, new[] { typeof(Beat), typeof(StrictHardBeat) }),\nnew Speed(mods, hitWindowGreat),\nnew Complexity(mods)\n};\n@@ -130,6 +130,7 @@ protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clo\nnew TauModHardRock(),\nnew TauModDoubleTime(),\nnew TauModNightcore(),\n+ new TauModStrict(),\n// Automation\nnew TauModRelax(),\n"
}
]
| C# | MIT License | taulazer/tau | Apply strict hard beat into difficulty calculation |
664,859 | 23.08.2022 08:03:44 | 14,400 | 582fe766f8d37954ebf1503da9ff88354e2ab536 | Schedule addition of adjustment container | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau.Tests/Objects/TestSceneSliderHardBeat.cs",
"new_path": "osu.Game.Rulesets.Tau.Tests/Objects/TestSceneSliderHardBeat.cs",
"diff": "@@ -16,11 +16,13 @@ public class TestSceneSliderHardBeat : TauTestScene\n{\nprivate int depthIndex;\n+ private TauPlayfieldAdjustmentContainer container;\n+\n[Test]\npublic void TestSingleSlider()\n{\n- TauPlayfieldAdjustmentContainer container;\n- Add(container = new TauPlayfieldAdjustmentContainer());\n+ AddStep(\"clear screen\", Clear);\n+ AddStep(\"add container\", () => Add(container = new TauPlayfieldAdjustmentContainer()));\nAddStep(\"Miss Single\", () => container.Add(testSingle()));\nAddStep(\"Hit Single\", () => container.Add(testSingle(true)));\n@@ -30,8 +32,8 @@ public void TestSingleSlider()\n[Test]\npublic void TestSliderPerformance()\n{\n- TauPlayfieldAdjustmentContainer container;\n- Add(container = new TauPlayfieldAdjustmentContainer());\n+ AddStep(\"clear screen\", Clear);\n+ AddStep(\"add container\", () => Add(container = new TauPlayfieldAdjustmentContainer()));\nAddStep(\"Miss Single\", () => container.AddRange(testMultiple(100)));\nAddStep(\"Hit Single\", () => container.AddRange(testMultiple(100, true)));\n"
}
]
| C# | MIT License | taulazer/tau | Schedule addition of adjustment container |
664,859 | 24.08.2022 00:16:12 | 14,400 | e6e2e57feb782efc23a1a850066e0e84b2cc025b | Add localisation for lenience and strict mods | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Localisation/ModStrings.cs",
"new_path": "osu.Game.Rulesets.Tau/Localisation/ModStrings.cs",
"diff": "@@ -156,6 +156,26 @@ public static LocalisableString TraceableDescription\n#endregion\n+ #region Lenience\n+\n+ /// <summary>\n+ /// \"Hard beats are more forgiving\"\n+ /// </summary>\n+ public static LocalisableString LenienceDescription\n+ => new TranslatableString(getKey(@\"lenience_description\"), @\"Hard beats are more forgiving\");\n+\n+ #endregion\n+\n+ #region Strict\n+\n+ /// <summary>\n+ /// \"Aim the hard beats!\"\n+ /// </summary>\n+ public static LocalisableString StrictDescription\n+ => new TranslatableString(getKey(@\"strict_description\"), @\"Aim the hard beats!\");\n+\n+ #endregion\n+\nprivate static string getKey(string key) => $@\"{prefix}:{key}\";\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Mods/TauModLenience.cs",
"new_path": "osu.Game.Rulesets.Tau/Mods/TauModLenience.cs",
"diff": "using System.Diagnostics;\nusing System.Linq;\nusing osu.Framework.Input.Events;\n+using osu.Framework.Localisation;\nusing osu.Game.Beatmaps;\nusing osu.Game.Rulesets.Mods;\nusing osu.Game.Rulesets.Scoring;\nusing osu.Game.Rulesets.Tau.Beatmaps;\n+using osu.Game.Rulesets.Tau.Localisation;\nusing osu.Game.Rulesets.Tau.Objects;\nusing osu.Game.Rulesets.Tau.Objects.Drawables;\nusing osu.Game.Rulesets.UI;\n@@ -15,7 +17,7 @@ namespace osu.Game.Rulesets.Tau.Mods\npublic class TauModLenience : Mod, IApplicableAfterBeatmapConversion, IApplicableToDrawableRuleset<TauHitObject>\n{\npublic override string Name => \"Lenience\";\n- public override string Description => \"Hard beats are more forgiving\";\n+ public override LocalisableString Description => ModStrings.LenienceDescription;\npublic override double ScoreMultiplier => 0.6;\npublic override string Acronym => \"LN\";\npublic override ModType Type => ModType.DifficultyReduction;\n"
}
]
| C# | MIT License | taulazer/tau | Add localisation for lenience and strict mods |
664,859 | 24.08.2022 00:27:40 | 14,400 | b18ae5024d2e523b08b7fbfd20489036adec65bb | Include new localization resource files | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/osu.Game.Rulesets.Tau.csproj",
"new_path": "osu.Game.Rulesets.Tau/osu.Game.Rulesets.Tau.csproj",
"diff": "<EmbeddedResource Update=\"Localisation\\Translations\\Settings.*.resx\">\n<DependentUpon>Settings.resx</DependentUpon>\n</EmbeddedResource>\n- <EmbeddedResource Update=\"Localisation\\Translations\\Inputs.resx\">\n- <Generator>ResXFileCodeGenerator</Generator>\n- <LastGenOutput>Inputs.Designer.cs</LastGenOutput>\n+ <EmbeddedResource Update=\"Localisation\\Translations\\UI.*.resx\">\n+ <DependentUpon>UI.resx</DependentUpon>\n+ </EmbeddedResource>\n+ <EmbeddedResource Update=\"Localisation\\Translations\\Mods.*.resx\">\n+ <DependentUpon>Mods.resx</DependentUpon>\n</EmbeddedResource>\n</ItemGroup>\n<ItemGroup>\n"
}
]
| C# | MIT License | taulazer/tau | Include new localization resource files |
664,859 | 24.08.2022 00:55:59 | 14,400 | 4d35971a9ae7389d0b3e5f1e3369b6a2e77ab309 | Add missing localisation strings | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Localisation/ModStrings.cs",
"new_path": "osu.Game.Rulesets.Tau/Localisation/ModStrings.cs",
"diff": "@@ -6,6 +6,88 @@ public class ModStrings\n{\nprivate const string prefix = @\"osu.Game.Rulesets.Tau.Localisation.Translations.Mods\";\n+ #region Difficulty Adjust\n+\n+ /// <summary>\n+ /// \"Paddle Size\"\n+ /// </summary>\n+ public static LocalisableString DifficultyAdjustPaddleSizeName\n+ => new TranslatableString(getKey(@\"difficulty_adjust_paddle_size_name\"), @\"Paddle Size\");\n+\n+ /// <summary>\n+ /// \"Override a beatmap's set PS.\"\n+ /// </summary>\n+ public static LocalisableString DifficultyAdjustPaddleSizeDescription\n+ => new TranslatableString(getKey(@\"difficulty_adjust_paddle_size_description\"), @\"Override a beatmap's set PS.\");\n+\n+ /// <summary>\n+ /// \"Approach Rate\"\n+ /// </summary>\n+ public static LocalisableString DifficultyAdjustApproachRateName\n+ => new TranslatableString(getKey(@\"difficulty_adjust_approach_rate_name\"), @\"Approach Rate\");\n+\n+ /// <summary>\n+ /// \"Override a beatmap's set AR.\"\n+ /// </summary>\n+ public static LocalisableString DifficultyAdjustApproachRateDescription\n+ => new TranslatableString(getKey(@\"difficulty_adjust_approach_rate_description\"), @\"Override a beatmap's set AR.\");\n+\n+ #endregion\n+\n+ #region Dual\n+\n+ /// <summary>\n+ /// \"When one isn't enough\"\n+ /// </summary>\n+ public static LocalisableString DualDescription\n+ => new TranslatableString(getKey(@\"dual_description\"), @\"When one isn't enough\");\n+\n+ /// <summary>\n+ /// \"Paddle count\"\n+ /// </summary>\n+ public static LocalisableString DualPaddleCountName\n+ => new TranslatableString(getKey(@\"dual_paddle_count_name\"), @\"Paddle count\");\n+\n+ #endregion\n+\n+ #region Easy\n+\n+ /// <summary>\n+ /// \"Larger paddle, more forgiving HP drain, less accuracy required, and three lives!\"\n+ /// </summary>\n+ public static LocalisableString EasyDescription\n+ => new TranslatableString(getKey(@\"easy_description\"), @\"Larger paddle, more forgiving HP drain, less accuracy required, and three lives!\");\n+\n+ #endregion\n+\n+ #region Flashlight\n+\n+ /// <summary>\n+ /// \"Flashlight size\"\n+ /// </summary>\n+ public static LocalisableString FlashlightSizeName\n+ => new TranslatableString(getKey(@\"flashlight_size_name\"), @\"Flashlight size\");\n+\n+ /// <summary>\n+ /// \"Multiplier applied to the default flashlight size.\"\n+ /// </summary>\n+ public static LocalisableString FlashlightSizeDescription\n+ => new TranslatableString(getKey(@\"flashlight_size_description\"), @\"Multiplier applied to the default flashlight size.\");\n+\n+ /// <summary>\n+ /// \"Change size based on combo\"\n+ /// </summary>\n+ public static LocalisableString FlashlightComboName\n+ => new TranslatableString(getKey(@\"flashlight_combo_name\"), @\"Change size based on combo\");\n+\n+ /// <summary>\n+ /// \"Change size based on combo\"\n+ /// </summary>\n+ public static LocalisableString FlashlightComboDescription\n+ => new TranslatableString(getKey(@\"flashlight_combo_description\"), @\"Decrease the flashlight size as combo increases.\");\n+\n+ #endregion\n+\n#region Autopilot\n/// <summary>\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Localisation/Translations/Mods.resx",
"new_path": "osu.Game.Rulesets.Tau/Localisation/Translations/Mods.resx",
"diff": "</xsd:complexType>\n</xsd:element>\n</xsd:schema>\n+ <data name=\"difficulty_adjust_paddle_size_name\" xml:space=\"preserve\">\n+ <value>Paddle Size</value>\n+ </data>\n+ <data name=\"difficulty_adjust_paddle_size_description\" xml:space=\"preserve\">\n+ <value>Override a beatmap's set PS.</value>\n+ </data>\n+ <data name=\"difficulty_adjust_approach_rate_name\" xml:space=\"preserve\">\n+ <value>Approach Rate</value>\n+ </data>\n+ <data name=\"difficulty_adjust_approach_rate_description\" xml:space=\"preserve\">\n+ <value>Override a beatmap's set AR.</value>\n+ </data>\n+\n+ <data name=\"dual_description\" xml:space=\"preserve\">\n+ <value>When one isn't enough</value>\n+ </data>\n+ <data name=\"dual_paddle_count_name\" xml:space=\"preserve\">\n+ <value>Paddle count</value>\n+ </data>\n+\n+ <data name=\"easy_description\" xml:space=\"preserve\">\n+ <value>Larger paddle, more forgiving HP drain, less accuracy required, and three lives!</value>\n+ </data>\n+\n+ <data name=\"flashlight_size_name\" xml:space=\"preserve\">\n+ <value>Flashlight size</value>\n+ </data>\n+ <data name=\"flashlight_size_description\" xml:space=\"preserve\">\n+ <value>Multiplier applied to the default flashlight size.</value>\n+ </data>\n+ <data name=\"flashlight_combo_name\" xml:space=\"preserve\">\n+ <value>Change size based on combo</value>\n+ </data>\n+ <data name=\"flashlight_combo_description\" xml:space=\"preserve\">\n+ <value>Decrease the flashlight size as combo increases.</value>\n+ </data>\n+\n<data name=\"autopilot_description\" xml:space=\"preserve\">\n<value>Automatic paddle movement - just follow the rhythm.</value>\n</data>\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Mods/TauModDifficultyAdjust.cs",
"new_path": "osu.Game.Rulesets.Tau/Mods/TauModDifficultyAdjust.cs",
"diff": "using osu.Game.Beatmaps;\nusing osu.Game.Configuration;\nusing osu.Game.Rulesets.Mods;\n+using osu.Game.Rulesets.Tau.Localisation;\nnamespace osu.Game.Rulesets.Tau.Mods\n{\npublic class TauModDifficultyAdjust : ModDifficultyAdjust\n{\n- [SettingSource(\"Paddle Size\", \"Override a beatmap's set PS.\", FIRST_SETTING_ORDER - 1, SettingControlType = typeof(DifficultyAdjustSettingsControl))]\n+ [SettingSource(typeof(ModStrings), nameof(ModStrings.DifficultyAdjustPaddleSizeName), nameof(ModStrings.DifficultyAdjustPaddleSizeDescription),\n+ FIRST_SETTING_ORDER - 1, SettingControlType = typeof(DifficultyAdjustSettingsControl))]\npublic DifficultyBindable PaddleSize { get; } = new DifficultyBindable\n{\nPrecision = 0.1f,\n@@ -17,7 +19,9 @@ public class TauModDifficultyAdjust : ModDifficultyAdjust\nReadCurrentFromDifficulty = diff => diff.CircleSize,\n};\n- [SettingSource(\"Approach Rate\", \"Override a beatmap's set AR.\", LAST_SETTING_ORDER + 1, SettingControlType = typeof(DifficultyAdjustSettingsControl))]\n+ // [SettingSource(\"Approach Rate\", \"Override a beatmap's set AR.\", LAST_SETTING_ORDER + 1, SettingControlType = typeof(DifficultyAdjustSettingsControl))]\n+ [SettingSource(typeof(ModStrings), nameof(ModStrings.DifficultyAdjustApproachRateName), nameof(ModStrings.DifficultyAdjustApproachRateDescription),\n+ FIRST_SETTING_ORDER + 1, SettingControlType = typeof(DifficultyAdjustSettingsControl))]\npublic DifficultyBindable ApproachRate { get; } = new DifficultyBindable\n{\nPrecision = 0.1f,\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Mods/TauModDual.cs",
"new_path": "osu.Game.Rulesets.Tau/Mods/TauModDual.cs",
"diff": "using osu.Framework.Localisation;\nusing osu.Game.Configuration;\nusing osu.Game.Rulesets.Mods;\n+using osu.Game.Rulesets.Tau.Localisation;\nnamespace osu.Game.Rulesets.Tau.Mods\n{\n@@ -9,13 +10,13 @@ public class TauModDual : Mod\n{\npublic override string Name => \"Dual\";\npublic override string Acronym => \"DL\";\n- public override LocalisableString Description => \"When one isn't enough\";\n+ public override LocalisableString Description => ModStrings.DualDescription;\npublic override double ScoreMultiplier => 1;\npublic override ModType Type => ModType.Fun;\npublic override bool HasImplementation => true;\n- [SettingSource(\"Paddle count\")]\n+ [SettingSource(typeof(ModStrings), nameof(ModStrings.DualPaddleCountName))]\npublic BindableNumber<int> PaddleCount { get; } = new()\n{\nValue = 2,\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Mods/TauModFlashlight.cs",
"new_path": "osu.Game.Rulesets.Tau/Mods/TauModFlashlight.cs",
"diff": "using osu.Game.Rulesets.Mods;\nusing osu.Game.Rulesets.Objects;\nusing osu.Game.Rulesets.Scoring;\n+using osu.Game.Rulesets.Tau.Localisation;\nusing osu.Game.Rulesets.Tau.Objects;\nusing osu.Game.Rulesets.Tau.UI;\nusing osu.Game.Rulesets.UI;\n@@ -30,7 +31,7 @@ public class TauModFlashlight : TauModFlashlight<TauHitObject>\npublic override float DefaultFlashlightSize => 0;\n- [SettingSource(\"Flashlight size\", \"Multiplier applied to the default flashlight size.\")]\n+ [SettingSource(typeof(ModStrings), nameof(ModStrings.FlashlightSizeName), nameof(ModStrings.FlashlightSizeDescription))]\npublic override BindableFloat SizeMultiplier { get; } = new BindableFloat\n{\nMinValue = 0.5f,\n@@ -40,7 +41,7 @@ public class TauModFlashlight : TauModFlashlight<TauHitObject>\nPrecision = 0.1f\n};\n- [SettingSource(\"Change size based on combo\", \"Decrease the flashlight size as combo increases.\")]\n+ [SettingSource(typeof(ModStrings), nameof(ModStrings.FlashlightComboName), nameof(ModStrings.FlashlightComboDescription))]\npublic override BindableBool ComboBasedSize { get; } = new BindableBool\n{\nDefault = true,\n"
}
]
| C# | MIT License | taulazer/tau | Add missing localisation strings |
664,859 | 24.08.2022 01:08:04 | 14,400 | 8de828a213f10b6da476de68cf36cfdb92ee184d | ...even more missing localization strings | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Localisation/Translations/Mods.resx",
"new_path": "osu.Game.Rulesets.Tau/Localisation/Translations/Mods.resx",
"diff": "<data name=\"no_scope_description\" xml:space=\"preserve\">\n<value>Where's the paddle?</value>\n</data>\n+ <data name=\"no_scope_threshold_name\" xml:space=\"preserve\">\n+ <value>Hidden at combo</value>\n+ </data>\n<data name=\"no_scope_threshold_description\" xml:space=\"preserve\">\n<value>The combo count at which the paddle becomes completely hidden</value>\n</data>\n"
}
]
| C# | MIT License | taulazer/tau | ...even more missing localization strings |
664,859 | 02.09.2022 06:48:10 | 14,400 | b3d0232b29ddbb991b9faf2739a13ff74b5eb1bb | Apply `RulesetAPIVersionSupported` changes | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/TauRuleset.cs",
"new_path": "osu.Game.Rulesets.Tau/TauRuleset.cs",
"diff": "@@ -36,6 +36,8 @@ public class TauRuleset : Ruleset\n{\npublic const string SHORT_NAME = \"tau\";\n+ public override string RulesetAPIVersionSupported => CURRENT_RULESET_API_VERSION;\n+\npublic override string Description => SHORT_NAME;\npublic override string ShortName => SHORT_NAME;\npublic override string PlayingVerb => \"Slicing beats\";\n"
}
]
| C# | MIT License | taulazer/tau | Apply `RulesetAPIVersionSupported` changes |
664,869 | 05.09.2022 16:37:40 | 14,400 | 3d67942ccbf14110d6a683817bcb70e11ad15eae | Update readme with special thanks | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -63,6 +63,14 @@ For new ideas and features, we would prefer for you to write an issue before try\nIf you wish to help with localisation efforts, head over to [crowdin](https://crowdin.com/project/tau).\n+### Special thanks\n+\n+Thanks to each and every contributor to [this project](https://github.com/taulazer/tau/graphs/contributors).\n+\n+Thanks to all of those who have helped with localization efforts. Members includes (as of 2022, September 5th): [Akira](https://crowdin.com/profile/princessakira), [KalTa](https://crowdin.com/profile/kalta289), [Loreos](https://crowdin.com/profile/loreos), [MioStream_](https://crowdin.com/profile/miostream_), [Morco011](https://crowdin.com/profile/morcooooooo), [Nooraldeen Samir](https://crowdin.com/profile/noordlee), and [Peri](https://crowdin.com/profile/perigee).\n+\n+Thanks to all of the amazing people within our discord community.\n+\n## License\ntau is licenced under the [MIT](https://opensource.org/licenses/MIT) License. For licensing information, refer to the [license file](https://github.com/Altenhh/tau/blob/master/LICENSE) regarding what is permitted regarding the codebase of tau.\n"
}
]
| C# | MIT License | taulazer/tau | Update readme with special thanks |
664,859 | 24.10.2022 14:52:36 | 14,400 | e899ae55de7a5c2f238562440ff553cd97ead689 | Fix strict hard beats not applying correct size | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/osu.Game.Rulesets.Tau.csproj",
"new_path": "osu.Game.Rulesets.Tau/osu.Game.Rulesets.Tau.csproj",
"diff": "<None Remove=\"Resources\\Shaders\\sh_DepthMask.vs\" />\n</ItemGroup>\n<ItemGroup>\n- <PackageReference Include=\"ppy.osu.Game\" Version=\"2022.911.0\" />\n+ <PackageReference Include=\"ppy.osu.Game\" Version=\"2022.1022.0\" />\n</ItemGroup>\n<ItemGroup>\n<Compile Update=\"Objects\\Drawables\\DrawableSlider.Calculations.cs\">\n"
}
]
| C# | MIT License | taulazer/tau | Fix strict hard beats not applying correct size |
664,859 | 24.10.2022 15:01:03 | 14,400 | c68779c6fa13f0382a77c3caf974bf54eaab68af | Remove manual `CreateSlidingSamples()` function | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Slider.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Slider.cs",
"diff": "@@ -25,21 +25,6 @@ public double Duration\npublic override IList<HitSampleInfo> AuxiliarySamples => CreateSlidingSamples().Concat(TailSamples).ToArray();\n- public IList<HitSampleInfo> CreateSlidingSamples()\n- {\n- var slidingSamples = new List<HitSampleInfo>();\n-\n- var normalSample = Samples.FirstOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL);\n- if (normalSample != null)\n- slidingSamples.Add(normalSample.With(\"sliderslide\"));\n-\n- var whistleSample = Samples.FirstOrDefault(s => s.Name == HitSampleInfo.HIT_WHISTLE);\n- if (whistleSample != null)\n- slidingSamples.Add(whistleSample.With(\"sliderwhistle\"));\n-\n- return slidingSamples;\n- }\n-\n[JsonIgnore]\npublic AngledTauHitObject HeadBeat { get; protected set; }\n"
}
]
| C# | MIT License | taulazer/tau | Remove manual `CreateSlidingSamples()` function |
664,859 | 26.11.2022 10:16:03 | 18,000 | 012c8730d270db8b18637c679c691d4ebc32d9b7 | Difficulty balance pass | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"diff": "@@ -11,8 +11,8 @@ public class Aim : StrainDecaySkill\n{\nprivate readonly Type[] allowedHitObjects;\n- protected override double SkillMultiplier => 10;\n- protected override double StrainDecayBase => 0.2;\n+ protected override double SkillMultiplier => 7;\n+ protected override double StrainDecayBase => 0.25;\npublic Aim(Mod[] mods, Type[] allowedHitObjects)\n: base(mods)\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Speed.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Speed.cs",
"diff": "@@ -7,7 +7,7 @@ namespace osu.Game.Rulesets.Tau.Difficulty.Skills\n{\npublic class Speed : TauStrainSkill\n{\n- private const double skill_multiplier = 510;\n+ private const double skill_multiplier = 520;\nprivate const double strain_decay_base = 0.3;\nprivate readonly double greatWindow;\n@@ -16,7 +16,7 @@ public class Speed : TauStrainSkill\nprivate double currentRhythm;\nprotected override int ReducedSectionCount => 5;\n- protected override double DifficultyMultiplier => 1.20;\n+ protected override double DifficultyMultiplier => 1.4;\npublic Speed(Mod[] mods, double hitWindowGreat)\n: base(mods)\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/TauDifficultyCalculator.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/TauDifficultyCalculator.cs",
"diff": "@@ -44,6 +44,12 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat\ncomplexity = 0.0;\n}\n+ if (mods.Any(m => m is TauModAutopilot))\n+ {\n+ aim = 0.0;\n+ aimNoSliders = 0.0;\n+ }\n+\ndouble preempt = IBeatmapDifficultyInfo.DifficultyRange(beatmap.Difficulty.ApproachRate, 1800, 1200, 450) / clockRate;\ndouble baseAim = Math.Pow(5 * Math.Max(1, aim / 0.0675) - 4, 3) / 100000;\n"
}
]
| C# | MIT License | taulazer/tau | Difficulty balance pass |
664,859 | 27.11.2022 11:12:06 | 18,000 | bc49eda72ee7476924406130cf83343c941d6720 | Another difficulty balancing | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"diff": "@@ -11,7 +11,7 @@ public class Aim : StrainDecaySkill\n{\nprivate readonly Type[] allowedHitObjects;\n- protected override double SkillMultiplier => 7;\n+ protected override double SkillMultiplier => 8;\nprotected override double StrainDecayBase => 0.25;\npublic Aim(Mod[] mods, Type[] allowedHitObjects)\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Complexity.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Complexity.cs",
"diff": "@@ -7,9 +7,9 @@ namespace osu.Game.Rulesets.Tau.Difficulty.Skills\n{\npublic class Complexity : StrainDecaySkill\n{\n- protected override double SkillMultiplier => 50;\n+ protected override double SkillMultiplier => 55;\n- protected override double StrainDecayBase => 0.4;\n+ protected override double StrainDecayBase => 0.35;\npublic Complexity(Mod[] mods)\n: base(mods)\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Speed.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Speed.cs",
"diff": "@@ -7,7 +7,7 @@ namespace osu.Game.Rulesets.Tau.Difficulty.Skills\n{\npublic class Speed : TauStrainSkill\n{\n- private const double skill_multiplier = 520;\n+ private const double skill_multiplier = 515;\nprivate const double strain_decay_base = 0.3;\nprivate readonly double greatWindow;\n@@ -16,7 +16,7 @@ public class Speed : TauStrainSkill\nprivate double currentRhythm;\nprotected override int ReducedSectionCount => 5;\n- protected override double DifficultyMultiplier => 1.4;\n+ protected override double DifficultyMultiplier => 1.3;\npublic Speed(Mod[] mods, double hitWindowGreat)\n: base(mods)\n"
}
]
| C# | MIT License | taulazer/tau | Another difficulty balancing |
664,859 | 27.11.2022 12:12:48 | 18,000 | a1220dbc4ab55c5871860f63047f40f02ca96df6 | Loosely check for autopilot | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/TauDifficultyCalculator.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/TauDifficultyCalculator.cs",
"diff": "@@ -44,7 +44,7 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat\ncomplexity = 0.0;\n}\n- if (mods.Any(m => m is TauModAutopilot))\n+ if (mods.Any(m => m.Name == \"Autopilot\"))\n{\naim = 0.0;\naimNoSliders = 0.0;\n"
}
]
| C# | MIT License | taulazer/tau | Loosely check for autopilot |
664,859 | 27.11.2022 12:14:50 | 18,000 | 010fa11eca6cecbcb69dad007c562e3eb43e0d06 | Loosely check for relax | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/TauDifficultyCalculator.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/TauDifficultyCalculator.cs",
"diff": "@@ -38,7 +38,7 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat\ndouble speed = Math.Sqrt(skills[2].DifficultyValue()) * difficulty_multiplier;\ndouble complexity = Math.Sqrt(skills[3].DifficultyValue()) * difficulty_multiplier;\n- if (mods.Any(m => m is TauModRelax))\n+ if (mods.Any(m => m.Name == \"Relax\"))\n{\nspeed = 0.0;\ncomplexity = 0.0;\n"
}
]
| C# | MIT License | taulazer/tau | Loosely check for relax |
664,859 | 27.11.2022 12:20:56 | 18,000 | a92a29020ac03749c7616cd7e9acd7ea2c7c5fc7 | Lower aim values | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"diff": "@@ -11,8 +11,8 @@ public class Aim : StrainDecaySkill\n{\nprivate readonly Type[] allowedHitObjects;\n- protected override double SkillMultiplier => 8;\n- protected override double StrainDecayBase => 0.25;\n+ protected override double SkillMultiplier => 7.5;\n+ protected override double StrainDecayBase => 0.225;\npublic Aim(Mod[] mods, Type[] allowedHitObjects)\n: base(mods)\n"
}
]
| C# | MIT License | taulazer/tau | Lower aim values |
664,859 | 27.11.2022 13:05:10 | 18,000 | 1fcb39b6926c6a3f7f70f38d3781293b5d6ffddb | Final difficulty balancing | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Aim.cs",
"diff": "@@ -11,8 +11,8 @@ public class Aim : StrainDecaySkill\n{\nprivate readonly Type[] allowedHitObjects;\n- protected override double SkillMultiplier => 7.5;\n- protected override double StrainDecayBase => 0.225;\n+ protected override double SkillMultiplier => 7.4;\n+ protected override double StrainDecayBase => 0.25;\npublic Aim(Mod[] mods, Type[] allowedHitObjects)\n: base(mods)\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Complexity.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Complexity.cs",
"diff": "@@ -7,7 +7,7 @@ namespace osu.Game.Rulesets.Tau.Difficulty.Skills\n{\npublic class Complexity : StrainDecaySkill\n{\n- protected override double SkillMultiplier => 55;\n+ protected override double SkillMultiplier => 60;\nprotected override double StrainDecayBase => 0.35;\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Speed.cs",
"new_path": "osu.Game.Rulesets.Tau/Difficulty/Skills/Speed.cs",
"diff": "@@ -16,7 +16,7 @@ public class Speed : TauStrainSkill\nprivate double currentRhythm;\nprotected override int ReducedSectionCount => 5;\n- protected override double DifficultyMultiplier => 1.3;\n+ protected override double DifficultyMultiplier => 1.37;\npublic Speed(Mod[] mods, double hitWindowGreat)\n: base(mods)\n"
}
]
| C# | MIT License | taulazer/tau | Final difficulty balancing |
664,859 | 06.12.2022 02:27:10 | 18,000 | 945623208cca76c78db41eb3c8b0b7ecbd17866a | Use CircularProgress | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Statistics/PaddleDistributionGraph.cs",
"new_path": "osu.Game.Rulesets.Tau/Statistics/PaddleDistributionGraph.cs",
"diff": "using osu.Framework.Graphics.Colour;\nusing osu.Framework.Graphics.Containers;\nusing osu.Framework.Graphics.Shapes;\n+using osu.Framework.Graphics.UserInterface;\nusing osu.Framework.Testing;\nusing osu.Game.Beatmaps;\nusing osu.Game.Graphics;\nusing osu.Game.Rulesets.Tau.Localisation;\nusing osu.Game.Rulesets.Tau.Objects;\nusing osu.Game.Rulesets.Tau.UI;\n-using osu.Game.Screens.Ranking.Expanded.Accuracy;\nusing osuTK;\nusing osuTK.Graphics;\n@@ -173,7 +173,7 @@ private void load()\nColour = ColourInfo.GradientVertical(Color4.DarkGray.Darken(0.5f).Opacity(0.3f), Color4.DarkGray.Darken(0.5f).Opacity(0f)),\nHeight = 0.25f,\n},\n- new SmoothCircularProgress\n+ new CircularProgress\n{\nRelativeSizeAxes = Axes.Both,\nRelativePositionAxes = Axes.Both,\n"
}
]
| C# | MIT License | taulazer/tau | Use CircularProgress |
664,857 | 08.01.2023 00:34:55 | 28,800 | 72952264d7c67f4789b425723772b65954624b59 | Update all repo links to `taulazer/tau` | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "-[](https://github.com/Altenhh/tau \"tau\")\n+[](https://github.com/taulazer/tau \"tau\")\n<div align=\"center\">\n-[](https://github.com/Altenhh/tau/releases)\n-[](https://github.com/Altenhh/tau/LICENSE)\n-\n-\n+[](https://github.com/taulazer/tau/releases)\n+[](https://github.com/taulazer/tau/LICENSE)\n+\n+\n[](https://github.com/taulazer/tau/actions/workflows/ci.yml)\n[](https://crowdin.com/project/tau)\n[](https://discord.gg/7Y8GXAa)\n[Art](https://github.com/taulazer/tau/wiki/Mascot) done by [Izeunne](https://www.fiverr.com/izeunne)\n## Running the Gamemode\n-We have [prebuilt libraries](https://github.com/Altenhh/tau/releases) for users looking to play the mode without creating a development environment. All releases will work on all operating systems that *osu!* supports.\n+We have [prebuilt libraries](https://github.com/taulazer/tau/releases) for users looking to play the mode without creating a development environment. All releases will work on all operating systems that *osu!* supports.\n-| [Latest Releases](https://github.com/Altenhh/tau/releases)\n+| [Latest Releases](https://github.com/taulazer/tau/releases)\n| ------------- |\n### Instructions\n@@ -43,7 +43,7 @@ When developing or debugging the tau codebase, a few prerequisites are required\n### Source Code\nYou are able to clone the repository over command line, or by downloading it. Updating this code to the latest commit would be done with `git pull`, inside the tau directory.\n```sh\n-git clone https://github.com/Altenhh/tau.git\n+git clone https://github.com/taulazer/tau.git\ncd tau\n```\n@@ -72,6 +72,6 @@ Thanks to all of those who have helped with localization efforts. Members includ\nThanks to all of the amazing people within our discord community.\n## License\n-tau is licenced under the [MIT](https://opensource.org/licenses/MIT) License. For licensing information, refer to the [license file](https://github.com/Altenhh/tau/blob/master/LICENSE) regarding what is permitted regarding the codebase of tau.\n+tau is licenced under the [MIT](https://opensource.org/licenses/MIT) License. For licensing information, refer to the [license file](https://github.com/taulazer/tau/blob/master/LICENSE) regarding what is permitted regarding the codebase of tau.\nThe licensing here does not directly apply to [osu!](https://github.com/ppy/osu), as it is bound to its own licensing. What is reflected in our licensing *may* not be allowed in the [osu!](https://github.com/ppy/osu) github repository.\n"
}
]
| C# | MIT License | taulazer/tau | Update all repo links to `taulazer/tau` |
664,857 | 08.01.2023 00:42:44 | 28,800 | 1a8cefcb6eeb1c557195276198db48a7f79173ab | Fix broken license badge link | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "<div align=\"center\">\n[](https://github.com/taulazer/tau/releases)\n-[](https://github.com/taulazer/tau/LICENSE)\n+[](https://github.com/taulazer/tau/blob/master/LICENSE)\n\n\n[](https://github.com/taulazer/tau/actions/workflows/ci.yml)\n"
}
]
| C# | MIT License | taulazer/tau | Fix broken license badge link |
664,861 | 09.02.2023 01:55:22 | 21,600 | aa6e2176242e7e7dff5efa5774bd53b198dbf7d7 | patch to work with 2023.207.0 | [
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau.Tests/osu.Game.Rulesets.Tau.Tests.csproj",
"new_path": "osu.Game.Rulesets.Tau.Tests/osu.Game.Rulesets.Tau.Tests.csproj",
"diff": "<PackageReference Include=\"Microsoft.NET.Test.Sdk\" Version=\"17.3.0\" />\n<PackageReference Include=\"NUnit\" Version=\"3.13.3\" />\n<PackageReference Include=\"NUnit3TestAdapter\" Version=\"4.2.1\" />\n+ <PackageReference Include=\"ppy.osu.Game\" Version=\"2023.207.0\" />\n</ItemGroup>\n<ItemGroup>\n<ProjectReference Include=\"..\\osu.Game.Rulesets.Tau\\osu.Game.Rulesets.Tau.csproj\" />\n"
},
{
"change_type": "MODIFY",
"old_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableSlider.cs",
"new_path": "osu.Game.Rulesets.Tau/Objects/Drawables/DrawableSlider.cs",
"diff": "@@ -110,6 +110,7 @@ protected override void AddNestedHitObject(DrawableHitObject hitObject)\nheadContainer.Child = head;\nbreak;\n+\ncase DrawableSliderRepeat repeat:\nrepeatContainer.Add(repeat);\nbreak;\n@@ -176,8 +177,7 @@ protected override void OnFree()\n{\nbase.OnFree();\ntrackingCheckpoints.Clear();\n-\n- slidingSample.Samples = null;\n+ slidingSample?.ClearSamples();\n}\nprotected override void LoadSamples()\n"
}
]
| C# | MIT License | taulazer/tau | patch to work with 2023.207.0 |
664,859 | 09.02.2023 11:30:19 | 18,000 | 2b9d8cf4f6ff68d0383d34c441d92d0f8bef5f94 | Update release workflow to include localisation info | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/release.yml",
"new_path": ".github/workflows/release.yml",
"diff": "@@ -29,17 +29,26 @@ jobs:\nrelease_name: ${{ github.ref }}\ndraft: true\nbody: |\n- ## Changes\n- - ExampleA\n- - ExampleB\n-\n# Installation:\nTo install this ruleset just simply put this .DLL file onto your `osu/Rulesets` directory under `%appdata%`/.\nosu!lazer will do the rest for you.\n+ ## Localisation\n+ Localisations for this ruleset are available. If you want to help with translation efforts, please visit our [crowdin](https://crowdin.com/project/tau) page.\n+\n+ ### Installing translations\n+ Download the `Localisations.zip` included in this release and extract it to the same place as you would place the tau DLL (`%appdata%/osu/Rulesets`).\n+ The file structure should look something like the following:\n+\n+ - rulesets/\n+ - ar/\n+ - fr/\n+ - .../\n+ - osu.Game.Rulesets.Tau.dll\n+\n---\n- Have a feature to suggest? Or encountered a bug? Or just want to chat with other people interested in tau? [Join the discord server](https://discord.gg/GZ9R9vjFNW)!\n+ Have a feature to suggest? Or encountered a bug? Or just want to chat with people interested in tau? [Join the discord server](https://discord.gg/GZ9R9vjFNW)!\n- name: Upload Release Asset\nid: upload-release-asset\nuses: actions/upload-release-asset@master\n"
}
]
| C# | MIT License | taulazer/tau | Update release workflow to include localisation info |
596,240 | 25.04.2017 10:44:06 | -7,200 | 1c87fb3b23568e6983208e7f8bb1241c41ba0a9c | stub for cli interface | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "Makefile",
"diff": "+DATE = $(shell date +%Y%m%d%H%M)\n+IMAGE ?= sapcc/kubernikus\n+VERSION = v$(DATE)\n+GOOS ?= $(shell go env | grep GOOS | cut -d'\"' -f2)\n+BINARIES := groundctl\n+\n+LDFLAGS := -X github.com/sapcc/kubernikus/pkg/version.VERSION=$(VERSION)\n+GOFLAGS := -ldflags \"$(LDFLAGS)\"\n+\n+SRCDIRS := pkg cmd\n+PACKAGES := $(shell find $(SRCDIRS) -type d)\n+GOFILES := $(addsuffix /*.go,$(PACKAGES))\n+GOFILES := $(wildcard $(GOFILES))\n+\n+ifneq ($(http_proxy),)\n+BUILD_ARGS+= --build-arg http_proxy=$(http_proxy) --build-arg https_proxy=$(https_proxy) --build-arg no_proxy=$(no_proxy)\n+endif\n+\n+.PHONY: all clean\n+\n+all: $(BINARIES:%=bin/$(GOOS)/%)\n+\n+bin/%: $(GOFILES) Makefile\n+ GOOS=$(*D) GOARCH=amd64 go build $(GOFLAGS) -v -i -o $(@D)/$(@F) ./cmd/$(@F)\n+\n+build: $(BINARIES:bin/linux/%)\n+ docker build $(BUILD_ARGS) -t $(IMAGE):$(VERSION) .\n+\n+push:\n+ docker push $(IMAGE):$(VERSION)\n+\n+clean:\n+ rm -rf bin/*\n+\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "cmd/groundctl/certificates.go",
"diff": "+package main\n+\n+import (\n+ \"fmt\"\n+\n+ \"github.com/spf13/cobra\"\n+)\n+\n+func init() {\n+ caCmd.AddCommand(etcdCmd)\n+ certificatesCmd.AddCommand(caCmd)\n+ RootCmd.AddCommand(certificatesCmd)\n+}\n+\n+var certificatesCmd = &cobra.Command{\n+ Use: \"certificates\",\n+}\n+\n+var caCmd = &cobra.Command{\n+ Use: \"generate\",\n+}\n+\n+var etcdCmd = &cobra.Command{\n+ Use: \"etcd\",\n+ Run: func(cmd *cobra.Command, args []string) {\n+ fmt.Println(\"Generated CA certificates for etcd\")\n+ },\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "cmd/groundctl/main.go",
"diff": "+package main\n+\n+import \"github.com/spf13/cobra\"\n+\n+var RootCmd = &cobra.Command{Use: \"groundctl\"}\n+\n+func main() {\n+ RootCmd.Execute()\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "glide.yaml",
"diff": "+package: github.com/sapcc/kubernikus\n+import:\n+- package: github.com/spf13/cobra/cobra\n+\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/controller/ground/certificates.go",
"diff": "+package ground\n+\n+\n+func main() {\n+ fmt.Println(\"vim-go\")\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/version/base.go",
"diff": "+package version\n+\n+var VERSION = \"HEAD\"\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | stub for cli interface |
596,240 | 25.04.2017 14:11:28 | -7,200 | 8a3341e19a8c199f44021336a0c2f821ded09cce | implement CA generation | [
{
"change_type": "MODIFY",
"old_path": "cmd/groundctl/certificates.go",
"new_path": "cmd/groundctl/certificates.go",
"diff": "@@ -3,12 +3,14 @@ package main\nimport (\n\"fmt\"\n+ \"github.com/sapcc/kubernikus/pkg/controller/ground\"\n\"github.com/spf13/cobra\"\n)\n+var name string\n+\nfunc init() {\n- caCmd.AddCommand(etcdCmd)\n- certificatesCmd.AddCommand(caCmd)\n+ certificatesCmd.AddCommand(generateCmd)\nRootCmd.AddCommand(certificatesCmd)\n}\n@@ -16,13 +18,13 @@ var certificatesCmd = &cobra.Command{\nUse: \"certificates\",\n}\n-var caCmd = &cobra.Command{\n- Use: \"generate\",\n-}\n-\n-var etcdCmd = &cobra.Command{\n- Use: \"etcd\",\n+var generateCmd = &cobra.Command{\n+ Use: \"generate [name]\",\nRun: func(cmd *cobra.Command, args []string) {\n- fmt.Println(\"Generated CA certificates for etcd\")\n+ if len(args) != 1 {\n+ fmt.Println(\"You need to give a satellite name\")\n+ return\n+ }\n+ ground.WriteCertificateAuthorities(args[0])\n},\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "glide.lock",
"diff": "+hash: 132195369ba0f82f9f6433779a0ac05f78302eea04564afde66a6217693aa506\n+updated: 2017-04-25T11:16:23.881160967+02:00\n+imports:\n+- name: github.com/inconshreveable/mousetrap\n+ version: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75\n+- name: github.com/spf13/cobra\n+ version: f4f10f6873175e78bb1503da7e78c260a7f3ef63\n+ subpackages:\n+ - cobra\n+- name: github.com/spf13/pflag\n+ version: 2300d0f8576fe575f71aaa5b9bbe4e1b0dc2eb51\n+- name: k8s.io/client-go\n+ version: 3627aeb7d4f6ade38f995d2c923e459146493c7e\n+testImports: []\n"
},
{
"change_type": "MODIFY",
"old_path": "glide.yaml",
"new_path": "glide.yaml",
"diff": "package: github.com/sapcc/kubernikus\nimport:\n- package: github.com/spf13/cobra/cobra\n+- package: k8s.io/client-go\n+ version: v3.0.0-beta.0\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/controller/ground/certificates.go",
"new_path": "pkg/controller/ground/certificates.go",
"diff": "package ground\n+import (\n+ \"crypto/rand\"\n+ \"crypto/rsa\"\n+ \"crypto/x509\"\n+ \"crypto/x509/pkix\"\n+ \"fmt\"\n+ \"math/big\"\n+ \"net\"\n+ \"path\"\n+ \"strings\"\n+ \"time\"\n-func main() {\n- fmt.Println(\"vim-go\")\n+ certutil \"k8s.io/client-go/util/cert\"\n+)\n+\n+const (\n+ DEFAULT_CA_RSA_KEY_SIZE = 1024\n+ DEFAULT_CA_VALIDITY = time.Hour * 24 * 365 * 10\n+\n+ ORGANIZATION = \"SAP Converged Cloud\"\n+)\n+\n+type Subject struct {\n+ CommonName string\n+ Organization []string\n+ OrganizationalUnit []string\n+ AltNames AltNames\n+ Usages []x509.ExtKeyUsage\n+}\n+\n+type AltNames struct {\n+ DNSNames []string\n+ IPs []net.IP\n+}\n+\n+func WriteCertificateAuthorities(name string) {\n+ writeCertificateAuthority(\".\", []string{\"Etcd\", \"Peers\"}, name)\n+ writeCertificateAuthority(\".\", []string{\"Etcd\", \"Clients\"}, name)\n+ writeCertificateAuthority(\".\", []string{\"Kubernetes\", \"Clients\"}, name)\n+ writeCertificateAuthority(\".\", []string{\"Kubernetes\", \"Kubelets\"}, name)\n+ writeCertificateAuthority(\".\", []string{\"TLS\"}, name)\n+}\n+\n+func writeCertificateAuthority(dir string, system []string, project string) error {\n+ cert, key, err := newCertificateAuthority(system, project)\n+ if err != nil {\n+ return err\n+ }\n+\n+ err = certutil.WriteCert(pathForCACert(dir, system), certutil.EncodeCertPEM(cert))\n+ if err != nil {\n+ return err\n+ }\n+\n+ err = certutil.WriteKey(pathForCAKey(dir, system), certutil.EncodePrivateKeyPEM(key))\n+ if err != nil {\n+ return err\n+ }\n+\n+ return nil\n+}\n+\n+func newCertificateAuthority(system []string, project string) (*x509.Certificate, *rsa.PrivateKey, error) {\n+ key, err := newPrivateKey(DEFAULT_CA_RSA_KEY_SIZE)\n+ if err != nil {\n+ return nil, nil, fmt.Errorf(\"unable to create private key [%v]\", err)\n+ }\n+\n+ subject := Subject{\n+ CommonName: fmt.Sprintf(\"%s CA\", project),\n+ Organization: []string{ORGANIZATION, \"Kubernikus\"},\n+ OrganizationalUnit: system,\n+ }\n+ cert, err := newSelfSignedCACert(subject, key)\n+ if err != nil {\n+ return nil, nil, fmt.Errorf(\"unable to create self-signed certificate [%v]\", err)\n+ }\n+\n+ return cert, key, nil\n+}\n+\n+func newPrivateKey(bits int) (*rsa.PrivateKey, error) {\n+ return rsa.GenerateKey(rand.Reader, bits)\n+}\n+\n+func newSelfSignedCACert(subject Subject, key *rsa.PrivateKey) (*x509.Certificate, error) {\n+ now := time.Now()\n+\n+ tmpl := x509.Certificate{\n+ SerialNumber: new(big.Int).SetInt64(0),\n+ Subject: pkix.Name{\n+ CommonName: subject.CommonName,\n+ Organization: subject.Organization,\n+ OrganizationalUnit: subject.OrganizationalUnit,\n+ },\n+ NotBefore: now.UTC(),\n+ NotAfter: now.Add(DEFAULT_CA_VALIDITY).UTC(),\n+ KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,\n+ BasicConstraintsValid: true,\n+ IsCA: true,\n+ }\n+\n+ certDERBytes, err := x509.CreateCertificate(rand.Reader, &tmpl, &tmpl, key.Public(), key)\n+ if err != nil {\n+ return nil, err\n+ }\n+ return x509.ParseCertificate(certDERBytes)\n+}\n+\n+func pathForCert(dir, name string) string {\n+ return path.Join(dir, fmt.Sprintf(\"%s.pem\", strings.ToLower(name)))\n+}\n+\n+func pathForKey(dir, name string) string {\n+ return path.Join(dir, fmt.Sprintf(\"%s-key.pem\", strings.ToLower(name)))\n+}\n+\n+func pathForCACert(dir string, system []string) string {\n+ return pathForCert(dir, fmt.Sprintf(\"%s-ca\", strings.ToLower(strings.Join(system, \"-\"))))\n+}\n+\n+func pathForCAKey(dir string, system []string) string {\n+ return pathForKey(dir, fmt.Sprintf(\"%s-ca\", strings.ToLower(strings.Join(system, \"-\"))))\n}\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | implement CA generation |
596,240 | 26.04.2017 11:39:16 | -7,200 | 43c19cd9b67d238e227805cbbdd93622b6338e36 | abstracts config output into writers. allow debugging and helm values | [
{
"change_type": "MODIFY",
"old_path": "cmd/groundctl/certificates.go",
"new_path": "cmd/groundctl/certificates.go",
"diff": "@@ -25,6 +25,6 @@ var generateCmd = &cobra.Command{\nfmt.Println(\"You need to give a satellite name\")\nreturn\n}\n- ground.WriteCertificateAuthorities(args[0])\n+ ground.NewCluster(args[0]).WriteConfig(&ground.FilePersister{\".\"})\n},\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "glide.lock",
"new_path": "glide.lock",
"diff": "-hash: 132195369ba0f82f9f6433779a0ac05f78302eea04564afde66a6217693aa506\n-updated: 2017-04-25T11:16:23.881160967+02:00\n+hash: 573117d979545f7af92bf8820c119dfb9f9e264cc1ad9fbec257da8f78b1e583\n+updated: 2017-04-26T10:04:27.401964901+02:00\nimports:\n- name: github.com/inconshreveable/mousetrap\nversion: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75\n+- name: github.com/kennygrant/sanitize\n+ version: 6a0bfdde8629a3a3a7418a7eae45c54154692514\n- name: github.com/spf13/cobra\nversion: f4f10f6873175e78bb1503da7e78c260a7f3ef63\nsubpackages:\n- cobra\n- name: github.com/spf13/pflag\nversion: 2300d0f8576fe575f71aaa5b9bbe4e1b0dc2eb51\n+- name: golang.org/x/net\n+ version: e90d6d0afc4c315a0d87a568ae68577cc15149a0\n+ subpackages:\n+ - html\n+ - html/atom\n- name: k8s.io/client-go\nversion: 3627aeb7d4f6ade38f995d2c923e459146493c7e\n+ subpackages:\n+ - util/cert\ntestImports: []\n"
},
{
"change_type": "MODIFY",
"old_path": "glide.yaml",
"new_path": "glide.yaml",
"diff": "@@ -3,4 +3,4 @@ import:\n- package: github.com/spf13/cobra/cobra\n- package: k8s.io/client-go\nversion: v3.0.0-beta.0\n-\n+- package: github.com/kennygrant/sanitize\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/controller/ground/certificates.go",
"new_path": "pkg/controller/ground/certificates.go",
"diff": "@@ -5,27 +5,53 @@ import (\n\"crypto/rsa\"\n\"crypto/x509\"\n\"crypto/x509/pkix\"\n+ \"errors\"\n\"fmt\"\n+ \"math\"\n\"math/big\"\n\"net\"\n- \"path\"\n- \"strings\"\n\"time\"\ncertutil \"k8s.io/client-go/util/cert\"\n)\nconst (\n- DEFAULT_CA_RSA_KEY_SIZE = 1024\n- DEFAULT_CA_VALIDITY = time.Hour * 24 * 365 * 10\n-\n- ORGANIZATION = \"SAP Converged Cloud\"\n+ duration365d = time.Hour * 24 * 365\n)\n-type Subject struct {\n+type ClusterCerts struct {\n+ Name string\n+ Etcd *EtcdCerts\n+ Kubernetes *KubernetesCerts\n+}\n+\n+type EtcdCerts struct {\n+ Peers *Pool\n+ Clients *Pool\n+}\n+\n+type KubernetesCerts struct {\n+ Clients *Pool\n+ Kubelets *Pool\n+ TLS *Pool\n+}\n+\n+type Pool struct {\n+ CA *Bundle\n+ Certificates []*Bundle\n+}\n+\n+type Bundle struct {\n+ Certificate *x509.Certificate\n+ PrivateKey *rsa.PrivateKey\n+}\n+\n+type Config struct {\nCommonName string\nOrganization []string\nOrganizationalUnit []string\n+ Locality []string\n+ Province []string\nAltNames AltNames\nUsages []x509.ExtKeyUsage\n}\n@@ -35,68 +61,91 @@ type AltNames struct {\nIPs []net.IP\n}\n-func WriteCertificateAuthorities(name string) {\n- writeCertificateAuthority(\".\", []string{\"Etcd\", \"Peers\"}, name)\n- writeCertificateAuthority(\".\", []string{\"Etcd\", \"Clients\"}, name)\n- writeCertificateAuthority(\".\", []string{\"Kubernetes\", \"Clients\"}, name)\n- writeCertificateAuthority(\".\", []string{\"Kubernetes\", \"Kubelets\"}, name)\n- writeCertificateAuthority(\".\", []string{\"TLS\"}, name)\n+func newClusterCerts(name string) ClusterCerts {\n+ dict := ClusterCerts{\n+ Name: name,\n}\n-func writeCertificateAuthority(dir string, system []string, project string) error {\n- cert, key, err := newCertificateAuthority(system, project)\n- if err != nil {\n- return err\n+ dict.Etcd = dict.initializeEtcdCerts()\n+ dict.Kubernetes = dict.initializeKubernetesCerts()\n+\n+ return dict\n}\n- err = certutil.WriteCert(pathForCACert(dir, system), certutil.EncodeCertPEM(cert))\n- if err != nil {\n- return err\n+func (dict ClusterCerts) initializeEtcdCerts() *EtcdCerts {\n+ return &EtcdCerts{\n+ Peers: dict.newPool(\"Etcd Peers\"),\n+ Clients: dict.newPool(\"Etcd Clients\"),\n+ }\n}\n- err = certutil.WriteKey(pathForCAKey(dir, system), certutil.EncodePrivateKeyPEM(key))\n- if err != nil {\n- return err\n+func (dict ClusterCerts) initializeKubernetesCerts() *KubernetesCerts {\n+ return &KubernetesCerts{\n+ Clients: dict.newPool(\"Kubernetes Clients\"),\n+ Kubelets: dict.newPool(\"Kubernetes Kubelets\"),\n+ TLS: dict.newPool(\"Kubernetes TLS\"),\n+ }\n+}\n+\n+func (c ClusterCerts) bundles() []*Bundle {\n+ bundles := []*Bundle{}\n+ bundles = append(bundles, c.Etcd.Clients.bundles()...)\n+ bundles = append(bundles, c.Etcd.Peers.bundles()...)\n+ bundles = append(bundles, c.Kubernetes.Clients.bundles()...)\n+ bundles = append(bundles, c.Kubernetes.Kubelets.bundles()...)\n+ bundles = append(bundles, c.Kubernetes.TLS.bundles()...)\n+\n+ return bundles\n}\n- return nil\n+func (p Pool) bundles() []*Bundle {\n+ return append(p.Certificates, p.CA)\n}\n-func newCertificateAuthority(system []string, project string) (*x509.Certificate, *rsa.PrivateKey, error) {\n- key, err := newPrivateKey(DEFAULT_CA_RSA_KEY_SIZE)\n+func (dict ClusterCerts) newPool(name string) *Pool {\n+ ca, err := dict.newCA(name)\nif err != nil {\n- return nil, nil, fmt.Errorf(\"unable to create private key [%v]\", err)\n+ panic(err)\n}\n-\n- subject := Subject{\n- CommonName: fmt.Sprintf(\"%s CA\", project),\n- Organization: []string{ORGANIZATION, \"Kubernikus\"},\n- OrganizationalUnit: system,\n+ pool := &Pool{CA: ca}\n+ return pool\n}\n- cert, err := newSelfSignedCACert(subject, key)\n+\n+func (dict ClusterCerts) newCA(name string) (*Bundle, error) {\n+ key, err := certutil.NewPrivateKey()\nif err != nil {\n- return nil, nil, fmt.Errorf(\"unable to create self-signed certificate [%v]\", err)\n+ panic(err)\n+ return &Bundle{}, fmt.Errorf(\"unable to create private key [%v]\", err)\n}\n- return cert, key, nil\n+ config := Config{\n+ OrganizationalUnit: []string{\"SAP Converged Cloud\", \"Kubernikus\"},\n+ Province: []string{fmt.Sprintf(\"%s CA\", name)},\n+ Locality: []string{dict.Name},\n}\n+ cert, err := NewSelfSignedCACert(config, key)\n-func newPrivateKey(bits int) (*rsa.PrivateKey, error) {\n- return rsa.GenerateKey(rand.Reader, bits)\n+ if err != nil {\n+ panic(err)\n+ return &Bundle{}, fmt.Errorf(\"unable to create self-signed certificate [%v]\", err)\n}\n-func newSelfSignedCACert(subject Subject, key *rsa.PrivateKey) (*x509.Certificate, error) {\n- now := time.Now()\n+ return &Bundle{cert, key}, nil\n+}\n+func NewSelfSignedCACert(cfg Config, key *rsa.PrivateKey) (*x509.Certificate, error) {\n+ now := time.Now()\ntmpl := x509.Certificate{\nSerialNumber: new(big.Int).SetInt64(0),\nSubject: pkix.Name{\n- CommonName: subject.CommonName,\n- Organization: subject.Organization,\n- OrganizationalUnit: subject.OrganizationalUnit,\n+ CommonName: cfg.CommonName,\n+ Organization: cfg.Organization,\n+ OrganizationalUnit: cfg.OrganizationalUnit,\n+ Province: cfg.Province,\n+ Locality: cfg.Locality,\n},\nNotBefore: now.UTC(),\n- NotAfter: now.Add(DEFAULT_CA_VALIDITY).UTC(),\n+ NotAfter: now.Add(duration365d * 10).UTC(),\nKeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,\nBasicConstraintsValid: true,\nIsCA: true,\n@@ -109,18 +158,35 @@ func newSelfSignedCACert(subject Subject, key *rsa.PrivateKey) (*x509.Certificat\nreturn x509.ParseCertificate(certDERBytes)\n}\n-func pathForCert(dir, name string) string {\n- return path.Join(dir, fmt.Sprintf(\"%s.pem\", strings.ToLower(name)))\n+func NewSignedCert(cfg Config, key *rsa.PrivateKey, caCert *x509.Certificate, caKey *rsa.PrivateKey) (*x509.Certificate, error) {\n+ serial, err := rand.Int(rand.Reader, new(big.Int).SetInt64(math.MaxInt64))\n+ if err != nil {\n+ return nil, err\n}\n-\n-func pathForKey(dir, name string) string {\n- return path.Join(dir, fmt.Sprintf(\"%s-key.pem\", strings.ToLower(name)))\n+ if len(cfg.CommonName) == 0 {\n+ return nil, errors.New(\"must specify a CommonName\")\n}\n-\n-func pathForCACert(dir string, system []string) string {\n- return pathForCert(dir, fmt.Sprintf(\"%s-ca\", strings.ToLower(strings.Join(system, \"-\"))))\n+ if len(cfg.Usages) == 0 {\n+ return nil, errors.New(\"must specify at least one ExtKeyUsage\")\n}\n-func pathForCAKey(dir string, system []string) string {\n- return pathForKey(dir, fmt.Sprintf(\"%s-ca\", strings.ToLower(strings.Join(system, \"-\"))))\n+ certTmpl := x509.Certificate{\n+ Subject: pkix.Name{\n+ CommonName: cfg.CommonName,\n+ Organization: cfg.Organization,\n+ OrganizationalUnit: cfg.OrganizationalUnit,\n+ },\n+ DNSNames: cfg.AltNames.DNSNames,\n+ IPAddresses: cfg.AltNames.IPs,\n+ SerialNumber: serial,\n+ NotBefore: caCert.NotBefore,\n+ NotAfter: time.Now().Add(duration365d).UTC(),\n+ KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,\n+ ExtKeyUsage: cfg.Usages,\n+ }\n+ certDERBytes, err := x509.CreateCertificate(rand.Reader, &certTmpl, caCert, key.Public(), caKey)\n+ if err != nil {\n+ return nil, err\n+ }\n+ return x509.ParseCertificate(certDERBytes)\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/controller/ground/cluster.go",
"diff": "+package ground\n+\n+type Cluster struct {\n+ Certificates ClusterCerts\n+}\n+\n+func NewCluster(name string) *Cluster {\n+ cluster := &Cluster{}\n+ cluster.Certificates = newClusterCerts(name)\n+\n+ return cluster\n+}\n+\n+func (c Cluster) WriteConfig(persister ConfigPersister) error {\n+ return persister.WriteConfig(c)\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/controller/ground/io.go",
"diff": "+package ground\n+\n+import (\n+ \"fmt\"\n+ \"path\"\n+ \"strings\"\n+\n+ \"github.com/kennygrant/sanitize\"\n+ certutil \"k8s.io/client-go/util/cert\"\n+)\n+\n+type ConfigPersister interface {\n+ WriteConfig(Cluster) error\n+}\n+\n+type HelmValuePersister struct{}\n+type SpecPersister struct{}\n+\n+type FilePersister struct {\n+ BaseDir string\n+}\n+\n+func (fp FilePersister) WriteConfig(cluster Cluster) error {\n+ for _, bundle := range cluster.Certificates.bundles() {\n+ err := fp.writeToFiles(bundle)\n+ if err != nil {\n+ return err\n+ }\n+ }\n+\n+ return nil\n+}\n+\n+func (fp FilePersister) writeToFiles(b *Bundle) error {\n+ fmt.Println(fp.pathForCert(b))\n+ err := certutil.WriteCert(fp.pathForCert(b), certutil.EncodeCertPEM(b.Certificate))\n+ if err != nil {\n+ return err\n+ }\n+\n+ fmt.Println(fp.pathForKey(b))\n+ err = certutil.WriteKey(fp.pathForKey(b), certutil.EncodePrivateKeyPEM(b.PrivateKey))\n+ if err != nil {\n+ return err\n+ }\n+\n+ return nil\n+}\n+\n+func (fp FilePersister) pathForCert(b *Bundle) string {\n+ return path.Join(fp.basedir(b), fmt.Sprintf(\"%s.pem\", fp.basename(b)))\n+}\n+\n+func (fp FilePersister) pathForKey(b *Bundle) string {\n+ return path.Join(fp.basedir(b), fmt.Sprintf(\"%s-key.pem\", fp.basename(b)))\n+}\n+\n+func (fp FilePersister) basename(b *Bundle) string {\n+ return sanitize.BaseName(strings.ToLower(strings.Join(b.Certificate.Subject.Province, \"-\")))\n+}\n+\n+func (fp FilePersister) basedir(b *Bundle) string {\n+ return sanitize.BaseName(strings.ToLower(strings.Join(b.Certificate.Subject.Locality, \"-\")))\n+}\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | abstracts config output into writers. allow debugging and helm values |
596,240 | 26.04.2017 14:49:45 | -7,200 | 8663721a978e083e716ab8f19057f09725daf15d | adds command to spit out helm values | [
{
"change_type": "MODIFY",
"old_path": "cmd/groundctl/certificates.go",
"new_path": "cmd/groundctl/certificates.go",
"diff": "@@ -25,6 +25,6 @@ var generateCmd = &cobra.Command{\nfmt.Println(\"You need to give a satellite name\")\nreturn\n}\n- ground.NewCluster(args[0]).WriteConfig(&ground.FilePersister{\".\"})\n+ ground.NewCluster(args[0]).WriteConfig(ground.NewFilePersister(\".\"))\n},\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "cmd/groundctl/helm.go",
"diff": "+package main\n+\n+import (\n+ \"fmt\"\n+\n+ \"github.com/sapcc/kubernikus/pkg/controller/ground\"\n+ \"github.com/spf13/cobra\"\n+)\n+\n+func init() {\n+ helmCmd.AddCommand(valuesCmd)\n+ RootCmd.AddCommand(helmCmd)\n+}\n+\n+var helmCmd = &cobra.Command{\n+ Use: \"helm\",\n+}\n+\n+var valuesCmd = &cobra.Command{\n+ Use: \"values [NAME]\",\n+ Run: func(cmd *cobra.Command, args []string) {\n+ if len(args) != 1 {\n+ fmt.Println(\"You need to give a satellite name\")\n+ return\n+ }\n+\n+ var result = \"\"\n+ ground.NewCluster(args[0]).WriteConfig(ground.NewHelmValuePersister(&result))\n+ fmt.Println(result)\n+ },\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "cmd/groundctl/main.go",
"new_path": "cmd/groundctl/main.go",
"diff": "package main\n-import \"github.com/spf13/cobra\"\n+import (\n+ \"fmt\"\n+ \"os\"\n-var RootCmd = &cobra.Command{Use: \"groundctl\"}\n+ \"github.com/spf13/cobra\"\n+)\n+\n+var RootCmd = &cobra.Command{\n+ Use: \"groundctl\",\n+}\n+\n+var satelliteName string\nfunc main() {\n- RootCmd.Execute()\n+ if err := RootCmd.Execute(); err != nil {\n+ fmt.Println(err)\n+ os.Exit(1)\n+ }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/controller/ground/io.go",
"new_path": "pkg/controller/ground/io.go",
"diff": "@@ -5,6 +5,8 @@ import (\n\"path\"\n\"strings\"\n+ yaml \"gopkg.in/yaml.v2\"\n+\n\"github.com/kennygrant/sanitize\"\ncertutil \"k8s.io/client-go/util/cert\"\n)\n@@ -13,13 +15,35 @@ type ConfigPersister interface {\nWriteConfig(Cluster) error\n}\n-type HelmValuePersister struct{}\n-type SpecPersister struct{}\n+type BasePersister struct{}\n+\n+type HelmValuePersister struct {\n+ BasePersister\n+\n+ result *string\n+}\ntype FilePersister struct {\n+ BasePersister\nBaseDir string\n}\n+type HelmValues struct {\n+ Certs map[string]string\n+}\n+\n+func NewFilePersister(basedir string) *FilePersister {\n+ p := &FilePersister{}\n+ p.BaseDir = basedir\n+ return p\n+}\n+\n+func NewHelmValuePersister(result *string) *HelmValuePersister {\n+ p := &HelmValuePersister{}\n+ p.result = result\n+ return p\n+}\n+\nfunc (fp FilePersister) WriteConfig(cluster Cluster) error {\nfor _, bundle := range cluster.Certificates.bundles() {\nerr := fp.writeToFiles(bundle)\n@@ -47,18 +71,46 @@ func (fp FilePersister) writeToFiles(b *Bundle) error {\nreturn nil\n}\n-func (fp FilePersister) pathForCert(b *Bundle) string {\n- return path.Join(fp.basedir(b), fmt.Sprintf(\"%s.pem\", fp.basename(b)))\n+func (bp BasePersister) basename(b *Bundle) string {\n+ return sanitize.BaseName(strings.ToLower(strings.Join(b.Certificate.Subject.Province, \"-\")))\n}\n-func (fp FilePersister) pathForKey(b *Bundle) string {\n- return path.Join(fp.basedir(b), fmt.Sprintf(\"%s-key.pem\", fp.basename(b)))\n+func (bp BasePersister) nameForKey(b *Bundle) string {\n+ return fmt.Sprintf(\"%s-key.pem\", bp.basename(b))\n}\n-func (fp FilePersister) basename(b *Bundle) string {\n- return sanitize.BaseName(strings.ToLower(strings.Join(b.Certificate.Subject.Province, \"-\")))\n+func (bp BasePersister) nameForCert(b *Bundle) string {\n+ return fmt.Sprintf(\"%s.pem\", bp.basename(b))\n+}\n+\n+func (fp FilePersister) pathForCert(b *Bundle) string {\n+ return path.Join(fp.basedir(b), fp.nameForCert(b))\n+}\n+\n+func (fp FilePersister) pathForKey(b *Bundle) string {\n+ return path.Join(fp.basedir(b))\n}\nfunc (fp FilePersister) basedir(b *Bundle) string {\nreturn sanitize.BaseName(strings.ToLower(strings.Join(b.Certificate.Subject.Locality, \"-\")))\n}\n+\n+func (hvp HelmValuePersister) WriteConfig(cluster Cluster) error {\n+ values := HelmValues{\n+ Certs: map[string]string{},\n+ }\n+\n+ for _, bundle := range cluster.Certificates.bundles() {\n+ values.Certs[hvp.nameForCert(bundle)] = string(certutil.EncodeCertPEM(bundle.Certificate))\n+ values.Certs[hvp.nameForKey(bundle)] = string(certutil.EncodePrivateKeyPEM(bundle.PrivateKey))\n+ }\n+\n+ result, err := yaml.Marshal(&values)\n+ if err != nil {\n+ return err\n+ }\n+\n+ *hvp.result = string(result)\n+\n+ return nil\n+}\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | adds command to spit out helm values |
596,240 | 27.04.2017 22:24:05 | -7,200 | f2102c03cd46f34dfe86271e75200b33885d0d2c | adds plain structure. generate all certs | [
{
"change_type": "MODIFY",
"old_path": "cmd/groundctl/certificates.go",
"new_path": "cmd/groundctl/certificates.go",
"diff": "@@ -2,6 +2,7 @@ package main\nimport (\n\"fmt\"\n+ \"os\"\n\"github.com/sapcc/kubernikus/pkg/controller/ground\"\n\"github.com/spf13/cobra\"\n@@ -25,6 +26,16 @@ var generateCmd = &cobra.Command{\nfmt.Println(\"You need to give a satellite name\")\nreturn\n}\n- ground.NewCluster(args[0]).WriteConfig(ground.NewFilePersister(\".\"))\n+ cluster, err := ground.NewCluster(args[0])\n+ if err != nil {\n+ fmt.Println(err)\n+ os.Exit(-1)\n+ }\n+\n+ err = cluster.WriteConfig(ground.NewFilePersister(\".\"))\n+ if err != nil {\n+ fmt.Println(err)\n+ os.Exit(-1)\n+ }\n},\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "cmd/groundctl/helm.go",
"new_path": "cmd/groundctl/helm.go",
"diff": "@@ -2,6 +2,7 @@ package main\nimport (\n\"fmt\"\n+ \"os\"\n\"github.com/sapcc/kubernikus/pkg/controller/ground\"\n\"github.com/spf13/cobra\"\n@@ -25,7 +26,17 @@ var valuesCmd = &cobra.Command{\n}\nvar result = \"\"\n- ground.NewCluster(args[0]).WriteConfig(ground.NewHelmValuePersister(&result))\n+ cluster, err := ground.NewCluster(args[0])\n+\n+ if err == nil {\n+ err = cluster.WriteConfig(ground.NewHelmValuePersister(&result))\n+ }\n+\n+ if err != nil {\n+ fmt.Println(err)\n+ os.Exit(-1)\n+ }\n+\nfmt.Println(result)\n},\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/controller/ground/certificates.go",
"new_path": "pkg/controller/ground/certificates.go",
"diff": "@@ -19,26 +19,34 @@ const (\nduration365d = time.Hour * 24 * 365\n)\n-type ClusterCerts struct {\n- Name string\n- Etcd *EtcdCerts\n- Kubernetes *KubernetesCerts\n+type Certificates struct {\n+ Etcd struct {\n+ Clients struct {\n+ CA *Bundle\n+ Apiserver *Bundle\n}\n-\n-type EtcdCerts struct {\n- Peers *Pool\n- Clients *Pool\n}\n-type KubernetesCerts struct {\n- Clients *Pool\n- Kubelets *Pool\n- TLS *Pool\n+ Kubernetes struct {\n+ Clients struct {\n+ CA *Bundle\n+ ControllerManager *Bundle\n+ Scheduler *Bundle\n+ Proxy *Bundle\n+ Kubelet *Bundle\n+ ClusterAdmin *Bundle\n+ }\n+ Nodes struct {\n+ CA *Bundle\n+ Generic *Bundle\n+ }\n}\n-type Pool struct {\n+ TLS struct {\nCA *Bundle\n- Certificates []*Bundle\n+ ApiServer *Bundle\n+ Etcd *Bundle\n+ }\n}\ntype Bundle struct {\n@@ -50,8 +58,6 @@ type Config struct {\nCommonName string\nOrganization []string\nOrganizationalUnit []string\n- Locality []string\n- Province []string\nAltNames AltNames\nUsages []x509.ExtKeyUsage\n}\n@@ -61,57 +67,147 @@ type AltNames struct {\nIPs []net.IP\n}\n-func newClusterCerts(name string) ClusterCerts {\n- dict := ClusterCerts{\n- Name: name,\n+func (c Certificates) all() []*Bundle {\n+ return []*Bundle{\n+ c.Etcd.Clients.Apiserver,\n+ c.Etcd.Clients.CA,\n+ c.Kubernetes.Clients.CA,\n+ c.Kubernetes.Clients.ControllerManager,\n+ c.Kubernetes.Clients.Scheduler,\n+ c.Kubernetes.Clients.Proxy,\n+ c.Kubernetes.Clients.Kubelet,\n+ c.Kubernetes.Clients.ClusterAdmin,\n+ c.Kubernetes.Nodes.CA,\n+ c.Kubernetes.Nodes.Generic,\n+ c.TLS.CA,\n+ c.TLS.ApiServer,\n+ c.TLS.Etcd,\n+ }\n}\n- dict.Etcd = dict.initializeEtcdCerts()\n- dict.Kubernetes = dict.initializeKubernetesCerts()\n+func newCertificates(satellite string) (*Certificates, error) {\n+ certs := &Certificates{}\n- return dict\n+ if ca, err := newCA(satellite, \"Etcd Clients\"); err != nil {\n+ return certs, err\n+ } else {\n+ certs.Etcd.Clients.CA = ca\n}\n-func (dict ClusterCerts) initializeEtcdCerts() *EtcdCerts {\n- return &EtcdCerts{\n- Peers: dict.newPool(\"Etcd Peers\"),\n- Clients: dict.newPool(\"Etcd Clients\"),\n+ if ca, err := newCA(satellite, \"Kubernetes Clients\"); err != nil {\n+ return certs, err\n+ } else {\n+ certs.Kubernetes.Clients.CA = ca\n}\n+\n+ if ca, err := newCA(satellite, \"Kubernetes Nodes\"); err != nil {\n+ return certs, err\n+ } else {\n+ certs.Kubernetes.Nodes.CA = ca\n}\n-func (dict ClusterCerts) initializeKubernetesCerts() *KubernetesCerts {\n- return &KubernetesCerts{\n- Clients: dict.newPool(\"Kubernetes Clients\"),\n- Kubelets: dict.newPool(\"Kubernetes Kubelets\"),\n- TLS: dict.newPool(\"Kubernetes TLS\"),\n+ if ca, err := newCA(satellite, \"TLS\"); err != nil {\n+ return certs, err\n+ } else {\n+ certs.TLS.CA = ca\n}\n+\n+ if cert, err := newSignedBundle(Config{\n+ CommonName: \"apiserver\",\n+ Usages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},\n+ }, certs.Etcd.Clients.CA); err != nil {\n+ return certs, err\n+ } else {\n+ certs.Etcd.Clients.Apiserver = cert\n}\n-func (c ClusterCerts) bundles() []*Bundle {\n- bundles := []*Bundle{}\n- bundles = append(bundles, c.Etcd.Clients.bundles()...)\n- bundles = append(bundles, c.Etcd.Peers.bundles()...)\n- bundles = append(bundles, c.Kubernetes.Clients.bundles()...)\n- bundles = append(bundles, c.Kubernetes.Kubelets.bundles()...)\n- bundles = append(bundles, c.Kubernetes.TLS.bundles()...)\n+ if cert, err := newSignedBundle(Config{\n+ CommonName: \"cluster-admin\",\n+ Organization: []string{\"system:masters\"},\n+ Usages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},\n+ }, certs.Kubernetes.Clients.CA); err != nil {\n+ return certs, err\n+ } else {\n+ certs.Kubernetes.Clients.ClusterAdmin = cert\n+ }\n- return bundles\n+ if cert, err := newSignedBundle(Config{\n+ CommonName: \"system:kube-controller-manager\",\n+ Usages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},\n+ }, certs.Kubernetes.Clients.CA); err != nil {\n+ return certs, err\n+ } else {\n+ certs.Kubernetes.Clients.ControllerManager = cert\n}\n-func (p Pool) bundles() []*Bundle {\n- return append(p.Certificates, p.CA)\n+ if cert, err := newSignedBundle(Config{\n+ CommonName: \"kuelet\",\n+ Organization: []string{\"system:nodes\"},\n+ Usages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},\n+ }, certs.Kubernetes.Clients.CA); err != nil {\n+ return certs, err\n+ } else {\n+ certs.Kubernetes.Clients.Kubelet = cert\n}\n-func (dict ClusterCerts) newPool(name string) *Pool {\n- ca, err := dict.newCA(name)\n- if err != nil {\n- panic(err)\n+ if cert, err := newSignedBundle(Config{\n+ CommonName: \"system:kube-proxy\",\n+ Usages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},\n+ }, certs.Kubernetes.Clients.CA); err != nil {\n+ return certs, err\n+ } else {\n+ certs.Kubernetes.Clients.Proxy = cert\n+ }\n+\n+ if cert, err := newSignedBundle(Config{\n+ CommonName: \"system:kube-scheduler\",\n+ Usages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},\n+ }, certs.Kubernetes.Clients.CA); err != nil {\n+ return certs, err\n+ } else {\n+ certs.Kubernetes.Clients.Scheduler = cert\n+ }\n+\n+ if cert, err := newSignedBundle(Config{\n+ CommonName: \"kubelet\",\n+ Organization: []string{\"system:nodes\"},\n+ Usages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},\n+ }, certs.Kubernetes.Nodes.CA); err != nil {\n+ return certs, err\n+ } else {\n+ certs.Kubernetes.Nodes.Generic = cert\n+ }\n+\n+ if cert, err := newSignedBundle(Config{\n+ CommonName: \"apiserver\",\n+ Usages: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},\n+ AltNames: AltNames{\n+ DNSNames: []string{\"kubernetes\", \"kubernetes.default\", \"apiserver\", \"TODO:external.dns.name\"},\n+ IPs: []net.IP{net.IPv4(127, 0, 0, 1)},\n+ },\n+ }, certs.TLS.CA); err != nil {\n+ return certs, err\n+ } else {\n+ certs.TLS.ApiServer = cert\n}\n- pool := &Pool{CA: ca}\n- return pool\n+\n+ if cert, err := newSignedBundle(Config{\n+ CommonName: \"etcd\",\n+ Usages: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},\n+ AltNames: AltNames{\n+ DNSNames: []string{\"etcd\"},\n+ IPs: []net.IP{net.IPv4(127, 0, 0, 1)},\n+ },\n+ }, certs.TLS.CA); err != nil {\n+ return certs, err\n+ } else {\n+ certs.TLS.Etcd = cert\n+ }\n+\n+ return certs, nil\n}\n-func (dict ClusterCerts) newCA(name string) (*Bundle, error) {\n+func newCA(satellite, name string) (*Bundle, error) {\nkey, err := certutil.NewPrivateKey()\nif err != nil {\npanic(err)\n@@ -119,9 +215,8 @@ func (dict ClusterCerts) newCA(name string) (*Bundle, error) {\n}\nconfig := Config{\n- OrganizationalUnit: []string{\"SAP Converged Cloud\", \"Kubernikus\"},\n- Province: []string{fmt.Sprintf(\"%s CA\", name)},\n- Locality: []string{dict.Name},\n+ CommonName: name,\n+ OrganizationalUnit: []string{\"SAP Converged Cloud\", \"Kubernikus\", satellite},\n}\ncert, err := NewSelfSignedCACert(config, key)\n@@ -133,6 +228,23 @@ func (dict ClusterCerts) newCA(name string) (*Bundle, error) {\nreturn &Bundle{cert, key}, nil\n}\n+func newSignedBundle(config Config, ca *Bundle) (*Bundle, error) {\n+ key, err := certutil.NewPrivateKey()\n+ if err != nil {\n+ return &Bundle{}, fmt.Errorf(\"unable to create private key [%v]\", err)\n+ }\n+\n+ config.OrganizationalUnit = ca.Certificate.Subject.OrganizationalUnit\n+\n+ cert, err := NewSignedCert(config, key, ca.Certificate, ca.PrivateKey)\n+\n+ if err != nil {\n+ return &Bundle{}, fmt.Errorf(\"unable to create self-signed certificate [%v]\", err)\n+ }\n+\n+ return &Bundle{cert, key}, nil\n+}\n+\nfunc NewSelfSignedCACert(cfg Config, key *rsa.PrivateKey) (*x509.Certificate, error) {\nnow := time.Now()\ntmpl := x509.Certificate{\n@@ -141,8 +253,6 @@ func NewSelfSignedCACert(cfg Config, key *rsa.PrivateKey) (*x509.Certificate, er\nCommonName: cfg.CommonName,\nOrganization: cfg.Organization,\nOrganizationalUnit: cfg.OrganizationalUnit,\n- Province: cfg.Province,\n- Locality: cfg.Locality,\n},\nNotBefore: now.UTC(),\nNotAfter: now.Add(duration365d * 10).UTC(),\n@@ -180,7 +290,7 @@ func NewSignedCert(cfg Config, key *rsa.PrivateKey, caCert *x509.Certificate, ca\nIPAddresses: cfg.AltNames.IPs,\nSerialNumber: serial,\nNotBefore: caCert.NotBefore,\n- NotAfter: time.Now().Add(duration365d).UTC(),\n+ NotAfter: time.Now().Add(duration365d * 10).UTC(),\nKeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,\nExtKeyUsage: cfg.Usages,\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/controller/ground/cluster.go",
"new_path": "pkg/controller/ground/cluster.go",
"diff": "package ground\ntype Cluster struct {\n- Certificates ClusterCerts\n+ Certificates *Certificates\n}\n-func NewCluster(name string) *Cluster {\n+func NewCluster(name string) (*Cluster, error) {\ncluster := &Cluster{}\n- cluster.Certificates = newClusterCerts(name)\n+ if certs, err := newCertificates(name); err != nil {\n+ return cluster, err\n+ } else {\n+ cluster.Certificates = certs\n+ }\n- return cluster\n+ return cluster, nil\n}\nfunc (c Cluster) WriteConfig(persister ConfigPersister) error {\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/controller/ground/io.go",
"new_path": "pkg/controller/ground/io.go",
"diff": "@@ -45,7 +45,7 @@ func NewHelmValuePersister(result *string) *HelmValuePersister {\n}\nfunc (fp FilePersister) WriteConfig(cluster Cluster) error {\n- for _, bundle := range cluster.Certificates.bundles() {\n+ for _, bundle := range cluster.Certificates.all() {\nerr := fp.writeToFiles(bundle)\nif err != nil {\nreturn err\n@@ -72,7 +72,18 @@ func (fp FilePersister) writeToFiles(b *Bundle) error {\n}\nfunc (bp BasePersister) basename(b *Bundle) string {\n- return sanitize.BaseName(strings.ToLower(strings.Join(b.Certificate.Subject.Province, \"-\")))\n+ stem := \"\"\n+ suffix := \"\"\n+\n+ if b.Certificate.IsCA {\n+ stem = b.Certificate.Subject.CommonName\n+ suffix = \"ca\"\n+ } else {\n+ stem = b.Certificate.Issuer.CommonName\n+ suffix = b.Certificate.Subject.CommonName\n+ }\n+\n+ return sanitize.BaseName(strings.ToLower(fmt.Sprintf(\"%s-%s\", stem, suffix)))\n}\nfunc (bp BasePersister) nameForKey(b *Bundle) string {\n@@ -88,11 +99,11 @@ func (fp FilePersister) pathForCert(b *Bundle) string {\n}\nfunc (fp FilePersister) pathForKey(b *Bundle) string {\n- return path.Join(fp.basedir(b))\n+ return path.Join(fp.basedir(b), fp.nameForKey(b))\n}\nfunc (fp FilePersister) basedir(b *Bundle) string {\n- return sanitize.BaseName(strings.ToLower(strings.Join(b.Certificate.Subject.Locality, \"-\")))\n+ return sanitize.BaseName(strings.ToLower(b.Certificate.Subject.OrganizationalUnit[len(b.Certificate.Subject.OrganizationalUnit)-1]))\n}\nfunc (hvp HelmValuePersister) WriteConfig(cluster Cluster) error {\n@@ -100,7 +111,7 @@ func (hvp HelmValuePersister) WriteConfig(cluster Cluster) error {\nCerts: map[string]string{},\n}\n- for _, bundle := range cluster.Certificates.bundles() {\n+ for _, bundle := range cluster.Certificates.all() {\nvalues.Certs[hvp.nameForCert(bundle)] = string(certutil.EncodeCertPEM(bundle.Certificate))\nvalues.Certs[hvp.nameForKey(bundle)] = string(certutil.EncodePrivateKeyPEM(bundle.PrivateKey))\n}\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | adds plain structure. generate all certs |
596,240 | 28.04.2017 10:02:46 | -7,200 | c4f3b5b8fd10bb63e15a7a50d33974de3781fc8b | add etcd peer certificates | [
{
"change_type": "MODIFY",
"old_path": "pkg/controller/ground/certificates.go",
"new_path": "pkg/controller/ground/certificates.go",
"diff": "@@ -25,6 +25,10 @@ type Certificates struct {\nCA *Bundle\nApiserver *Bundle\n}\n+ Peers struct {\n+ CA *Bundle\n+ Universal *Bundle\n+ }\n}\nKubernetes struct {\n@@ -38,7 +42,7 @@ type Certificates struct {\n}\nNodes struct {\nCA *Bundle\n- Generic *Bundle\n+ Universal *Bundle\n}\n}\n@@ -71,6 +75,8 @@ func (c Certificates) all() []*Bundle {\nreturn []*Bundle{\nc.Etcd.Clients.Apiserver,\nc.Etcd.Clients.CA,\n+ c.Etcd.Peers.Universal,\n+ c.Etcd.Peers.CA,\nc.Kubernetes.Clients.CA,\nc.Kubernetes.Clients.ControllerManager,\nc.Kubernetes.Clients.Scheduler,\n@@ -78,7 +84,7 @@ func (c Certificates) all() []*Bundle {\nc.Kubernetes.Clients.Kubelet,\nc.Kubernetes.Clients.ClusterAdmin,\nc.Kubernetes.Nodes.CA,\n- c.Kubernetes.Nodes.Generic,\n+ c.Kubernetes.Nodes.Universal,\nc.TLS.CA,\nc.TLS.ApiServer,\nc.TLS.Etcd,\n@@ -94,6 +100,12 @@ func newCertificates(satellite string) (*Certificates, error) {\ncerts.Etcd.Clients.CA = ca\n}\n+ if ca, err := newCA(satellite, \"Etcd Peers\"); err != nil {\n+ return certs, err\n+ } else {\n+ certs.Etcd.Peers.CA = ca\n+ }\n+\nif ca, err := newCA(satellite, \"Kubernetes Clients\"); err != nil {\nreturn certs, err\n} else {\n@@ -121,6 +133,15 @@ func newCertificates(satellite string) (*Certificates, error) {\ncerts.Etcd.Clients.Apiserver = cert\n}\n+ if cert, err := newSignedBundle(Config{\n+ CommonName: \"universal\",\n+ Usages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth},\n+ }, certs.Etcd.Peers.CA); err != nil {\n+ return certs, err\n+ } else {\n+ certs.Etcd.Peers.Universal = cert\n+ }\n+\nif cert, err := newSignedBundle(Config{\nCommonName: \"cluster-admin\",\nOrganization: []string{\"system:masters\"},\n@@ -141,7 +162,7 @@ func newCertificates(satellite string) (*Certificates, error) {\n}\nif cert, err := newSignedBundle(Config{\n- CommonName: \"kuelet\",\n+ CommonName: \"kubelet\",\nOrganization: []string{\"system:nodes\"},\nUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},\n}, certs.Kubernetes.Clients.CA); err != nil {\n@@ -169,13 +190,13 @@ func newCertificates(satellite string) (*Certificates, error) {\n}\nif cert, err := newSignedBundle(Config{\n- CommonName: \"kubelet\",\n+ CommonName: \"universal\",\nOrganization: []string{\"system:nodes\"},\nUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},\n}, certs.Kubernetes.Nodes.CA); err != nil {\nreturn certs, err\n} else {\n- certs.Kubernetes.Nodes.Generic = cert\n+ certs.Kubernetes.Nodes.Universal = cert\n}\nif cert, err := newSignedBundle(Config{\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | add etcd peer certificates |
596,240 | 29.04.2017 18:42:02 | -7,200 | b0c37abb2c5cd5e781070c47b92d5ce8b6a5900e | adds another CA for clients connecting to the kubelets | [
{
"change_type": "MODIFY",
"old_path": "pkg/controller/ground/certificates.go",
"new_path": "pkg/controller/ground/certificates.go",
"diff": "@@ -5,8 +5,6 @@ import (\n\"crypto/rsa\"\n\"crypto/x509\"\n\"crypto/x509/pkix\"\n- \"errors\"\n- \"fmt\"\n\"math\"\n\"math/big\"\n\"net\"\n@@ -22,34 +20,39 @@ const (\ntype Certificates struct {\nEtcd struct {\nClients struct {\n- CA *Bundle\n- Apiserver *Bundle\n+ CA Bundle\n+ ApiServer Bundle\n}\nPeers struct {\n- CA *Bundle\n- Universal *Bundle\n+ CA Bundle\n+ Universal Bundle\n}\n}\n- Kubernetes struct {\n+ ApiServer struct {\nClients struct {\n- CA *Bundle\n- ControllerManager *Bundle\n- Scheduler *Bundle\n- Proxy *Bundle\n- Kubelet *Bundle\n- ClusterAdmin *Bundle\n+ CA Bundle\n+ ControllerManager Bundle\n+ Scheduler Bundle\n+ Proxy Bundle\n+ ClusterAdmin Bundle\n}\nNodes struct {\n- CA *Bundle\n- Universal *Bundle\n+ CA Bundle\n+ Universal Bundle\n+ }\n+ }\n+\n+ Kubelet struct {\n+ Clients struct {\n+ CA Bundle\n+ ApiServer Bundle\n}\n}\nTLS struct {\n- CA *Bundle\n- ApiServer *Bundle\n- Etcd *Bundle\n+ CA Bundle\n+ ApiServer Bundle\n}\n}\n@@ -59,7 +62,7 @@ type Bundle struct {\n}\ntype Config struct {\n- CommonName string\n+ sign string\nOrganization []string\nOrganizationalUnit []string\nAltNames AltNames\n@@ -71,209 +74,112 @@ type AltNames struct {\nIPs []net.IP\n}\n-func (c Certificates) all() []*Bundle {\n- return []*Bundle{\n- c.Etcd.Clients.Apiserver,\n+func (c Certificates) all() []Bundle {\n+ return []Bundle{\nc.Etcd.Clients.CA,\n- c.Etcd.Peers.Universal,\n+ c.Etcd.Clients.ApiServer,\nc.Etcd.Peers.CA,\n- c.Kubernetes.Clients.CA,\n- c.Kubernetes.Clients.ControllerManager,\n- c.Kubernetes.Clients.Scheduler,\n- c.Kubernetes.Clients.Proxy,\n- c.Kubernetes.Clients.Kubelet,\n- c.Kubernetes.Clients.ClusterAdmin,\n- c.Kubernetes.Nodes.CA,\n- c.Kubernetes.Nodes.Universal,\n+ c.Etcd.Peers.Universal,\n+ c.ApiServer.Clients.CA,\n+ c.ApiServer.Clients.ControllerManager,\n+ c.ApiServer.Clients.Scheduler,\n+ c.ApiServer.Clients.Proxy,\n+ c.ApiServer.Clients.ClusterAdmin,\n+ c.ApiServer.Nodes.CA,\n+ c.ApiServer.Nodes.Universal,\n+ c.Kubelet.Clients.CA,\n+ c.Kubelet.Clients.ApiServer,\nc.TLS.CA,\nc.TLS.ApiServer,\n- c.TLS.Etcd,\n- }\n-}\n-\n-func newCertificates(satellite string) (*Certificates, error) {\n- certs := &Certificates{}\n-\n- if ca, err := newCA(satellite, \"Etcd Clients\"); err != nil {\n- return certs, err\n- } else {\n- certs.Etcd.Clients.CA = ca\n}\n-\n- if ca, err := newCA(satellite, \"Etcd Peers\"); err != nil {\n- return certs, err\n- } else {\n- certs.Etcd.Peers.CA = ca\n}\n- if ca, err := newCA(satellite, \"Kubernetes Clients\"); err != nil {\n- return certs, err\n- } else {\n- certs.Kubernetes.Clients.CA = ca\n- }\n+func (certs *Certificates) populateForSatellite(satellite string) error {\n+ createCA(satellite, \"Etcd Clients\", &certs.Etcd.Clients.CA)\n+ createCA(satellite, \"Etcd Peers\", &certs.Etcd.Peers.CA)\n+ createCA(satellite, \"ApiServer Clients\", &certs.ApiServer.Clients.CA)\n+ createCA(satellite, \"ApiServer Nodes\", &certs.ApiServer.Nodes.CA)\n+ createCA(satellite, \"Kubelet Clients\", &certs.Kubelet.Clients.CA)\n+ createCA(satellite, \"TLS\", &certs.TLS.CA)\n- if ca, err := newCA(satellite, \"Kubernetes Nodes\"); err != nil {\n- return certs, err\n- } else {\n- certs.Kubernetes.Nodes.CA = ca\n- }\n+ certs.Etcd.Clients.ApiServer = certs.signEtcdClient(\"apiserver\")\n+ certs.Etcd.Peers.Universal = certs.signEtcdPeer(\"universal\")\n+ certs.ApiServer.Clients.ClusterAdmin = certs.signApiServerClient(\"cluster-admin\", \"system:masters\")\n+ certs.ApiServer.Clients.ControllerManager = certs.signApiServerClient(\"system:kube-controller-manager\")\n+ certs.ApiServer.Clients.Proxy = certs.signApiServerClient(\"system:kube-proxy\")\n+ certs.ApiServer.Clients.Scheduler = certs.signApiServerClient(\"system:kube-scheduler\")\n+ certs.ApiServer.Nodes.Universal = certs.signApiServerNode(\"universal\")\n+ certs.Kubelet.Clients.ApiServer = certs.signKubeletClient(\"apiserver\")\n+ certs.TLS.ApiServer = certs.signTLS(\"apiserver\",\n+ []string{\"kubernetes\", \"kubernetes.default\", \"apiserver\", \"TODO:external.dns.name\"},\n+ []net.IP{net.IPv4(127, 0, 0, 1)})\n- if ca, err := newCA(satellite, \"TLS\"); err != nil {\n- return certs, err\n- } else {\n- certs.TLS.CA = ca\n+ return nil\n}\n- if cert, err := newSignedBundle(Config{\n- CommonName: \"apiserver\",\n+func (c Certificates) signEtcdClient(name string) Bundle {\n+ config := Config{\n+ sign: name,\nUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},\n- }, certs.Etcd.Clients.CA); err != nil {\n- return certs, err\n- } else {\n- certs.Etcd.Clients.Apiserver = cert\n+ }\n+ return c.Etcd.Clients.CA.sign(config)\n}\n- if cert, err := newSignedBundle(Config{\n- CommonName: \"universal\",\n+func (c Certificates) signEtcdPeer(name string) Bundle {\n+ config := Config{\n+ sign: name,\nUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth},\n- }, certs.Etcd.Peers.CA); err != nil {\n- return certs, err\n- } else {\n- certs.Etcd.Peers.Universal = cert\n}\n-\n- if cert, err := newSignedBundle(Config{\n- CommonName: \"cluster-admin\",\n- Organization: []string{\"system:masters\"},\n- Usages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},\n- }, certs.Kubernetes.Clients.CA); err != nil {\n- return certs, err\n- } else {\n- certs.Kubernetes.Clients.ClusterAdmin = cert\n+ return c.Etcd.Peers.CA.sign(config)\n}\n- if cert, err := newSignedBundle(Config{\n- CommonName: \"system:kube-controller-manager\",\n+func (c Certificates) signApiServerClient(name string, groups ...string) Bundle {\n+ config := Config{\n+ sign: name,\n+ Organization: groups,\nUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},\n- }, certs.Kubernetes.Clients.CA); err != nil {\n- return certs, err\n- } else {\n- certs.Kubernetes.Clients.ControllerManager = cert\n+ }\n+ return c.ApiServer.Clients.CA.sign(config)\n}\n- if cert, err := newSignedBundle(Config{\n- CommonName: \"kubelet\",\n+func (c Certificates) signApiServerNode(name string) Bundle {\n+ config := Config{\n+ sign: name,\nOrganization: []string{\"system:nodes\"},\nUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},\n- }, certs.Kubernetes.Clients.CA); err != nil {\n- return certs, err\n- } else {\n- certs.Kubernetes.Clients.Kubelet = cert\n}\n-\n- if cert, err := newSignedBundle(Config{\n- CommonName: \"system:kube-proxy\",\n- Usages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},\n- }, certs.Kubernetes.Clients.CA); err != nil {\n- return certs, err\n- } else {\n- certs.Kubernetes.Clients.Proxy = cert\n+ return c.ApiServer.Nodes.CA.sign(config)\n}\n- if cert, err := newSignedBundle(Config{\n- CommonName: \"system:kube-scheduler\",\n- Usages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},\n- }, certs.Kubernetes.Clients.CA); err != nil {\n- return certs, err\n- } else {\n- certs.Kubernetes.Clients.Scheduler = cert\n- }\n-\n- if cert, err := newSignedBundle(Config{\n- CommonName: \"universal\",\n- Organization: []string{\"system:nodes\"},\n+func (c Certificates) signKubeletClient(name string) Bundle {\n+ config := Config{\n+ sign: name,\nUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},\n- }, certs.Kubernetes.Nodes.CA); err != nil {\n- return certs, err\n- } else {\n- certs.Kubernetes.Nodes.Universal = cert\n}\n-\n- if cert, err := newSignedBundle(Config{\n- CommonName: \"apiserver\",\n- Usages: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},\n- AltNames: AltNames{\n- DNSNames: []string{\"kubernetes\", \"kubernetes.default\", \"apiserver\", \"TODO:external.dns.name\"},\n- IPs: []net.IP{net.IPv4(127, 0, 0, 1)},\n- },\n- }, certs.TLS.CA); err != nil {\n- return certs, err\n- } else {\n- certs.TLS.ApiServer = cert\n+ return c.Kubelet.Clients.CA.sign(config)\n}\n- if cert, err := newSignedBundle(Config{\n- CommonName: \"etcd\",\n+func (c Certificates) signTLS(name string, dnsNames []string, ips []net.IP) Bundle {\n+ config := Config{\n+ sign: name,\nUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},\nAltNames: AltNames{\n- DNSNames: []string{\"etcd\"},\n- IPs: []net.IP{net.IPv4(127, 0, 0, 1)},\n+ DNSNames: dnsNames,\n+ IPs: ips,\n},\n- }, certs.TLS.CA); err != nil {\n- return certs, err\n- } else {\n- certs.TLS.Etcd = cert\n- }\n-\n- return certs, nil\n-}\n-\n-func newCA(satellite, name string) (*Bundle, error) {\n- key, err := certutil.NewPrivateKey()\n- if err != nil {\n- panic(err)\n- return &Bundle{}, fmt.Errorf(\"unable to create private key [%v]\", err)\n- }\n-\n- config := Config{\n- CommonName: name,\n- OrganizationalUnit: []string{\"SAP Converged Cloud\", \"Kubernikus\", satellite},\n- }\n- cert, err := NewSelfSignedCACert(config, key)\n-\n- if err != nil {\n- panic(err)\n- return &Bundle{}, fmt.Errorf(\"unable to create self-signed certificate [%v]\", err)\n- }\n-\n- return &Bundle{cert, key}, nil\n}\n-\n-func newSignedBundle(config Config, ca *Bundle) (*Bundle, error) {\n- key, err := certutil.NewPrivateKey()\n- if err != nil {\n- return &Bundle{}, fmt.Errorf(\"unable to create private key [%v]\", err)\n+ return c.TLS.CA.sign(config)\n}\n- config.OrganizationalUnit = ca.Certificate.Subject.OrganizationalUnit\n+func createCA(satellite, name string, bundle *Bundle) {\n+ bundle.PrivateKey, _ = certutil.NewPrivateKey()\n- cert, err := NewSignedCert(config, key, ca.Certificate, ca.PrivateKey)\n-\n- if err != nil {\n- return &Bundle{}, fmt.Errorf(\"unable to create self-signed certificate [%v]\", err)\n- }\n-\n- return &Bundle{cert, key}, nil\n-}\n-\n-func NewSelfSignedCACert(cfg Config, key *rsa.PrivateKey) (*x509.Certificate, error) {\nnow := time.Now()\ntmpl := x509.Certificate{\nSerialNumber: new(big.Int).SetInt64(0),\nSubject: pkix.Name{\n- CommonName: cfg.CommonName,\n- Organization: cfg.Organization,\n- OrganizationalUnit: cfg.OrganizationalUnit,\n+ CommonName: name,\n+ OrganizationalUnit: []string{\"SAP Converged Cloud\", \"Kubernikus\", satellite},\n},\nNotBefore: now.UTC(),\nNotAfter: now.Add(duration365d * 10).UTC(),\n@@ -282,42 +188,36 @@ func NewSelfSignedCACert(cfg Config, key *rsa.PrivateKey) (*x509.Certificate, er\nIsCA: true,\n}\n- certDERBytes, err := x509.CreateCertificate(rand.Reader, &tmpl, &tmpl, key.Public(), key)\n- if err != nil {\n- return nil, err\n- }\n- return x509.ParseCertificate(certDERBytes)\n+ certDERBytes, _ := x509.CreateCertificate(rand.Reader, &tmpl, &tmpl, bundle.PrivateKey.Public(), bundle.PrivateKey)\n+ bundle.Certificate, _ = x509.ParseCertificate(certDERBytes)\n}\n-func NewSignedCert(cfg Config, key *rsa.PrivateKey, caCert *x509.Certificate, caKey *rsa.PrivateKey) (*x509.Certificate, error) {\n- serial, err := rand.Int(rand.Reader, new(big.Int).SetInt64(math.MaxInt64))\n- if err != nil {\n- return nil, err\n- }\n- if len(cfg.CommonName) == 0 {\n- return nil, errors.New(\"must specify a CommonName\")\n- }\n- if len(cfg.Usages) == 0 {\n- return nil, errors.New(\"must specify at least one ExtKeyUsage\")\n+func (ca Bundle) sign(config Config) Bundle {\n+ if !ca.Certificate.IsCA {\n+ panic(\"You can't use this certificate for signing. It's not a CA...\")\n}\n+ key, _ := certutil.NewPrivateKey()\n+ serial, _ := rand.Int(rand.Reader, new(big.Int).SetInt64(math.MaxInt64))\n+\ncertTmpl := x509.Certificate{\nSubject: pkix.Name{\n- CommonName: cfg.CommonName,\n- Organization: cfg.Organization,\n- OrganizationalUnit: cfg.OrganizationalUnit,\n+ CommonName: config.sign,\n+ Organization: config.Organization,\n+ OrganizationalUnit: ca.Certificate.Subject.OrganizationalUnit,\n},\n- DNSNames: cfg.AltNames.DNSNames,\n- IPAddresses: cfg.AltNames.IPs,\n+ DNSNames: config.AltNames.DNSNames,\n+ IPAddresses: config.AltNames.IPs,\nSerialNumber: serial,\n- NotBefore: caCert.NotBefore,\n+ NotBefore: ca.Certificate.NotBefore,\nNotAfter: time.Now().Add(duration365d * 10).UTC(),\nKeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,\n- ExtKeyUsage: cfg.Usages,\n- }\n- certDERBytes, err := x509.CreateCertificate(rand.Reader, &certTmpl, caCert, key.Public(), caKey)\n- if err != nil {\n- return nil, err\n+ ExtKeyUsage: config.Usages,\n}\n- return x509.ParseCertificate(certDERBytes)\n+\n+ certDERBytes, _ := x509.CreateCertificate(rand.Reader, &certTmpl, ca.Certificate, key.Public(), ca.PrivateKey)\n+\n+ cert, _ := x509.ParseCertificate(certDERBytes)\n+\n+ return Bundle{cert, key}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/controller/ground/cluster.go",
"new_path": "pkg/controller/ground/cluster.go",
"diff": "@@ -5,11 +5,12 @@ type Cluster struct {\n}\nfunc NewCluster(name string) (*Cluster, error) {\n- cluster := &Cluster{}\n- if certs, err := newCertificates(name); err != nil {\n+ cluster := &Cluster{\n+ Certificates: &Certificates{},\n+ }\n+\n+ if err := cluster.Certificates.populateForSatellite(name); err != nil {\nreturn cluster, err\n- } else {\n- cluster.Certificates = certs\n}\nreturn cluster, nil\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/controller/ground/io.go",
"new_path": "pkg/controller/ground/io.go",
"diff": "@@ -55,7 +55,7 @@ func (fp FilePersister) WriteConfig(cluster Cluster) error {\nreturn nil\n}\n-func (fp FilePersister) writeToFiles(b *Bundle) error {\n+func (fp FilePersister) writeToFiles(b Bundle) error {\nfmt.Println(fp.pathForCert(b))\nerr := certutil.WriteCert(fp.pathForCert(b), certutil.EncodeCertPEM(b.Certificate))\nif err != nil {\n@@ -71,7 +71,7 @@ func (fp FilePersister) writeToFiles(b *Bundle) error {\nreturn nil\n}\n-func (bp BasePersister) basename(b *Bundle) string {\n+func (bp BasePersister) basename(b Bundle) string {\nstem := \"\"\nsuffix := \"\"\n@@ -86,23 +86,23 @@ func (bp BasePersister) basename(b *Bundle) string {\nreturn sanitize.BaseName(strings.ToLower(fmt.Sprintf(\"%s-%s\", stem, suffix)))\n}\n-func (bp BasePersister) nameForKey(b *Bundle) string {\n+func (bp BasePersister) nameForKey(b Bundle) string {\nreturn fmt.Sprintf(\"%s-key.pem\", bp.basename(b))\n}\n-func (bp BasePersister) nameForCert(b *Bundle) string {\n+func (bp BasePersister) nameForCert(b Bundle) string {\nreturn fmt.Sprintf(\"%s.pem\", bp.basename(b))\n}\n-func (fp FilePersister) pathForCert(b *Bundle) string {\n+func (fp FilePersister) pathForCert(b Bundle) string {\nreturn path.Join(fp.basedir(b), fp.nameForCert(b))\n}\n-func (fp FilePersister) pathForKey(b *Bundle) string {\n+func (fp FilePersister) pathForKey(b Bundle) string {\nreturn path.Join(fp.basedir(b), fp.nameForKey(b))\n}\n-func (fp FilePersister) basedir(b *Bundle) string {\n+func (fp FilePersister) basedir(b Bundle) string {\nreturn sanitize.BaseName(strings.ToLower(b.Certificate.Subject.OrganizationalUnit[len(b.Certificate.Subject.OrganizationalUnit)-1]))\n}\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | adds another CA for clients connecting to the kubelets |
596,240 | 06.06.2017 14:22:08 | -7,200 | febc83a113066785497e3b1b9ce1327b5a25083e | uses viper for configuration management | [
{
"change_type": "MODIFY",
"old_path": "cmd/groundctl/certificates.go",
"new_path": "cmd/groundctl/certificates.go",
"diff": "package main\nimport (\n- \"fmt\"\n- \"os\"\n+ \"errors\"\n\"github.com/sapcc/kubernikus/pkg/controller/ground\"\n\"github.com/spf13/cobra\"\n+ \"github.com/spf13/viper\"\n)\n-var name string\n-\nfunc init() {\n- certificatesCmd.AddCommand(generateCmd)\nRootCmd.AddCommand(certificatesCmd)\n+\n+ certificatesCmd.Flags().String(\"name\", \"\", \"Name of the satellite cluster\")\n+ viper.BindPFlag(\"name\", certificatesCmd.Flags().Lookup(\"name\"))\n}\nvar certificatesCmd = &cobra.Command{\n- Use: \"certificates\",\n-}\n+ Use: \"certificates --name NAME\",\n-var generateCmd = &cobra.Command{\n- Use: \"generate [name]\",\n- Run: func(cmd *cobra.Command, args []string) {\n- if len(args) != 1 {\n- fmt.Println(\"You need to give a satellite name\")\n- return\n+ RunE: func(cmd *cobra.Command, args []string) error {\n+ err := validateCertificateInputs()\n+ if err != nil {\n+ return err\n}\n- cluster, err := ground.NewCluster(args[0])\n+\n+ cluster, err := ground.NewCluster(viper.GetString(\"name\"))\nif err != nil {\n- fmt.Println(err)\n- os.Exit(-1)\n+ return err\n}\nerr = cluster.WriteConfig(ground.NewFilePersister(\".\"))\nif err != nil {\n- fmt.Println(err)\n- os.Exit(-1)\n+ return err\n}\n+\n+ return nil\n},\n}\n+\n+func validateCertificateInputs() error {\n+ if viper.GetString(\"name\") == \"\" {\n+ return errors.New(\"You need to provide a name\")\n+ }\n+\n+ return nil\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "cmd/groundctl/helm.go",
"new_path": "cmd/groundctl/helm.go",
"diff": "package main\nimport (\n+ \"errors\"\n\"fmt\"\n- \"os\"\n\"github.com/sapcc/kubernikus/pkg/controller/ground\"\n\"github.com/spf13/cobra\"\n+ \"github.com/spf13/viper\"\n)\nfunc init() {\n- helmCmd.AddCommand(valuesCmd)\nRootCmd.AddCommand(helmCmd)\n+\n+ helmCmd.Flags().String(\"name\", \"\", \"Name of the satellite cluster\")\n+ viper.BindPFlag(\"name\", certificatesCmd.Flags().Lookup(\"name\"))\n}\nvar helmCmd = &cobra.Command{\n- Use: \"helm\",\n-}\n+ Use: \"values --name NAME\",\n+ RunE: func(cmd *cobra.Command, args []string) error {\n+ var result = \"\"\n-var valuesCmd = &cobra.Command{\n- Use: \"values [NAME]\",\n- Run: func(cmd *cobra.Command, args []string) {\n- if len(args) != 1 {\n- fmt.Println(\"You need to give a satellite name\")\n- return\n+ err := validateHelmInputs()\n+ if err != nil {\n+ return err\n}\n- var result = \"\"\n- cluster, err := ground.NewCluster(args[0])\n-\n- if err == nil {\n- err = cluster.WriteConfig(ground.NewHelmValuePersister(&result))\n+ cluster, err := ground.NewCluster(viper.GetString(\"name\"))\n+ if err != nil {\n+ return err\n}\n+ err = cluster.WriteConfig(ground.NewHelmValuePersister(&result))\nif err != nil {\n- fmt.Println(err)\n- os.Exit(-1)\n+ return err\n}\nfmt.Println(result)\n+\n+ return nil\n},\n}\n+\n+func validateHelmInputs() error {\n+ if viper.GetString(\"name\") == \"\" {\n+ return errors.New(\"You need to provide a name\")\n+ }\n+\n+ return nil\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "cmd/groundctl/main.go",
"new_path": "cmd/groundctl/main.go",
"diff": "package main\nimport (\n- \"fmt\"\n- \"os\"\n+ goflag \"flag\"\n+ flag \"github.com/spf13/pflag\"\n+\n+ \"github.com/golang/glog\"\n\"github.com/spf13/cobra\"\n+ \"github.com/spf13/viper\"\n)\nvar RootCmd = &cobra.Command{\n@@ -12,10 +15,34 @@ var RootCmd = &cobra.Command{\n}\nvar satelliteName string\n+var configFile string\nfunc main() {\n- if err := RootCmd.Execute(); err != nil {\n- fmt.Println(err)\n- os.Exit(1)\n+ RootCmd.Execute()\n+}\n+\n+func init() {\n+ flag.CommandLine.AddGoFlagSet(goflag.CommandLine)\n+ cobra.OnInitialize(initConfig)\n+\n+ RootCmd.PersistentFlags().StringVar(&configFile, \"config\", \"\", \"config file (default is /etc/kubernikus/groundctl.yaml)\")\n+}\n+\n+func initConfig() {\n+ if configFile != \"\" { // enable ability to specify config file via flag\n+ viper.SetConfigFile(configFile)\n+ }\n+\n+ viper.SetConfigName(\"groundctl\")\n+ viper.AddConfigPath(\".\")\n+ viper.AddConfigPath(\"$HOME\")\n+ viper.AddConfigPath(\"/etc/kubernikus\")\n+ viper.AutomaticEnv()\n+\n+ err := viper.ReadInConfig()\n+ if err != nil {\n+ glog.Fatalf(\"%v\", err)\n+ } else {\n+ glog.V(2).Infof(viper.ConfigFileUsed())\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/controller/ground/io.go",
"new_path": "pkg/controller/ground/io.go",
"diff": "@@ -2,13 +2,9 @@ package ground\nimport (\n\"fmt\"\n- \"path\"\n\"strings\"\n- yaml \"gopkg.in/yaml.v2\"\n-\n\"github.com/kennygrant/sanitize\"\n- certutil \"k8s.io/client-go/util/cert\"\n)\ntype ConfigPersister interface {\n@@ -17,60 +13,6 @@ type ConfigPersister interface {\ntype BasePersister struct{}\n-type HelmValuePersister struct {\n- BasePersister\n-\n- result *string\n-}\n-\n-type FilePersister struct {\n- BasePersister\n- BaseDir string\n-}\n-\n-type HelmValues struct {\n- Certs map[string]string\n-}\n-\n-func NewFilePersister(basedir string) *FilePersister {\n- p := &FilePersister{}\n- p.BaseDir = basedir\n- return p\n-}\n-\n-func NewHelmValuePersister(result *string) *HelmValuePersister {\n- p := &HelmValuePersister{}\n- p.result = result\n- return p\n-}\n-\n-func (fp FilePersister) WriteConfig(cluster Cluster) error {\n- for _, bundle := range cluster.Certificates.all() {\n- err := fp.writeToFiles(bundle)\n- if err != nil {\n- return err\n- }\n- }\n-\n- return nil\n-}\n-\n-func (fp FilePersister) writeToFiles(b Bundle) error {\n- fmt.Println(fp.pathForCert(b))\n- err := certutil.WriteCert(fp.pathForCert(b), certutil.EncodeCertPEM(b.Certificate))\n- if err != nil {\n- return err\n- }\n-\n- fmt.Println(fp.pathForKey(b))\n- err = certutil.WriteKey(fp.pathForKey(b), certutil.EncodePrivateKeyPEM(b.PrivateKey))\n- if err != nil {\n- return err\n- }\n-\n- return nil\n-}\n-\nfunc (bp BasePersister) basename(b Bundle) string {\nstem := \"\"\nsuffix := \"\"\n@@ -93,35 +35,3 @@ func (bp BasePersister) nameForKey(b Bundle) string {\nfunc (bp BasePersister) nameForCert(b Bundle) string {\nreturn fmt.Sprintf(\"%s.pem\", bp.basename(b))\n}\n-\n-func (fp FilePersister) pathForCert(b Bundle) string {\n- return path.Join(fp.basedir(b), fp.nameForCert(b))\n-}\n-\n-func (fp FilePersister) pathForKey(b Bundle) string {\n- return path.Join(fp.basedir(b), fp.nameForKey(b))\n-}\n-\n-func (fp FilePersister) basedir(b Bundle) string {\n- return sanitize.BaseName(strings.ToLower(b.Certificate.Subject.OrganizationalUnit[len(b.Certificate.Subject.OrganizationalUnit)-1]))\n-}\n-\n-func (hvp HelmValuePersister) WriteConfig(cluster Cluster) error {\n- values := HelmValues{\n- Certs: map[string]string{},\n- }\n-\n- for _, bundle := range cluster.Certificates.all() {\n- values.Certs[hvp.nameForCert(bundle)] = string(certutil.EncodeCertPEM(bundle.Certificate))\n- values.Certs[hvp.nameForKey(bundle)] = string(certutil.EncodePrivateKeyPEM(bundle.PrivateKey))\n- }\n-\n- result, err := yaml.Marshal(&values)\n- if err != nil {\n- return err\n- }\n-\n- *hvp.result = string(result)\n-\n- return nil\n-}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/controller/ground/io_files.go",
"diff": "+package ground\n+\n+import (\n+ \"fmt\"\n+ \"path\"\n+ \"strings\"\n+\n+ \"github.com/kennygrant/sanitize\"\n+ certutil \"k8s.io/client-go/util/cert\"\n+)\n+\n+type FilePersister struct {\n+ BasePersister\n+ BaseDir string\n+}\n+\n+func NewFilePersister(basedir string) *FilePersister {\n+ p := &FilePersister{}\n+ p.BaseDir = basedir\n+ return p\n+}\n+\n+func (fp FilePersister) WriteConfig(cluster Cluster) error {\n+ for _, bundle := range cluster.Certificates.all() {\n+ err := fp.writeToFiles(bundle)\n+ if err != nil {\n+ return err\n+ }\n+ }\n+\n+ return nil\n+}\n+\n+func (fp FilePersister) writeToFiles(b Bundle) error {\n+ fmt.Println(fp.pathForCert(b))\n+ err := certutil.WriteCert(fp.pathForCert(b), certutil.EncodeCertPEM(b.Certificate))\n+ if err != nil {\n+ return err\n+ }\n+\n+ fmt.Println(fp.pathForKey(b))\n+ err = certutil.WriteKey(fp.pathForKey(b), certutil.EncodePrivateKeyPEM(b.PrivateKey))\n+ if err != nil {\n+ return err\n+ }\n+\n+ return nil\n+}\n+\n+func (fp FilePersister) pathForCert(b Bundle) string {\n+ return path.Join(fp.basedir(b), fp.nameForCert(b))\n+}\n+\n+func (fp FilePersister) pathForKey(b Bundle) string {\n+ return path.Join(fp.basedir(b), fp.nameForKey(b))\n+}\n+\n+func (fp FilePersister) basedir(b Bundle) string {\n+ return sanitize.BaseName(strings.ToLower(b.Certificate.Subject.OrganizationalUnit[len(b.Certificate.Subject.OrganizationalUnit)-1]))\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/controller/ground/io_helm.go",
"diff": "+package ground\n+\n+import (\n+ yaml \"gopkg.in/yaml.v2\"\n+\n+ certutil \"k8s.io/client-go/util/cert\"\n+)\n+\n+type HelmValuePersister struct {\n+ BasePersister\n+\n+ result *string\n+}\n+\n+type HelmValues struct {\n+ Certs map[string]string\n+}\n+\n+func NewHelmValuePersister(result *string) *HelmValuePersister {\n+ p := &HelmValuePersister{}\n+ p.result = result\n+ return p\n+}\n+\n+func (hvp HelmValuePersister) WriteConfig(cluster Cluster) error {\n+ values := HelmValues{\n+ Certs: map[string]string{},\n+ }\n+\n+ for _, bundle := range cluster.Certificates.all() {\n+ values.Certs[hvp.nameForCert(bundle)] = string(certutil.EncodeCertPEM(bundle.Certificate))\n+ values.Certs[hvp.nameForKey(bundle)] = string(certutil.EncodePrivateKeyPEM(bundle.PrivateKey))\n+ }\n+\n+ result, err := yaml.Marshal(&values)\n+ if err != nil {\n+ return err\n+ }\n+\n+ *hvp.result = string(result)\n+\n+ return nil\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/controller/ground/io_kubernetes.go",
"diff": "+package version\n+\n+import (\n+ \"github.com/golang/glog\"\n+ \"k8s.io/client-go/kubernetes\"\n+ \"k8s.io/client-go/tools/clientcmd\"\n+)\n+\n+func NewClient(kubeconfig string) *kubernetes.Clientset {\n+ glog.V(2).Infof(\"Creating Client\")\n+ rules := clientcmd.NewDefaultClientConfigLoadingRules()\n+ overrides := &clientcmd.ConfigOverrides{}\n+\n+ if kubeconfig != \"\" {\n+ rules.ExplicitPath = kubeconfig\n+ }\n+\n+ config, err := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(rules, overrides).ClientConfig()\n+ if err != nil {\n+ glog.Fatalf(\"Couldn't get Kubernetes default config: %s\", err)\n+ }\n+\n+ client, err := kubernetes.NewForConfig(config)\n+ if err != nil {\n+ glog.Fatalf(\"Couldn't create Kubernetes client: %s\", err)\n+ }\n+\n+ glog.V(3).Infof(\"Using Kubernetes Api at %s\", config.Host)\n+ return client\n+}\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | uses viper for configuration management |
596,240 | 30.08.2017 09:47:53 | -7,200 | 30967d3fe513a84ba1941ad623dd7b539c380cc1 | adds node pools spec | [
{
"change_type": "MODIFY",
"old_path": "pkg/tpr/v1/types.go",
"new_path": "pkg/tpr/v1/types.go",
"diff": "@@ -6,6 +6,20 @@ const KlusterResourcePlural = \"klusters\"\ntype KlusterSpec struct {\nName string `json:\"name\"`\n+ NodePools []NodePool `json:\"nodePools\"`\n+}\n+\n+type NodePool struct {\n+ Name string `json:\"name\"`\n+ Size int `json:\"size\"`\n+ Flavor string `json:\"flavor\"`\n+ Image string `json:\"image\"`\n+ Config NodePoolConfig `json:\"config\"`\n+}\n+\n+type NodePoolConfig struct {\n+ Upgrade bool `json:\"upgrade\"`\n+ Repair bool `json:\"repair\"`\n}\nfunc (spec KlusterSpec) Validate() error {\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | adds node pools spec |
596,240 | 31.08.2017 13:45:31 | -7,200 | 5c86fb59671039974ccd93c663f88c7f0ab9f823 | adds code generators for kubernetes api | [
{
"change_type": "MODIFY",
"old_path": "Makefile",
"new_path": "Makefile",
"diff": "+include *.mk\n+\nDATE = $(shell date +%Y%m%d%H%M)\nIMAGE ?= sapcc/kubernikus\nVERSION ?= latest\n@@ -21,7 +23,7 @@ endif\nHAS_GLIDE := $(shell command -v glide;)\nHAS_SWAGGER := $(shell command -v swagger;)\n-.PHONY: all clean\n+.PHONY: all clean code-gen client-gen informer-gen lister-gen\nall: $(BINARIES:%=bin/$(GOOS)/%)\n@@ -47,6 +49,8 @@ swagger-generate:\nclean:\nrm -rf bin/*\n+code-gen: client-gen informer-gen lister-gen\n+\nbootstrap:\nifndef HAS_GLIDE\nbrew install glide\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "code-generate.mk",
"diff": "+OUTPUT := _output\n+OUTPUT_BASE := $(GOPATH)/src\n+INPUT_BASE := github.com/sapcc/kubernikus\n+API_BASE := $(INPUT_BASE)/pkg/apis\n+GENERATED_BASE := $(INPUT_BASE)/pkg/generated\n+BIN := $(OUTPUT)/bin\n+\n+client-gen: $(OUTPUT)/bin/client-gen\n+ @rm -rf ./pkg/generated/clientset\n+ @mkdir -p ./pkg/generated/clientset\n+ $(BIN)/client-gen \\\n+ --go-header-file /dev/null \\\n+ --output-base $(OUTPUT_BASE) \\\n+ --input-base $(API_BASE) \\\n+ --clientset-path $(GENERATED_BASE) \\\n+ --input kubernikus/v1 \\\n+ --clientset-name clientset\n+\n+informer-gen: $(OUTPUT)/bin/informer-gen\n+ @rm -rf ./pkg/generated/informers\n+ @mkdir -p ./pkg/generated/informers\n+ $(BIN)/informer-gen \\\n+ --logtostderr \\\n+ --go-header-file /dev/null \\\n+ --output-base $(OUTPUT_BASE) \\\n+ --input-dirs $(API_BASE)/kubernikus/v1 \\\n+ --output-package $(GENERATED_BASE)/informers \\\n+ --listers-package $(GENERATED_BASE)/listers \\\n+ --internal-clientset-package $(GENERATED_BASE)/clientset \\\n+ --versioned-clientset-package $(GENERATED_BASE)/clientset\n+\n+lister-gen: $(OUTPUT)/bin/lister-gen\n+ @rm -rf ./pkg/generated/listers\n+ @mkdir -p ./pkg/generated/listers\n+ ${BIN}/lister-gen \\\n+ --logtostderr \\\n+ --go-header-file /dev/null \\\n+ --output-base $(OUTPUT_BASE) \\\n+ --input-dirs $(API_BASE)/kubernikus/v1 \\\n+ --output-package $(GENERATED_BASE)/listers\n+\n+$(OUTPUT)/bin/%:\n+ @mkdir -p _output/bin\n+ go build -o $@ ./vendor/k8s.io/code-generator/cmd/$*\n"
},
{
"change_type": "MODIFY",
"old_path": "glide.lock",
"new_path": "glide.lock",
"diff": "-hash: 4d5962135d0914288f8b30de13f4b9124d66fdd00d4b51379a10b67ff02df23c\n-updated: 2017-08-03T13:41:02.303609168+02:00\n+hash: 56cc165b7ea4bd90814a0ad72aab3be6c775f6d44a3ad9da8a14f7af14700643\n+updated: 2017-08-30T17:40:40.19949364+02:00\nimports:\n- name: github.com/asaskevich/govalidator\nversion: 7664702784775e51966f0885f5cd27435916517b\n@@ -288,6 +288,37 @@ imports:\nversion: d92e8497f71b7b4e0494e5bd204b48d34bd6f254\nsubpackages:\n- discovery\n+ - discovery/fake\n+ - informers\n+ - informers/admissionregistration\n+ - informers/admissionregistration/v1alpha1\n+ - informers/apps\n+ - informers/apps/v1beta1\n+ - informers/autoscaling\n+ - informers/autoscaling/v1\n+ - informers/autoscaling/v2alpha1\n+ - informers/batch\n+ - informers/batch/v1\n+ - informers/batch/v2alpha1\n+ - informers/certificates\n+ - informers/certificates/v1beta1\n+ - informers/core\n+ - informers/core/v1\n+ - informers/extensions\n+ - informers/extensions/v1beta1\n+ - informers/internalinterfaces\n+ - informers/networking\n+ - informers/networking/v1\n+ - informers/policy\n+ - informers/policy/v1beta1\n+ - informers/rbac\n+ - informers/rbac/v1alpha1\n+ - informers/rbac/v1beta1\n+ - informers/settings\n+ - informers/settings/v1alpha1\n+ - informers/storage\n+ - informers/storage/v1\n+ - informers/storage/v1beta1\n- kubernetes\n- kubernetes/scheme\n- kubernetes/typed/admissionregistration/v1alpha1\n@@ -310,6 +341,22 @@ imports:\n- kubernetes/typed/settings/v1alpha1\n- kubernetes/typed/storage/v1\n- kubernetes/typed/storage/v1beta1\n+ - listers/admissionregistration/v1alpha1\n+ - listers/apps/v1beta1\n+ - listers/autoscaling/v1\n+ - listers/autoscaling/v2alpha1\n+ - listers/batch/v1\n+ - listers/batch/v2alpha1\n+ - listers/certificates/v1beta1\n+ - listers/core/v1\n+ - listers/extensions/v1beta1\n+ - listers/networking/v1\n+ - listers/policy/v1beta1\n+ - listers/rbac/v1alpha1\n+ - listers/rbac/v1beta1\n+ - listers/settings/v1alpha1\n+ - listers/storage/v1\n+ - listers/storage/v1beta1\n- pkg/api\n- pkg/api/v1\n- pkg/api/v1/ref\n@@ -350,6 +397,7 @@ imports:\n- pkg/version\n- rest\n- rest/watch\n+ - testing\n- tools/auth\n- tools/cache\n- tools/clientcmd\n@@ -366,6 +414,11 @@ imports:\n- util/homedir\n- util/integer\n- util/workqueue\n+- name: k8s.io/code-generator\n+ version: bf449d588b78132603c5e2dba7286e7d335abedc\n+ repo: https://github.com/sttts/code-generator\n+- name: k8s.io/gengo\n+ version: 9e661e9308f078838e266cca1c673922088c0ea4\n- name: k8s.io/helm\nversion: 012cb0ac1a1b2f888144ef5a67b8dab6c2d45be6\nsubpackages:\n"
},
{
"change_type": "MODIFY",
"old_path": "glide.yaml",
"new_path": "glide.yaml",
"diff": "@@ -21,3 +21,7 @@ import:\nversion: e43299b4afa7bc7f22e5e82e3d48607230e4c177\n- package: github.com/mailru/easyjson\nversion: 44c0351a5bc860bcb2608d54aa03ea686c4e7b25\n+- package: k8s.io/code-generator\n+ repo: https://github.com/sttts/code-generator\n+- package: k8s.io/gengo\n+ version: 9e661e9308f078838e266cca1c673922088c0ea4\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/apis/kubernikus/v1/constants.go",
"diff": "+package v1\n+\n+const (\n+ KlusterResourcePlural = \"klusters\"\n+)\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/apis/kubernikus/v1/kluster.go",
"diff": "+package v1\n+\n+import metav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n+\n+type NodePoolConfig struct {\n+ Upgrade bool `json:\"upgrade\"`\n+ Repair bool `json:\"repair\"`\n+}\n+\n+type NodePool struct {\n+ Name string `json:\"name\"`\n+ Size int `json:\"size\"`\n+ Flavor string `json:\"flavor\"`\n+ Image string `json:\"image\"`\n+ Config NodePoolConfig `json:\"config\"`\n+}\n+\n+type KlusterSpec struct {\n+ Name string `json:\"name\"`\n+ NodePools []NodePool `json:\"nodePools\"`\n+}\n+\n+type KlusterState string\n+\n+const (\n+ KlusterPending KlusterState = \"Pending\"\n+ KlusterCreating KlusterState = \"Creating\"\n+ KlusterCreated KlusterState = \"Created\"\n+ KlusterTerminating KlusterState = \"Terminating\"\n+ KlusterTerminated KlusterState = \"Terminated\"\n+ KlusterError KlusterState = \"Error\"\n+)\n+\n+type KlusterStatus struct {\n+ State KlusterState `json:\"state,omitempty\"`\n+ Message string `json:\"message,omitempty\"`\n+}\n+\n+// +genclient\n+\n+type Kluster struct {\n+ metav1.TypeMeta `json:\",inline\"`\n+ metav1.ObjectMeta `json:\"metadata\"`\n+ Spec KlusterSpec `json:\"spec\"`\n+ Status KlusterStatus `json:\"status,omitempty\"`\n+}\n+\n+type KlusterList struct {\n+ metav1.TypeMeta `json:\",inline\"`\n+ metav1.ListMeta `json:\"metadata\"`\n+ Items []Kluster `json:\"items\"`\n+}\n+\n+func (spec KlusterSpec) Validate() error {\n+ //Add some validation\n+ return nil\n+}\n+\n+func (spec Kluster) Account() string {\n+ return spec.ObjectMeta.Labels[\"account\"]\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/apis/kubernikus/v1/register.go",
"diff": "+package v1\n+\n+import (\n+ metav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n+ \"k8s.io/apimachinery/pkg/runtime\"\n+ \"k8s.io/apimachinery/pkg/runtime/schema\"\n+)\n+\n+var (\n+ // SchemeBuilder collects the scheme builder functions for the Ark API\n+ SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)\n+\n+ // AddToScheme applies the SchemeBuilder functions to a specified scheme\n+ AddToScheme = SchemeBuilder.AddToScheme\n+)\n+\n+// GroupName is the group name for the Ark API\n+const GroupName = \"kubernikus.sap.cc\"\n+\n+// SchemeGroupVersion is the GroupVersion for the Ark API\n+var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: \"v1\"}\n+\n+// Resource gets an Ark GroupResource for a specified resource\n+func Resource(resource string) schema.GroupResource {\n+ return SchemeGroupVersion.WithResource(resource).GroupResource()\n+}\n+\n+func addKnownTypes(scheme *runtime.Scheme) error {\n+ scheme.AddKnownTypes(SchemeGroupVersion,\n+ &Kluster{},\n+ &KlusterList{},\n+ )\n+ metav1.AddToGroupVersion(scheme, SchemeGroupVersion)\n+ return nil\n+}\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | adds code generators for kubernetes api |
596,240 | 31.08.2017 15:04:35 | -7,200 | 7451eda8960d4f2c1f6040b949ed8bb1d6dbddfb | fixes makefile default target foo | [
{
"change_type": "MODIFY",
"old_path": "Makefile",
"new_path": "Makefile",
"diff": "-include *.mk\nDATE = $(shell date +%Y%m%d%H%M)\nIMAGE ?= sapcc/kubernikus\nVERSION ?= latest\nGOOS ?= $(shell go env | grep GOOS | cut -d'\"' -f2)\n-BINARIES := groundctl apiserver\n+BINARIES := kubernikus\nLDFLAGS := -X github.com/sapcc/kubernikus/pkg/version.VERSION=$(VERSION)\nGOFLAGS := -ldflags \"$(LDFLAGS) -s -w\"\n@@ -49,6 +48,7 @@ swagger-generate:\nclean:\nrm -rf bin/*\n+include code-generate.mk\ncode-gen: client-gen informer-gen lister-gen\nbootstrap:\n"
},
{
"change_type": "MODIFY",
"old_path": "code-generate.mk",
"new_path": "code-generate.mk",
"diff": "@@ -5,7 +5,9 @@ API_BASE := $(INPUT_BASE)/pkg/apis\nGENERATED_BASE := $(INPUT_BASE)/pkg/generated\nBIN := $(OUTPUT)/bin\n-client-gen: $(OUTPUT)/bin/client-gen\n+.PHONY: client-gen informer-gen lister-gen\n+\n+client-gen: $(BIN)/client-gen\n@rm -rf ./pkg/generated/clientset\n@mkdir -p ./pkg/generated/clientset\n$(BIN)/client-gen \\\n@@ -16,7 +18,7 @@ client-gen: $(OUTPUT)/bin/client-gen\n--input kubernikus/v1 \\\n--clientset-name clientset\n-informer-gen: $(OUTPUT)/bin/informer-gen\n+informer-gen: $(BIN)/bin/informer-gen\n@rm -rf ./pkg/generated/informers\n@mkdir -p ./pkg/generated/informers\n$(BIN)/informer-gen \\\n@@ -29,10 +31,10 @@ informer-gen: $(OUTPUT)/bin/informer-gen\n--internal-clientset-package $(GENERATED_BASE)/clientset \\\n--versioned-clientset-package $(GENERATED_BASE)/clientset\n-lister-gen: $(OUTPUT)/bin/lister-gen\n+lister-gen: $(BIN)/bin/lister-gen\n@rm -rf ./pkg/generated/listers\n@mkdir -p ./pkg/generated/listers\n- ${BIN}/lister-gen \\\n+ $(BIN)/lister-gen \\\n--logtostderr \\\n--go-header-file /dev/null \\\n--output-base $(OUTPUT_BASE) \\\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | fixes makefile default target foo |
596,240 | 31.08.2017 16:37:52 | -7,200 | b1598ef0001a57f4c01f95989fe25c7574c376d4 | refactors cobra command layout | [
{
"change_type": "DELETE",
"old_path": "cmd/groundctl/certificates.go",
"new_path": null,
"diff": "-package main\n-\n-import (\n- \"errors\"\n-\n- \"github.com/sapcc/kubernikus/pkg/controller/ground\"\n- \"github.com/spf13/cobra\"\n- \"github.com/spf13/viper\"\n-)\n-\n-func init() {\n- RootCmd.AddCommand(certificatesCmd)\n-\n- certificatesCmd.Flags().String(\"name\", \"\", \"Name of the satellite cluster\")\n- viper.BindPFlag(\"certificates.name\", certificatesCmd.Flags().Lookup(\"name\"))\n-}\n-\n-var certificatesCmd = &cobra.Command{\n- Use: \"certificates --name NAME\",\n-\n- RunE: func(cmd *cobra.Command, args []string) error {\n- err := validateCertificateInputs()\n- if err != nil {\n- return err\n- }\n-\n- cluster, err := ground.NewCluster(viper.GetString(\"certificates.name\"), \"localdomain\")\n- if err != nil {\n- return err\n- }\n-\n- err = cluster.WriteConfig(ground.NewFilePersister(\".\"))\n- if err != nil {\n- return err\n- }\n-\n- return nil\n- },\n-}\n-\n-func validateCertificateInputs() error {\n- if viper.GetString(\"certificates.name\") == \"\" {\n- return errors.New(\"You need to provide a name\")\n- }\n-\n- return nil\n-}\n"
},
{
"change_type": "DELETE",
"old_path": "cmd/groundctl/helm.go",
"new_path": null,
"diff": "-package main\n-\n-import (\n- \"errors\"\n- \"fmt\"\n-\n- yaml \"gopkg.in/yaml.v2\"\n-\n- \"github.com/sapcc/kubernikus/pkg/controller/ground\"\n- \"github.com/spf13/cobra\"\n- \"github.com/spf13/viper\"\n-)\n-\n-func init() {\n- RootCmd.AddCommand(helmCmd)\n-\n- helmCmd.Flags().String(\"name\", \"\", \"Name of the satellite cluster\")\n- viper.BindPFlag(\"helm.name\", helmCmd.Flags().Lookup(\"name\"))\n-}\n-\n-var helmCmd = &cobra.Command{\n- Use: \"values --name NAME\",\n- RunE: func(cmd *cobra.Command, args []string) error {\n- err := validateHelmInputs()\n- if err != nil {\n- return err\n- }\n-\n- cluster, err := ground.NewCluster(viper.GetString(\"helm.name\"), \"localdomain\")\n- if err != nil {\n- return err\n- }\n-\n- result, err := yaml.Marshal(cluster)\n- if err != nil {\n- return err\n- }\n-\n- fmt.Println(string(result))\n-\n- return nil\n- },\n-}\n-\n-func validateHelmInputs() error {\n- if viper.GetString(\"helm.name\") == \"\" {\n- return errors.New(\"You need to provide a name\")\n- }\n-\n- return nil\n-}\n"
},
{
"change_type": "DELETE",
"old_path": "cmd/groundctl/main.go",
"new_path": null,
"diff": "-package main\n-\n-import (\n- goflag \"flag\"\n- \"os\"\n- \"os/signal\"\n- \"sync\"\n- \"syscall\"\n-\n- \"github.com/sapcc/kubernikus/pkg/controller/ground\"\n- flag \"github.com/spf13/pflag\"\n-\n- \"github.com/golang/glog\"\n- \"github.com/spf13/cobra\"\n- \"github.com/spf13/viper\"\n-)\n-\n-var RootCmd = &cobra.Command{\n- Use: \"groundctl\",\n- RunE: func(cmd *cobra.Command, args []string) error {\n- sigs := make(chan os.Signal, 1)\n- stop := make(chan struct{})\n- signal.Notify(sigs, os.Interrupt, syscall.SIGTERM) // Push signals into channel\n-\n- wg := &sync.WaitGroup{} // Goroutines can add themselves to this to be waited on\n-\n- options := ground.Options{\n- ChartDirectory: viper.GetString(\"chart-directory\"),\n- AuthURL: viper.GetString(\"auth-url\"),\n- AuthDomain: viper.GetString(\"auth-domain\"),\n- AuthUsername: viper.GetString(\"auth-username\"),\n- AuthPassword: viper.GetString(\"auth-password\"),\n- AuthProject: viper.GetString(\"auth-project\"),\n- AuthProjectDomain: viper.GetString(\"auth-project-domain\"),\n- }\n-\n- go ground.New(options).Run(1, stop, wg)\n-\n- <-sigs // Wait for signals (this hangs until a signal arrives)\n- glog.Info(\"Shutting down...\")\n-\n- close(stop) // Tell goroutines to stop themselves\n- wg.Wait() // Wait for all to be stopped\n- return nil\n- },\n-}\n-\n-var satelliteName string\n-var configFile string\n-\n-func main() {\n- RootCmd.Execute()\n-}\n-\n-func init() {\n- // parse the CLI flags\n- if f := goflag.Lookup(\"logtostderr\"); f != nil {\n- f.Value.Set(\"true\") // log to stderr by default\n- }\n- flag.CommandLine.AddGoFlagSet(goflag.CommandLine)\n- //goflag.CommandLine.Parse([]string{}) //https://github.com/kubernetes/kubernetes/issues/17162\n-\n- cobra.OnInitialize(initConfig)\n- viper.AutomaticEnv()\n- viper.SetEnvPrefix(\"KUBERNIKUS\")\n-\n- RootCmd.PersistentFlags().StringVar(&configFile, \"config\", \"\", \"config file (default is /etc/kubernikus/groundctl.yaml)\")\n- RootCmd.Flags().String(\"chart-directory\", \"charts/\", \"Directory containing the kubernikus related charts\")\n- viper.BindPFlag(\"chart-directory\", RootCmd.Flags().Lookup(\"chart-directory\"))\n-\n- RootCmd.Flags().String(\"auth-url\", \"http://keystone.monsoon3:5000/v3\", \"Openstack keystone url\")\n- viper.BindPFlag(\"auth-url\", RootCmd.Flags().Lookup(\"auth-url\"))\n-\n- RootCmd.Flags().String(\"auth-username\", \"kubernikus\", \"Service user for kubernikus\")\n- viper.BindPFlag(\"auth-username\", RootCmd.Flags().Lookup(\"auth-username\"))\n-\n- RootCmd.Flags().String(\"auth-password\", \"\", \"Service user password\")\n- viper.BindPFlag(\"auth-password\", RootCmd.Flags().Lookup(\"auth-password\"))\n-\n- RootCmd.Flags().String(\"auth-domain\", \"Default\", \"Service user domain\")\n- viper.BindPFlag(\"auth-domain\", RootCmd.Flags().Lookup(\"auth-domain\"))\n-\n- RootCmd.Flags().String(\"auth-project\", \"\", \"Scope service user to this project\")\n- viper.BindPFlag(\"auth-project\", RootCmd.Flags().Lookup(\"auth-project\"))\n-\n- RootCmd.Flags().String(\"auth-project-domain\", \"\", \"Domain of the project\")\n- viper.BindPFlag(\"auth-project-domain\", RootCmd.Flags().Lookup(\"auth-project-domain\"))\n-}\n-\n-func initConfig() {\n- if configFile != \"\" { // enable ability to specify config file via flag\n- viper.SetConfigFile(configFile)\n- }\n-\n- viper.SetConfigName(\"groundctl\")\n- viper.AddConfigPath(\".\")\n- viper.AddConfigPath(\"$HOME\")\n- viper.AddConfigPath(\"/etc/kubernikus\")\n- viper.AutomaticEnv()\n-\n- err := viper.ReadInConfig()\n- if err != nil {\n- glog.V(2).Infof(\"Not using any config file: %s\", err)\n- } else {\n- glog.V(2).Infof(\"Loaded config %s\", viper.ConfigFileUsed())\n- }\n-}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "cmd/kubernikus/main.go",
"diff": "+package main\n+\n+import (\n+ \"os\"\n+ \"path/filepath\"\n+\n+ \"github.com/golang/glog\"\n+\n+ \"github.com/sapcc/kubernikus/pkg/cmd\"\n+ \"github.com/sapcc/kubernikus/pkg/cmd/kubernikus\"\n+)\n+\n+func main() {\n+ defer glog.Flush()\n+\n+ baseName := filepath.Base(os.Args[0])\n+\n+ err := kubernikus.NewCommand(baseName).Execute()\n+ cmd.CheckError(err)\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/client/kubernetes.go",
"diff": "+package client\n+\n+import (\n+ \"github.com/golang/glog\"\n+ \"k8s.io/client-go/kubernetes\"\n+ \"k8s.io/client-go/rest\"\n+ \"k8s.io/client-go/tools/clientcmd\"\n+)\n+\n+func config(kubeconfig string) (*rest.Config, error) {\n+ rules := clientcmd.NewDefaultClientConfigLoadingRules()\n+ overrides := &clientcmd.ConfigOverrides{}\n+\n+ if len(kubeconfig) > 0 {\n+ rules.ExplicitPath = kubeconfig\n+ }\n+\n+ config, err := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(rules, overrides).ClientConfig()\n+ if err != nil {\n+ glog.Fatalf(\"Couldn't get Kubernetes default config: %s\", err)\n+ }\n+\n+ return config, nil\n+}\n+\n+func NewKubernetesClient(kubeconfig string) (kubernetes.Interface, error) {\n+ config, err := config(kubeconfig)\n+ if err != nil {\n+ return nil, err\n+ }\n+\n+ clientset, err := kubernetes.NewForConfig(config)\n+ if err != nil {\n+ return nil, err\n+ }\n+\n+ glog.V(3).Infof(\"Using Kubernetes Api at %s\", config.Host)\n+\n+ return clientset, nil\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/client/kubernikus.go",
"diff": "+package client\n+\n+import (\n+ \"github.com/golang/glog\"\n+ \"github.com/sapcc/kubernikus/pkg/generated/clientset\"\n+)\n+\n+func NewKubernikusClient(kubeconfig string) (clientset.Interface, error) {\n+ config, err := config(kubeconfig)\n+ if err != nil {\n+ return nil, err\n+ }\n+\n+ clientset, err := clientset.NewForConfig(config)\n+ if err != nil {\n+ return nil, err\n+ }\n+\n+ glog.V(3).Infof(\"Using Kubernetes Api at %s\", config.Host)\n+\n+ return clientset, nil\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/cmd/cli/certificates/certificates.go",
"diff": "+package certificates\n+\n+import (\n+ \"github.com/spf13/cobra\"\n+)\n+\n+func NewCommand() *cobra.Command {\n+ c := &cobra.Command{\n+ Use: \"certificates\",\n+ Short: \"Debug certificates\",\n+ }\n+\n+ c.AddCommand(\n+ NewFilesCommand(),\n+ NewPlainCommand(),\n+ )\n+\n+ return c\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/cmd/cli/certificates/files.go",
"diff": "+package certificates\n+\n+import (\n+ \"errors\"\n+\n+ \"github.com/sapcc/kubernikus/pkg/cmd\"\n+ \"github.com/sapcc/kubernikus/pkg/controller/ground\"\n+ \"github.com/spf13/cobra\"\n+ \"github.com/spf13/pflag\"\n+)\n+\n+func NewFilesCommand() *cobra.Command {\n+ o := NewFilesOptions()\n+\n+ c := &cobra.Command{\n+ Use: \"files NAME\",\n+ Short: \"Writes certificates to files\",\n+ Run: func(c *cobra.Command, args []string) {\n+ cmd.CheckError(o.Validate(c, args))\n+ cmd.CheckError(o.Complete(args))\n+ cmd.CheckError(o.Run(c))\n+ },\n+ }\n+\n+ o.BindFlags(c.Flags())\n+\n+ return c\n+}\n+\n+type FilesOptions struct {\n+ Name string\n+}\n+\n+func NewFilesOptions() *FilesOptions {\n+ return &FilesOptions{}\n+}\n+\n+func (o *FilesOptions) BindFlags(flags *pflag.FlagSet) {\n+}\n+\n+func (o *FilesOptions) Validate(c *cobra.Command, args []string) error {\n+ if len(args) != 1 {\n+ return errors.New(\"you must specify the cluster's name\")\n+ }\n+\n+ return nil\n+}\n+\n+func (o *FilesOptions) Complete(args []string) error {\n+ o.Name = args[0]\n+ return nil\n+}\n+\n+func (o *FilesOptions) Run(c *cobra.Command) error {\n+ cluster, err := ground.NewCluster(o.Name, \"localdomain\")\n+ if err != nil {\n+ return err\n+ }\n+\n+ err = cluster.WriteConfig(ground.NewFilePersister(\".\"))\n+ if err != nil {\n+ return err\n+ }\n+\n+ return nil\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/cmd/cli/certificates/plain.go",
"diff": "+package certificates\n+\n+import (\n+ \"errors\"\n+\n+ \"github.com/sapcc/kubernikus/pkg/cmd\"\n+ \"github.com/sapcc/kubernikus/pkg/controller/ground\"\n+ \"github.com/spf13/cobra\"\n+)\n+\n+func NewPlainCommand() *cobra.Command {\n+ o := NewPlainOptions()\n+\n+ c := &cobra.Command{\n+ Use: \"plain NAME\",\n+ Short: \"Prints plain certificates to stdout\",\n+ Run: func(c *cobra.Command, args []string) {\n+ cmd.CheckError(o.Validate(c, args))\n+ cmd.CheckError(o.Complete(args))\n+ cmd.CheckError(o.Run(c))\n+ },\n+ }\n+\n+ return c\n+}\n+\n+type PlainOptions struct {\n+ Name string\n+}\n+\n+func NewPlainOptions() *PlainOptions {\n+ return &PlainOptions{}\n+}\n+\n+func (o *PlainOptions) Validate(c *cobra.Command, args []string) error {\n+ if len(args) != 1 {\n+ return errors.New(\"you must specify the cluster's name\")\n+ }\n+\n+ return nil\n+}\n+\n+func (o *PlainOptions) Complete(args []string) error {\n+ o.Name = args[0]\n+ return nil\n+}\n+\n+func (o *PlainOptions) Run(c *cobra.Command) error {\n+ cluster, err := ground.NewCluster(o.Name, \"localdomain\")\n+ if err != nil {\n+ return err\n+ }\n+\n+ err = cluster.WriteConfig(ground.NewPlainPersister())\n+ if err != nil {\n+ return err\n+ }\n+\n+ return nil\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/cmd/cli/helm/helm.go",
"diff": "+package helm\n+\n+import (\n+ \"errors\"\n+ \"fmt\"\n+\n+ \"github.com/sapcc/kubernikus/pkg/cmd\"\n+ \"github.com/sapcc/kubernikus/pkg/controller/ground\"\n+ \"github.com/spf13/cobra\"\n+ yaml \"gopkg.in/yaml.v2\"\n+)\n+\n+func NewCommand() *cobra.Command {\n+ o := NewHelmOptions()\n+\n+ c := &cobra.Command{\n+ Use: \"helm NAME\",\n+ Short: \"Print Helm values\",\n+ Run: func(c *cobra.Command, args []string) {\n+ cmd.CheckError(o.Validate(c, args))\n+ cmd.CheckError(o.Complete(args))\n+ cmd.CheckError(o.Run(c))\n+ },\n+ }\n+\n+ return c\n+}\n+\n+type HelmOptions struct {\n+ Name string\n+}\n+\n+func NewHelmOptions() *HelmOptions {\n+ return &HelmOptions{}\n+}\n+\n+func (o *HelmOptions) Validate(c *cobra.Command, args []string) error {\n+ if len(args) != 1 {\n+ return errors.New(\"you must specify the cluster's name\")\n+ }\n+\n+ return nil\n+}\n+\n+func (o *HelmOptions) Complete(args []string) error {\n+ o.Name = args[0]\n+ return nil\n+}\n+\n+func (o *HelmOptions) Run(c *cobra.Command) error {\n+ cluster, err := ground.NewCluster(o.Name, \"localdomain\")\n+ if err != nil {\n+ return err\n+ }\n+\n+ result, err := yaml.Marshal(cluster)\n+ if err != nil {\n+ return err\n+ }\n+\n+ fmt.Println(string(result))\n+\n+ return nil\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/cmd/errors.go",
"diff": "+package cmd\n+\n+import (\n+ \"context\"\n+ \"fmt\"\n+ \"os\"\n+)\n+\n+func CheckError(err error) {\n+ if err != nil {\n+ if err != context.Canceled {\n+ fmt.Fprintf(os.Stderr, fmt.Sprintf(\"An error occurred: %v\\n\", err))\n+ }\n+ os.Exit(1)\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/cmd/kubernikus/kubernikus.go",
"diff": "+package kubernikus\n+\n+import (\n+ \"flag\"\n+\n+ \"github.com/sapcc/kubernikus/pkg/cmd/cli/certificates\"\n+ \"github.com/sapcc/kubernikus/pkg/cmd/cli/helm\"\n+ \"github.com/sapcc/kubernikus/pkg/cmd/operator\"\n+ \"github.com/spf13/cobra\"\n+)\n+\n+func NewCommand(name string) *cobra.Command {\n+ c := &cobra.Command{\n+ Use: name,\n+ Short: \"Kubernetes as a Service\",\n+ Long: `Kubernikus is a tool for managing Kubernetes clusters on Openstack.`,\n+ }\n+\n+ c.AddCommand(\n+ certificates.NewCommand(),\n+ helm.NewCommand(),\n+ operator.NewCommand(),\n+ )\n+ c.PersistentFlags().AddGoFlagSet(flag.CommandLine)\n+\n+ return c\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/cmd/operator/imploperator.go",
"diff": "+package operator\n+\n+import (\n+ \"fmt\"\n+ \"reflect\"\n+ \"sync\"\n+ \"time\"\n+\n+ \"github.com/golang/glog\"\n+ \"github.com/sapcc/kubernikus/pkg/client\"\n+ \"github.com/sapcc/kubernikus/pkg/generated/clientset\"\n+ kubernikus_informers \"github.com/sapcc/kubernikus/pkg/generated/informers/externalversions\"\n+ \"github.com/sapcc/kubernikus/pkg/openstack\"\n+ \"github.com/sapcc/kubernikus/pkg/version\"\n+\n+ \"k8s.io/client-go/informers\"\n+ \"k8s.io/client-go/kubernetes\"\n+ \"k8s.io/client-go/tools/cache\"\n+)\n+\n+type Options struct {\n+ kubeConfig string\n+\n+ ChartDirectory string\n+\n+ AuthURL string\n+ AuthUsername string\n+ AuthPassword string\n+ AuthDomain string\n+ AuthProject string\n+ AuthProjectDomain string\n+}\n+\n+type Operator struct {\n+ Options\n+\n+ kubernikusClient clientset.Interface\n+ kubernetesClient kubernetes.Interface\n+ openstackClient openstack.Client\n+\n+ kubernikusInformers kubernikus_informers.SharedInformerFactory\n+ kubernetesInformers informers.SharedInformerFactory\n+}\n+\n+func New(options Options) *Operator {\n+ kubernetesClient, err := client.NewKubernetesClient(options.kubeConfig)\n+ if err != nil {\n+ glog.Fatalf(\"Failed to create kubernetes clients: %s\", err)\n+ }\n+\n+ kubernikusClient, err := client.NewKubernikusClient(options.kubeConfig)\n+ if err != nil {\n+ glog.Fatalf(\"Failed to create kubernikus clients: %s\", err)\n+ }\n+\n+ openstackClient, err := openstack.NewClient(\n+ options.AuthURL,\n+ options.AuthUsername,\n+ options.AuthPassword,\n+ options.AuthDomain,\n+ options.AuthProject,\n+ options.AuthProjectDomain,\n+ )\n+ if err != nil {\n+ glog.Fatalf(\"Failed to create openstack client: %s\", err)\n+ }\n+\n+ o := &Operator{\n+ Options: options,\n+ kubernikusClient: kubernikusClient,\n+ kubernetesClient: kubernetesClient,\n+ openstackClient: openstackClient,\n+ }\n+\n+ o.kubernikusInformers = kubernikus_informers.NewSharedInformerFactory(o.kubernikusClient, 5*time.Minute)\n+ o.kubernetesInformers = informers.NewSharedInformerFactory(o.kubernetesClient, 5*time.Minute)\n+\n+ o.kubernetesInformers.Core().V1().Nodes().Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n+ AddFunc: o.debugAdd,\n+ UpdateFunc: o.debugUpdate,\n+ DeleteFunc: o.debugDelete,\n+ })\n+\n+ o.kubernikusInformers.Kubernikus().V1().Klusters().Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n+ AddFunc: o.debugAdd,\n+ UpdateFunc: o.debugUpdate,\n+ DeleteFunc: o.debugDelete,\n+ })\n+\n+ return o\n+}\n+\n+func (o *Operator) Run(stopCh <-chan struct{}, wg *sync.WaitGroup) {\n+ fmt.Printf(\"Welcome to Kubernikus %v\\n\", version.VERSION)\n+\n+ o.kubernikusInformers.Start(stopCh)\n+ o.kubernetesInformers.Start(stopCh)\n+\n+ o.kubernikusInformers.WaitForCacheSync(stopCh)\n+ o.kubernetesInformers.WaitForCacheSync(stopCh)\n+\n+ glog.Info(\"Cache primed. Ready for Action!\")\n+}\n+\n+func (p *Operator) debugAdd(obj interface{}) {\n+ key, _ := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)\n+ glog.V(5).Infof(\"ADD %s (%s)\", reflect.TypeOf(obj), key)\n+}\n+\n+func (p *Operator) debugDelete(obj interface{}) {\n+ key, _ := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)\n+ glog.V(5).Infof(\"DELETE %s (%s)\", reflect.TypeOf(obj), key)\n+}\n+\n+func (p *Operator) debugUpdate(cur, old interface{}) {\n+ key, _ := cache.DeletionHandlingMetaNamespaceKeyFunc(cur)\n+ glog.V(5).Infof(\"UPDATE %s (%s)\", reflect.TypeOf(cur), key)\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/cmd/operator/operator.go",
"diff": "+package operator\n+\n+import (\n+ \"errors\"\n+ goflag \"flag\"\n+ \"os\"\n+ \"os/signal\"\n+ \"sync\"\n+ \"syscall\"\n+\n+ \"github.com/golang/glog\"\n+ \"github.com/sapcc/kubernikus/pkg/cmd\"\n+ \"github.com/sapcc/kubernikus/pkg/controller/ground\"\n+ \"github.com/spf13/cobra\"\n+ \"github.com/spf13/pflag\"\n+)\n+\n+func NewCommand() *cobra.Command {\n+ o := NewOperatorOptions()\n+\n+ if f := goflag.Lookup(\"logtostderr\"); f != nil {\n+ f.Value.Set(\"true\") // log to stderr by default\n+ }\n+\n+ c := &cobra.Command{\n+ Use: \"operator\",\n+ Short: \"Starts an operator that operates things. Beware of magic!\",\n+ Run: func(c *cobra.Command, args []string) {\n+ cmd.CheckError(o.Validate(c, args))\n+ cmd.CheckError(o.Complete(args))\n+ cmd.CheckError(o.Run(c))\n+ },\n+ }\n+\n+ o.BindFlags(c.Flags())\n+\n+ return c\n+}\n+\n+type OperatorOptions struct {\n+ KubeConfig string\n+ ChartDirectory string\n+ AuthURL string\n+ AuthUsername string\n+ AuthPassword string\n+ AuthDomain string\n+ AuthProject string\n+ AuthProjectDomain string\n+}\n+\n+func NewOperatorOptions() *OperatorOptions {\n+ return &OperatorOptions{\n+ ChartDirectory: \"charts/\",\n+ AuthURL: \"http://keystone.monsoon3:5000/v3\",\n+ AuthUsername: \"kubernikus\",\n+ AuthDomain: \"Default\",\n+ }\n+}\n+\n+func (o *OperatorOptions) BindFlags(flags *pflag.FlagSet) {\n+ flags.StringVar(&o.ChartDirectory, \"chart-directory\", o.ChartDirectory, \"Directory containing the kubernikus related charts\")\n+ flags.StringVar(&o.AuthURL, \"auth-url\", o.AuthURL, \"Openstack keystone url\")\n+ flags.StringVar(&o.AuthUsername, \"auth-username\", o.AuthUsername, \"Service user for kubernikus\")\n+ flags.StringVar(&o.AuthPassword, \"auth-password\", o.AuthPassword, \"Service user password\")\n+ flags.StringVar(&o.AuthDomain, \"auth-domain\", o.AuthDomain, \"Service user domain\")\n+ flags.StringVar(&o.AuthProject, \"auth-project\", o.AuthProject, \"Scope service user to this project\")\n+ flags.StringVar(&o.AuthProjectDomain, \"auth-project-domain\", o.AuthProjectDomain, \"Domain of the project\")\n+}\n+\n+func (o *OperatorOptions) Validate(c *cobra.Command, args []string) error {\n+ if len(o.AuthPassword) == 0 {\n+ return errors.New(\"you must specify the auth-password flag\")\n+ }\n+\n+ return nil\n+}\n+\n+func (o *OperatorOptions) Complete(args []string) error {\n+ return nil\n+}\n+\n+func (o *OperatorOptions) Run(c *cobra.Command) error {\n+ sigs := make(chan os.Signal, 1)\n+ stop := make(chan struct{})\n+ signal.Notify(sigs, os.Interrupt, syscall.SIGTERM) // Push signals into channel\n+ wg := &sync.WaitGroup{} // Goroutines can add themselves to this to be waited on\n+\n+ opts := ground.Options{\n+ ConfigFile: o.KubeConfig,\n+ ChartDirectory: o.ChartDirectory,\n+ AuthURL: o.AuthURL,\n+ AuthUsername: o.AuthUsername,\n+ AuthPassword: o.AuthPassword,\n+ AuthDomain: o.AuthDomain,\n+ AuthProject: o.AuthProject,\n+ AuthProjectDomain: o.AuthProjectDomain,\n+ }\n+\n+ go ground.New(opts).Run(1, stop, wg)\n+\n+ <-sigs // Wait for signals (this hangs until a signal arrives)\n+ glog.Info(\"Shutting down...\")\n+ close(stop) // Tell goroutines to stop themselves\n+ wg.Wait() // Wait for all to be stopped\n+\n+ return nil\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/controller/ground/controller.go",
"new_path": "pkg/controller/ground/controller.go",
"diff": "@@ -34,7 +34,7 @@ const (\n)\ntype Options struct {\n- kube.Options\n+ ConfigFile string\nChartDirectory string\nAuthURL string\nAuthUsername string\n@@ -55,7 +55,7 @@ type Operator struct {\nfunc New(options Options) *Operator {\n- clients, err := kube.NewClientCache(options.Options)\n+ clients, err := kube.NewClientCache(kube.Options{options.ConfigFile})\nif err != nil {\nglog.Fatalf(\"Failed to create kubenetes clients: %s\", err)\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/controller/ground/io_plain.go",
"diff": "+package ground\n+\n+import (\n+ \"fmt\"\n+\n+ certutil \"k8s.io/client-go/util/cert\"\n+)\n+\n+type PlainPersister struct{}\n+\n+func NewPlainPersister() *PlainPersister {\n+ return &PlainPersister{}\n+}\n+\n+func (fp PlainPersister) WriteConfig(cluster Cluster) error {\n+ for _, b := range cluster.Certificates.all() {\n+ fmt.Println(b.NameForCert())\n+ fmt.Println(string(certutil.EncodeCertPEM(b.Certificate)))\n+ fmt.Println(b.NameForKey())\n+ fmt.Println(string(certutil.EncodePrivateKeyPEM(b.PrivateKey)))\n+ }\n+\n+ return nil\n+}\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | refactors cobra command layout |
596,240 | 31.08.2017 16:41:03 | -7,200 | 8c689fd8c4b6d15ce3d30395cb563bf324095669 | passes kubeconfig | [
{
"change_type": "MODIFY",
"old_path": "pkg/cmd/operator/operator.go",
"new_path": "pkg/cmd/operator/operator.go",
"diff": "@@ -58,6 +58,7 @@ func NewOperatorOptions() *OperatorOptions {\n}\nfunc (o *OperatorOptions) BindFlags(flags *pflag.FlagSet) {\n+ flags.StringVar(&o.KubeConfig, \"kubeconfig\", o.KubeConfig, \"Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration\")\nflags.StringVar(&o.ChartDirectory, \"chart-directory\", o.ChartDirectory, \"Directory containing the kubernikus related charts\")\nflags.StringVar(&o.AuthURL, \"auth-url\", o.AuthURL, \"Openstack keystone url\")\nflags.StringVar(&o.AuthUsername, \"auth-username\", o.AuthUsername, \"Service user for kubernikus\")\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | passes kubeconfig |
596,240 | 01.09.2017 13:57:20 | -7,200 | f020b74c3c9af93b7c77b2fefa2839ba86d9f479 | fixes informer runtime chrash | [
{
"change_type": "MODIFY",
"old_path": "pkg/controller/ground/controller.go",
"new_path": "pkg/controller/ground/controller.go",
"diff": "@@ -107,6 +107,8 @@ func New(options Options) *Operator {\nDeleteFunc: operator.klusterTerminate,\n})\n+ operator.tprInformer = operator.informers.Kubernikus().V1().Klusters().Informer()\n+\nreturn operator\n}\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | fixes informer runtime chrash |
596,240 | 04.09.2017 13:47:57 | -7,200 | cd5060c07f6d5e8c7cc074e76b2524335b045f7e | unifies client constructors | [
{
"change_type": "MODIFY",
"old_path": "pkg/api/rest/kubeclient.go",
"new_path": "pkg/api/rest/kubeclient.go",
"diff": "@@ -16,13 +16,13 @@ func init() {\n}\nfunc NewKubeClients() *api.Clients {\n- client, err := kubernikus.NewKubernikusClient(kubeconfig)\n+ client, err := kubernikus.NewClient(kubeconfig)\nif err != nil {\nglog.Fatal(\"Failed to create kubernikus clients: %s\", err)\n}\n- kubernetesClient, err := kubernetes.NewKubernetesClient(kubeconfig)\n+ kubernetesClient, err := kubernetes.NewClient(kubeconfig)\nif err != nil {\nglog.Fatal(\"Failed to create kubernetes clients: %s\", err)\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/client/kubernetes/client.go",
"new_path": "pkg/client/kubernetes/client.go",
"diff": "@@ -7,7 +7,7 @@ import (\n\"k8s.io/client-go/tools/clientcmd\"\n)\n-func Config(kubeconfig string) (*rest.Config, error) {\n+func NewConfig(kubeconfig string) (*rest.Config, error) {\nrules := clientcmd.NewDefaultClientConfigLoadingRules()\noverrides := &clientcmd.ConfigOverrides{}\n@@ -23,8 +23,8 @@ func Config(kubeconfig string) (*rest.Config, error) {\nreturn config, nil\n}\n-func NewKubernetesClient(kubeconfig string) (kubernetes.Interface, error) {\n- config, err := Config(kubeconfig)\n+func NewClient(kubeconfig string) (kubernetes.Interface, error) {\n+ config, err := NewConfig(kubeconfig)\nif err != nil {\nreturn nil, err\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/client/kubernikus/client.go",
"new_path": "pkg/client/kubernikus/client.go",
"diff": "@@ -6,8 +6,8 @@ import (\n\"github.com/sapcc/kubernikus/pkg/generated/clientset\"\n)\n-func NewKubernikusClient(kubeconfig string) (clientset.Interface, error) {\n- config, err := kube.Config(kubeconfig)\n+func NewClient(kubeconfig string) (clientset.Interface, error) {\n+ config, err := kube.NewConfig(kubeconfig)\nif err != nil {\nreturn nil, err\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cmd/operator/imploperator.go",
"new_path": "pkg/cmd/operator/imploperator.go",
"diff": "@@ -44,12 +44,12 @@ type Operator struct {\n}\nfunc New(options Options) *Operator {\n- kubernetesClient, err := kube.NewKubernetesClient(options.kubeConfig)\n+ kubernetesClient, err := kube.NewClient(options.kubeConfig)\nif err != nil {\nglog.Fatalf(\"Failed to create kubernetes clients: %s\", err)\n}\n- kubernikusClient, err := kubernikus.NewKubernikusClient(options.kubeConfig)\n+ kubernikusClient, err := kubernikus.NewClient(options.kubeConfig)\nif err != nil {\nglog.Fatalf(\"Failed to create kubernikus clients: %s\", err)\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/controller/ground/controller.go",
"new_path": "pkg/controller/ground/controller.go",
"diff": "@@ -63,17 +63,17 @@ type Operator struct {\n}\nfunc New(options Options) *Operator {\n- kubernetesClient, err := kube.NewKubernetesClient(options.KubeConfig)\n+ kubernetesClient, err := kube.NewClient(options.KubeConfig)\nif err != nil {\nglog.Fatalf(\"Failed to create kubernetes clients: %s\", err)\n}\n- kubernetesConfig, err := kube.Config(options.KubeConfig)\n+ kubernetesConfig, err := kube.NewConfig(options.KubeConfig)\nif err != nil {\nglog.Fatalf(\"Failed to create kubernetes config: %s\", err)\n}\n- kubernikusClient, err := kubernikus.NewKubernikusClient(options.KubeConfig)\n+ kubernikusClient, err := kubernikus.NewClient(options.KubeConfig)\nif err != nil {\nglog.Fatalf(\"Failed to create kubernikus clients: %s\", err)\n}\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | unifies client constructors |
596,240 | 04.09.2017 16:49:10 | -7,200 | d7bbf27a7195d91265a43e09b18c58033dffc943 | prettifies kubernikus operator | [
{
"change_type": "DELETE",
"old_path": "pkg/cmd/operator/imploperator.go",
"new_path": null,
"diff": "-package operator\n-\n-import (\n- \"fmt\"\n- \"reflect\"\n- \"sync\"\n- \"time\"\n-\n- \"github.com/golang/glog\"\n- kube \"github.com/sapcc/kubernikus/pkg/client/kubernetes\"\n- \"github.com/sapcc/kubernikus/pkg/client/kubernikus\"\n- \"github.com/sapcc/kubernikus/pkg/client/openstack\"\n- \"github.com/sapcc/kubernikus/pkg/generated/clientset\"\n- kubernikus_informers \"github.com/sapcc/kubernikus/pkg/generated/informers/externalversions\"\n- \"github.com/sapcc/kubernikus/pkg/version\"\n-\n- \"k8s.io/client-go/informers\"\n- \"k8s.io/client-go/kubernetes\"\n- \"k8s.io/client-go/tools/cache\"\n-)\n-\n-type Options struct {\n- kubeConfig string\n-\n- ChartDirectory string\n-\n- AuthURL string\n- AuthUsername string\n- AuthPassword string\n- AuthDomain string\n- AuthProject string\n- AuthProjectDomain string\n-}\n-\n-type Operator struct {\n- Options\n-\n- kubernikusClient clientset.Interface\n- kubernetesClient kubernetes.Interface\n- openstackClient openstack.Client\n-\n- kubernikusInformers kubernikus_informers.SharedInformerFactory\n- kubernetesInformers informers.SharedInformerFactory\n-}\n-\n-func New(options Options) *Operator {\n- kubernetesClient, err := kube.NewClient(options.kubeConfig)\n- if err != nil {\n- glog.Fatalf(\"Failed to create kubernetes clients: %s\", err)\n- }\n-\n- kubernikusClient, err := kubernikus.NewClient(options.kubeConfig)\n- if err != nil {\n- glog.Fatalf(\"Failed to create kubernikus clients: %s\", err)\n- }\n-\n- openstackClient, err := openstack.NewClient(\n- options.AuthURL,\n- options.AuthUsername,\n- options.AuthPassword,\n- options.AuthDomain,\n- options.AuthProject,\n- options.AuthProjectDomain,\n- )\n- if err != nil {\n- glog.Fatalf(\"Failed to create openstack client: %s\", err)\n- }\n-\n- o := &Operator{\n- Options: options,\n- kubernikusClient: kubernikusClient,\n- kubernetesClient: kubernetesClient,\n- openstackClient: openstackClient,\n- }\n-\n- o.kubernikusInformers = kubernikus_informers.NewSharedInformerFactory(o.kubernikusClient, 5*time.Minute)\n- o.kubernetesInformers = informers.NewSharedInformerFactory(o.kubernetesClient, 5*time.Minute)\n-\n- o.kubernetesInformers.Core().V1().Nodes().Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n- AddFunc: o.debugAdd,\n- UpdateFunc: o.debugUpdate,\n- DeleteFunc: o.debugDelete,\n- })\n-\n- o.kubernikusInformers.Kubernikus().V1().Klusters().Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n- AddFunc: o.debugAdd,\n- UpdateFunc: o.debugUpdate,\n- DeleteFunc: o.debugDelete,\n- })\n-\n- return o\n-}\n-\n-func (o *Operator) Run(stopCh <-chan struct{}, wg *sync.WaitGroup) {\n- fmt.Printf(\"Welcome to Kubernikus %v\\n\", version.VERSION)\n-\n- o.kubernikusInformers.Start(stopCh)\n- o.kubernetesInformers.Start(stopCh)\n-\n- o.kubernikusInformers.WaitForCacheSync(stopCh)\n- o.kubernetesInformers.WaitForCacheSync(stopCh)\n-\n- glog.Info(\"Cache primed. Ready for Action!\")\n-}\n-\n-func (p *Operator) debugAdd(obj interface{}) {\n- key, _ := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)\n- glog.V(5).Infof(\"ADD %s (%s)\", reflect.TypeOf(obj), key)\n-}\n-\n-func (p *Operator) debugDelete(obj interface{}) {\n- key, _ := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)\n- glog.V(5).Infof(\"DELETE %s (%s)\", reflect.TypeOf(obj), key)\n-}\n-\n-func (p *Operator) debugUpdate(cur, old interface{}) {\n- key, _ := cache.DeletionHandlingMetaNamespaceKeyFunc(cur)\n- glog.V(5).Infof(\"UPDATE %s (%s)\", reflect.TypeOf(cur), key)\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cmd/operator/operator.go",
"new_path": "pkg/cmd/operator/operator.go",
"diff": "@@ -10,7 +10,7 @@ import (\n\"github.com/golang/glog\"\n\"github.com/sapcc/kubernikus/pkg/cmd\"\n- \"github.com/sapcc/kubernikus/pkg/controller/ground\"\n+ \"github.com/sapcc/kubernikus/pkg/controller\"\n\"github.com/spf13/cobra\"\n\"github.com/spf13/pflag\"\n)\n@@ -37,9 +37,11 @@ func NewCommand() *cobra.Command {\nreturn c\n}\n-type OperatorOptions struct {\n+type Options struct {\nKubeConfig string\n+\nChartDirectory string\n+\nAuthURL string\nAuthUsername string\nAuthPassword string\n@@ -48,8 +50,8 @@ type OperatorOptions struct {\nAuthProjectDomain string\n}\n-func NewOperatorOptions() *OperatorOptions {\n- return &OperatorOptions{\n+func NewOperatorOptions() *Options {\n+ return &Options{\nChartDirectory: \"charts/\",\nAuthURL: \"http://keystone.monsoon3:5000/v3\",\nAuthUsername: \"kubernikus\",\n@@ -57,7 +59,7 @@ func NewOperatorOptions() *OperatorOptions {\n}\n}\n-func (o *OperatorOptions) BindFlags(flags *pflag.FlagSet) {\n+func (o *Options) BindFlags(flags *pflag.FlagSet) {\nflags.StringVar(&o.KubeConfig, \"kubeconfig\", o.KubeConfig, \"Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration\")\nflags.StringVar(&o.ChartDirectory, \"chart-directory\", o.ChartDirectory, \"Directory containing the kubernikus related charts\")\nflags.StringVar(&o.AuthURL, \"auth-url\", o.AuthURL, \"Openstack keystone url\")\n@@ -68,7 +70,7 @@ func (o *OperatorOptions) BindFlags(flags *pflag.FlagSet) {\nflags.StringVar(&o.AuthProjectDomain, \"auth-project-domain\", o.AuthProjectDomain, \"Domain of the project\")\n}\n-func (o *OperatorOptions) Validate(c *cobra.Command, args []string) error {\n+func (o *Options) Validate(c *cobra.Command, args []string) error {\nif len(o.AuthPassword) == 0 {\nreturn errors.New(\"you must specify the auth-password flag\")\n}\n@@ -76,17 +78,17 @@ func (o *OperatorOptions) Validate(c *cobra.Command, args []string) error {\nreturn nil\n}\n-func (o *OperatorOptions) Complete(args []string) error {\n+func (o *Options) Complete(args []string) error {\nreturn nil\n}\n-func (o *OperatorOptions) Run(c *cobra.Command) error {\n+func (o *Options) Run(c *cobra.Command) error {\nsigs := make(chan os.Signal, 1)\nstop := make(chan struct{})\nsignal.Notify(sigs, os.Interrupt, syscall.SIGTERM) // Push signals into channel\nwg := &sync.WaitGroup{} // Goroutines can add themselves to this to be waited on\n- opts := ground.Options{\n+ opts := &controller.KubernikusOperatorOptions{\nKubeConfig: o.KubeConfig,\nChartDirectory: o.ChartDirectory,\nAuthURL: o.AuthURL,\n@@ -97,7 +99,7 @@ func (o *OperatorOptions) Run(c *cobra.Command) error {\nAuthProjectDomain: o.AuthProjectDomain,\n}\n- go ground.New(opts).Run(1, stop, wg)\n+ go controller.NewKubernikusOperator(opts).Run(stop, wg)\n<-sigs // Wait for signals (this hangs until a signal arrives)\nglog.Info(\"Shutting down...\")\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/controller/operator.go",
"diff": "+package controller\n+\n+import (\n+ \"fmt\"\n+ \"reflect\"\n+ \"sync\"\n+ \"time\"\n+\n+ \"github.com/golang/glog\"\n+ kube \"github.com/sapcc/kubernikus/pkg/client/kubernetes\"\n+ \"github.com/sapcc/kubernikus/pkg/client/kubernikus\"\n+ \"github.com/sapcc/kubernikus/pkg/client/openstack\"\n+ kubernikus_clientset \"github.com/sapcc/kubernikus/pkg/generated/clientset\"\n+ kubernikus_informers \"github.com/sapcc/kubernikus/pkg/generated/informers/externalversions\"\n+ \"github.com/sapcc/kubernikus/pkg/version\"\n+\n+ kubernetes_informers \"k8s.io/client-go/informers\"\n+ kubernetes_clientset \"k8s.io/client-go/kubernetes\"\n+ \"k8s.io/client-go/tools/cache\"\n+)\n+\n+type KubernikusOperatorOptions struct {\n+ KubeConfig string\n+\n+ ChartDirectory string\n+\n+ AuthURL string\n+ AuthUsername string\n+ AuthPassword string\n+ AuthDomain string\n+ AuthProject string\n+ AuthProjectDomain string\n+}\n+\n+type Clients struct {\n+ Kubernikus kubernikus_clientset.Interface\n+ Kubernetes kubernetes_clientset.Interface\n+ Openstack openstack.Client\n+}\n+\n+type Factories struct {\n+ Kubernikus kubernikus_informers.SharedInformerFactory\n+ Kubernetes kubernetes_informers.SharedInformerFactory\n+}\n+\n+type KubernikusOperator struct {\n+ Options *KubernikusOperatorOptions\n+ Clients\n+ Factories\n+}\n+\n+func NewKubernikusOperator(options *KubernikusOperatorOptions) *KubernikusOperator {\n+ var err error\n+\n+ o := &KubernikusOperator{\n+ Options: options,\n+ }\n+\n+ o.Clients.Kubernetes, err = kube.NewClient(options.KubeConfig)\n+ if err != nil {\n+ glog.Fatalf(\"Failed to create kubernetes clients: %s\", err)\n+ }\n+\n+ o.Clients.Kubernikus, err = kubernikus.NewClient(options.KubeConfig)\n+ if err != nil {\n+ glog.Fatalf(\"Failed to create kubernikus clients: %s\", err)\n+ }\n+\n+ o.Clients.Openstack, err = openstack.NewClient(\n+ options.AuthURL,\n+ options.AuthUsername,\n+ options.AuthPassword,\n+ options.AuthDomain,\n+ options.AuthProject,\n+ options.AuthProjectDomain,\n+ )\n+ if err != nil {\n+ glog.Fatalf(\"Failed to create openstack client: %s\", err)\n+ }\n+\n+ o.Factories.Kubernikus = kubernikus_informers.NewSharedInformerFactory(o.Clients.Kubernikus, 5*time.Minute)\n+ o.Factories.Kubernetes = kubernetes_informers.NewSharedInformerFactory(o.Clients.Kubernetes, 5*time.Minute)\n+\n+ o.Factories.Kubernetes.Core().V1().Nodes().Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n+ AddFunc: o.debugAdd,\n+ UpdateFunc: o.debugUpdate,\n+ DeleteFunc: o.debugDelete,\n+ })\n+\n+ o.Factories.Kubernikus.Kubernikus().V1().Klusters().Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n+ AddFunc: o.debugAdd,\n+ UpdateFunc: o.debugUpdate,\n+ DeleteFunc: o.debugDelete,\n+ })\n+\n+ return o\n+}\n+\n+func (o *KubernikusOperator) Run(stopCh <-chan struct{}, wg *sync.WaitGroup) {\n+ fmt.Printf(\"Welcome to Kubernikus %v\\n\", version.VERSION)\n+\n+ o.Factories.Kubernikus.Start(stopCh)\n+ o.Factories.Kubernetes.Start(stopCh)\n+\n+ o.Factories.Kubernikus.WaitForCacheSync(stopCh)\n+ o.Factories.Kubernetes.WaitForCacheSync(stopCh)\n+\n+ glog.Info(\"Cache primed. Ready for Action!\")\n+}\n+\n+func (p *KubernikusOperator) debugAdd(obj interface{}) {\n+ key, _ := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)\n+ glog.V(5).Infof(\"ADD %s (%s)\", reflect.TypeOf(obj), key)\n+}\n+\n+func (p *KubernikusOperator) debugDelete(obj interface{}) {\n+ key, _ := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)\n+ glog.V(5).Infof(\"DELETE %s (%s)\", reflect.TypeOf(obj), key)\n+}\n+\n+func (p *KubernikusOperator) debugUpdate(cur, old interface{}) {\n+ key, _ := cache.DeletionHandlingMetaNamespaceKeyFunc(cur)\n+ glog.V(5).Infof(\"UPDATE %s (%s)\", reflect.TypeOf(cur), key)\n+}\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | prettifies kubernikus operator |
596,240 | 04.09.2017 17:54:55 | -7,200 | 62f8c833ba8fc361862b9425a2d217dcff9ec397 | implements one operator to rule them all.. | [
{
"change_type": "RENAME",
"old_path": "pkg/controller/ground/controller.go",
"new_path": "pkg/controller/ground.go",
"diff": "-package ground\n+package controller\nimport (\n\"fmt\"\n@@ -13,8 +13,6 @@ import (\n\"github.com/golang/glog\"\nmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n\"k8s.io/apimachinery/pkg/util/wait\"\n- \"k8s.io/client-go/kubernetes\"\n- \"k8s.io/client-go/rest\"\n\"k8s.io/client-go/tools/cache\"\n\"k8s.io/client-go/util/workqueue\"\n\"k8s.io/helm/pkg/helm\"\n@@ -22,108 +20,47 @@ import (\n\"strings\"\n\"github.com/sapcc/kubernikus/pkg/apis/kubernikus/v1\"\n- helmutil \"github.com/sapcc/kubernikus/pkg/client/helm\"\n- kube \"github.com/sapcc/kubernikus/pkg/client/kubernetes\"\n- \"github.com/sapcc/kubernikus/pkg/client/kubernikus\"\n- \"github.com/sapcc/kubernikus/pkg/client/openstack\"\n- \"github.com/sapcc/kubernikus/pkg/generated/clientset\"\n- kubernikus_informers \"github.com/sapcc/kubernikus/pkg/generated/informers/externalversions\"\n+ \"github.com/sapcc/kubernikus/pkg/controller/ground\"\n\"github.com/sapcc/kubernikus/pkg/version\"\n\"google.golang.org/grpc\"\n)\nconst (\nTPR_RECHECK_INTERVAL = 5 * time.Minute\n- CACHE_RESYNC_PERIOD = 2 * time.Minute\n)\n-type Options struct {\n- KubeConfig string\n+type GroundControl struct {\n+ Clients\n+ Factories\n+ Config\n- ChartDirectory string\n- AuthURL string\n- AuthUsername string\n- AuthPassword string\n- AuthDomain string\n- AuthProject string\n- AuthProjectDomain string\n-}\n-\n-type Operator struct {\n- Options\n-\n- kubernikusClient clientset.Interface\n- kubernetesClient kubernetes.Interface\n- kubernetesConfig *rest.Config\n- openstackClient openstack.Client\n-\n- informers kubernikus_informers.SharedInformerFactory\n- tprInformer cache.SharedIndexInformer\nqueue workqueue.RateLimitingInterface\n+ tprInformer cache.SharedIndexInformer\n}\n-func New(options Options) *Operator {\n- kubernetesClient, err := kube.NewClient(options.KubeConfig)\n- if err != nil {\n- glog.Fatalf(\"Failed to create kubernetes clients: %s\", err)\n- }\n-\n- kubernetesConfig, err := kube.NewConfig(options.KubeConfig)\n- if err != nil {\n- glog.Fatalf(\"Failed to create kubernetes config: %s\", err)\n- }\n-\n- kubernikusClient, err := kubernikus.NewClient(options.KubeConfig)\n- if err != nil {\n- glog.Fatalf(\"Failed to create kubernikus clients: %s\", err)\n- }\n-\n- openstackClient, err := openstack.NewClient(\n- options.AuthURL,\n- options.AuthUsername,\n- options.AuthPassword,\n- options.AuthDomain,\n- options.AuthProject,\n- options.AuthProjectDomain,\n- )\n- if err != nil {\n- glog.Fatalf(\"Failed to create openstack client: %s\", err)\n- }\n-\n- operator := &Operator{\n- Options: options,\n+func NewGroundController(factories Factories, clients Clients, config Config) *GroundControl {\n+ operator := &GroundControl{\n+ Clients: clients,\n+ Factories: factories,\nqueue: workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()),\n- kubernikusClient: kubernikusClient,\n- kubernetesClient: kubernetesClient,\n- openstackClient: openstackClient,\n- kubernetesConfig: kubernetesConfig,\n+ tprInformer: factories.Kubernikus.Kubernikus().V1().Klusters().Informer(),\n}\n- operator.informers = kubernikus_informers.NewSharedInformerFactory(operator.kubernikusClient, 5*time.Minute)\n-\n- operator.informers.Kubernikus().V1().Klusters().Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n+ operator.tprInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{\nAddFunc: operator.klusterAdd,\nUpdateFunc: operator.klusterUpdate,\nDeleteFunc: operator.klusterTerminate,\n})\n- operator.tprInformer = operator.informers.Kubernikus().V1().Klusters().Informer()\n-\nreturn operator\n}\n-func (op *Operator) Run(threadiness int, stopCh <-chan struct{}, wg *sync.WaitGroup) {\n+func (op *GroundControl) Run(threadiness int, stopCh <-chan struct{}, wg *sync.WaitGroup) {\ndefer op.queue.ShutDown()\ndefer wg.Done()\nwg.Add(1)\nglog.Infof(\"Kluster operator started! %v\\n\", version.VERSION)\n- go op.tprInformer.Run(stopCh)\n-\n- glog.Info(\"Waiting for cache to sync...\")\n- cache.WaitForCacheSync(stopCh, op.tprInformer.HasSynced)\n- glog.Info(\"Cache primed. Ready for operations.\")\n-\nfor i := 0; i < threadiness; i++ {\ngo wait.Until(op.runWorker, time.Second, stopCh)\n}\n@@ -145,12 +82,12 @@ func (op *Operator) Run(threadiness int, stopCh <-chan struct{}, wg *sync.WaitGr\n<-stopCh\n}\n-func (op *Operator) runWorker() {\n+func (op *GroundControl) runWorker() {\nfor op.processNextWorkItem() {\n}\n}\n-func (op *Operator) processNextWorkItem() bool {\n+func (op *GroundControl) processNextWorkItem() bool {\nkey, quit := op.queue.Get()\nif quit {\nreturn false\n@@ -169,7 +106,7 @@ func (op *Operator) processNextWorkItem() bool {\nreturn true\n}\n-func (op *Operator) handler(key string) error {\n+func (op *GroundControl) handler(key string) error {\nobj, exists, err := op.tprInformer.GetIndexer().GetByKey(key)\nif err != nil {\nreturn fmt.Errorf(\"Failed to fetch key %s from cache: %s\", key, err)\n@@ -210,7 +147,7 @@ func (op *Operator) handler(key string) error {\nreturn nil\n}\n-func (op *Operator) klusterAdd(obj interface{}) {\n+func (op *GroundControl) klusterAdd(obj interface{}) {\nc := obj.(*v1.Kluster)\nkey, err := cache.MetaNamespaceKeyFunc(c)\nif err != nil {\n@@ -220,7 +157,7 @@ func (op *Operator) klusterAdd(obj interface{}) {\nop.queue.Add(key)\n}\n-func (op *Operator) klusterTerminate(obj interface{}) {\n+func (op *GroundControl) klusterTerminate(obj interface{}) {\nc := obj.(*v1.Kluster)\nkey, err := cache.DeletionHandlingMetaNamespaceKeyFunc(c)\nif err != nil {\n@@ -230,7 +167,7 @@ func (op *Operator) klusterTerminate(obj interface{}) {\nop.queue.Add(key)\n}\n-func (op *Operator) klusterUpdate(cur, old interface{}) {\n+func (op *GroundControl) klusterUpdate(cur, old interface{}) {\ncurKluster := cur.(*v1.Kluster)\noldKluster := old.(*v1.Kluster)\nif !reflect.DeepEqual(oldKluster, curKluster) {\n@@ -243,8 +180,10 @@ func (op *Operator) klusterUpdate(cur, old interface{}) {\n}\n}\n-func (op *Operator) updateStatus(tpr *v1.Kluster, state v1.KlusterState, message string) error {\n+func (op *GroundControl) updateStatus(tpr *v1.Kluster, state v1.KlusterState, message string) error {\n//Get a fresh copy from the cache\n+ op.Factories.Kubernikus.Kubernikus().V1().Klusters().Informer().GetStore()\n+\nobj, exists, err := op.tprInformer.GetStore().Get(tpr)\nif err != nil {\nreturn err\n@@ -256,24 +195,19 @@ func (op *Operator) updateStatus(tpr *v1.Kluster, state v1.KlusterState, message\nkluster := obj.(*v1.Kluster)\n//Never modify the cache, at leasts thats what I've been told\n- tpr, err = op.kubernikusClient.Kubernikus().Klusters(kluster.Namespace).Get(kluster.Name, metav1.GetOptions{})\n+ tpr, err = op.Clients.Kubernikus.Kubernikus().Klusters(kluster.Namespace).Get(kluster.Name, metav1.GetOptions{})\nif err != nil {\nreturn err\n}\ntpr.Status.Message = message\ntpr.Status.State = state\n- _, err = op.kubernikusClient.Kubernikus().Klusters(tpr.Namespace).Update(tpr)\n+ _, err = op.Clients.Kubernikus.Kubernikus().Klusters(tpr.Namespace).Update(tpr)\nreturn err\n}\n-func (op *Operator) createKluster(tpr *v1.Kluster) error {\n- helmClient, err := helmutil.NewClient(op.kubernetesClient, op.kubernetesConfig)\n- if err != nil {\n- return fmt.Errorf(\"Failed to create helm client: %s\", err)\n- }\n-\n- routers, err := op.openstackClient.GetRouters(tpr.Account())\n+func (op *GroundControl) createKluster(tpr *v1.Kluster) error {\n+ routers, err := op.Clients.Openstack.GetRouters(tpr.Account())\nif err != nil {\nreturn fmt.Errorf(\"Couldn't get routers for project %s: %s\", tpr.Account(), err)\n}\n@@ -284,12 +218,12 @@ func (op *Operator) createKluster(tpr *v1.Kluster) error {\nreturn fmt.Errorf(\"Project needs to contain a router with exactly one subnet\")\n}\n- cluster, err := NewCluster(tpr.GetName(), \"kluster.staging.cloud.sap\")\n+ cluster, err := ground.NewCluster(tpr.GetName(), \"kluster.staging.cloud.sap\")\nif err != nil {\nreturn err\n}\n- cluster.OpenStack.AuthURL = op.AuthURL\n+ cluster.OpenStack.AuthURL = op.Config.Openstack.AuthURL\ncluster.OpenStack.Username = serviceUsername(tpr.GetName())\npassword, err := goutils.RandomAscii(20)\nif err != nil {\n@@ -309,27 +243,23 @@ func (op *Operator) createKluster(tpr *v1.Kluster) error {\nglog.Infof(\"Installing helm release %s\", tpr.GetName())\nglog.V(3).Infof(\"Chart values:\\n%s\", string(rawValues))\n- _, err = helmClient.InstallRelease(path.Join(op.ChartDirectory, \"kube-master\"), tpr.Namespace, helm.ValueOverrides(rawValues), helm.ReleaseName(tpr.GetName()))\n+ _, err = op.Clients.Helm.InstallRelease(path.Join(op.Config.Helm.ChartDirectory, \"kube-master\"), tpr.Namespace, helm.ValueOverrides(rawValues), helm.ReleaseName(tpr.GetName()))\nreturn err\n}\n-func (op *Operator) terminateKluster(tpr *v1.Kluster) error {\n- helmClient, err := helmutil.NewClient(op.kubernetesClient, op.kubernetesConfig)\n- if err != nil {\n- return fmt.Errorf(\"Failed to create helm client: %s\", err)\n- }\n+func (op *GroundControl) terminateKluster(tpr *v1.Kluster) error {\nglog.Infof(\"Deleting helm release %s\", tpr.GetName())\n- _, err = helmClient.DeleteRelease(tpr.GetName(), helm.DeletePurge(true))\n+ _, err := op.Clients.Helm.DeleteRelease(tpr.GetName(), helm.DeletePurge(true))\nif err != nil && !strings.Contains(grpc.ErrorDesc(err), fmt.Sprintf(`release: \"%s\" not found`, tpr.GetName())) {\nreturn err\n}\nu := serviceUsername(tpr.GetName())\nglog.Infof(\"Deleting openstack user %s@default\", u)\n- if err := op.openstackClient.DeleteUser(u, \"default\"); err != nil {\n+ if err := op.Clients.Openstack.DeleteUser(u, \"default\"); err != nil {\nreturn err\n}\n- return op.kubernikusClient.Kubernikus().Klusters(tpr.Namespace).Delete(tpr.Name, &metav1.DeleteOptions{})\n+ return op.Clients.Kubernikus.Kubernikus().Klusters(tpr.Namespace).Delete(tpr.Name, &metav1.DeleteOptions{})\n}\nfunc serviceUsername(name string) string {\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/controller/operator.go",
"new_path": "pkg/controller/operator.go",
"diff": "@@ -14,9 +14,11 @@ import (\nkubernikus_informers \"github.com/sapcc/kubernikus/pkg/generated/informers/externalversions\"\n\"github.com/sapcc/kubernikus/pkg/version\"\n+ helmutil \"github.com/sapcc/kubernikus/pkg/client/helm\"\nkubernetes_informers \"k8s.io/client-go/informers\"\nkubernetes_clientset \"k8s.io/client-go/kubernetes\"\n\"k8s.io/client-go/tools/cache\"\n+ \"k8s.io/helm/pkg/helm\"\n)\ntype KubernikusOperatorOptions struct {\n@@ -36,6 +38,25 @@ type Clients struct {\nKubernikus kubernikus_clientset.Interface\nKubernetes kubernetes_clientset.Interface\nOpenstack openstack.Client\n+ Helm *helm.Client\n+}\n+\n+type OpenstackConfig struct {\n+ AuthURL string\n+ AuthUsername string\n+ AuthPassword string\n+ AuthDomain string\n+ AuthProject string\n+ AuthProjectDomain string\n+}\n+\n+type HelmConfig struct {\n+ ChartDirectory string\n+}\n+\n+type Config struct {\n+ Openstack OpenstackConfig\n+ Helm HelmConfig\n}\ntype Factories struct {\n@@ -44,8 +65,8 @@ type Factories struct {\n}\ntype KubernikusOperator struct {\n- Options *KubernikusOperatorOptions\nClients\n+ Config\nFactories\n}\n@@ -53,7 +74,18 @@ func NewKubernikusOperator(options *KubernikusOperatorOptions) *KubernikusOperat\nvar err error\no := &KubernikusOperator{\n- Options: options,\n+ Config: Config{\n+ Openstack: OpenstackConfig{\n+ AuthURL: options.AuthURL,\n+ AuthUsername: options.AuthUsername,\n+ AuthPassword: options.AuthPassword,\n+ AuthProject: options.AuthProjectDomain,\n+ AuthProjectDomain: options.AuthProjectDomain,\n+ },\n+ Helm: HelmConfig{\n+ ChartDirectory: options.ChartDirectory,\n+ },\n+ },\n}\no.Clients.Kubernetes, err = kube.NewClient(options.KubeConfig)\n@@ -78,6 +110,15 @@ func NewKubernikusOperator(options *KubernikusOperatorOptions) *KubernikusOperat\nglog.Fatalf(\"Failed to create openstack client: %s\", err)\n}\n+ config, err := kube.NewConfig(options.KubeConfig)\n+ if err != nil {\n+ glog.Fatalf(\"Failed to create kubernetes config: %s\", err)\n+ }\n+ o.Clients.Helm, err = helmutil.NewClient(o.Clients.Kubernetes, config)\n+ if err != nil {\n+ glog.Fatalf(\"Failed to create helm client: %s\", err)\n+ }\n+\no.Factories.Kubernikus = kubernikus_informers.NewSharedInformerFactory(o.Clients.Kubernikus, 5*time.Minute)\no.Factories.Kubernetes = kubernetes_informers.NewSharedInformerFactory(o.Clients.Kubernetes, 5*time.Minute)\n@@ -106,6 +147,8 @@ func (o *KubernikusOperator) Run(stopCh <-chan struct{}, wg *sync.WaitGroup) {\no.Factories.Kubernetes.WaitForCacheSync(stopCh)\nglog.Info(\"Cache primed. Ready for Action!\")\n+\n+ go NewGroundController(o.Factories, o.Clients, o.Config).Run(1, stopCh, wg)\n}\nfunc (p *KubernikusOperator) debugAdd(obj interface{}) {\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | implements one operator to rule them all.. |
596,240 | 05.09.2017 11:40:36 | -7,200 | 619f8d60abaefcac341e14b5e8df31f842ecfade | inits launchctl | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/controller/launch.go",
"diff": "+package controller\n+\n+import (\n+ \"sync\"\n+ \"time\"\n+\n+ \"github.com/golang/glog\"\n+ \"k8s.io/apimachinery/pkg/util/wait\"\n+ \"k8s.io/client-go/util/workqueue\"\n+)\n+\n+type LaunchControl struct {\n+ Factories\n+ queue workqueue.RateLimitingInterface\n+}\n+\n+func NewLaunchController(factories Factories) *LaunchControl {\n+ launchctl := &LaunchControl{\n+ Factories: factories,\n+ queue: workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()),\n+ }\n+\n+ return launchctl\n+}\n+\n+func (launchctl *LaunchControl) Run(threadiness int, stopCh <-chan struct{}, wg *sync.WaitGroup) {\n+ defer launchctl.queue.ShutDown()\n+ defer wg.Done()\n+ wg.Add(1)\n+ glog.Infof(\"LaunchControl started!\")\n+\n+ for i := 0; i < threadiness; i++ {\n+ go wait.Until(launchctl.runWorker, time.Second, stopCh)\n+ }\n+\n+ <-stopCh\n+}\n+\n+func (launchctl *LaunchControl) runWorker() {\n+ for launchctl.processNextWorkItem() {\n+ }\n+}\n+\n+func (launchctl *LaunchControl) processNextWorkItem() bool {\n+ key, quit := launchctl.queue.Get()\n+ if quit {\n+ return false\n+ }\n+ defer launchctl.queue.Done(key)\n+\n+ err := launchctl.handler(key.(string))\n+ if err == nil {\n+ launchctl.queue.Forget(key)\n+ return true\n+ }\n+\n+ glog.Warningf(\"Error running handler: %v\", err)\n+ launchctl.queue.AddRateLimited(key)\n+\n+ return true\n+}\n+\n+func (launchctl *LaunchControl) handler(key string) error {\n+ return nil\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/controller/operator.go",
"new_path": "pkg/controller/operator.go",
"diff": "@@ -70,6 +70,11 @@ type KubernikusOperator struct {\nFactories\n}\n+const (\n+ GROUNDCTL_WORKERS = 1\n+ LAUNCHCTL_WORKERS = 1\n+)\n+\nfunc NewKubernikusOperator(options *KubernikusOperatorOptions) *KubernikusOperator {\nvar err error\n@@ -148,7 +153,8 @@ func (o *KubernikusOperator) Run(stopCh <-chan struct{}, wg *sync.WaitGroup) {\nglog.Info(\"Cache primed. Ready for Action!\")\n- go NewGroundController(o.Factories, o.Clients, o.Config).Run(1, stopCh, wg)\n+ go NewGroundController(o.Factories, o.Clients, o.Config).Run(GROUNDCTL_WORKERS, stopCh, wg)\n+ go NewLaunchController(o.Factories).Run(LAUNCHCTL_WORKERS, stopCh, wg)\n}\nfunc (p *KubernikusOperator) debugAdd(obj interface{}) {\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | inits launchctl |
596,240 | 05.09.2017 11:49:28 | -7,200 | 43b8f384b164101cbfbba88acc663d9926f94e5f | removes debug informer | [
{
"change_type": "MODIFY",
"old_path": "pkg/controller/operator.go",
"new_path": "pkg/controller/operator.go",
"diff": "@@ -128,12 +128,6 @@ func NewKubernikusOperator(options *KubernikusOperatorOptions) *KubernikusOperat\no.Factories.Kubernikus = kubernikus_informers.NewSharedInformerFactory(o.Clients.Kubernikus, RECONCILIATION_DURATION)\no.Factories.Kubernetes = kubernetes_informers.NewSharedInformerFactory(o.Clients.Kubernetes, RECONCILIATION_DURATION)\n- o.Factories.Kubernetes.Core().V1().Nodes().Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n- AddFunc: o.debugAdd,\n- UpdateFunc: o.debugUpdate,\n- DeleteFunc: o.debugDelete,\n- })\n-\no.Factories.Kubernikus.Kubernikus().V1().Klusters().Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\nAddFunc: o.debugAdd,\nUpdateFunc: o.debugUpdate,\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | removes debug informer |
596,240 | 05.09.2017 11:58:11 | -7,200 | c3b4b5c44048c8ff0b24f6c0a70a93ee8d9c0096 | creates informers earlier than waiting for caches to sync | [
{
"change_type": "MODIFY",
"old_path": "pkg/controller/operator.go",
"new_path": "pkg/controller/operator.go",
"diff": "@@ -71,7 +71,7 @@ type KubernikusOperator struct {\n}\nconst (\n- GROUNDCTL_WORKERS = 1\n+ GROUNDCTL_WORKERS = 10\nLAUNCHCTL_WORKERS = 1\nRECONCILIATION_DURATION = 5 * time.Minute\n)\n@@ -140,6 +140,9 @@ func NewKubernikusOperator(options *KubernikusOperatorOptions) *KubernikusOperat\nfunc (o *KubernikusOperator) Run(stopCh <-chan struct{}, wg *sync.WaitGroup) {\nfmt.Printf(\"Welcome to Kubernikus %v\\n\", version.VERSION)\n+ groundctl := NewGroundController(o.Factories, o.Clients, o.Config)\n+ launchctl := NewLaunchController(o.Factories)\n+\no.Factories.Kubernikus.Start(stopCh)\no.Factories.Kubernetes.Start(stopCh)\n@@ -148,8 +151,8 @@ func (o *KubernikusOperator) Run(stopCh <-chan struct{}, wg *sync.WaitGroup) {\nglog.Info(\"Cache primed. Ready for Action!\")\n- go NewGroundController(o.Factories, o.Clients, o.Config).Run(GROUNDCTL_WORKERS, stopCh, wg)\n- go NewLaunchController(o.Factories).Run(LAUNCHCTL_WORKERS, stopCh, wg)\n+ go groundctl.Run(GROUNDCTL_WORKERS, stopCh, wg)\n+ go launchctl.Run(LAUNCHCTL_WORKERS, stopCh, wg)\n}\nfunc (p *KubernikusOperator) debugAdd(obj interface{}) {\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | creates informers earlier than waiting for caches to sync |
596,240 | 06.09.2017 14:47:50 | -7,200 | 2d3eed2a94bada2b0786b135fcf4050830d63dbd | fixes broken target for code generators | [
{
"change_type": "MODIFY",
"old_path": "code-generate.mk",
"new_path": "code-generate.mk",
"diff": "@@ -18,7 +18,7 @@ client-gen: $(BIN)/client-gen\n--input kubernikus/v1 \\\n--clientset-name clientset\n-informer-gen: $(BIN)/bin/informer-gen\n+informer-gen: $(BIN)/informer-gen\n@rm -rf ./pkg/generated/informers\n@mkdir -p ./pkg/generated/informers\n$(BIN)/informer-gen \\\n@@ -31,7 +31,7 @@ informer-gen: $(BIN)/bin/informer-gen\n--internal-clientset-package $(GENERATED_BASE)/clientset \\\n--versioned-clientset-package $(GENERATED_BASE)/clientset\n-lister-gen: $(BIN)/bin/lister-gen\n+lister-gen: $(BIN)/lister-gen\n@rm -rf ./pkg/generated/listers\n@mkdir -p ./pkg/generated/listers\n$(BIN)/lister-gen \\\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | fixes broken target for code generators |
596,240 | 06.09.2017 14:48:19 | -7,200 | 2d97ae7483ec84350366cb2f8ae22e84d1877e0f | creates empty nodepools | [
{
"change_type": "MODIFY",
"old_path": "pkg/api/handlers/create_cluster.go",
"new_path": "pkg/api/handlers/create_cluster.go",
"diff": "@@ -31,6 +31,7 @@ func (d *createCluster) Handle(params operations.CreateClusterParams, principal\n},\nSpec: v1.KlusterSpec{\nName: name,\n+ NodePools: []v1.NodePool,\n},\nStatus: v1.KlusterStatus{\nState: v1.KlusterPending,\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | creates empty nodepools |
596,240 | 06.09.2017 14:49:20 | -7,200 | a539d6ce2da55e50190bf149dd832fe75260e0ed | allows nodepools to be empty | [
{
"change_type": "MODIFY",
"old_path": "pkg/apis/kubernikus/v1/kluster.go",
"new_path": "pkg/apis/kubernikus/v1/kluster.go",
"diff": "@@ -17,7 +17,7 @@ type NodePool struct {\ntype KlusterSpec struct {\nName string `json:\"name\"`\n- NodePools []NodePool `json:\"nodePools\"`\n+ NodePools []NodePool `json:\"nodePools,omitempty\"`\n}\ntype KlusterState string\n"
}
]
| Go | Apache License 2.0 | sapcc/kubernikus | allows nodepools to be empty |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.