Example #1
0
 [HarmonyPriority(-10000)] // Extremely low priority. We want this to happen last, since this will only overwrite RotatablePump results
 public static void Postfix(Pump __instance, ref bool __result, Element.State expected_state)
 {
     if (__instance is RotatablePump)
     {
         Rotatable rotatable = __instance.GetComponent <Rotatable>();
         RotatableElementConsumer consumer = __instance.GetComponent <RotatableElementConsumer>();
         //Debug.Log("IsPumpable call " + consumer.rotatableCellOffset + ", " + consumer.sampleCellOffset);
         // Basically a copy of vanilla Pump IsPumpable, but with different initial
         int num = Grid.PosToCell(__instance.transform.GetPosition() + Rotatable.GetRotatedOffset(consumer.rotatableCellOffset, rotatable.GetOrientation()));
         for (int i = 0; i < consumer.consumptionRadius; i++)
         {
             for (int j = 0; j < consumer.consumptionRadius; j++)
             {
                 int  num2 = num + j + Grid.WidthInCells * i;
                 bool flag = Grid.Element[num2].IsState(expected_state);
                 if (flag)
                 {
                     __result = true;
                     return;
                 }
             }
         }
         __result = false;
         return;
     }
 }
Example #2
0
        public override void DoPostConfigureComplete(GameObject go)
        {
            //go.AddOrGetDef<StorageController.Def>();

            GeneratedBuildings.RegisterSingleLogicInputPort(go);
            go.AddOrGet <LogicOperationalController>();
            go.AddOrGet <EnergyConsumer>();
            go.AddOrGet <RotatablePump>();
            Storage storage = go.AddOrGet <Storage>();

            storage.capacityKg = WallPumpsConfig.GetConfig().gasWallPump.pumpRate * 2;
            RotatableElementConsumer elementConsumer = go.AddOrGet <RotatableElementConsumer>();

            elementConsumer.configuration       = ElementConsumer.Configuration.AllGas;
            elementConsumer.consumptionRate     = WallPumpsConfig.GetConfig().gasWallPump.pumpRate;
            elementConsumer.storeOnConsume      = true;
            elementConsumer.showInStatusPanel   = false;
            elementConsumer.rotatableCellOffset = new Vector3(0, 1);
            elementConsumer.consumptionRadius   = 2;
            ConduitDispenser conduitDispenser = go.AddOrGet <ConduitDispenser>();

            conduitDispenser.conduitType    = ConduitType.Gas;
            conduitDispenser.alwaysDispense = true;
            conduitDispenser.elementFilter  = null;
            go.AddOrGetDef <OperationalController.Def>();
            AddVisualizer(go, false);

            GeneratedBuildings.RemoveLoopingSounds(go);
        }