Update to Gamecraft 2020.06.11.18.50
Apparently the pilot seat is recognised as a block even in sim mode when looking at it
This commit is contained in:
parent
47d1f43495
commit
20cd8b7a50
2 changed files with 41 additions and 38 deletions
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Gamecraft.Wires;
|
||||
using Gamecraft.Wires.ChannelsCommon;
|
||||
using GamecraftModdingAPI;
|
||||
using GamecraftModdingAPI.Blocks;
|
||||
|
@ -90,6 +91,12 @@ namespace BlockMod
|
|||
refBlock = blocks.Length > 0 ? blocks[0] : null;
|
||||
}).Build();
|
||||
|
||||
ConsoleCommands.RegisterWithChannel("selectSendSignal", ch =>
|
||||
{
|
||||
|
||||
}, ChannelType.Object,
|
||||
"Sends a signal for selecting a given object ID for a command block.");
|
||||
|
||||
RegisterBlockCommand("pushBlocks", "Adds velocity to the selected blocks. Only works in simulation.",
|
||||
(x, y, z, blocks, refBlock) =>
|
||||
{
|
||||
|
@ -118,8 +125,17 @@ namespace BlockMod
|
|||
private string GetBlockInfo()
|
||||
{
|
||||
if (GameState.IsBuildMode())
|
||||
return GetBlockInfoInBuildMode();
|
||||
if (GameState.IsSimulationMode())
|
||||
return GetBodyInfoInSimMode();
|
||||
|
||||
return "Switching modes...";
|
||||
}
|
||||
|
||||
private static string GetBlockInfoInBuildMode()
|
||||
{
|
||||
var block = new Player(PlayerType.Local).GetBlockLookedAt();
|
||||
if (block == null) return "";
|
||||
float3 pos = block.Position;
|
||||
float3 rot = block.Rotation;
|
||||
float3 scale = block.Scale;
|
||||
|
@ -129,9 +145,11 @@ namespace BlockMod
|
|||
$"- Scale: {scale.x:F} {scale.y:F} {scale.z:F}\n" +
|
||||
$"- Label: {block.Label}";
|
||||
}
|
||||
if (GameState.IsSimulationMode())
|
||||
|
||||
private static string GetBodyInfoInSimMode()
|
||||
{
|
||||
var body = new Player(PlayerType.Local).GetSimBodyLookedAt();
|
||||
if (body == null) return GetBlockInfoInBuildMode();
|
||||
float3 pos = body.Position;
|
||||
float3 rot = body.Rotation;
|
||||
float3 vel = body.Velocity;
|
||||
|
@ -144,9 +162,6 @@ namespace BlockMod
|
|||
$"- {(body.Static ? "Static body" : $"Mass: {body.Mass:F} center: {com.x:F} {com.y:F} {com.z:F}")}";
|
||||
}
|
||||
|
||||
return "Switching modes...";
|
||||
}
|
||||
|
||||
private bool CheckNoBlocks(Block[] blocks)
|
||||
{
|
||||
if (blocks.Length == 0)
|
||||
|
@ -179,7 +194,7 @@ namespace BlockMod
|
|||
var blks = SelectBlocks(ch);
|
||||
if (CheckNoBlocks(blks)) return;
|
||||
action(a1, a2, blks, blks[0]);
|
||||
}, BinaryChannelUtilities.ChannelType.Object, desc);
|
||||
}, ChannelType.Object, desc);
|
||||
}
|
||||
|
||||
private void RegisterBlockCommand(string name, string desc, Action<float, float, float, Block[], Block> action)
|
||||
|
@ -195,7 +210,7 @@ namespace BlockMod
|
|||
var blks = SelectBlocks(ch);
|
||||
if (CheckNoBlocks(blks)) return;
|
||||
action(x, y, z, blks, blks[0]);
|
||||
}, BinaryChannelUtilities.ChannelType.Object, desc);
|
||||
}, ChannelType.Object, desc);
|
||||
}
|
||||
|
||||
public void OnApplicationQuit()
|
||||
|
|
|
@ -57,9 +57,6 @@
|
|||
<Reference Include="Blocks.HUDFeedbackBlocks, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Blocks.HUDFeedbackBlocks.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ChannelsCommon, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\ChannelsCommon.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ClusterToWireConversion.Mock, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\ClusterToWireConversion.Mock.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -72,9 +69,6 @@
|
|||
<Reference Include="DDNA, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\DDNA.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Facepunch.Steamworks.Win64, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Facepunch.Steamworks.Win64.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FMOD, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\FMOD.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -333,12 +327,6 @@
|
|||
<Reference Include="Svelto.ECS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Svelto.ECS.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Svelto.ECS.Debugger, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Svelto.ECS.Debugger.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Svelto.ECS.Debugger.Internal, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Svelto.ECS.Debugger.Internal.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Svelto.Services, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Svelto.Services.dll</HintPath>
|
||||
</Reference>
|
||||
|
|
Loading…
Reference in a new issue