protected override void OnSpawn()
    {
        base.OnSpawn();
        Prioritizable.AddRef(base.gameObject);
        if (configuration == null || configuration.typeId == HashedString.Invalid)
        {
            configuration = GetComponent <GeyserConfigurator>().MakeConfiguration();
        }
        emitter.emitRange   = 2;
        emitter.maxPressure = configuration.GetMaxPressure();
        ElementEmitter elementEmitter       = emitter;
        float          emitRate             = configuration.GetEmitRate();
        SimHashes      element              = configuration.GetElement();
        float          temperature          = configuration.GetTemperature();
        float          outputElementOffsetx = (float)outputOffset.x;
        float          outputElementOffsety = (float)outputOffset.y;

        elementEmitter.outputElement = new ElementConverter.OutputElement(emitRate, element, temperature, false, false, outputElementOffsetx, outputElementOffsety, 1f, configuration.GetDiseaseIdx(), Mathf.RoundToInt((float)configuration.GetDiseaseCount() * configuration.GetEmitRate()));
        base.smi.StartSM();
        Workable component = GetComponent <Studyable>();

        if ((Object)component != (Object)null)
        {
            component.alwaysShowProgressBar = true;
        }
    }
Example #2
0
        public static void Postfix(GeyserConfigurator __instance, ref GeyserConfigurator.GeyserInstanceConfiguration __result)
        {
            if (CustomizeGeyserState.StateManager.State.RandomizerRerollsCycleRate)
            {
                System.Random RNG;
                if (CustomizeGeyserState.StateManager.State.RandomizerUsesMapSeed)
                {
                    RNG = new System.Random(SaveLoader.Instance.worldDetailSave.globalWorldSeed + (int)__instance.transform.GetPosition().x + (int)__instance.transform.GetPosition().y);
                }
                else
                {
                    RNG = new System.Random();
                }

                __result.rateRoll             = (float)RNG.NextDouble();
                __result.iterationLengthRoll  = (float)RNG.NextDouble();
                __result.iterationPercentRoll = (float)RNG.NextDouble();
                __result.yearLengthRoll       = (float)RNG.NextDouble();
                __result.yearPercentRoll      = (float)RNG.NextDouble();
            }
        }
Example #3
0
        public void OnCracked(Chore chore)
        {
            GeyserConfigurator.GeyserInstanceConfiguration conf = geyser.configuration;

            // boost rate
            float maxOut = conf.geyserType.maxRatePerCycle;
            float curOut = GetStats();

            if (curOut < maxOut * SingletonOptions <ConfigData> .Instance.MaxCracking)
            {
                float rem      = (maxOut * SingletonOptions <ConfigData> .Instance.MaxCracking) - curOut;
                float remP     = rem / maxOut;
                float boostAmt = Random.Range(SingletonOptions <ConfigData> .Instance.MinPerCrack, SingletonOptions <ConfigData> .Instance.MaxPerCrack);
                if (boostAmt > remP - 0.001f)
                {
                    maxCracked = true;
                    SetStats(maxOut * SingletonOptions <ConfigData> .Instance.MaxCracking);
                }
                else
                {
                    SetStats(maxOut * (SingletonOptions <ConfigData> .Instance.MaxCracking - remP + boostAmt));
                }
            }
            curP = GetStats() / maxOut;
            geyser.GetComponent <Storage>().items.RemoveAll(it => true);
            this.chore        = null;
            markedForCracking = false;
            UpdateUI();

            // boost short timings
            // Debug.Log("Boosting short timing.");
            // if (conf.GetIterationPercent() < 1.0f) scaledIter.SetValue(conf, Random.Range(conf.GetIterationPercent(), 1.0f));

            // boost long timings
            // Debug.Log("Boosting long timing.");
            // if (conf.GetYearPercent() < 0.9f) scaledYear.SetValue(conf, Random.Range(conf.GetYearPercent(), 0.9f));

            // TODO: forcibly start an eruption?
        }
Example #4
0
        protected override void OnSpawn()
        {
            base.OnSpawn();

            GeyserConfigurator.GeyserInstanceConfiguration conf = geyser.configuration;
            float maxOut = conf.geyserType.maxRatePerCycle;
            float curOut = GetStats();

            if (curP <= 0)
            {
                curP = curOut / maxOut;
            }
            else
            {
                SetStats(maxOut * curP);
                if (curP >= SingletonOptions <ConfigData> .Instance.MaxCracking)
                {
                    maxCracked = true;
                }
            }
            Invoke("CheckStudyable", 1f);
            Sim1000ms(0);
        }
Example #5
0
 private float GetStats()
 {
     GeyserConfigurator.GeyserInstanceConfiguration conf = geyser.configuration;
     return((float)scaledRate.GetValue(conf));
 }