Mafi.Core.CoreModConfig

DevWiki
Devany (토론 | 기여)님의 2024년 4월 15일 (월) 17:23 판 (새 문서: <syntaxhighlight lang="csharp" line="1"> [GlobalDependency(RegistrationMode.AsEverything, false, false)] [GenerateSerializer(false, null, 0)] public sealed class CoreModConfig : IConfig, IUnlockedProtosConfig, IBattleSimConfig, IGameRunnerConfig, IDeterminismValidatorConfig, IPopulationConfig, IInstaBuildConfig, ILogisticsConfig, ITracingConfig, IGodModeConfig { private static readonly Action<object, BlobWriter> s_serializeDataDelayedAction; private static readonly Acti...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)
둘러보기로 이동 검색으로 이동
[GlobalDependency(RegistrationMode.AsEverything, false, false)]
[GenerateSerializer(false, null, 0)]
public sealed class CoreModConfig : IConfig, IUnlockedProtosConfig, IBattleSimConfig, IGameRunnerConfig, IDeterminismValidatorConfig, IPopulationConfig, IInstaBuildConfig, ILogisticsConfig, ITracingConfig, IGodModeConfig
{
    private static readonly Action<object, BlobWriter> s_serializeDataDelayedAction;

    private static readonly Action<object, BlobReader> s_deserializeDataDelayedAction;

    public Option<string> LoadedWorldMapName { get; set; }

    //
    // 요약:
    //     지형 물리학을 비활성화할지 여부입니다.
    //     물리 시뮬레이션이 없는 지형은 가파른 각도에 빠지지 않습니다.
    public bool DisableTerrainPhysics { get; set; }

    //
    // 요약:
    //     지형 표면 시뮬레이션을 비활성화할지 여부입니다.
    //     물리적 표면 시뮬레이션이 없는 지형은 중단된 타일 이벤트를 처리하지 않습니다.
    public bool DisableTerrainSurfaceSimulation { get; set; }

    //
    // 요약:
    //     차량 경로 찾기를 비활성화해야 하는지 여부입니다.
    //     길 찾기 기능이 없으면 모든 차량은 장애물을 무시하고 직선으로 이동합니다.
    public bool DisablePathFinding { get; set; }

    public bool DisableMultiThreadTerrainGeneration { get; set; }

    //
    // 요약:
    //     경계 셀의 자동 잠금 해제를 비활성화할지 여부입니다. 이것은 테스트에 편리합니다.
    public bool DisableBoundaryCellAutoUnlock { get; set; }

    //
    // 요약:
    //     지형에서 리소스를 생성할지 여부입니다.
    public bool DisableResourcesGeneration { get; set; }

    public Option<string> LoadedIslandMapName { get; set; }

    //
    // 요약:
    //     잠긴 셀에 대한 지형 청크 생성을 비활성화할지 여부입니다.
    //     이렇게 하면 시작 시간이 크게 단축되고 디버깅할 때 편리합니다.
    public bool DisableLockedCellsTerrainGeneration { get; set; }

    //
    // 요약:
    //     잠긴 모든 프로토를 게임 시작부터 잠금 해제할지 여부입니다.
    public bool ShouldUnlockAllProtosOnInit { get; set; }

    public bool LogCommandsAsCSharp { get; set; }

    public bool IsInstaBuildEnabled { get; set; }

    [DoNotSave(0, null)]
    public bool IsGodModeEnabled { get; set; }

    public bool DisableSimulationBackgroundThread { get; set; }

    public bool DeterminismValidationEnabled { get; set; }

    public Duration DeterminismValidationFrequencySteps { get; set; }

    public bool DeterminismDisableCommandsForwarding { get; set; }

    public int DefenderExtraBattlePriority { get; set; }

    public int MaxBattleRounds { get; set; }

    public int StartingExtraFleetDistance { get; set; }

    public int PossibleEscapeDistance { get; set; }

    public Percent ShipEscapeHpThreshold { get; set; }

    public int BaseRoundsToEscape { get; set; }

    public Percent ChanceForSameEntityRepeatedFire { get; set; }

    public Percent ChanceForDisabledEnemyFire { get; set; }

    public Percent ExtraMissChanceWhenEscaping { get; set; }

    public Percent MaxArmorReduction { get; set; }

    public Percent RecoverableHpMultiplier { get; set; }

    public Percent HullDamageMultWhenPartIsHit { get; set; }

    public int StartingPopulation { get; set; }

    public bool SaveTraceOnSimOvertime { get; set; }

    public Duration SaveTraceOnSimOvertimeMinDelay { get; set; }

    public Duration SaveTimingLogPeriod { get; set; }

    public int InitialVehiclesCap { get; set; }

    public bool AlwaysSunny { get; set; }

    [InitAfterLoad(InitPriority.High)]
    private void initAfterLoad(int saveVersion)
    {
        if (saveVersion < 109)
        {
            InitialVehiclesCap = 60;
        }
    }

    public static void Serialize(CoreModConfig value, BlobWriter writer)
    {
        if (writer.TryStartClassSerialization(value))
        {
            writer.EnqueueDataSerialization(value, s_serializeDataDelayedAction);
        }
    }

    private void SerializeData(BlobWriter writer)
    {
        writer.WriteBool(AlwaysSunny);
        writer.WriteInt(BaseRoundsToEscape);
        Percent.Serialize(ChanceForDisabledEnemyFire, writer);
        Percent.Serialize(ChanceForSameEntityRepeatedFire, writer);
        writer.WriteInt(DefenderExtraBattlePriority);
        writer.WriteBool(DeterminismDisableCommandsForwarding);
        writer.WriteBool(DeterminismValidationEnabled);
        Duration.Serialize(DeterminismValidationFrequencySteps, writer);
        writer.WriteBool(DisableBoundaryCellAutoUnlock);
        writer.WriteBool(DisableLockedCellsTerrainGeneration);
        writer.WriteBool(DisableMultiThreadTerrainGeneration);
        writer.WriteBool(DisablePathFinding);
        writer.WriteBool(DisableResourcesGeneration);
        writer.WriteBool(DisableSimulationBackgroundThread);
        writer.WriteBool(DisableTerrainPhysics);
        writer.WriteBool(DisableTerrainSurfaceSimulation);
        Percent.Serialize(ExtraMissChanceWhenEscaping, writer);
        Percent.Serialize(HullDamageMultWhenPartIsHit, writer);
        writer.WriteInt(InitialVehiclesCap);
        writer.WriteBool(IsInstaBuildEnabled);
        Option<string>.Serialize(LoadedIslandMapName, writer);
        Option<string>.Serialize(LoadedWorldMapName, writer);
        writer.WriteBool(LogCommandsAsCSharp);
        Percent.Serialize(MaxArmorReduction, writer);
        writer.WriteInt(MaxBattleRounds);
        writer.WriteInt(PossibleEscapeDistance);
        Percent.Serialize(RecoverableHpMultiplier, writer);
        Duration.Serialize(SaveTimingLogPeriod, writer);
        writer.WriteBool(SaveTraceOnSimOvertime);
        Duration.Serialize(SaveTraceOnSimOvertimeMinDelay, writer);
        Percent.Serialize(ShipEscapeHpThreshold, writer);
        writer.WriteBool(ShouldUnlockAllProtosOnInit);
        writer.WriteInt(StartingExtraFleetDistance);
        writer.WriteInt(StartingPopulation);
    }

    public static CoreModConfig Deserialize(BlobReader reader)
    {
        if (reader.TryStartClassDeserialization(out CoreModConfig obj, (Func<BlobReader, Type, CoreModConfig>)null))
        {
            reader.EnqueueDataDeserialization(obj, s_deserializeDataDelayedAction);
        }

        return obj;
    }

    private void DeserializeData(BlobReader reader)
    {
        AlwaysSunny = reader.ReadBool();
        BaseRoundsToEscape = reader.ReadInt();
        ChanceForDisabledEnemyFire = Percent.Deserialize(reader);
        ChanceForSameEntityRepeatedFire = Percent.Deserialize(reader);
        DefenderExtraBattlePriority = reader.ReadInt();
        DeterminismDisableCommandsForwarding = reader.ReadBool();
        DeterminismValidationEnabled = reader.ReadBool();
        DeterminismValidationFrequencySteps = Duration.Deserialize(reader);
        DisableBoundaryCellAutoUnlock = reader.ReadBool();
        DisableLockedCellsTerrainGeneration = reader.ReadBool();
        DisableMultiThreadTerrainGeneration = reader.ReadBool();
        DisablePathFinding = reader.ReadBool();
        DisableResourcesGeneration = reader.ReadBool();
        DisableSimulationBackgroundThread = reader.ReadBool();
        DisableTerrainPhysics = reader.ReadBool();
        DisableTerrainSurfaceSimulation = reader.ReadBool();
        ExtraMissChanceWhenEscaping = Percent.Deserialize(reader);
        HullDamageMultWhenPartIsHit = Percent.Deserialize(reader);
        InitialVehiclesCap = reader.ReadInt();
        IsInstaBuildEnabled = reader.ReadBool();
        LoadedIslandMapName = Option<string>.Deserialize(reader);
        LoadedWorldMapName = Option<string>.Deserialize(reader);
        LogCommandsAsCSharp = reader.ReadBool();
        MaxArmorReduction = Percent.Deserialize(reader);
        MaxBattleRounds = reader.ReadInt();
        PossibleEscapeDistance = reader.ReadInt();
        RecoverableHpMultiplier = Percent.Deserialize(reader);
        SaveTimingLogPeriod = Duration.Deserialize(reader);
        SaveTraceOnSimOvertime = reader.ReadBool();
        SaveTraceOnSimOvertimeMinDelay = Duration.Deserialize(reader);
        ShipEscapeHpThreshold = Percent.Deserialize(reader);
        ShouldUnlockAllProtosOnInit = reader.ReadBool();
        StartingExtraFleetDistance = reader.ReadInt();
        StartingPopulation = reader.ReadInt();
        reader.RegisterInitAfterLoad(this, "initAfterLoad", InitPriority.High);
    }

    public CoreModConfig()
    {
        MBiHIp97M4MqqbtZOh.PekMfKdUx();
        DeterminismValidationFrequencySteps = 10.Seconds();
        DefenderExtraBattlePriority = 10;
        MaxBattleRounds = 1000;
        StartingExtraFleetDistance = 4;
        PossibleEscapeDistance = 15;
        ShipEscapeHpThreshold = 25.Percent();
        BaseRoundsToEscape = 25;
        ChanceForSameEntityRepeatedFire = 60.Percent();
        ChanceForDisabledEnemyFire = 40.Percent();
        ExtraMissChanceWhenEscaping = 40.Percent();
        MaxArmorReduction = 80.Percent();
        RecoverableHpMultiplier = 40.Percent();
        HullDamageMultWhenPartIsHit = 50.Percent();
        StartingPopulation = 90;
        SaveTraceOnSimOvertimeMinDelay = Duration.FromSec(30);
        InitialVehiclesCap = 60;
        base._002Ector();
    }

    static CoreModConfig()
    {
        MBiHIp97M4MqqbtZOh.PekMfKdUx();
        s_serializeDataDelayedAction = delegate (object obj, BlobWriter writer)
        {
            ((CoreModConfig)obj).SerializeData(writer);
        };
        s_deserializeDataDelayedAction = delegate (object obj, BlobReader reader)
        {
            ((CoreModConfig)obj).DeserializeData(reader);
        };
    }
}