Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
86be6f6
Add cleanup filters "nopower" and "haspower". Add option to stop all …
rexxar-tc Jun 4, 2018
8773f93
Ask Jenkins to please build this against the Torch/client-mod branch.…
rexxar-tc Jun 11, 2018
2121aa6
Add !utility listgrids command to show the user all grids they own. C…
rexxar-tc Jun 11, 2018
e177313
Put MOTD in a dialog because that's nicer than chat.
rexxar-tc Jun 11, 2018
aa8322f
Add 'insideplanet' argument to grid cleanup. Finds grids that are mor…
rexxar-tc Jun 11, 2018
b3ed0f9
Add logging to cleanup
rexxar-tc Jun 11, 2018
250a28d
Remove !utlity listrids because !grids list is apparently a thing.
rexxar-tc Jun 11, 2018
661c8e7
Fix #25 !grids static large command not syncing
rexxar-tc Jun 11, 2018
fdb825a
Implement #38 : cleanup voxels with no grids nearby.
rexxar-tc Jun 11, 2018
10d2567
Add separate MOTD for new users.
rexxar-tc Jun 11, 2018
dfbc5dd
Make AutoCommands suck less.
rexxar-tc Jun 14, 2018
73053d2
Add !cleanup help command.
rexxar-tc Jun 16, 2018
2d9b0fe
Un-break cleanup.
rexxar-tc Jun 18, 2018
dd5b48c
Remove global static logger to make Equinox happy
rexxar-tc Jun 18, 2018
f7a9a21
Complete refactor of auto commands! I even tested it this time!
rexxar-tc Jul 3, 2018
5af3086
Fix a typo in autocommand helptext
rexxar-tc Jul 4, 2018
300dfea
!cleanup list now prints to a dialog window.
rexxar-tc Jul 4, 2018
8c05800
Implement info commands
rexxar-tc Jul 6, 2018
770f7d0
Fix crashes in autocommands
rexxar-tc Jul 6, 2018
6928828
client-mod branch deleted, build against master again
rexxar-tc Jul 7, 2018
58122b0
Add !voxels reset planets
rexxar-tc Jul 8, 2018
dcee1aa
Change cleanup conditions to public. Might change behavior??
rexxar-tc Jul 8, 2018
cf47d52
Fix borked cleanup
rexxar-tc Jul 9, 2018
d726efd
Add %player% wildcard to MOTD. Replaces with receiving player's name.
rexxar-tc Jul 9, 2018
085796f
Fix haspower check crashing with a key not present error
rexxar-tc Jul 9, 2018
de1542c
Add DayOfWeek option to auto commands.
rexxar-tc Jul 9, 2018
9921a0e
Don't be stupid and use ViewModels
rexxar-tc Jul 10, 2018
111442e
Default cleanup to not search for grids with pilots.
rexxar-tc Jul 18, 2018
ece8376
Delay sending MOTD until the player spawns with a character.
rexxar-tc Jul 18, 2018
d695c86
Be careful using copy and paste
Jimmacle Jul 19, 2018
9220a94
Fix entity refresh reflection
Jimmacle Jul 19, 2018
0bc78d2
Actually fix entities refresh command
Jimmacle Jul 19, 2018
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add 'insideplanet' argument to grid cleanup. Finds grids that are mor…
…e than halfway to the center of the planet.
  • Loading branch information
rexxar-tc committed Jun 11, 2018
commit aa8322f36e18698c8e9f9a92653c928d9b51bdcf
29 changes: 29 additions & 0 deletions Essentials/Commands/CleanupModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Media.Media3D;
using Sandbox.Game.Entities;
using Sandbox.Game.World;
using Torch.Commands;
using NLog;
using Sandbox.Game.EntityComponents;
using SpaceEngineers.Game.Entities.Blocks;
using VRage.Game.Entity;
using VRage.Game.ModAPI;
using Vector3D = VRageMath.Vector3D;

namespace Essentials.Commands
{
Expand Down Expand Up @@ -88,6 +91,9 @@ private IEnumerable<MyCubeGrid> ScanConditions(IReadOnlyList<string> args)
case "haspower":
conditions.Add(g => HasPower(g));
break;
case "insideplanet":
conditions.Add(g => InsidePlanet(g));
break;
default:
Context.Respond($"Unknown argument '{arg}'");
yield break;
Expand Down Expand Up @@ -139,6 +145,29 @@ private bool HasPower(MyCubeGrid grid)
return false;
}

private bool InsidePlanet(MyCubeGrid grid)
{
var s = grid.PositionComp.WorldVolume;
var voxels = new List<MyVoxelBase>();
MyGamePruningStructure.GetAllVoxelMapsInSphere(ref s, voxels);

if (!voxels.Any())
return false;

foreach (var v in voxels)
{
var planet = v as MyPlanet;
if (planet == null)
continue;

var dist2center = Vector3D.DistanceSquared(s.Center, planet.PositionComp.WorldVolume.Center);
if (dist2center <= (planet.MaximumRadius * planet.MaximumRadius) / 2)
return true;
}

return false;
}

private bool OwnedBy(MyCubeGrid grid, string str)
{
long identityId;
Expand Down