This repository has been archived by the owner on Jun 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
General performance increases with scan, delete, stop chat commands. …
…Remove docking. Tweaks to concealment. Crash fix in player block enforcement. New commands: /admin scan insideplanet /admin delete insideplanet
- Loading branch information
Showing
20 changed files
with
335 additions
and
311 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
//243 | ||
//257 | ||
// | ||
// This code was generated by a tool. Any changes made manually will be lost | ||
// the next time this code is regenerated. | ||
// | ||
|
||
using System.Reflection; | ||
|
||
[assembly: AssemblyFileVersion("1.13.7.243")] | ||
[assembly: AssemblyVersion("1.13.7.243")] | ||
[assembly: AssemblyFileVersion("1.13.7.257")] | ||
[assembly: AssemblyVersion("1.13.7.257")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
EssentialsPlugin/ChatHandlers/AdminDelete/HandleAdminDeleteInsidePlanet.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
namespace EssentialsPlugin.ChatHandlers | ||
{ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using EssentialsPlugin.Utility; | ||
using Sandbox.Game.Entities; | ||
using Sandbox.Game.Entities.Character; | ||
using VRageMath; | ||
|
||
public class HandleAdminDeleteInsidePlanet : ChatHandlerBase | ||
{ | ||
public override string GetHelp() | ||
{ | ||
return "This command allows you to delete entities that are trapped inside planets. Usage /admin delete insideplanet"; | ||
} | ||
public override string GetCommandText() | ||
{ | ||
return "/admin delete insideplanet"; | ||
} | ||
|
||
public override bool IsAdminCommand() | ||
{ | ||
return true; | ||
} | ||
|
||
public override bool AllowedInConsole() | ||
{ | ||
return true; | ||
} | ||
|
||
public override bool HandleCommand(ulong userId, string[] words) | ||
{ | ||
var entities = MyEntities.GetEntities( ).ToArray( ); | ||
var planets = new HashSet<MyPlanet>( ); | ||
int count = 0; | ||
foreach (var entity in entities) | ||
{ | ||
MyPlanet item = entity as MyPlanet; | ||
if (item != null) | ||
planets.Add( item ); | ||
} | ||
|
||
foreach (var planet in planets) | ||
{ | ||
var sphere25 = new BoundingSphereD(planet.PositionComp.GetPosition(), planet.MinimumRadius * 0.25); | ||
var sphere75 = new BoundingSphereD(planet.PositionComp.GetPosition(), planet.MinimumRadius * 0.75); | ||
foreach (var entity in entities) | ||
{ | ||
if (entity.MarkedForClose || entity.Physics == null || entity is MyCharacter) | ||
continue; | ||
|
||
if (sphere25.Contains(entity.PositionComp.GetPosition()) != ContainmentType.Disjoint) | ||
{ | ||
count++; | ||
Wrapper.BeginGameAction( entity.Close, null, null ); | ||
continue; | ||
} | ||
|
||
if (Vector3.IsZero(entity.Physics.LinearVelocity)) | ||
continue; | ||
|
||
if (sphere75.Contains(entity.PositionComp.GetPosition()) == ContainmentType.Disjoint) | ||
continue; | ||
|
||
count++; | ||
Wrapper.BeginGameAction(entity.Close, null, null); | ||
} | ||
} | ||
|
||
Communication.SendPrivateInformation( userId, $"Deleted {count} entities trapped in planets." ); | ||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
EssentialsPlugin/ChatHandlers/AdminScan/HandleAdminScanInsidePlanet.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
namespace EssentialsPlugin.ChatHandlers | ||
{ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using EssentialsPlugin.Utility; | ||
using Sandbox.Game.Entities; | ||
using Sandbox.Game.Entities.Character; | ||
using VRageMath; | ||
|
||
public class HandleAdminScanInsidePlanet : ChatHandlerBase | ||
{ | ||
public override string GetHelp() | ||
{ | ||
return "This command allows you to scan for entities that are trapped inside planets. Usage /admin scan insideplanet"; | ||
} | ||
public override string GetCommandText() | ||
{ | ||
return "/admin scan insideplanet"; | ||
} | ||
|
||
public override bool IsAdminCommand() | ||
{ | ||
return true; | ||
} | ||
|
||
public override bool AllowedInConsole() | ||
{ | ||
return true; | ||
} | ||
|
||
public override bool HandleCommand(ulong userId, string[] words) | ||
{ | ||
var entities = MyEntities.GetEntities( ).ToArray( ); | ||
var planets = new HashSet<MyPlanet>( ); | ||
int count = 0; | ||
foreach (var entity in entities) | ||
{ | ||
MyPlanet item = entity as MyPlanet; | ||
if (item != null) | ||
planets.Add( item ); | ||
} | ||
|
||
foreach (var planet in planets) | ||
{ | ||
var sphere25 = new BoundingSphereD( planet.PositionComp.GetPosition( ), planet.MinimumRadius * 0.25 ); | ||
var sphere75 = new BoundingSphereD( planet.PositionComp.GetPosition( ), planet.MinimumRadius * 0.75 ); | ||
foreach (var entity in entities) | ||
{ | ||
if (entity.MarkedForClose || entity.Physics == null || entity is MyCharacter) | ||
continue; | ||
|
||
if (sphere25.Contains( entity.PositionComp.GetPosition( ) ) != ContainmentType.Disjoint) | ||
{ | ||
count++; | ||
continue; | ||
} | ||
|
||
if (Vector3.IsZero( entity.Physics.LinearVelocity )) | ||
continue; | ||
|
||
if (sphere75.Contains( entity.PositionComp.GetPosition( ) ) == ContainmentType.Disjoint) | ||
continue; | ||
|
||
count++; | ||
} | ||
} | ||
|
||
Communication.SendPrivateInformation( userId, $"Found {count} entities trapped in planets." ); | ||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.