Exemplo n.º 1
0
        public bool SeeWeldPadInfo()
        {
            if (!Networking.IsPlayer)
            {
                return(false);
            }

            if (ThisPad.GetPlayerRelationToOwner() == MyRelationsBetweenPlayerAndBlock.Enemies)
            {
                return(false);
            }

            // doesn't quite work for ship with LG carrying a weldpad'd block
            //IMyShipController controlled = MyAPIGateway.Session.ControlledObject as IMyShipController;
            //if(controlled != null)
            //{
            //    if(!controlled.CanControlShip)
            //        return false;

            //    if(!MyAPIGateway.GridGroups.HasConnection(controlled.CubeGrid, ThisPad.CubeGrid, GridLinkTypeEnum.Mechanical))
            //        return false;

            //    if(OtherPad != null && !MyAPIGateway.GridGroups.HasConnection(controlled.CubeGrid, OtherPad.CubeGrid, GridLinkTypeEnum.Mechanical))
            //        return false;
            //}
            //else
            {
                Vector3D camPos = MyAPIGateway.Session.Camera.WorldMatrix.Translation;
                Vector3D padPos = ThisPad.GetPosition();
                if (Vector3D.DistanceSquared(camPos, padPos) > NotifyMaxDistanceSq)
                {
                    return(false);
                }
            }

            return(true);
        }