コード例 #1
0
 static void Postfix(FiltrationMachine __instance)
 {
     if (__instance.GetComponent <StorageConnectable>() != null)
     {
         MonoBehaviour.DestroyImmediate(__instance.GetComponent <StorageConnectable>());
     }
 }
コード例 #2
0
 internal static void Postfix(FiltrationMachine __instance)
 {
     if (Main.Instance != null)
     {
         Main.Instance.onFilterFastChanged.Trigger((bool)__instance.GetPrivateField("fastFiltering"));
     }
 }
コード例 #3
0
 static void Prefix(FiltrationMachine __instance)
 {
     if (__instance.gameObject.GetComponent <FiltrationMachineToggle>() == null)
     {
         __instance.gameObject.AddComponent <FiltrationMachineToggle>();
         Logger.Log("Added FiltrationMachineToggle component to FiltrationMachine!");
     }
 }
コード例 #4
0
        private void Init()
        {
            geo = GetComponentInParent <BaseFiltrationMachineGeometry>();

            machine    = (FiltrationMachine)GetModuleMethod.Invoke(geo, new object[] { });
            identifier = machine.GetComponent <PrefabIdentifier>();
            id         = identifier.Id;

            toggle = machine.GetComponent <FiltrationMachineToggle>();

            initialized = true;
        }
コード例 #5
0
        private static void Postfix(FiltrationMachine __instance)
        {
            int        maxSalt          = Main.config.FiltrationSalt;
            int        maxWater         = Main.config.FiltrationWater;
            Vector2int newContainerSize = new Vector2int(Main.config.FiltrationWidth, Main.config.FiltrationHeight);

#if !RELEASE
            Logger.Log(Logger.Level.Debug, $"Reconfiguring Filtration Machine {__instance.gameObject.name} with configuration values of: maxSalt {maxSalt}, maxWater {maxWater}, new size ({newContainerSize.x}, {newContainerSize.y})");
#endif

            __instance.maxSalt  = maxSalt;
            __instance.maxWater = maxWater;
            __instance.storageContainer.Resize(newContainerSize.x, newContainerSize.y);
        }
コード例 #6
0
        public void Initialize()
        {
            filtrationMachine = GetComponent <FiltrationMachine>();
            geo = (BaseFiltrationMachineGeometry)GetModelMethod.Invoke(filtrationMachine, new object[] { });

            identifier = GetComponentInParent <PrefabIdentifier>();
            id         = identifier.Id;

            OnLoad();

            SetFiltrationMachineToggle(isOn);

            initialized = true;
        }
コード例 #7
0
 private static void Postfix(FiltrationMachine __instance)
 {
     __instance.maxSalt  = Mod.config.FiltrationMachine.maxSalt;
     __instance.maxWater = Mod.config.FiltrationMachine.maxWater;
     __instance.storageContainer.Resize(Mod.config.FiltrationMachine.width, Mod.config.FiltrationMachine.height);
 }
コード例 #8
0
 public FiltrationMachinePowerConsumerInfo(FiltrationMachine filter) : base(filter.name)
 {
     this.filter = filter;
 }