public override void ProcessServer() { ScanSettingsEntity scanSettings = ScanDataManager.GetPlayerScanData(SenderSteamId); TrackDetailEntity detail = null; if (!string.IsNullOrEmpty(ShipName)) { int index; if (ShipName.Substring(0, 1) == "#" && int.TryParse(ShipName.Substring(1), out index) && index > 0 && index <= scanSettings.ScanHostList.Count) { detail = scanSettings.ScanHostList[index - 1]; } if (detail == null) { MyAPIGateway.Utilities.SendMessage(SenderSteamId, "Track failed", "Object '{0}' not found.", ShipName); return; } } // send an empty TrackEntity if no shipname is provided. This Action should clear any current tracking. ConnectionHelper.SendMessageToPlayer(SenderSteamId, new PushSetTrack { TrackEntity = detail }); }
public void InitTracking(TrackDetailEntity trackEntity) { _track = trackEntity; if (_track != null) { _currentController = MyAPIGateway.Session.Player.Controller.ControlledEntity; _isTracking = true; InitHudObjective(); MyAPIGateway.Utilities.ShowMessage("Tracking", "object '{0}'.", _track.Title); return; } if (_isTracking) { _isTracking = false; MyAPIGateway.Utilities.ShowNotification("Cancelling tracking", 2000, MyFontEnum.White); ClearHudObjective(); return; } MyAPIGateway.Utilities.ShowMessage("Track failed", "Specify scanned item to track."); }
public static void SetTracking(TrackDetailEntity trackEntity) { Instance.InitTracking(trackEntity); }