Source

tutagx / ttgx / model / gameset.py

The branch 'nsgui' does not exist.
from ttgx.meta import model
from ttgx.model import agency, ai, aircraft, base, date, misc
import ttgx.util.split as split
from .entity import GameEntity


class StartConfig(GameEntity):
    is_value_type = True
    agency = model.Ref(agency.Agency)
    ais = model.List(model.Ref(ai.AIActor))
    date = model.Value(date.Date)


class Difficulty(GameEntity):
    name = model.Ref(misc.GameText)
    research_percent = model.Integer()
    ufos_per_day = model.Float()
    start_config = model.Value(StartConfig)

    _OID_PATTERN = 'dif/{.name["en"]}'


@split.simple_splitting
class GameSet(GameEntity):
    name = model.Ref(misc.GameText)
    author = model.String()
    version = model.String()
    description = model.String()
    assets = model.String()
    gui = model.String()
    start_page = model.String()

    startup_scripts = model.List(model.String())

    aircraft_templates = model.List(model.Ref(aircraft.AircraftTemplate))
    difficulties = model.List(model.Ref(Difficulty))

    _OID_PATTERN = 'gs/{.name["en"]}'