Exemple #1
0
 private static void Postfix(Valve __instance, ValveBase ___valveBase)
 {
     if (FluidWarpMod_Utils.IsWarpGate(___valveBase))
     {
         WarpSpaceManager.OnWarpGateChannelChange(___valveBase);
     }
 }
Exemple #2
0
 private static void Postfix(Valve __instance, ValveBase ___valveBase)
 {
     if (___valveBase.conduitType == GasWarpConfig.CONDUIT_TYPE || ___valveBase.conduitType == LiquidWarpConfig.CONDUIT_TYPE)
     {
         WarpSpaceManager.OnValveChannelChange(___valveBase);
     }
 }
Exemple #3
0
 private static void Postfix(Valve __instance, ValveBase ___valveBase)
 {
     if (___valveBase.conduitType == GasWarpConfig.CONDUIT_TYPE || ___valveBase.conduitType == LiquidWarpConfig.CONDUIT_TYPE)
     {
         WarpSpaceManager.RemoveProviderValve(___valveBase);
     }
 }
Exemple #4
0
        private static bool Prefix(ValveBase __instance, float dt, int ___inputCell, int ___outputCell)
        {
            if (__instance.conduitType != LiquidWarpConfig.CONDUIT_TYPE && __instance.conduitType != GasWarpConfig.CONDUIT_TYPE)
            {
                return(true);
            }

            int channelNo = Mathf.RoundToInt(__instance.CurrentFlow * 1000.0f); // simple cast to int sometimes gives invalid result

            Logger.LogFormat(" === ValveBase.ConduitUpdate({0}) Prefix conduitType={1}, inputCell={2}, outputCell={3}, channelNo={4}", dt, __instance.conduitType, ___inputCell, ___outputCell, channelNo);

            if (channelNo == 10000)
            {
                // Channel number is set to MaxFlow (10k), which means WarpGate is disabled
                return(false);
            }

            ConduitFlow flowManager = null;

            if (__instance.conduitType == LiquidWarpConfig.CONDUIT_TYPE)
            {
                flowManager = Conduit.GetFlowManager(ConduitType.Liquid);
            }
            else if (__instance.conduitType == GasWarpConfig.CONDUIT_TYPE)
            {
                flowManager = Conduit.GetFlowManager(ConduitType.Gas);
            }

            if (!flowManager.HasConduit(___inputCell) || !flowManager.HasConduit(___outputCell))
            {
                __instance.UpdateAnim();
            }

            if (flowManager.HasConduit(___outputCell) && !flowManager.IsConduitFull(___outputCell))
            {
                WarpSpaceManager.RequestFluidFromChannel(__instance, channelNo);
                __instance.UpdateAnim();
                return(false);
            }

            return(false);
        }
Exemple #5
0
 private static void Postfix(Valve __instance, ValveBase ___valveBase)
 {
     WarpSpaceManager.OnValveChannelChange(___valveBase);
     return;
 }
Exemple #6
0
 private static void Postfix(Valve __instance, ValveBase ___valveBase)
 {
     WarpSpaceManager.RemoveProviderValve(___valveBase);
     return;
 }