Exemple #1
0
        public static void ReportActivityStart(MyEntity sourceEntity, string activityName, string activityFocus, string activityType, string activityItemUsage, bool expectActivityEnd = true)
        {
            if (MySandboxGame.IsDedicated || SanityCheckAmountPerMinute(ReportChecksActivityStart, 60))
            {
                return;
            }
            try
            {
                IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
                if (analytics == null)
                {
                    return;
                }

                if (!IsReportedPlayer(sourceEntity))
                {
                    return;
                }

                if (MySession.Static != null && MySession.Static.LocalCharacter != null && MySession.Static.LocalCharacter.PositionComp != null)
                {
                    MyPlanetNamesData planetData = GetPlanetNames(MySession.Static.LocalCharacter.PositionComp.GetPosition());
                    analytics.ReportActivityStart(activityName, activityFocus, activityType, activityItemUsage, expectActivityEnd, planetData.planetName, planetData.planetType, Sandbox.Engine.Physics.MyPhysics.SimulationRatio, Sync.ServerSimulationRatio);
                }
                else
                {
                    analytics.ReportActivityStart(activityName, activityFocus, activityType, activityItemUsage, expectActivityEnd, simSpeedPlayer: Sandbox.Engine.Physics.MyPhysics.SimulationRatio, simSpeedServer: Sync.ServerSimulationRatio);
                }
                ReportChecksActivityStart++;
            }
            catch (Exception exception)
            {
                MyLog.Default.WriteLine(exception);
            }
        }
Exemple #2
0
        public static MyPlanetNamesData GetPlanetNames(Vector3D position)
        {
            MyPlanetNamesData returnData = new MyPlanetNamesData();

            if (Sandbox.Game.GameSystems.MyGravityProviderSystem.CalculateNaturalGravityInPoint(position).LengthSquared() > 0f)
            {
                MyPlanet planet = Sandbox.Game.GameSystems.MyGravityProviderSystem.GetStrongestGravityWell(position);
                returnData.planetName = planet.StorageName;
                returnData.planetType = planet.Generator.FolderName;
            }
            else
            {
                returnData.planetName = "";
                returnData.planetType = "";
            }
            return(returnData);
        }
        public static MyPlanetNamesData GetPlanetNames(Vector3D position)
        {
            MyPlanetNamesData returnData = new MyPlanetNamesData();

            var planet = MyGamePruningStructure.GetClosestPlanet(position);
            if (planet != null)
            {
                returnData.planetName = planet.StorageName;
                returnData.planetType = planet.Generator.FolderName;
            }
            else
            {
                returnData.planetName = "";
                returnData.planetType = "";
            }
            return returnData;
        }
Exemple #4
0
        public static MyPlanetNamesData GetPlanetNames(Vector3D position)
        {
            MyPlanetNamesData returnData = new MyPlanetNamesData();

            var planet = MyGamePruningStructure.GetClosestPlanet(position);

            if (planet != null)
            {
                returnData.planetName = planet.StorageName;
                returnData.planetType = planet.Generator.FolderName;
            }
            else
            {
                returnData.planetName = "";
                returnData.planetType = "";
            }
            return(returnData);
        }
 public static MyPlanetNamesData GetPlanetNames(Vector3D position)
 {
     MyPlanetNamesData returnData = new MyPlanetNamesData();
     if (Sandbox.Game.GameSystems.MyGravityProviderSystem.CalculateNaturalGravityInPoint(position).LengthSquared() > 0f)
     {
         MyPlanet planet = Sandbox.Game.GameSystems.MyGravityProviderSystem.GetStrongestGravityWell(position);
         returnData.planetName = planet.StorageName;
         returnData.planetType = planet.Generator.FolderName;
     }
     else
     {
         returnData.planetName = "";
         returnData.planetType = "";
     }
     return returnData;
 }
Exemple #6
0
        public static void ReportPlayerDeath(bool isLocallyControlled, ulong playerSteamId)
        {
            if (MySandboxGame.IsDedicated)
            {
                return;
            }
            try
            {
                IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
                if (analytics == null)
                {
                    return;
                }

                if (!isLocallyControlled)
                {
                    return;
                }

                var deathCause = m_lastDamageInformation.Type.String;

                Debug.Assert(!string.IsNullOrEmpty(deathCause), "Analytics: Unknown death type. Please report what you were doing to the devs.");

                string deathType;
                bool   pvp           = false;
                bool   selfInflicted = false;
                if (m_lastDamageInformation.Type != MyStringHash.NullOrEmpty && m_lastDamageInformation.AttackerId != 0)
                {
                    MyEntity entity = null;
                    MyEntities.TryGetEntityById(m_lastDamageInformation.AttackerId, out entity);
                    var controllableEntity = entity as IMyControllableEntity;
                    if (controllableEntity != null)
                    {
                        // The attacker is controller by a character.
                        var controller = controllableEntity.ControllerInfo.Controller;
                        if (controller != null)
                        {
                            if (controller.Player.Id.SteamId != playerSteamId)
                            {
                                pvp = true;
                            }
                            else
                            {
                                selfInflicted = true;
                            }
                        }
                    }
                    else if (entity is IMyGunBaseUser || entity is IMyHandheldGunObject <MyToolBase> ||
                             entity is IMyHandheldGunObject <MyGunBase> )
                    {
                        pvp = true;
                    }
                }

                if (pvp)
                {
                    deathType = "pvp";
                }
                else if (selfInflicted)
                {
                    deathType = "self_inflicted";
                }
                else
                {
                    deathType = m_lastDamageInformation.Type == MyDamageType.Environment ? "environment" : "unknown";
                }

                MyPlanetNamesData planetData = GetPlanetNames(MySession.Static.LocalCharacter.PositionComp.GetPosition());
                analytics.ReportPlayerDeath(deathType, deathCause, planetData.planetName, planetData.planetType, MySession.Static.IsScenario);
            }
            catch (Exception exception)
            {
                MyLog.Default.WriteLine(exception);
            }
        }