private void OnStationInitialized(StationInitializedEvent msg)
    {
        var stationJobs = AddComp <StationJobsComponent>(msg.Station);
        var stationData = Comp <StationDataComponent>(msg.Station);

        if (stationData.StationConfig == null)
        {
            return;
        }

        var mapJobList = stationData.StationConfig.AvailableJobs;

        stationJobs.RoundStartTotalJobs = mapJobList.Values.Where(x => x[0] is not null && x[0] > 0).Sum(x => x[0] !.Value);
        stationJobs.MidRoundTotalJobs   = mapJobList.Values.Where(x => x[1] is not null && x[1] > 0).Sum(x => x[1] !.Value);
        stationJobs.TotalJobs           = stationJobs.MidRoundTotalJobs;
        stationJobs.JobList             = mapJobList.ToDictionary(x => x.Key, x =>
        {
            if (x.Value[1] <= -1)
            {
                return(null);
            }
            return((uint?)x.Value[1]);
        });
        stationJobs.RoundStartJobList = mapJobList.ToDictionary(x => x.Key, x =>
        {
            if (x.Value[0] <= -1)
            {
                return(null);
            }
            return((uint?)x.Value[0]);
        });
        stationJobs.OverflowJobs = stationData.StationConfig.OverflowJobs.ToHashSet();
        UpdateJobsAvailable();
    }
Пример #2
0
    private void OnStationInitialize(StationInitializedEvent args)
    {
        var alertLevelComponent = AddComp <AlertLevelComponent>(args.Station);

        if (!_prototypeManager.TryIndex(DefaultAlertLevelSet, out AlertLevelPrototype? alerts))
        {
            return;
        }

        alertLevelComponent.AlertLevels = alerts;

        var defaultLevel = alertLevelComponent.AlertLevels.DefaultLevel;

        if (string.IsNullOrEmpty(defaultLevel))
        {
            defaultLevel = alertLevelComponent.AlertLevels.Levels.Keys.First();
        }

        SetLevel(args.Station, defaultLevel, false, false, true);
    }
Пример #3
0
 private void OnStationInitialized(StationInitializedEvent ev)
 {
     AddComp <StationSpawningComponent>(ev.Station);
 }
Пример #4
0
 private void OnStationInit(StationInitializedEvent ev)
 {
     EnsureComp <StationBankAccountComponent>(ev.Station);
     EnsureComp <StationCargoOrderDatabaseComponent>(ev.Station);
 }