Skip to content
This repository was archived by the owner on Jun 23, 2023. It is now read-only.

Commit 61c1db6

Browse files
committed
Revert to 46f1e30 to fix performance issues
1 parent 70033d1 commit 61c1db6

24 files changed

+956
-616
lines changed

.gitignore

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,3 @@ $RECYCLE.BIN/
128128
ClientEntityManagement.cs
129129
ProcessClientConceal.cs
130130
packages/*/*
131-
.vs/Supercharger/EssentialsPlugin/code_marker.dat
132-
.vs/Supercharger/EssentialsPlugin/codemap.dat
133-
.vs/Supercharger/EssentialsPlugin/codemap.sync-conflict-20160901-211216.dat
134-
.vs/Supercharger/EssentialsPlugin/global_history.dat
135-
.vs/Supercharger/EssentialsPlugin/global_history.sync-conflict-20160901-211216.dat
136-
.vs/Supercharger/EssentialsPlugin/rich_code_format.dat
137-
.vs/Supercharger/EssentialsPlugin/workbench.dat
0 Bytes
Binary file not shown.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
//291
1+
//243
22
//
33
// This code was generated by a tool. Any changes made manually will be lost
44
// the next time this code is regenerated.
55
//
66

77
using System.Reflection;
88

9-
[assembly: AssemblyFileVersion("1.13.7.291")]
10-
[assembly: AssemblyVersion("1.13.7.291")]
9+
[assembly: AssemblyFileVersion("1.13.7.243")]
10+
[assembly: AssemblyVersion("1.13.7.243")]

EssentialsPlugin/ChatHandlers/Admin/HandleAdminOwnershipChange.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class HandleAdminOwnershipChange : ChatHandlerBase
1616
{
1717
public override string GetHelp( )
1818
{
19-
return "This command allows you to change the ownership of a ship. Usage: /admin ownership change <entityId/entityName> <PlayerName>";
19+
return "This command allows you to change the ownership of a ship. Usage: /admin ownership change <entityId> <PlayerName>";
2020
}
2121
public override string GetCommandText( )
2222
{

EssentialsPlugin/ChatHandlers/Admin/HandleAdminStop.cs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
using VRageMath;
1414
using Sandbox.Game.Entities;
1515
using Sandbox.Game.Entities.Cube;
16-
using VRage.Game.Entity;
1716
using VRage.Game.ModAPI;
1817

1918
public class HandleAdminStop : ChatHandlerBase
@@ -78,23 +77,25 @@ public override bool HandleCommand( ulong userId, string[ ] words )
7877
// arg_ships = true;
7978
// arg_piloted = true;
8079
//}
81-
HashSet<MyEntity> entities = new HashSet<MyEntity>( );
80+
HashSet<IMyEntity> entities = new HashSet<IMyEntity>( );
8281
Wrapper.GameAction( ( ) =>
83-
{
84-
entities = MyEntities.GetEntities( );
85-
} );
82+
{
83+
MyAPIGateway.Entities.GetEntities( entities );
84+
} );
8685

87-
foreach ( MyEntity entity in entities )
86+
foreach ( IMyEntity entity in entities )
8887
{
8988
bool found = false;
89+
if ( entity == null )
90+
continue;
9091

91-
if ( entity?.Physics == null )
92+
if ( entity.Physics == null )
9293
continue;
9394

9495
//if ( !(entity is IMyCubeGrid) || !(entity is IMyFloatingObject) || !(entity is MyInventoryBagEntity) )
9596
// continue;
9697

97-
if ( arg_ships && entity is MyCubeGrid )
98+
if ( arg_ships && entity is IMyCubeGrid )
9899
{
99100
//TODO: find a way to stop piloted ships
100101
//even if we try to stop the grid entity, it won't work if there's a pilot
@@ -118,10 +119,10 @@ public override bool HandleCommand( ulong userId, string[ ] words )
118119
*/
119120
Stop( entity.GetTopMostParent( ) );
120121
}
121-
else if ( arg_floating && (entity is MyFloatingObject || entity is MyInventoryBagEntity) )
122+
else if ( arg_floating && (entity is IMyFloatingObject || entity is MyInventoryBagEntity) )
122123
Stop( entity );
123124
}
124-
Communication.SendPrivateInformation( userId, count + " entities have been stopped." );
125+
Communication.SendPrivateInformation( userId, count.ToString( ) + " entities have been stopped." );
125126
count = 0;
126127
return true;
127128
}
@@ -132,10 +133,11 @@ private static void Stop( IMyEntity entity )
132133
if ( entity.Physics.LinearVelocity == Vector3D.Zero && entity.Physics.AngularVelocity == Vector3D.Zero )
133134
return;
134135

135-
Wrapper.BeginGameAction( ( ) =>
136+
Wrapper.GameAction( ( ) =>
136137
{
137-
entity.Physics.SetSpeeds( Vector3.Zero, Vector3.Zero );
138-
}, null, null );
138+
entity.Physics.LinearVelocity = Vector3D.Zero;
139+
entity.Physics.AngularVelocity = Vector3D.Zero;
140+
} );
139141
++count;
140142
}
141143

EssentialsPlugin/ChatHandlers/AdminDelete/HandleAdminDeleteFloating.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
using SEModAPIInternal.API.Entity.Sector.SectorObject;
1212
using SEModAPIInternal.API.Entity.Sector.SectorObject.CubeGrid;
1313
using SEModAPIInternal.API.Entity.Sector.SectorObject.CubeGrid.CubeBlock;
14-
using VRage.Game.Entity;
1514
using VRage.Game.ModAPI;
1615
using VRage.ModAPI;
1716
public class HandleAdminDeleteFloating : ChatHandlerBase
@@ -48,19 +47,26 @@ public override bool AllowedInConsole( )
4847
public override bool HandleCommand( ulong userId, string[ ] words )
4948
{
5049
int count = 0;
51-
HashSet<MyEntity> entities = new HashSet<MyEntity>( );
50+
HashSet<IMyEntity> entities = new HashSet<IMyEntity>( );
5251

53-
Wrapper.GameAction( ( ) => entities = MyEntities.GetEntities( ) );
52+
Wrapper.GameAction( ( ) =>
53+
{
54+
MyAPIGateway.Entities.GetEntities( entities );
55+
} );
5456

55-
foreach ( MyEntity entity in entities )
57+
foreach ( IMyEntity entity in entities )
5658
{
5759
if ( entity == null )
5860
continue;
5961

60-
if ( entity is MyFloatingObject || entity is MyInventoryBagEntity || entity is IMyMeteor )
62+
if ( entity is IMyFloatingObject || entity is MyInventoryBagEntity || entity is IMyMeteor )
6163
{
6264
count++;
63-
Wrapper.BeginGameAction( entity.Close, null, null );
65+
Wrapper.GameAction(()=>
66+
{
67+
entity.Close( );
68+
} );
69+
//MyMultiplayer.ReplicateImmediatelly( MyExternalReplicable.FindByObject( entity ) );
6470
}
6571
}
6672
Communication.SendPrivateInformation( userId, count.ToString( ) + " floating objects deleted." );

EssentialsPlugin/ChatHandlers/AdminDelete/HandleAdminDeleteInsidePlanet.cs

Lines changed: 0 additions & 74 deletions
This file was deleted.

EssentialsPlugin/ChatHandlers/AdminScan/HandleAdminScanAreaAt.cs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
using System.Linq;
55
using EssentialsPlugin.Utility;
66
using Sandbox.Common.ObjectBuilders;
7-
using Sandbox.Game.Entities;
87
using Sandbox.ModAPI;
98
using VRage.Game;
10-
using VRage.Game.Entity;
119
using VRage.Game.ModAPI;
1210
using VRage.ModAPI;
1311
using VRageMath;
@@ -73,21 +71,19 @@ public override bool HandleCommand(ulong userId, string[] words)
7371
List<MyObjectBuilder_CubeGrid> gridsToMove = new List<MyObjectBuilder_CubeGrid>();
7472
BoundingSphereD sphere = new BoundingSphereD(startPosition, radius);
7573
List<IMyEntity> entitiesToMove = MyAPIGateway.Entities.GetEntitiesInSphere(ref sphere);
76-
List<MyEntity> entities;
77-
int count = 0;
78-
Wrapper.GameAction( ( ) =>
79-
{
80-
entities = MyEntities.GetTopMostEntitiesInSphere( ref sphere );
74+
int count = 0;
8175

82-
foreach (MyEntity entity in entities)
83-
{
84-
if (!( entity is MyCubeGrid ))
85-
continue;
76+
Wrapper.GameAction(() =>
77+
{
78+
foreach (IMyEntity entity in entitiesToMove)
79+
{
80+
if (!(entity is IMyCubeGrid))
81+
continue;
8682

87-
Communication.SendPrivateInformation( userId, string.Format( "Found ship '{0}' ({1}) at {2}", entity.DisplayName, entity.EntityId, General.Vector3DToString( entity.PositionComp.GetPosition( ) ) ) );
88-
count++;
89-
}
90-
} );
83+
Communication.SendPrivateInformation(userId, string.Format("Found ship '{0}' ({1}) at {2}", entity.DisplayName, entity.EntityId, General.Vector3DToString(entity.GetPosition())));
84+
count++;
85+
}
86+
});
9187

9288
Communication.SendPrivateInformation(userId, string.Format("Total ships found: {0}", count));
9389
return true;

EssentialsPlugin/ChatHandlers/AdminScan/HandleAdminScanInsidePlanet.cs

Lines changed: 0 additions & 72 deletions
This file was deleted.

EssentialsPlugin/ChatHandlers/ChatHandlerBase.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ public abstract class ChatHandlerBase
1313
protected static readonly Logger Log = LogManager.GetLogger( "PluginLog" );
1414
public ChatHandlerBase( )
1515
{
16-
#if DEBUG
17-
Log.Debug( $"Added chat handler: {GetCommandText()}" );
18-
#endif
19-
}
16+
if ( ExtenderOptions.IsDebugging )
17+
Log.Debug( $"Added chat handler: {GetCommandText()}" );
18+
}
2019

2120
public virtual Boolean CanHandle(ulong steamId, String[] words, ref int commandCount)
2221
{

0 commit comments

Comments
 (0)