using UnityEngine; public class MachineInteraction { private PlayerController playerController; private InteractionController interactionController; //! This class handles the player's interactions with machines. public MachineInteraction(PlayerController playerController, InteractionController interactionController) { this.playerController = playerController; this.interactionController = interactionController; } //! Called when the player is looking at an electric light. public void InteractWithElectricLight() { if(cInput.GetKeyDown("Collect Object")) { interactionController.CollectObject("Electric Light"); } } //! Called when the player is looking at a quantum hatchway. public void InteractWithAirLock() { AirLock airLock = playerController.objectInSight.GetComponent(); if (cInput.GetKeyDown("Collect Object")) { interactionController.CollectObject("Quantum Hatchway"); } if (cInput.GetKeyDown("Interact")) { AirLock[] airLocks = Object.FindObjectsOfType(); foreach (AirLock a in airLocks) { if (Vector3.Distance(playerController.transform.position, a.transform.position) < 40) { a.ToggleOpen(); } } if (airLock.open == true) { airLock.openObject.GetComponent().Play(); } else { airLock.closedObject.GetComponent().Play(); } } } //! Called when the player is looking at a power source. public void InteractWithPowerSource() { PowerSource powerSource = playerController.objectInSight.GetComponent(); playerController.machineInSight = playerController.objectInSight; playerController.machineID = powerSource.ID; playerController.machineOutputID = powerSource.outputID; if (powerSource.type.Equals("Solar Panel")) { if (powerSource.blocked == false) { playerController.machinePower = 2; } else { playerController.machinePower = 0; } } else if (powerSource.type.Equals("Generator")) { playerController.machineAmount = powerSource.fuelAmount; playerController.machineType = powerSource.fuelType; if (powerSource.outOfFuel == false) { playerController.machinePower = 20; } else { playerController.machinePower = 0; } } else if (powerSource.type.Equals("Reactor Turbine")) { if (powerSource.noReactor == false) { playerController.machinePower = 200; } else { playerController.machinePower = 0; } } if (cInput.GetKeyDown("Collect Object")) { interactionController.CollectObject(powerSource.type); } if (cInput.GetKeyDown("Interact")) { interactionController.ToggleMachineGUI(); } } //! Called when the player is looking at a nuclear reactor. public void InteractWithNuclearReactor() { NuclearReactor reactor = playerController.objectInSight.GetComponent(); playerController.machineInSight = playerController.objectInSight; playerController.machineID = reactor.ID; playerController.machineCooling = reactor.cooling; if (cInput.GetKeyDown("Collect Object")) { interactionController.CollectObject("Nuclear Reactor"); } } //! Called when the player is looking at a power conduit. public void InteractWithPowerConduit() { PowerConduit powerConduit = playerController.objectInSight.GetComponent(); playerController.machineInSight = playerController.objectInSight; playerController.machineID = powerConduit.ID; playerController.machineOutputID = powerConduit.outputID1; playerController.machineOutputID2 = powerConduit.outputID2; playerController.machinePower = powerConduit.powerAmount; playerController.machineRange = powerConduit.range; if (playerController.machineRange < 10) { playerController.machineRange = 10; } if (cInput.GetKeyDown("Collect Object")) { interactionController.CollectObject("Power Conduit"); } if (cInput.GetKeyDown("Interact")) { interactionController.ToggleMachineGUI(); } } //! Called when the player is looking at a turret. public void InteractWithTurret() { Turret turret = playerController.objectInSight.GetComponent(); playerController.machineInSight = playerController.objectInSight; playerController.machineID = turret.ID; playerController.machineHasPower = turret.powerON; playerController.machineSpeed = turret.speed; playerController.machinePower = turret.power; playerController.machineHeat = turret.heat; playerController.machineCooling = turret.cooling; if (cInput.GetKeyDown("Collect Object")) { interactionController.CollectObject("Turret"); } if (cInput.GetKeyDown("Interact")) { interactionController.ToggleMachineGUI(); } } //! Called when the player is looking at a universal extractor. public void InteractWithUniversalExtractor() { UniversalExtractor extractor = playerController.objectInSight.GetComponent(); playerController.machineInSight = playerController.objectInSight; playerController.machineID = extractor.ID; playerController.collectorAmount = extractor.amount; playerController.machineHasPower = extractor.powerON; playerController.machinePower = extractor.power; playerController.machineSpeed = extractor.speed; playerController.machineHeat = extractor.heat; playerController.machineCooling = extractor.cooling; playerController.machineType = extractor.type; if (cInput.GetKeyDown("Collect Object")) { interactionController.CollectObject("Universal Extractor"); } if (cInput.GetKeyDown("Interact")) { interactionController.ToggleMachineGUI(); } } //! Called when the player is looking at an auger. public void InteractWithAuger() { Auger auger = playerController.objectInSight.GetComponent(); playerController.machineInSight = playerController.objectInSight; playerController.machineID = auger.ID; playerController.collectorAmount = auger.amount; playerController.machineHasPower = auger.powerON; playerController.machinePower = auger.power; playerController.machineSpeed = auger.speed; playerController.machineHeat = auger.heat; playerController.machineCooling = auger.cooling; if (cInput.GetKeyDown("Collect Object")) { interactionController.CollectObject("Auger"); } if (cInput.GetKeyDown("Interact")) { interactionController.ToggleMachineGUI(); } } //! Called when the player is looking at a dark matter collector. public void InteractWithDarkMatterCollector() { DarkMatterCollector collector = playerController.objectInSight.GetComponent(); playerController.machineInSight = playerController.objectInSight; playerController.machineID = collector.ID; playerController.collectorAmount = collector.darkMatterAmount; playerController.machineHasPower = collector.powerON; playerController.machinePower = collector.power; playerController.machineSpeed = collector.speed; playerController.machineHeat = collector.heat; playerController.machineCooling = collector.cooling; if (cInput.GetKeyDown("Collect Object")) { interactionController.CollectObject("Dark Matter Collector"); } if (cInput.GetKeyDown("Interact")) { if (playerController.machineGUIopen == false) { playerController.machineGUIopen = true; } else { playerController.machineGUIopen = false; } } } //! Called when the player is looking at a universal conduit. public void InteractWithUniversalConduit() { UniversalConduit conduit = playerController.objectInSight.GetComponent(); playerController.machineInSight = playerController.objectInSight; playerController.machineAmount = conduit.amount; playerController.machineID = conduit.ID; playerController.machineType = conduit.type; playerController.machineSpeed = conduit.speed; playerController.machineRange = conduit.range; if (playerController.machineRange < 10) { playerController.machineRange = 10; } if (conduit.inputObject != null) { GameObject conduitInput = conduit.inputObject; if (conduitInput.GetComponent() != null) { playerController.machineInputID = conduitInput.GetComponent().ID; playerController.machineInputAmount = conduitInput.GetComponent().amount; playerController.machineInputType = conduitInput.GetComponent().type; } if (conduitInput.GetComponent() != null) { playerController.machineInputID = conduitInput.GetComponent().ID; playerController.machineInputAmount = conduitInput.GetComponent().amount; playerController.machineInputType = conduitInput.GetComponent().type; } if (conduitInput.GetComponent() != null) { playerController.machineInputID = conduitInput.GetComponent().ID; playerController.machineInputAmount = conduitInput.GetComponent().amount; playerController.machineInputType = "Regolith"; } if (conduitInput.GetComponent() != null) { playerController.machineInputID = conduitInput.GetComponent().ID; playerController.machineInputAmount = conduitInput.GetComponent().amount; playerController.machineInputType = conduitInput.GetComponent().outputType; } if (conduitInput.GetComponent() != null) { playerController.machineInputID = conduitInput.GetComponent().ID; playerController.machineInputAmount = conduitInput.GetComponent().amount; playerController.machineInputType = conduitInput.GetComponent().outputType; } if (conduitInput.GetComponent() != null) { playerController.machineInputID = conduitInput.GetComponent().ID; playerController.machineInputAmount = conduitInput.GetComponent().amount; playerController.machineInputType = conduitInput.GetComponent().outputType; } if (conduitInput.GetComponent() != null) { playerController.machineInputID = conduitInput.GetComponent().ID; playerController.machineInputAmount = conduitInput.GetComponent().amount; playerController.machineInputType = conduitInput.GetComponent().outputType; } if (conduitInput.GetComponent() != null) { playerController.machineInputID = conduitInput.GetComponent().ID; playerController.machineInputType = conduitInput.GetComponent().currentType; } if (conduitInput.GetComponent() != null) { playerController.machineInputID = conduitInput.GetComponent().ID; playerController.machineInputAmount = conduitInput.GetComponent().amount; playerController.machineInputType = conduitInput.GetComponent().inputType; } if (conduitInput.GetComponent() != null) { playerController.machineInputID = conduitInput.GetComponent().ID; playerController.machineInputAmount = conduitInput.GetComponent().amount; playerController.machineInputType = conduitInput.GetComponent().outputType; } if (conduitInput.GetComponent() != null) { playerController.machineInputID = conduitInput.GetComponent().ID; playerController.machineInputAmount = conduitInput.GetComponent().amount; playerController.machineInputType = conduitInput.GetComponent().outputType; } } if (conduit.outputObject != null) { GameObject conduitOutput = conduit.outputObject; if (conduitOutput.GetComponent() != null) { playerController.machineOutputID = conduitOutput.GetComponent().ID; playerController.machineOutputAmount = conduitOutput.GetComponent().fuelAmount; playerController.machineOutputType = conduitOutput.GetComponent().fuelType; } if (conduitOutput.GetComponent() != null) { playerController.machineOutputID = conduitOutput.GetComponent().ID; playerController.machineOutputAmount = conduitOutput.GetComponent().amount; playerController.machineOutputType = conduitOutput.GetComponent().type; } if (conduitOutput.GetComponent() != null) { playerController.machineOutputID = conduitOutput.GetComponent().ID; playerController.machineOutputAmount = conduitOutput.GetComponent().amount; playerController.machineOutputType = conduitOutput.GetComponent().inputType; } if (conduitOutput.GetComponent() != null) { playerController.machineOutputID = conduitOutput.GetComponent().ID; playerController.machineOutputAmount = conduitOutput.GetComponent().amount; playerController.machineOutputType = conduitOutput.GetComponent().inputType; } if (conduitOutput.GetComponent() != null) { playerController.machineOutputID = conduitOutput.GetComponent().ID; playerController.machineOutputAmount = conduitOutput.GetComponent().amount; playerController.machineOutputType = conduitOutput.GetComponent().inputType; } if (conduitOutput.GetComponent() != null) { playerController.machineOutputID = conduitOutput.GetComponent().ID; playerController.machineOutputAmount = conduitOutput.GetComponent().amount; playerController.machineOutputType = conduitOutput.GetComponent().inputType; } if (conduitOutput.GetComponent() != null) { playerController.machineOutputID = conduitOutput.GetComponent().ID; playerController.machineOutputAmount = conduitOutput.GetComponent().amount; playerController.machineOutputType = conduitOutput.GetComponent().inputType; } if (conduitOutput.GetComponent() != null) { playerController.machineOutputID = conduitOutput.GetComponent().ID; playerController.machineOutputAmount = conduitOutput.GetComponent().amount; playerController.machineOutputType = conduitOutput.GetComponent().inputType; } if (conduitOutput.GetComponent() != null) { playerController.machineOutputID = conduitOutput.GetComponent().ID; playerController.machineOutputAmount = conduitOutput.GetComponent().amount; if (conduit.type.Equals(conduitOutput.GetComponent().inputType1)) { playerController.machineOutputType = conduitOutput.GetComponent().inputType1; } else if (conduit.type.Equals(conduitOutput.GetComponent().inputType2)) { playerController.machineOutputType = conduitOutput.GetComponent().inputType2; } } if (conduitOutput.GetComponent() != null) { playerController.machineOutputID = conduitOutput.GetComponent().ID; int storageTotal = 0; foreach (InventorySlot slot in conduitOutput.GetComponent().inventory) { if (slot.typeInSlot.Equals(conduit.type)) { storageTotal += slot.amountInSlot; playerController.machineOutputType = slot.typeInSlot; } } playerController.machineOutputAmount = storageTotal; } if (conduitOutput.GetComponent() != null) { playerController.machineOutputID = conduitOutput.GetComponent().ID; int storageTotal = 0; foreach (InventoryManager manager in conduitOutput.GetComponent().computerContainers) { foreach (InventorySlot slot in manager.inventory) { if (slot.typeInSlot.Equals(conduit.type)) { storageTotal += slot.amountInSlot; playerController.machineOutputType = slot.typeInSlot; } } } playerController.machineOutputAmount = storageTotal; } } if (cInput.GetKeyDown("Collect Object")) { interactionController.CollectObject("Universal Conduit"); } if (cInput.GetKeyDown("Interact")) { interactionController.ToggleMachineGUI(); } } //! Called when the player is looking at a dark matter conduit. public void InteractWithDarkMatterConduit() { DarkMatterConduit dmConduit = playerController.objectInSight.GetComponent(); playerController.machineInSight = playerController.objectInSight; playerController.machineAmount = dmConduit.darkMatterAmount; playerController.machineID = dmConduit.ID; playerController.machineSpeed = dmConduit.speed; playerController.machineRange = dmConduit.range; if (playerController.machineRange < 10) { playerController.machineRange = 10; } if (dmConduit.inputObject != null) { if (dmConduit.inputObject.GetComponent() != null) { playerController.machineInputID = dmConduit.inputObject.GetComponent().ID; playerController.machineInputAmount = dmConduit.inputObject.GetComponent().darkMatterAmount; playerController.machineInputType = "Dark Matter"; } if (dmConduit.inputObject.GetComponent() != null) { playerController.machineInputID = dmConduit.inputObject.GetComponent().ID; playerController.machineInputAmount = dmConduit.inputObject.GetComponent().darkMatterAmount; playerController.machineInputType = "Dark Matter"; } } if (dmConduit.outputObject != null) { if (dmConduit.outputObject.GetComponent() != null) { playerController.machineOutputID = dmConduit.outputObject.GetComponent().ID; playerController.machineOutputAmount = dmConduit.outputObject.GetComponent().darkMatterAmount; playerController.machineOutputType = "Dark Matter"; } if (dmConduit.outputObject.GetComponent() != null) { playerController.machineOutputID = dmConduit.outputObject.GetComponent().ID; int storageTotal = 0; foreach (InventoryManager manager in dmConduit.outputObject.GetComponent().computerContainers) { foreach (InventorySlot slot in manager.inventory) { if (slot.typeInSlot.Equals("Dark Matter")) { storageTotal += slot.amountInSlot; playerController.machineOutputType = "Dark Matter"; } } } playerController.machineOutputAmount = storageTotal; } if (dmConduit.outputObject.GetComponent() != null) { playerController.machineOutputID = dmConduit.outputObject.GetComponent().ID; int storageTotal = 0; foreach (InventorySlot slot in dmConduit.outputObject.GetComponent().inventory) { if (slot.typeInSlot.Equals("Dark Matter")) { storageTotal += slot.amountInSlot; playerController.machineOutputType = "Dark Matter"; } } playerController.machineOutputAmount = storageTotal; } } if (cInput.GetKeyDown("Collect Object")) { interactionController.CollectObject("Dark Matter Conduit"); } if (cInput.GetKeyDown("Interact")) { interactionController.ToggleMachineGUI(); } } //! Called when the player is looking at a smelter. public void InteractWithSmelter() { Smelter smelter = playerController.objectInSight.GetComponent(); playerController.machineInSight = playerController.objectInSight; playerController.machineAmount = smelter.amount; playerController.machineID = smelter.ID; playerController.machineHasPower = smelter.powerON; playerController.machineType = smelter.inputType; playerController.machinePower = smelter.power; playerController.machineSpeed = smelter.speed; playerController.machineHeat = smelter.heat; playerController.machineCooling = smelter.cooling; if (smelter.inputObject != null) { if (smelter.inputObject.GetComponent() != null) { playerController.machineInputID = smelter.inputObject.GetComponent().ID; playerController.machineInputAmount = smelter.inputObject.GetComponent().amount; playerController.machineInputType = smelter.inputObject.GetComponent().type; } } if (smelter.outputObject != null) { if (smelter.outputObject.GetComponent() != null) { playerController.machineOutputID = smelter.outputObject.GetComponent().ID; playerController.machineOutputAmount = smelter.outputObject.GetComponent().amount; playerController.machineOutputType = smelter.outputObject.GetComponent().type; } } if (cInput.GetKeyDown("Collect Object")) { interactionController.CollectObject("Smelter"); } if (cInput.GetKeyDown("Interact")) { if (playerController.machineGUIopen == false) { playerController.machineGUIopen = true; } else { playerController.machineGUIopen = false; } } } //! Called when the player is looking at an alloy smelter. public void InteractWithAlloySmelter() { AlloySmelter alloySmelter = playerController.objectInSight.GetComponent(); playerController.machineInSight = playerController.objectInSight; playerController.machineAmount = alloySmelter.amount; playerController.machineAmount2 = alloySmelter.amount2; playerController.machineID = alloySmelter.ID; playerController.machineHasPower = alloySmelter.powerON; playerController.machineType = alloySmelter.inputType1; playerController.machineType2 = alloySmelter.inputType2; playerController.machinePower = alloySmelter.power; playerController.machineSpeed = alloySmelter.speed; playerController.machineHeat = alloySmelter.heat; playerController.machineCooling = alloySmelter.cooling; if (alloySmelter.inputObject1 != null) { if (alloySmelter.inputObject1.GetComponent() != null) { playerController.machineInputID = alloySmelter.inputObject1.GetComponent().ID; playerController.machineInputAmount = alloySmelter.inputObject1.GetComponent().amount; playerController.machineInputType = alloySmelter.inputObject1.GetComponent().type; } } if (alloySmelter.inputObject2 != null) { if (alloySmelter.inputObject2.GetComponent() != null) { playerController.machineInputID2 = alloySmelter.inputObject2.GetComponent().ID; playerController.machineInputAmount2 = alloySmelter.inputObject2.GetComponent().amount; playerController.machineInputType2 = alloySmelter.inputObject2.GetComponent().type; } } if (alloySmelter.outputObject != null) { if (alloySmelter.outputObject.GetComponent() != null) { playerController.machineOutputID = alloySmelter.outputObject.GetComponent().ID; playerController.machineOutputAmount = alloySmelter.outputObject.GetComponent().amount; playerController.machineOutputType = alloySmelter.outputObject.GetComponent().type; } } if (cInput.GetKeyDown("Collect Object")) { interactionController.CollectObject("Alloy Smelter"); } if (cInput.GetKeyDown("Interact")) { if (playerController.machineGUIopen == false) { playerController.machineGUIopen = true; } else { playerController.machineGUIopen = false; } } } //! Called when the player is looking at an extruder. public void InteractWithExtruder() { Extruder extruder = playerController.objectInSight.GetComponent(); playerController.machineInSight = playerController.objectInSight; playerController.machineAmount = extruder.amount; playerController.machineID = extruder.ID; playerController.machineHasPower = extruder.powerON; playerController.machineType = extruder.inputType; playerController.machinePower = extruder.power; playerController.machineSpeed = extruder.speed; playerController.machineHeat = extruder.heat; playerController.machineCooling = extruder.cooling; if (extruder.inputObject != null) { if (extruder.inputObject.GetComponent() != null) { playerController.machineInputID = extruder.inputObject.GetComponent().ID; playerController.machineInputAmount = extruder.inputObject.GetComponent().amount; playerController.machineInputType = extruder.inputObject.GetComponent().type; } } if (extruder.outputObject != null) { if (extruder.outputObject.GetComponent() != null) { playerController.machineOutputID = extruder.outputObject.GetComponent().ID; playerController.machineOutputAmount = extruder.outputObject.GetComponent().amount; playerController.machineOutputType = extruder.outputObject.GetComponent().type; } } if (cInput.GetKeyDown("Collect Object")) { interactionController.CollectObject("Extruder"); } if (cInput.GetKeyDown("Interact")) { if (playerController.machineGUIopen == false) { playerController.machineGUIopen = true; } else { playerController.machineGUIopen = false; } } } //! Called when the player is looking at any machine added through the modding API (excluding plugins). public void InteractWithModMachine() { ModMachine modMachine = playerController.objectInSight.GetComponent(); playerController.machineInSight = playerController.objectInSight; playerController.machineAmount = modMachine.amount; playerController.machineID = modMachine.ID; playerController.machineHasPower = modMachine.powerON; playerController.machineType = modMachine.inputType; playerController.machinePower = modMachine.power; playerController.machineSpeed = modMachine.speed; playerController.machineHeat = modMachine.heat; playerController.machineCooling = modMachine.cooling; if (modMachine.inputObject != null) { if (modMachine.inputObject.GetComponent() != null) { playerController.machineInputID = modMachine.inputObject.GetComponent().ID; playerController.machineInputAmount = modMachine.inputObject.GetComponent().amount; playerController.machineInputType = modMachine.inputObject.GetComponent().type; } } if (modMachine.outputObject != null) { if (modMachine.outputObject.GetComponent() != null) { playerController.machineOutputID = modMachine.outputObject.GetComponent().ID; playerController.machineOutputAmount = modMachine.outputObject.GetComponent().amount; playerController.machineOutputType = modMachine.outputObject.GetComponent().type; } } if (cInput.GetKeyDown("Collect Object")) { interactionController.CollectObject(modMachine.machineName); } if (cInput.GetKeyDown("Interact")) { if (playerController.machineGUIopen == false) { playerController.machineGUIopen = true; } else { playerController.machineGUIopen = false; } } } //! Called when the player is looking at a rail cart hub. public void InteractWithRailCartHub() { RailCartHub railCartHub = playerController.objectInSight.GetComponent(); playerController.machineInSight = playerController.objectInSight; playerController.machineID = railCartHub.ID; playerController.machineRange = railCartHub.range; if (playerController.machineRange < 10) { playerController.machineRange = 10; } if (railCartHub.inputObject != null) { if (railCartHub.inputObject.GetComponent() != null) { playerController.machineInputID = railCartHub.inputObject.GetComponent().ID; } } if (railCartHub.outputObject != null) { if (railCartHub.outputObject.GetComponent() != null) { playerController.machineOutputID = railCartHub.outputObject.GetComponent().ID; } } if (cInput.GetKeyDown("Collect Object")) { interactionController.CollectObject("Rail Cart Hub"); } if (cInput.GetKeyDown("Interact")) { interactionController.ToggleMachineGUI(); } } //! Called when the player is looking at a retriever. public void InteractWithRetriever() { Retriever retriever = playerController.objectInSight.GetComponent(); playerController.machineInSight = playerController.objectInSight; playerController.machineID = retriever.ID; playerController.machineHasPower = retriever.powerON; if (retriever.type.Count > 1) { playerController.machineType = "multiple items"; } else if (retriever.type.Count > 0) { playerController.machineType = retriever.type[0]; } else { playerController.machineType = "nothing"; } playerController.machinePower = retriever.power; playerController.machineSpeed = retriever.speed; playerController.machineHeat = retriever.heat; playerController.machineCooling = retriever.cooling; playerController.storageInventory = playerController.objectInSight.GetComponent(); if (retriever.inputObject != null) { if (retriever.inputObject.GetComponent() != null) { playerController.machineInputID = retriever.inputObject.GetComponent().ID; } if (retriever.inputObject.GetComponent() != null) { playerController.machineInputID = retriever.inputObject.GetComponent().ID; } } if (retriever.outputObject != null) { if (retriever.outputObject.GetComponent() != null) { playerController.machineOutputID = retriever.outputObject.GetComponent().ID; playerController.machineOutputAmount = retriever.outputObject.GetComponent().amount; playerController.machineOutputType = retriever.outputObject.GetComponent().type; } } if (cInput.GetKeyDown("Collect Object")) { interactionController.CollectObject("Retriever"); } if (cInput.GetKeyDown("Interact")) { if (playerController.machineGUIopen == false) { playerController.machineGUIopen = true; playerController.remoteStorageActive = false; } else { playerController.machineGUIopen = false; } } } //! Called when the player is looking at a heat exchanger. public void InteractWithHeatExchanger() { HeatExchanger heatExchanger = playerController.objectInSight.GetComponent(); playerController.machineInSight = playerController.objectInSight; playerController.machineAmount = heatExchanger.amount; playerController.machineID = heatExchanger.ID; playerController.machineType = heatExchanger.inputType; playerController.machineSpeed = heatExchanger.speed; if (heatExchanger.inputObject != null) { if (heatExchanger.inputObject.GetComponent() != null) { playerController.machineInputID = heatExchanger.inputObject.GetComponent().ID; playerController.machineInputAmount = heatExchanger.inputObject.GetComponent().amount; playerController.machineInputType = heatExchanger.inputObject.GetComponent().type; } } if (heatExchanger.outputObject != null) { if (heatExchanger.outputObject.GetComponent() != null) { playerController.machineOutputID = heatExchanger.outputObject.GetComponent().ID; } if (heatExchanger.outputObject.GetComponent() != null) { playerController.machineOutputID = heatExchanger.outputObject.GetComponent().ID; } if (heatExchanger.outputObject.GetComponent() != null) { playerController.machineOutputID = heatExchanger.outputObject.GetComponent().ID; } if (heatExchanger.outputObject.GetComponent() != null) { playerController.machineOutputID = heatExchanger.outputObject.GetComponent().ID; } if (heatExchanger.outputObject.GetComponent() != null) { playerController.machineOutputID = heatExchanger.outputObject.GetComponent().ID; } if (heatExchanger.outputObject.GetComponent() != null) { playerController.machineOutputID = heatExchanger.outputObject.GetComponent().ID; } if (heatExchanger.outputObject.GetComponent() != null) { playerController.machineOutputID = heatExchanger.outputObject.GetComponent().ID; } if (heatExchanger.outputObject.GetComponent() != null) { playerController.machineOutputID = heatExchanger.outputObject.GetComponent().ID; } if (heatExchanger.outputObject.GetComponent() != null) { playerController.machineOutputID = heatExchanger.outputObject.GetComponent().ID; } if (heatExchanger.outputObject.GetComponent() != null) { playerController.machineOutputID = heatExchanger.outputObject.GetComponent().ID; } if (heatExchanger.outputObject.GetComponent() != null) { playerController.machineOutputID = heatExchanger.outputObject.GetComponent().ID; } if (heatExchanger.outputObject.GetComponent() != null) { playerController.machineOutputID = heatExchanger.outputObject.GetComponent().ID; } } if (cInput.GetKeyDown("Collect Object")) { interactionController.CollectObject("Heat Exchanger"); } if (cInput.GetKeyDown("Interact")) { if (playerController.machineGUIopen == false) { playerController.hxAmount = heatExchanger.amount; playerController.machineGUIopen = true; } else { playerController.machineGUIopen = false; } } } //! Called when the player is looking at a gear cutter. public void InteractWithGearCutter() { GearCutter gearCutter = playerController.objectInSight.GetComponent(); playerController.machineInSight = playerController.objectInSight; playerController.machineAmount = gearCutter.amount; playerController.machineID = gearCutter.ID; playerController.machineHasPower = gearCutter.powerON; playerController.machineType = gearCutter.inputType; playerController.machinePower = gearCutter.power; playerController.machineSpeed = gearCutter.speed; playerController.machineHeat = gearCutter.heat; playerController.machineCooling = gearCutter.cooling; if (gearCutter.inputObject != null) { if (gearCutter.inputObject.GetComponent() != null) { playerController.machineInputID = gearCutter.inputObject.GetComponent().ID; playerController.machineInputAmount = gearCutter.inputObject.GetComponent().amount; playerController.machineInputType = gearCutter.inputObject.GetComponent().type; } } if (gearCutter.outputObject != null) { if (gearCutter.outputObject.GetComponent() != null) { playerController.machineOutputID = gearCutter.outputObject.GetComponent().ID; playerController.machineOutputAmount = gearCutter.outputObject.GetComponent().amount; playerController.machineOutputType = gearCutter.outputObject.GetComponent().type; } } if (cInput.GetKeyDown("Collect Object")) { interactionController.CollectObject("Gear Cutter"); } if (cInput.GetKeyDown("Interact")) { if (playerController.machineGUIopen == false) { playerController.machineGUIopen = true; } else { playerController.machineGUIopen = false; } } } //! Called when the player is looking at a press. public void InteractWithPress() { Press press = playerController.objectInSight.GetComponent(); playerController.machineInSight = playerController.objectInSight; playerController.machineAmount = press.amount; playerController.machineID = press.ID; playerController.machineHasPower = press.powerON; playerController.machineType = press.inputType; playerController.machinePower = press.power; playerController.machineSpeed = press.speed; playerController.machineHeat = press.heat; playerController.machineCooling = press.cooling; if (press.inputObject != null) { if (press.inputObject.GetComponent() != null) { playerController.machineInputID = press.inputObject.GetComponent().ID; playerController.machineInputAmount = press.inputObject.GetComponent().amount; playerController.machineInputType = press.inputObject.GetComponent().type; } } if (press.outputObject != null) { if (press.outputObject.GetComponent() != null) { playerController.machineOutputID = press.outputObject.GetComponent().ID; playerController.machineOutputAmount = press.outputObject.GetComponent().amount; playerController.machineOutputType = press.outputObject.GetComponent().type; } } if (cInput.GetKeyDown("Collect Object")) { interactionController.CollectObject("Press"); } if (cInput.GetKeyDown("Interact")) { if (playerController.machineGUIopen == false) { playerController.machineGUIopen = true; } else { playerController.machineGUIopen = false; } } } //! Called when the player is looking at an auto crafter. public void InteractWithAutoCrafter() { AutoCrafter autoCrafter = playerController.objectInSight.GetComponent(); playerController.machineInSight = playerController.objectInSight; playerController.machineID = autoCrafter.ID; playerController.machineHasPower = autoCrafter.powerON; playerController.machineType = autoCrafter.type; playerController.machinePower = autoCrafter.power; playerController.machineSpeed = autoCrafter.speed; playerController.machineHeat = autoCrafter.heat; playerController.machineCooling = autoCrafter.cooling; playerController.storageInventory = playerController.objectInSight.GetComponent(); if (autoCrafter.inputObject != null) { if (autoCrafter.inputObject.GetComponent() != null) { playerController.machineInputID = autoCrafter.inputObject.GetComponent().ID; } if (autoCrafter.inputObject.GetComponent() != null) { playerController.machineInputID = autoCrafter.inputObject.GetComponent().ID; } } if (cInput.GetKeyDown("Collect Object")) { interactionController.CollectObject("Auto Crafter"); } if (cInput.GetKeyDown("Interact")) { if (playerController.machineGUIopen == false) { playerController.machineGUIopen = true; playerController.remoteStorageActive = false; } else { playerController.machineGUIopen = false; } } } }