more configuration, limit rate of sent frames

This commit is contained in:
Vinzenz Schroeter 2024-04-16 21:34:54 +02:00
parent 786c974a23
commit 3f4a301993
10 changed files with 104 additions and 45 deletions

View file

@ -1,6 +1,10 @@
namespace TanksServer.GameLogic;
internal sealed class CollideBulletsWithMap(BulletManager bullets, MapService map) : ITickStep
internal sealed class CollideBulletsWithMap(
BulletManager bullets,
MapService map,
IOptions<GameRulesConfiguration> options
) : ITickStep
{
public Task TickAsync(TimeSpan _)
{
@ -14,7 +18,8 @@ internal sealed class CollideBulletsWithMap(BulletManager bullets, MapService ma
if (!map.Current.IsWall(pixel))
return false;
map.Current.DestroyWallAt(pixel);
if (options.Value.DestructibleWalls)
map.Current.DestroyWallAt(pixel);
return true;
}
}

View file

@ -0,0 +1,6 @@
namespace TanksServer.GameLogic;
public class GameRulesConfiguration
{
public bool DestructibleWalls { get; set; } = true;
}