reposition tanks on map switch, rework map logic

This commit is contained in:
Vinzenz Schroeter 2024-05-03 15:47:33 +02:00 committed by RobbersDaughter
parent 3d65c81b8b
commit 97144ae3b8
13 changed files with 208 additions and 117 deletions

View file

@ -11,7 +11,8 @@ internal sealed class Endpoints(
ClientScreenServer clientScreenServer,
PlayerServer playerService,
ControlsServer controlsServer,
MapService mapService
MapService mapService,
ChangeToRequestedMap changeToRequestedMap
)
{
public void Map(WebApplication app)
@ -29,8 +30,9 @@ internal sealed class Endpoints(
{
if (string.IsNullOrWhiteSpace(name))
return TypedResults.BadRequest("invalid map name");
if (!mapService.TrySwitchTo(name))
if (!mapService.TryGetMapByName(name, out var map))
return TypedResults.NotFound("map with name not found");
changeToRequestedMap.Request(map);
return TypedResults.Ok();
}