public void Main() { test_panel.WriteText(""); detected_entities.Clear(); sensor.DetectedEntities(detected_entities); foreach (MyDetectedEntityInfo entity in detected_entities) { if (entity.Type == player_type) { if (entity.Velocity == new Vector3D(0.0)) { test_panel.WriteText($"I see: {entity.Type} at {entity.Name}\n", true); turret.SetTarget(entity.Position); } break; } } }
//GPS:Large Grid:157759.727203728:231485.308988417:5714590.54597619: //GPS:Thorium Lake:-249471.93:-166022.37:11030192.43: public void Aim900(string GPSToAimAt) { var targetVector = new Vector3D(); if (TryParseVector3D(GPSToAimAt, out targetVector)) { _program.Echo($"{targetVector}"); } else { throw new Exception("Invalid GPS data"); } _turret900.SetTarget(targetVector); var cockpitVector = _cockpit.GetPosition(); _program.Echo($"{cockpitVector}"); }
void SetTarget(IMyLargeTurretBase turret, Vector3D target) { turret.SetTarget(target); SetCustomProperty(turret, "target", VectorToString(target)); }