private void UpdatePlayerPainters() { ActiveMarks.Clear(); foreach (var pair in PlayerDummyTargets) { IMyPlayer player; if (Players.TryGetValue(pair.Key, out player)) { var painted = pair.Value.PaintedTarget; MyEntity target; if (!painted.Dirty && painted.EntityId != 0 && Tick - painted.LastInfoTick < 300 && !MyUtils.IsZero(painted.LocalPosition) && MyEntities.TryGetEntityById(painted.EntityId, out target)) { var grid = target as MyCubeGrid; if (player.IdentityId == PlayerId && grid != null) { var v3 = grid.LocalToGridInteger(painted.LocalPosition); MyCube cube; if (!grid.TryGetCube(v3, out cube)) { var startPos = grid.GridIntegerToWorld(v3); var endPos = startPos + (TargetUi.AimDirection * grid.PositionComp.LocalVolume.Radius); if (grid.RayCastBlocks(startPos, endPos) == null) { if (++painted.MissCount > 2) { painted.ClearMark(Tick); } } } } var rep = MyIDModule.GetRelationPlayerPlayer(PlayerId, player.IdentityId); var self = rep == MyRelationsBetweenPlayers.Self; var friend = rep == MyRelationsBetweenPlayers.Allies; var neut = rep == MyRelationsBetweenPlayers.Neutral; var color = neut ? new Vector4(1, 1, 1, 1) : self ? new Vector4(0.025f, 1f, 0.25f, 2) : friend ? new Vector4(0.025f, 0.025f, 1, 2) : new Vector4(1, 0.025f, 0.025f, 2); ActiveMarks.Add(new MyTuple <IMyPlayer, Vector4, GridAi.FakeTarget>(player, color, painted)); } } } }
private void UpdatePlayerPainters() { ActiveMarks.Clear(); foreach (var pair in PlayerDummyTargets) { IMyPlayer player; if (Players.TryGetValue(pair.Key, out player)) { var painted = pair.Value.PaintedTarget; MyEntity target; if (!painted.Dirty && painted.EntityId != 0 && Tick - painted.LastInfoTick < 300 && !MyUtils.IsZero(painted.LocalPosition) && MyEntities.TryGetEntityById(painted.EntityId, out target)) { var rep = MyIDModule.GetRelationPlayerPlayer(PlayerId, player.IdentityId); var self = rep == MyRelationsBetweenPlayers.Self; var friend = rep == MyRelationsBetweenPlayers.Allies; var neut = rep == MyRelationsBetweenPlayers.Neutral; var color = neut ? new Vector4(1, 1, 1, 1) : self ? new Vector4(0.025f, 1f, 0.25f, 2) : friend ? new Vector4(0.025f, 0.025f, 1, 2) : new Vector4(1, 0.025f, 0.025f, 2); ActiveMarks.Add(new MyTuple <IMyPlayer, Vector4, GridAi.FakeTarget>(player, color, painted)); } } } }