public void SaveGrid(string NameOrIdentity = "")
        {
            GridResult Result = new GridResult(true);



            //Gets grids player is looking at
            if (!Result.GetGrids(Chat, AdminUserCharacter, NameOrIdentity))
            {
                return;
            }

            GridStamp stamp = Result.GenerateGridStamp();


            PlayerHangar PlayersHanger = new PlayerHangar(Result.OwnerSteamID, Chat, true);


            GridUtilities.FormatGridName(PlayersHanger, stamp);
            if (PlayersHanger.SaveGridsToFile(Result, stamp.GridName))
            {
                PlayersHanger.SaveGridStamp(stamp, true);
                Chat?.Respond("Save Complete!");
            }
            else
            {
                Chat?.Respond("Saved Failed!");
                return;
            }
        }
        public async void SaveGrid(string NameOrIdentity = "")
        {
            GridResult Result = new GridResult(true);



            //Gets grids player is looking at
            if (!Result.GetGrids(Chat, AdminUserCharacter, NameOrIdentity))
            {
                return;
            }


            if (Result.OwnerSteamID == 0)
            {
                Chat?.Respond("Unable to get major grid owner!");
                return;
            }


            GridStamp    stamp         = Result.GenerateGridStamp();
            PlayerHangar PlayersHanger = new PlayerHangar(Result.OwnerSteamID, Chat, true);

            string Name = Result.OwnerSteamID.ToString();

            if (MySession.Static.Players.TryGetIdentityFromSteamID(Result.OwnerSteamID, out MyIdentity identity))
            {
                Name = identity.DisplayName;
            }

            PlayersHanger.SelectedPlayerFile.FormatGridName(stamp);

            bool val = await PlayersHanger.SaveGridsToFile(Result, stamp.GridName);

            if (val)
            {
                PlayersHanger.SaveGridStamp(stamp, true);
                Chat?.Respond($"{stamp.GridName} was saved to {Name}'s hangar!");
            }
            else
            {
                Chat?.Respond($"{stamp.GridName} failed to send to {Name}'s hangar!");
                return;
            }
        }
        public void GridExporter()
        {
            Chat       chat   = new Chat(Context);
            GridResult Result = new GridResult(true);

            //Gets grids player is looking at
            if (!Result.GetGrids(chat, Context.Player.Character as MyCharacter))
            {
                return;
            }

            chat.Respond(Result.Grids.Count.ToString());
            typeof(MyCubeGrid).GetMethod("ExportToObjFile", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static).Invoke(null, new object[] { Result.Grids, true, false });

            chat.Respond("Done!");

            //GridStamp stamp = Result.GenerateGridStamp();
        }
Beispiel #4
0
        public async void SaveGrid()
        {
            if (!PerformMainChecks(true))
            {
                return;
            }


            if (!PlayersHanger.CheckHanagarLimits())
            {
                return;
            }


            GridResult Result = new GridResult();

            //Gets grids player is looking at
            if (!Result.GetGrids(Chat, UserCharacter))
            {
                return;
            }


            if (IsAnyGridInsideSafeZone(Result))
            {
                return;
            }


            //Calculates incoming grids data
            GridStamp GridData = Result.GenerateGridStamp();


            //PlayersHanger.CheckGridLimits(GridData);

            //Checks for single and all slot block and grid limits
            if (!PlayersHanger.ExtensiveLimitChecker(GridData))
            {
                return;
            }


            if (!CheckEnemyDistance(Config.LoadType, PlayerPosition))
            {
                return;
            }


            if (!RequireSaveCurrency(Result))
            {
                return;
            }


            PlayersHanger.SelectedPlayerFile.FormatGridName(GridData);

            bool val = await PlayersHanger.SaveGridsToFile(Result, GridData.GridName);

            if (val)
            {
                PlayersHanger.SaveGridStamp(GridData);
                Chat?.Respond("Save Complete!");
            }
            else
            {
                Chat?.Respond("Saved Failed!");
                return;
            }
        }