Skip to content

Commit d0d99b9

Browse files
Recombining circles doesn't work (#3234)
# Description of Changes Fixes #3149 - Fix for MoveAllPlayers calculation to force the circles apart - Fix for PlayerSplit to properly calculate Scheduled_At for the recombine timer # API and ABI breaking changes None # Expected complexity level and risk 1 - Trivial # Testing I've loaded this up against the Unreal Blackholio comparing the server-rust vs server-csharp. - [x] Confirm split + recombine work correctly in the Unity client *Note*: The demo/Blackholio/client-unity project is currently generated with the server-rust bindings
1 parent 1d08167 commit d0d99b9

File tree

1 file changed

+4
-2
lines changed
  • demo/Blackholio/server-csharp

1 file changed

+4
-2
lines changed

demo/Blackholio/server-csharp/Lib.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ public static void MoveAllPlayers(ReducerContext ctx, MoveAllPlayersTimer timer)
322322
var gravity_multiplier =
323323
1f - time_before_recombining / SPLIT_GRAV_PULL_BEFORE_RECOMBINE_SEC;
324324
var vec = diff.Normalized
325-
* MathF.Sqrt(radius_sum - distance_sqr)
325+
* (radius_sum - MathF.Sqrt(distance_sqr))
326326
* gravity_multiplier
327327
* 0.05f
328328
/ count;
@@ -483,9 +483,11 @@ public static void PlayerSplit(ReducerContext ctx)
483483
}
484484
}
485485

486+
var duration = new TimeDuration { Microseconds = (long)(SPLIT_RECOMBINE_DELAY_SEC * 1_000_000) };
487+
var trigger_at = ctx.Timestamp + duration;
486488
ctx.Db.circle_recombine_timer.Insert(new CircleRecombineTimer
487489
{
488-
scheduled_at = new ScheduleAt.Time(DateTimeOffset.Now.Add(TimeSpan.FromSeconds(SPLIT_RECOMBINE_DELAY_SEC))),
490+
scheduled_at = new ScheduleAt.Time(trigger_at),
489491
player_id = player.player_id,
490492
});
491493

0 commit comments

Comments
 (0)