Пример #1
0
 private void ConsumeMass()
 {
     if (amountPerTick > 0f)
     {
         float a = Mathf.Min(amountPerTick, amountToPickup - consumedAmount);
         a = Mathf.Max(a, 1f);
         HandleVector <Game.ComplexCallbackInfo <Sim.MassConsumedCallback> > .Handle handle = Game.Instance.massConsumedCallbackManager.Add(OnSimConsumeCallback, this, "LiquidPumpingStation");
         int gameCell = Grid.OffsetCell(cell, new CellOffset(0, -PumpingStationGuide.GetDepthAvailable(cell, pump)));
         SimMessages.ConsumeMass(gameCell, element, a, 3, handle.index);
     }
 }
Пример #2
0
        private void Pump(float dt)
        {
            float mass = this.pumpKGRate * dt / (float)this.srcCells.Length;

            int[] array = this.srcCells;
            for (int i = 0; i < array.Length; i++)
            {
                int gameCell = array[i];
                HandleVector <Game.ComplexCallbackInfo <Sim.MassConsumedCallback> > .Handle handle = Game.Instance.massConsumedCallbackManager.Add(new Action <Sim.MassConsumedCallback, object>(SteamTurbine.OnSimConsumeCallback), this, "SteamTurbineConsume");
                SimMessages.ConsumeMass(gameCell, this.srcElem, mass, 1, handle.index);
            }
        }
    public bool ConsumeGas(OxygenBreather oxygen_breather, float gas_consumed)
    {
        SimHashes getBreathableElement = oxygen_breather.GetBreathableElement;

        if (getBreathableElement == SimHashes.Vacuum)
        {
            return(false);
        }
        HandleVector <Game.ComplexCallbackInfo <Sim.MassConsumedCallback> > .Handle handle = Game.Instance.massConsumedCallbackManager.Add(OnSimConsumeCallback, this, "GasBreatherFromWorldProvider");
        SimMessages.ConsumeMass(oxygen_breather.mouthCell, getBreathableElement, gas_consumed, 3, handle.index);
        return(true);
    }
 public static void MopCell(int cell, float amount, Action <Sim.MassConsumedCallback, object> cb)
 {
     if (Grid.Element[cell].IsLiquid)
     {
         int callbackIdx = -1;
         if (cb != null)
         {
             callbackIdx = Game.Instance.massConsumedCallbackManager.Add(cb, null, "Moppable").index;
         }
         SimMessages.ConsumeMass(cell, Grid.Element[cell].id, amount, 1, callbackIdx);
     }
 }
 public override void InitializeStates(out BaseState default_state)
 {
     default_state     = exchanging;
     base.serializable = true;
     exchanging.Enter(delegate(StatesInstance smi)
     {
         WiltCondition component = smi.master.gameObject.GetComponent <WiltCondition>();
         if ((UnityEngine.Object)component != (UnityEngine.Object)null && component.IsWilting())
         {
             smi.GoTo(smi.sm.paused);
         }
     }).EventTransition(GameHashes.Wilt, paused, null).ToggleStatusItem(Db.Get().CreatureStatusItems.ExchangingElementConsume, (object)null)
     .ToggleStatusItem(Db.Get().CreatureStatusItems.ExchangingElementOutput, (object)null)
     .Update("EntityElementExchanger", delegate(StatesInstance smi, float dt)
     {
         HandleVector <Game.ComplexCallbackInfo <Sim.MassConsumedCallback> > .Handle handle = Game.Instance.massConsumedCallbackManager.Add(OnSimConsumeCallback, smi.master, "EntityElementExchanger");
         SimMessages.ConsumeMass(Grid.PosToCell(smi.master.gameObject), smi.master.consumedElement, smi.master.consumeRate * dt, 3, handle.index);
     }, UpdateRate.SIM_1000ms, false);
     paused.EventTransition(GameHashes.WiltRecover, exchanging, null);
 }
Пример #6
0
        private static bool Prefix(GasBreatherFromWorldProvider __instance, ref bool __result, ref OxygenBreather oxygen_breather, ref float gas_consumed)
        {
            //Debug.Log(" === AmphibiousMod_GasBreatherFromWorldProvider_ConsumeGas === ");
            Klei.AI.Traits traits = oxygen_breather.gameObject.GetComponent <Klei.AI.Traits>();
            bool           flag   = traits.GetTraitIds().Contains("Amphibious");

            if (!flag)
            {
                return(true);
            }

            SimHashes getBreathableElement = oxygen_breather.GetBreathableElement;

            if (getBreathableElement == SimHashes.Vacuum)
            {
                __result = false;
                return(false);
            }
            //HandleVector<Game.ComplexCallbackInfo<Sim.MassConsumedCallback>>.Handle handle = Game.Instance.massConsumedCallbackManager.Add(OnSimConsumeCallback, __instance, "GasBreatherFromWorldProvider");
            //SimMessages.ConsumeMass(oxygen_breather.mouthCell, getBreathableElement, gas_consumed/5f, 3, handle.index);
            SimMessages.ConsumeMass(oxygen_breather.mouthCell, getBreathableElement, gas_consumed / 5f, 1);
            __result = true;
            return(false);
        }
Пример #7
0
        public void Consume(float dt)
        {
            int index = Game.Instance.massConsumedCallbackManager.Add(OnMassConsumedCallback, this, "GasAndLiquidConsumerMonitor").index;

            SimMessages.ConsumeMass(Grid.PosToCell(this), targetElement.id, base.def.consumptionRate * dt, 3, index);
        }