public void FetchBlocks() { missileDeployPairs.Clear(); attachmentRotors.Clear(); GridTerminalSystem.GetBlocksOfType(attachmentRotors, x => x.CustomName.Contains(attachmentPointTag) && x.TopGrid != null); foreach (var attachmentPoint in attachmentRotors) { var rotorTopGrid = attachmentPoint.TopGrid; programmableBlocks.Clear(); GridTerminalSystem.GetBlocksOfType(programmableBlocks, x => x.CubeGrid == rotorTopGrid && x.CustomName.Contains(guidanceComputerTag)); if (programmableBlocks.Count > 0) { DeployPair deployPair = new DeployPair(); deployPair.guidanceComputer = programmableBlocks[0]; GridTerminalSystem.GetBlocksOfType(attachmentMergeBlocks, x => x.CustomName.Contains(attachmentPointTag) && x.CubeGrid == attachmentPoint.TopGrid); if (attachmentMergeBlocks.Count > 0) { deployPair.attachmentPoint.attachmentMergeBlock = attachmentMergeBlocks[0]; } else { deployPair.attachmentPoint.attachmentRotor = attachmentPoint; } missileDeployPairs.Add(deployPair); } } }
public void DeployMissile(Vector3D targetPosition) { int deployPairCount = missileDeployPairs.Count; if (deployPairCount > 0) { DeployPair pair = missileDeployPairs[deployPairCount - 1]; if (pair.guidanceComputer.TryRun($"TargetLoc|{targetPosition}")) { pair.attachmentPoint.Detach(); missileDeployPairs.RemoveAt(deployPairCount - 1); } } }
public void DeployMissile() { int deployPairCount = missileDeployPairs.Count; if (deployPairCount > 0) { DeployPair pair = missileDeployPairs[deployPairCount - 1]; if (pair.guidanceComputer.TryRun("TurretControll")) { pair.attachmentPoint.Detach(); missileDeployPairs.RemoveAt(deployPairCount - 1); } } }