Пример #1
0
        public void RefreshModifiers(float dt)
        {
            IStateMachineTarget master = GetMaster();

            if (!master.isNull)
            {
                int cell = Grid.PosToCell(base.gameObject);
                if (Grid.IsValidCell(cell))
                {
                    KSelectable component  = GetComponent <KSelectable>();
                    KPrefabID   component2 = GetComponent <KPrefabID>();
                    if (component2.HasAnyTags(PRESERVED_TAGS))
                    {
                        UnrefrigeratedModifier.SetValue(0f);
                        ContaminatedAtmosphere.SetValue(0f);
                    }
                    else
                    {
                        UnrefrigeratedModifier.SetValue(rotTemperatureModifier());
                        ContaminatedAtmosphere.SetValue(rotAtmosphereModifier());
                    }
                    SetStatusItems(atmoshpere: (ContaminatedAtmosphere.Value != 0f) ? ((ContaminatedAtmosphere.Value > 0f) ? RotAtmosphereQuality.Sterilizing : RotAtmosphereQuality.Contaminating) : RotAtmosphereQuality.Normal, selectable: component, refrigerated: UnrefrigeratedModifier.Value == 0f);
                    RotAmountInstance.deltaAttribute.ClearModifiers();
                    if (UnrefrigeratedModifier.Value != 0f && ContaminatedAtmosphere.Value != 0.5f)
                    {
                        RotAmountInstance.deltaAttribute.Add(UnrefrigeratedModifier);
                    }
                    if (ContaminatedAtmosphere.Value != 0f && ContaminatedAtmosphere.Value != 0.5f)
                    {
                        RotAmountInstance.deltaAttribute.Add(ContaminatedAtmosphere);
                    }
                }
            }
        }
 private static void OnStartGame()
 {
     CarouselCentrifugeOptions.Reload();
     moraleModifier.SetValue(CarouselCentrifugeOptions.Instance.MoraleBonus);
     specificEffect.duration = (CarouselCentrifugeOptions.Instance.SpecificEffectDuration - 0.05f) * Constants.SECONDS_PER_CYCLE;
     trackingEffect.duration = CarouselCentrifugeOptions.Instance.TrackingEffectDuration * Constants.SECONDS_PER_CYCLE;
 }
Пример #3
0
            public void CalculateImmuneSystem(MinionIdentity dupe)
            {
                var totalGerms = 0;

                foreach (var germ in germList)
                {
                    if (germ.Id == Db.Get().Diseases.SlimeGerms.Id)
                    {
                        totalGerms += (int)(germ.Amount * 1.0f);
                    }
                    else if (germ.Id == Db.Get().Diseases.PollenGerms.Id)
                    {
                        totalGerms += (int)(germ.Amount * 0.5f);
                    }
                    else
                    {
                        totalGerms += (int)germ.Amount;
                    }
                }

                var amount = ImmuneSystemAmount.Lookup(dupe);

                for (int index = 0; index != amount.deltaAttribute.Modifiers.Count; ++index)
                {
                    AttributeModifier mod = amount.deltaAttribute.Modifiers[index];
                    if (mod.AttributeId == ImmuneSystemGermModifier.AttributeId &&
                        mod.Description == ImmuneSystemGermModifier.Description)
                    {
                        mod.SetValue((float)-(totalGerms / 900D / 500D));
                    }
                }
            }
Пример #4
0
 internal static void LoadOptions()
 {
     MechanicsStationOptions.Reload();
     MachinerySpeedModifier.SetValue(MechanicsStationOptions.Instance.machinery_speed_modifier / 100);
     CraftingSpeedModifier.SetValue(MechanicsStationOptions.Instance.crafting_speed_modifier / 100);
     MachineTinkerEffect.duration           = MechanicsStationOptions.Instance.machine_tinker_effect_duration * Constants.SECONDS_PER_CYCLE;
     MachineTinkerEffectDuration.multiplier = MechanicsStationOptions.Instance.machine_tinker_effect_duration_per_skill / 100;
 }
 public void ChangeClothes(ClothingInfo clothingInfo)
 {
     decorProvider.baseRadius         = 3f;
     currentClothing                  = clothingInfo;
     conductivityModifier.Description = clothingInfo.name;
     conductivityModifier.SetValue(currentClothing.conductivityMod);
     decorModifier.SetValue((float)currentClothing.decorMod);
 }
    private void SetupDependentAttribute(Klei.AI.Attribute targetAttribute, AttributeConverter attributeConverter)
    {
        Klei.AI.Attribute attribute         = attributeConverter.attribute;
        AttributeInstance attributeInstance = attribute.Lookup(this);
        AttributeModifier target_modifier   = new AttributeModifier(targetAttribute.Id, attributeConverter.Lookup(this).Evaluate(), attribute.Name, false, false, false);

        this.GetAttributes().Add(target_modifier);
        AttributeInstance attributeInstance2 = attributeInstance;

        attributeInstance2.OnDirty = (System.Action)Delegate.Combine(attributeInstance2.OnDirty, (System.Action) delegate
        {
            target_modifier.SetValue(attributeConverter.Lookup(this).Evaluate());
        });
    }
    public void Sim200ms(float dt)
    {
        average_kilowatts_exchanged.AddSample(currentExchangeWattage * 0.001f);
        averageTemperatureTransferPerSecond.SetValue(SimUtil.EnergyFlowToTemperatureDelta(average_kilowatts_exchanged.GetWeightedAverage, primaryElement.Element.specificHeatCapacity, primaryElement.Mass));
        float num = 0f;

        foreach (AttributeModifier nonSimTemperatureModifier in NonSimTemperatureModifiers)
        {
            num += nonSimTemperatureModifier.Value;
        }
        if (Sim.IsValidHandle(simHandle))
        {
            SimMessages.ModifyElementChunkEnergy(simHandle, num * dt * (primaryElement.Mass * 1000f) * primaryElement.Element.specificHeatCapacity * 0.001f);
        }
    }
Пример #8
0
 internal static void Postfix(AttributeModifier ___unrefrigeratedModifier,
                              AttributeModifier ___refrigeratedModifier,
                              AttributeModifier ___frozenModifier,
                              AttributeModifier ___contaminatedAtmosphereModifier,
                              AttributeModifier ___normalAtmosphereModifier,
                              AttributeModifier ___sterileAtmosphereModifier)
 {
     // Modifiers were initialized by the constructor
     // Normal: -0.5, Sterile: x0, Contaminated: -1
     // Refrigerated/Frozen: +0.5, Unrefrigerated: +0
     ___unrefrigeratedModifier.SetValue(0.0f);
     ___refrigeratedModifier.SetValue(0.5f);
     ___frozenModifier.SetValue(0.5f);
     ___normalAtmosphereModifier.SetValue(-0.5f);
     ___contaminatedAtmosphereModifier.SetValue(-1.0f);
     // IsReadonly is dead code, thankfully
     ___sterileAtmosphereModifier.SetValue(0.0f);
 }
        internal static void LoadOptions()
        {
            BetterPlantTendingOptions.Reload();
            var options = BetterPlantTendingOptions.Instance;

            ColdBreatherThroughputFarmTinkerModifier.SetValue(options.ColdBreatherThroughputFarmTinkerModifier);
            OxyfernThroughputFarmTinkerModifier.SetValue(options.OxyfernThroughputFarmTinkerModifier);
            ExtraSeedChanceDecorativeBaseValue.SetValue(options.ExtraSeedChanceDecorativeBaseValue);
            ExtraSeedChanceNotDecorativeBaseValue.SetValue(options.ExtraSeedChanceNotDecorativeBaseValue);
            ExtraSeedTendingChance.multiplier = options.ExtraSeedTendingChance;
#if EXPANSION1
            ColdBreatherThroughputDivergentModifier.SetValue(options.ColdBreatherThroughputDivergentModifier);
            ColdBreatherThroughputWormModifier.SetValue(options.ColdBreatherThroughputWormModifier);
            OxyfernThroughputDivergentModifier.SetValue(options.OxyfernThroughputDivergentModifier);
            OxyfernThroughputWormModifier.SetValue(options.OxyfernThroughputWormModifier);
            ExtraSeedChanceDivergentModifier.SetValue(options.ExtraSeedChanceDivergentModifier);
            ExtraSeedChanceWormModifier.SetValue(options.ExtraSeedChanceWormModifier);
#endif
        }
Пример #10
0
            /// <summary>
            /// Applied before Update runs.
            /// </summary>
            internal static bool Prefix(DecorMonitor.Instance __instance, float dt,
                                        AmountInstance ___amount, AttributeModifier ___modifier,
                                        ref float ___cycleTotalDecor)
            {
                bool        cont = true;
                ChoreDriver driver;

                // If no chore driver, allow stock implementation
                if ((driver = __instance.GetComponent <ChoreDriver>()) != null)
                {
                    var chore = driver.GetCurrentChore();
                    cont = false;
                    // Slew to half decor if sleeping
                    float decorAtCell = GameUtil.GetDecorAtCell(Grid.PosToCell(__instance));
                    if (chore != null && chore.choreType == Db.Get().ChoreTypes.Sleep)
                    {
                        decorAtCell *= DecorTuning.DECOR_FRACTION_SLEEP;
                    }
                    ___cycleTotalDecor += decorAtCell * dt;
                    // Constants are the same as the base game
                    float value = 0.0f, curDecor = ___amount.value;
                    if (Mathf.Abs(decorAtCell - curDecor) > 0.5f)
                    {
                        if (decorAtCell > curDecor)
                        {
                            value = 3.0f * SLEW;
                        }
                        else if (decorAtCell < curDecor)
                        {
                            value = -SLEW;
                        }
                    }
                    else
                    {
                        ___amount.value = decorAtCell;
                    }
                    ___modifier.SetValue(value);
                }
                return(cont);
            }
Пример #11
0
            public void Update()
            {
                float chance = Mathf.Clamp01(Mathf.Log10(age) * factor);

                baseHeartAttackChance.SetValue(chance);
            }