Skip to content

Command to delete grids that fail an IsWorking check for a specified block.#164

Closed
adambockey wants to merge 30 commits intoPatronfrom
master
Closed

Command to delete grids that fail an IsWorking check for a specified block.#164
adambockey wants to merge 30 commits intoPatronfrom
master

Conversation

@adambockey
Copy link
Copy Markdown

  //Possible to add this to the CleanupModule.cs ?  

    [Command("delete offtype", "Deletes grids with specified blocks toggled off.")]
    public void OffType(string type)
    {
        var count = 0;
        foreach (var grid in MyEntities.GetEntities().OfType<MyCubeGrid>().Where(x => x.Projector == null))
        {
            foreach (var block in grid.GetFatBlocks().OfType<IMyFunctionalBlock>())
            {
                var blockType = block.BlockDefinition.TypeId.ToString().Substring(16);
                if (block != null && string.Compare(type, blockType, StringComparison.InvariantCultureIgnoreCase) ==
                    0)
                {
                    if (block.IsWorking == false)
                    {
                        Log.Info($"Deleting grid: {grid.EntityId}: {grid.DisplayName}");
                        EjectPilots(grid);
                        grid.Close();
                        count++;
                    }
                }
            }
        }


        Context.Respond($"grid delete {count} with off blocks of type {type}.");

    }
N1Ran and others added 30 commits September 10, 2019 18:02
* AutoCommand update 1/2

* AutoCommands Update 2/2
* AutoCommand update 1/2

* AutoCommands Update 2/2

* Few forgotten things
Did this on my phone. Judge with highest scrutiny.
Stop fixing shit that ain't broke N1
* Added !tphere command to teleport players to you more easy

* Added command to Kill given player instantly

* Added Eject Command for specific player

* Added Ejectall command for grids. You can also use it by looking at the grid in question

* Typo fixed

* Turns out essentials already had eject and kill. Moved my code over and improved it a little to deal with offline players as well.

* Code-Review reworks
* Added !tphere command to teleport players to you more easy

* Added command to Kill given player instantly

* Added Eject Command for specific player

* Added Ejectall command for grids. You can also use it by looking at the grid in question

* Typo fixed

* Turns out essentials already had eject and kill. Moved my code over and improved it a little to deal with offline players as well.

* Code-Review reworks

* Uses VisualScriptLogicProvider to kick members

Main Advantage over faction.KickMember is that KickMember is only used for actually kicking members.

If the founder is kicked the next player in line wont be promoted. There are isntances where the identityID of the founder was still in the safe file, but the identity itself was deleted. causing internal NREs on faction.Members.Keys as the founder ID will always be in the members list.

But without identity building the DictionaryReader fails internally as it doesnt like NULL
* Added PCU conditions for the Cleanup command.

* Changed count to pcu for consistency.

Co-authored-by: SKO85 <sko85gaming@gmail.com>
add check to only convert largest grid in group to avoid subgrid conversion.
* Added PCU conditions for the Cleanup command.

* Changed count to pcu for consistency.

* Added `hasownership npc | player | nobody` condition for `!cleanup` command
Added Ownership Utility

Co-authored-by: SKO85 <sko85gaming@gmail.com>
* Add a visible notification for the player to indicate when they have been given items

* Add new economy interaction commands for both players and admins

* Add a client popup message to signal if they have send/recieved credits

* Updated incorrect grammar
* Some requested commands

* Fix sandbox clean removing faction reputations.

* fixed merger

Co-authored-by: Olatide F <tide1988@live.com>
…er rather than all players after a certain time period
Add "!identity clear" command to clear an identity of a specific player rather than all players after a certain time period
Only turn off blocks which are enabled
@adambockey adambockey closed this Jul 20, 2020
@adambockey adambockey changed the title Command to delete blocks that fail an IsWorking check. Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

8 participants