mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
refactor of previous commits
refactor to enum typing and many other fixes fix tests attempt to fix some typescript more typescript fixes more typescript test fixes revert all API changes update to pydcs mypy fixes Use properties to check if player is blue/red/neutral update requirements.txt black -_- bump pydcs and fix mypy add opponent property bump pydcs
This commit is contained in:
@@ -6,6 +6,7 @@ from fastapi import APIRouter, Body, Depends, HTTPException, status
|
||||
from starlette.responses import Response
|
||||
|
||||
from game import Game
|
||||
from game.theater.player import Player
|
||||
from .models import ControlPointJs
|
||||
from ..dependencies import GameContext
|
||||
from ..leaflet import LeafletPoint
|
||||
@@ -75,7 +76,7 @@ def set_destination(
|
||||
)
|
||||
if not cp.moveable:
|
||||
raise HTTPException(status.HTTP_403_FORBIDDEN, detail=f"{cp} is not mobile")
|
||||
if not cp.captured:
|
||||
if not cp.captured.is_blue:
|
||||
raise HTTPException(
|
||||
status.HTTP_403_FORBIDDEN, detail=f"{cp} is not owned by the player"
|
||||
)
|
||||
@@ -120,7 +121,7 @@ def cancel_travel(cp_id: UUID, game: Game = Depends(GameContext.require)) -> Non
|
||||
)
|
||||
if not cp.moveable:
|
||||
raise HTTPException(status.HTTP_403_FORBIDDEN, detail=f"{cp} is not mobile")
|
||||
if not cp.captured:
|
||||
if not cp.captured.is_blue:
|
||||
raise HTTPException(
|
||||
status.HTTP_403_FORBIDDEN, detail=f"{cp} is not owned by the player"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user