mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Move pydcs helper function out of db.
This commit is contained in:
0
game/dcs/__init__.py
Normal file
0
game/dcs/__init__.py
Normal file
20
game/dcs/helpers.py
Normal file
20
game/dcs/helpers.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from typing import Optional, Type
|
||||
|
||||
from dcs.helicopters import helicopter_map
|
||||
from dcs.planes import plane_map
|
||||
from dcs.ships import ship_map
|
||||
from dcs.unittype import UnitType
|
||||
from dcs.vehicles import vehicle_map
|
||||
|
||||
|
||||
def unit_type_from_name(name: str) -> Optional[Type[UnitType]]:
|
||||
if name in vehicle_map:
|
||||
return vehicle_map[name]
|
||||
elif name in plane_map:
|
||||
return plane_map[name]
|
||||
elif name in ship_map:
|
||||
return ship_map[name]
|
||||
if name in helicopter_map:
|
||||
return helicopter_map[name]
|
||||
else:
|
||||
return None
|
||||
Reference in New Issue
Block a user