public void ProcessConfig(InteractionContext context) { if (mode == CONNECTOR_MODE.Input) { context.Player.SendTemporaryMessage($"Set to output"); mode = CONNECTOR_MODE.Output; } else if (mode == CONNECTOR_MODE.Output) { context.Player.SendTemporaryMessage($"Set to input/output"); mode = CONNECTOR_MODE.InOut; } else if (mode == CONNECTOR_MODE.InOut) { context.Player.SendTemporaryMessage($"Set to none"); mode = CONNECTOR_MODE.None; CleanDestroy(); return; } else { context.Player.SendTemporaryMessage($"Set to input"); mode = CONNECTOR_MODE.Input; } callUpdate = true; }
public void InitInputOutput() { info.beltLinker.RemoveConnector(this); if (TransportPipeManager.pipesInfo.ContainsKey(Utils.MakeWorldMod(Position3i))) { info = TransportPipeManager.pipesInfo[Utils.MakeWorldMod(Position3i)]; } if (mode == CONNECTOR_MODE.Input) { WorldObject obj = Utils.SearchForConnectedStorageObject(Utils.MakeWorldMod(Position3i)); if (obj != null) { Input = obj; InvInput = Utils.SearchInventoryFromObject(obj); info.beltLinker.AddConnector(true, this); SetAnimatedState("SetModeInput", true); } if (Input == null || InvInput == null) { mode = CONNECTOR_MODE.None; } } if (mode == CONNECTOR_MODE.Output) { WorldObject obj = Utils.SearchForConnectedStorageObject(Utils.MakeWorldMod(Position3i)); if (obj != null) { Output = obj; InvOutput = Utils.SearchInventoryFromObject(obj); info.beltLinker.AddConnector(false, this); SetAnimatedState("SetModeOutput", true); } if (Output == null || InvOutput == null) { mode = CONNECTOR_MODE.None; } } if (mode == CONNECTOR_MODE.InOut) { WorldObject obj = Utils.SearchForConnectedStorageObject(Utils.MakeWorldMod(Position3i)); if (obj != null) { Input = obj; Output = obj; InvOutput = Utils.SearchInventoryFromObject(obj); InvInput = InvOutput; info.beltLinker.AddConnector(false, this); info.beltLinker.AddConnector(true, this); SetAnimatedState("SetModeIOput", true); } if (Input == null || InvOutput == null) { mode = CONNECTOR_MODE.None; } } // If it's in an unknow state - remove the connector if (mode == CONNECTOR_MODE.None) { CleanDestroy(); return; } if (info != null && info.beltLinker != null) { info.beltLinker.UpdateElectricityType(); } if (info != null) { SetAnimatedState("SetWood", info.type == PIPETYPE.Wooden); previousType = info.type; } }