private void AddGPS(long gridId, Vector3D target) { if (!_gpsPoints.ContainsKey(gridId)) { _gpsPoints.Add(gridId, MyAPIGateway.Session.GPS.Create(gridId.ToString(), "", target, true)); MyAPIGateway.Session.GPS.AddLocalGps(_gpsPoints[gridId]); MyVisualScriptLogicProvider.SetGPSColor(gridId.ToString(), Color.Orange); _gpsPoints[gridId].Name = ""; } _gpsPoints[gridId].Coords = target; }
internal void SetGpsInfo(Vector3D pos, string name, double dist = 0, Color color = default(Color)) { if (TargetGps != null) { var newPos = dist > 0 ? pos + (Camera.WorldMatrix.Up * dist) : pos; TargetGps.Coords = newPos; TargetGps.Name = name; if (color != default(Color)) { MyVisualScriptLogicProvider.SetGPSColor(TargetGps?.Name, color); } } }
internal void AddGps(Color color = default(Color)) { if (TargetGps != null) { if (!TargetGps.ShowOnHud) { TargetGps.ShowOnHud = true; MyAPIGateway.Session.GPS.AddLocalGps(TargetGps); if (color != default(Color)) { MyVisualScriptLogicProvider.SetGPSColor(TargetGps?.Name, color); } } } }
public bool CreateGpsForPlayers() { this.SpawnGroup = SpawnGroupManager.GetSpawnGroupByName(this.SpawnGroupName); if (this.SpawnGroup == null) { return(false); } var playerList = new List <IMyPlayer>(); MyAPIGateway.Players.GetPlayers(playerList); var bossGps = MyAPIGateway.Session.GPS.Create(this.SpawnGroup.BossCustomGPSLabel, "", this.Position, true); foreach (var player in playerList) { if (player.IsBot == true) { continue; } if (this.PlayersInEncounter.Contains(player.IdentityId) == false) { continue; } MyAPIGateway.Session.GPS.AddGps(player.IdentityId, bossGps); MyVisualScriptLogicProvider.SetGPSColor(this.SpawnGroup.BossCustomGPSLabel, new Color(255, 0, 255), player.IdentityId); if (PlayerGPSHashes.ContainsKey(player.IdentityId) == true) { PlayerGPSHashes[player.IdentityId] = bossGps.Hash; } else { PlayerGPSHashes.Add(player.IdentityId, bossGps.Hash); } } return(true); }
public static void BossEncounterGpsManager(SyncData receivedData) { var player = MyAPIGateway.Session.LocalHumanPlayer; if (player == null) { return; } if (receivedData.Instruction == "MESBossGPSRemove") { if (MES_SessionCore.BossEncounterGps != null) { try{ MyAPIGateway.Session.GPS.RemoveLocalGps(MES_SessionCore.BossEncounterGps); MES_SessionCore.BossEncounterGps = null; }catch (Exception exc) { } } return; } if (receivedData.Instruction == "MESBossGPSCreate") { var gpsCoords = receivedData.GpsCoords; if (gpsCoords == Vector3D.Zero) { return; } foreach (var gps in MyAPIGateway.Session.GPS.GetGpsList(player.IdentityId)) { if (gps.Coords == gpsCoords) { Logger.AddMsg("Boss Encounter GPS Or Other GPS Already Exist At Coordinates.", true); return; } } Logger.AddMsg("Boss Encounter GPS Created.", true); MES_SessionCore.BossEncounterGps = MyAPIGateway.Session.GPS.Create(receivedData.GpsName /* + player.IdentityId.ToString()*/, "", gpsCoords, true); try{ MyAPIGateway.Session.GPS.AddLocalGps(MES_SessionCore.BossEncounterGps); var syncData = receivedData; syncData.Instruction = "MESBossGPSColorServer"; MyVisualScriptLogicProvider.SetGPSColor(receivedData.GpsName, Color.Magenta, 0); //syncData.GpsName += player.IdentityId.ToString(); var sendData = MyAPIGateway.Utilities.SerializeToBinary <SyncData>(syncData); bool sendStatus = MyAPIGateway.Multiplayer.SendMessageToServer(8877, sendData); }catch (Exception exp) { } } if (receivedData.Instruction == "MESBossGPSColorServer") { MyVisualScriptLogicProvider.SetGPSColor(receivedData.GpsName, Color.Magenta, receivedData.PlayerId); //var syncData = receivedData; //syncData.Instruction = "MESBossGPSClientRename"; //var sendData = MyAPIGateway.Utilities.SerializeToBinary<SyncData>(syncData); //bool sendStatus = MyAPIGateway.Multiplayer.SendMessageTo(8877, sendData, receivedData.SteamUserId); } if (receivedData.Instruction == "MESBossGPSClientRename") { var gpsList = MyAPIGateway.Session.GPS.GetGpsList(receivedData.PlayerId); foreach (var gps in gpsList) { if (gps.Name == receivedData.GpsName) { MyVisualScriptLogicProvider.ShowNotificationToAll("Found Local GPS", 5000); MES_SessionCore.BossEncounterGps = gps; MyAPIGateway.Session.GPS.RemoveLocalGps(gps); MES_SessionCore.BossEncounterGps.Name = receivedData.GpsName.Replace(receivedData.PlayerId.ToString(), ""); MyAPIGateway.Session.GPS.AddLocalGps(MES_SessionCore.BossEncounterGps); } } } }