Skip to content

Commit

Permalink
release v4.1.124
Browse files Browse the repository at this point in the history
  • Loading branch information
FluffierThanThou committed Mar 16, 2024
1 parent 8cb91d2 commit 30938fc
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 14 deletions.
Binary file modified Assemblies/Fluffy_Relations.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion Source/ForceDirectedGraph/FactionNode.cs
Expand Up @@ -39,7 +39,7 @@ public class FactionNode: Node {
// apply force in direction of other
velocity += force * this.DirectionTo(other);

#if DEBUG
#if DEBUG_GRAPH
Graph.msg.AppendLine("\t\tOpinion: " + opinion + ", Force: " + force + ", Vector: " + (force * this.DirectionTo(other)));
#endif
}
Expand Down
14 changes: 7 additions & 7 deletions Source/ForceDirectedGraph/Graph.cs
Expand Up @@ -30,7 +30,7 @@ public class Graph {
private float temperature = .1f;
private readonly Dictionary<Pawn, Node> _pawnNodes = new();

#if DEBUG
#if DEBUG_GRAPH
public static StringBuilder msg = new();
#endif

Expand Down Expand Up @@ -118,7 +118,7 @@ public class Graph {
return;
}

#if TRACE
#if DEBUG_GRAPH
msg = new StringBuilder();
msg.AppendLine("Iteration: " + iteration);
#endif
Expand All @@ -128,7 +128,7 @@ public class Graph {

// calculate attractive forces
foreach (Edge edge in edges) {
#if TRACE
#if DEBUG_GRAPH
msg.AppendLine("\tAttractive force between " + edge.nodeA.pawn.Name.ToStringShort + edge.nodeA.position + " and " + edge.nodeB.pawn.Name.ToStringShort + edge.nodeB.position);
#endif
edge.nodeA.AttractedTo(edge.nodeB);
Expand All @@ -137,7 +137,7 @@ public class Graph {

// calculate repulsive forces
foreach (Node node in nodes) {
#if TRACE
#if DEBUG_GRAPH
msg.AppendLine("\tRepulsion for " + node.pawn.Name.ToStringShort + node.position);
#endif
foreach (Node other in nodes) {
Expand Down Expand Up @@ -182,7 +182,7 @@ public class Graph {
nodes.Where(n => !n.Frozen).Min(node => node.position.y));
Vector2 offset = (size / 2f) - graphCentre;

#if TRACE
#if DEBUG_GRAPH
msg.AppendLine("Centre: " + graphCentre + ", offset: " + (size / 2f));
#endif
foreach (Node node in nodes) {
Expand All @@ -197,7 +197,7 @@ public class Graph {
//if ( !node.frozen )
// node.Clamp( size );

#if TRACE
#if DEBUG_GRAPH
msg.AppendLine("\t" + node.pawn.LabelShort + ", velocity: " + node.velocity + ", position: " + node.position);
}
Log.Message(msg.ToString());
Expand All @@ -213,7 +213,7 @@ public class Graph {
Constants.SlotSize * 5f);
temperature = MAX_TEMPERATURE * (1f - (1f / MAX_ITERATIONS * iteration));

#if TRACE
#if DEBUG_GRAPH
msg.AppendLine("idealDistance: " + idealDistance + ", temperature: " + temperature);
#endif
}
Expand Down
4 changes: 2 additions & 2 deletions Source/ForceDirectedGraph/Node.cs
Expand Up @@ -58,7 +58,7 @@ public class Node {
float force = Graph.ATTRACTIVE_CONSTANT * Mathf.Max( this.DistanceTo( other ) - Graph.idealDistance, 0f );
velocity += force * this.DirectionTo(other);

#if DEBUG
#if DEBUG_GRAPH
Graph.msg.AppendLine("\t\tForce: " + force + ", Vector: " + (force * this.DirectionTo(other)));
#endif
}
Expand All @@ -72,7 +72,7 @@ public class Node {
float force = -( Graph.REPULSIVE_CONSTANT / Mathf.Pow( this.DistanceTo( other ), 2 ) * Graph.idealDistance );
velocity += force * this.DirectionTo(other);

#if DEBUG
#if DEBUG_GRAPH
Graph.msg.AppendLine("\t\tRepulsion from " + other.pawn.Name.ToStringShort + other.position + "; Distance: " + this.DistanceTo(other) + " (" + (Mathf.Pow(this.DistanceTo(other), 2) * Graph.idealDistance) + "), Force: " + force + ", Vector: " + (force * this.DirectionTo(other)));
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion Source/ForceDirectedGraph/PawnNode.cs
Expand Up @@ -23,7 +23,7 @@ public class PawnNode: Node {
// apply force in direction of other
velocity += force * this.DirectionTo(other);

#if DEBUG
#if DEBUG_GRAPH
Graph.msg.AppendLine("\t\tOpinion: " + opinion + ", Force: " + force + ", Vector: " + (force * this.DirectionTo(other)));
#endif
}
Expand Down
15 changes: 12 additions & 3 deletions modinfo.json
Expand Up @@ -4,9 +4,9 @@
"targetDir": "FluffyRelations",
"url": "https://github.com/fluffy-mods/RelationsTab",
"version": {
"major": 3,
"minor": 2,
"build": 122
"major": 4,
"minor": 1,
"build": 124
},
"author": {
"name": "Fluffy",
Expand All @@ -19,6 +19,15 @@
"url": "https://github.com/fluffy-mods/RelationsTab"
},
"changelog": [
{
"date": "2024-03-16T13:58:11.000Z",
"message": "update preview image, move some debug behind trace",
"author": {
"name": "Fluffy",
"email": "fluffy.l2032@gmail.com"
},
"hash": "8cb91d2a9b93876ff03643646f6a1c3d6b411d20"
},
{
"date": "2022-10-16T20:16:04.000Z",
"message": "release v3.2.119",
Expand Down

0 comments on commit 30938fc

Please sign in to comment.