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

Commit bb538e5

Browse files
committed
Thread the voxel reset commands. Should solve any hanging issues.
1 parent c8de3a1 commit bb538e5

File tree

2 files changed

+12
-30
lines changed

2 files changed

+12
-30
lines changed

EssentialsPlugin/ChatHandlers/Admin/HandleAdminResetAsteroid.cs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Collections.Generic;
44
using System.Linq;
55
using System.Threading;
6+
using ParallelTasks;
67
using Sandbox.Definitions;
78
using Sandbox.Engine.Multiplayer;
89
using Sandbox.Engine.Voxels;
@@ -25,17 +26,7 @@ public override string GetCommandText()
2526
{
2627
return "/admin reset asteroid";
2728
}
28-
29-
public override Communication.ServerDialogItem GetHelpDialog( )
30-
{
31-
Communication.ServerDialogItem DialogItem = new Communication.ServerDialogItem( );
32-
DialogItem.title = "Help";
33-
DialogItem.header = "";
34-
DialogItem.content = GetHelp( );
35-
DialogItem.buttonText = "close";
36-
return DialogItem;
37-
}
38-
29+
3930
public override bool IsAdminCommand()
4031
{
4132
return true;
@@ -68,11 +59,11 @@ public override bool HandleCommand( ulong userId, string[ ] words )
6859

6960
Communication.SendVoxelReset( ent.EntityId );
7061

71-
Wrapper.BeginGameAction( ( ) =>
72-
{
73-
voxel.Storage.Reset( VRage.Voxels.MyStorageDataTypeFlags.All );
62+
//Wrapper.BeginGameAction( ( ) =>
63+
// {
64+
Parallel.Start(()=>voxel.Storage.Reset( VRage.Voxels.MyStorageDataTypeFlags.All ));
7465
//MyMultiplayer.ReplicateImmediatelly( MyExternalReplicable.FindByObject( ent ) );
75-
}, null, null );
66+
// }, null, null );
7667

7768
Thread.Sleep( 100 );
7869
}

EssentialsPlugin/ChatHandlers/Admin/HandleAdminResetPlanet.cs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
namespace EssentialsPlugin.ChatHandlers.Admin
22
{
33
using System.Linq;
4+
using ParallelTasks;
45
using Sandbox.Definitions;
56
using Sandbox.Engine.Multiplayer;
67
using Sandbox.Engine.Voxels;
@@ -20,17 +21,7 @@ public override string GetCommandText()
2021
{
2122
return "/admin reset planet";
2223
}
23-
24-
public override Communication.ServerDialogItem GetHelpDialog( )
25-
{
26-
Communication.ServerDialogItem DialogItem = new Communication.ServerDialogItem( );
27-
DialogItem.title = "Help";
28-
DialogItem.header = "";
29-
DialogItem.content = GetHelp( );
30-
DialogItem.buttonText = "close";
31-
return DialogItem;
32-
}
33-
24+
3425
public override bool IsAdminCommand()
3526
{
3627
return true;
@@ -55,11 +46,11 @@ public override bool HandleCommand( ulong userId, string[ ] words )
5546

5647
Communication.SendVoxelReset( ent.EntityId );
5748

58-
Wrapper.BeginGameAction( ( ) =>
59-
{
60-
voxel.Storage.Reset( VRage.Voxels.MyStorageDataTypeFlags.All );
49+
//Wrapper.BeginGameAction( ( ) =>
50+
// {
51+
Parallel.Start(()=>voxel.Storage.Reset( VRage.Voxels.MyStorageDataTypeFlags.All ));
6152
//MyMultiplayer.ReplicateImmediatelly( MyExternalReplicable.FindByObject( ent ) );
62-
}, null, null );
53+
// }, null, null );
6354
}
6455
return true;
6556
}

0 commit comments

Comments
 (0)