Move mod vehicle registration to a decorator.

This cruft doesn't need to be in game.db, it can be kept with the mod
support code.
This commit is contained in:
Dan Albert
2022-02-18 12:40:30 -08:00
parent 4e030c4a3a
commit e3ee988225
14 changed files with 156 additions and 304 deletions

21
game/modsupport.py Normal file
View File

@@ -0,0 +1,21 @@
from typing import Type
from dcs.helicopters import HelicopterType, helicopter_map
from dcs.planes import PlaneType, plane_map
from dcs.unittype import VehicleType
from dcs.vehicles import vehicle_map
def helicoptermod(helicopter: Type[HelicopterType]) -> Type[HelicopterType]:
helicopter_map[helicopter.id] = helicopter
return helicopter
def planemod(plane: Type[PlaneType]) -> Type[PlaneType]:
plane_map[plane.id] = plane
return plane
def vehiclemod(vehicle: Type[VehicleType]) -> Type[VehicleType]:
vehicle_map[vehicle.id] = vehicle
return vehicle