Add voxel reset message
This commit is contained in:
@@ -10,6 +10,7 @@ namespace Torch.Mod.Messages
|
|||||||
#region Includes
|
#region Includes
|
||||||
[ProtoInclude(1, typeof(DialogMessage))]
|
[ProtoInclude(1, typeof(DialogMessage))]
|
||||||
[ProtoInclude(2, typeof(NotificationMessage))]
|
[ProtoInclude(2, typeof(NotificationMessage))]
|
||||||
|
[ProtoInclude(3, typeof(VoxelResetMessage))]
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
[ProtoContract]
|
[ProtoContract]
|
||||||
|
46
Torch.Mod/Messages/VoxelResetMessage.cs
Normal file
46
Torch.Mod/Messages/VoxelResetMessage.cs
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using ProtoBuf;
|
||||||
|
using Sandbox.ModAPI;
|
||||||
|
using VRage.ModAPI;
|
||||||
|
using VRage.Voxels;
|
||||||
|
|
||||||
|
namespace Torch.Mod.Messages
|
||||||
|
{
|
||||||
|
[ProtoContract]
|
||||||
|
public class VoxelResetMessage : MessageBase
|
||||||
|
{
|
||||||
|
[ProtoMember(201)]
|
||||||
|
public long[] EntityId;
|
||||||
|
|
||||||
|
public VoxelResetMessage()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public VoxelResetMessage(long[] entityId)
|
||||||
|
{
|
||||||
|
EntityId = entityId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ProcessClient()
|
||||||
|
{
|
||||||
|
MyAPIGateway.Parallel.ForEach(EntityId, id =>
|
||||||
|
{
|
||||||
|
IMyEntity e;
|
||||||
|
if (!MyAPIGateway.Entities.TryGetEntityById(id, out e))
|
||||||
|
return;
|
||||||
|
|
||||||
|
var v = e as IMyVoxelBase;
|
||||||
|
if (v == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
v.Storage.Reset(MyStorageDataTypeFlags.All);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ProcessServer()
|
||||||
|
{
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -12,6 +12,7 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)Messages\NotificationMessage.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Messages\NotificationMessage.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Messages\DialogMessage.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Messages\DialogMessage.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Messages\MessageBase.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Messages\MessageBase.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Messages\VoxelResetMessage.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)ModCommunication.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ModCommunication.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)TorchModCore.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)TorchModCore.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@@ -19,6 +19,7 @@ using Torch.Commands.Permissions;
|
|||||||
using Torch.Managers;
|
using Torch.Managers;
|
||||||
using Torch.Mod;
|
using Torch.Mod;
|
||||||
using Torch.Mod.Messages;
|
using Torch.Mod.Messages;
|
||||||
|
using VRage.Game;
|
||||||
using VRage.Game.ModAPI;
|
using VRage.Game.ModAPI;
|
||||||
|
|
||||||
namespace Torch.Commands
|
namespace Torch.Commands
|
||||||
|
Reference in New Issue
Block a user