Add free scaling and attempt to fix noclip
This commit is contained in:
parent
19bf8fbe18
commit
2b0cec100e
3 changed files with 36 additions and 45 deletions
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using DataLoader;
|
||||||
using GamecraftModdingAPI;
|
using GamecraftModdingAPI;
|
||||||
using GamecraftModdingAPI.Blocks;
|
using GamecraftModdingAPI.Blocks;
|
||||||
using GamecraftModdingAPI.Commands;
|
using GamecraftModdingAPI.Commands;
|
||||||
|
@ -158,6 +159,14 @@ namespace BuildingTools
|
||||||
GameEngineManager.AddGameEngine(noClip);
|
GameEngineManager.AddGameEngine(noClip);
|
||||||
CommandBuilder.Builder("noClip", "Allows you to go through blocks. Run again to disable.")
|
CommandBuilder.Builder("noClip", "Allows you to go through blocks. Run again to disable.")
|
||||||
.Action(noClip.Toggle).Build();
|
.Action(noClip.Toggle).Build();
|
||||||
|
CommandBuilder.Builder("freeScaling", "This command removes scaling restrictions on the selected block. Reselect block to apply.")
|
||||||
|
.Action(() =>
|
||||||
|
{
|
||||||
|
var blockID = Player.LocalPlayer.SelectedBlock;
|
||||||
|
FullGameFields._dataDb.GetValue<CubeListData>((int) blockID).scalingPermission =
|
||||||
|
ScalingPermission.NonUniform;
|
||||||
|
Logging.CommandLog("Free scaling enabled for " + blockID + " until the game is restarted.");
|
||||||
|
}).Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetBlockInfo()
|
private string GetBlockInfo()
|
||||||
|
|
|
@ -76,9 +76,6 @@
|
||||||
<Reference Include="Facepunch.Steamworks.Win64, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
|
<Reference Include="Facepunch.Steamworks.Win64, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Facepunch.Steamworks.Win64.dll</HintPath>
|
<HintPath>..\..\ref\Gamecraft_Data\Managed\Facepunch.Steamworks.Win64.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="FMOD, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\FMOD.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="FullGame, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
<Reference Include="FullGame, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\FullGame.dll</HintPath>
|
<HintPath>..\..\ref\Gamecraft_Data\Managed\FullGame.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
@ -250,7 +247,7 @@
|
||||||
<Reference Include="Gamecraft.Wires.Mockup, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
<Reference Include="Gamecraft.Wires.Mockup, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.Mockup.dll</HintPath>
|
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.Mockup.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="GamecraftModdingAPI, Version=1.7.0.0, Culture=neutral, PublicKeyToken=null">
|
<Reference Include="GamecraftModdingAPI">
|
||||||
<HintPath>..\..\GamecraftModdingAPI\GamecraftModdingAPI\bin\Debug\net472\GamecraftModdingAPI.dll</HintPath>
|
<HintPath>..\..\GamecraftModdingAPI\GamecraftModdingAPI\bin\Debug\net472\GamecraftModdingAPI.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="GameState, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
<Reference Include="GameState, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||||
|
@ -403,9 +400,6 @@
|
||||||
<Reference Include="RobocraftX.SaveGameDialog, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
<Reference Include="RobocraftX.SaveGameDialog, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\RobocraftX.SaveGameDialog.dll</HintPath>
|
<HintPath>..\..\ref\Gamecraft_Data\Managed\RobocraftX.SaveGameDialog.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="RobocraftX.Serializers, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\RobocraftX.Serializers.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="RobocraftX.Services, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
<Reference Include="RobocraftX.Services, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\RobocraftX.Services.dll</HintPath>
|
<HintPath>..\..\ref\Gamecraft_Data\Managed\RobocraftX.Services.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
@ -439,27 +433,6 @@
|
||||||
<Reference Include="Unity.Addressables, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
<Reference Include="Unity.Addressables, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Addressables.dll</HintPath>
|
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Addressables.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Unity.Animation, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Animation.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.Animation.Curves, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Animation.Curves.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.Animation.Curves.Hybrid, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Animation.Curves.Hybrid.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.Animation.DefaultGraphPipeline, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Animation.DefaultGraphPipeline.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.Animation.DefaultGraphPipeline.Hybrid, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Animation.DefaultGraphPipeline.Hybrid.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.Animation.Graph, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Animation.Graph.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.Animation.Hybrid, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Animation.Hybrid.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.Build.SlimPlayerRuntime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
<Reference Include="Unity.Build.SlimPlayerRuntime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Build.SlimPlayerRuntime.dll</HintPath>
|
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Build.SlimPlayerRuntime.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
@ -475,9 +448,6 @@
|
||||||
<Reference Include="Unity.Collections.LowLevel.ILSupport, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
<Reference Include="Unity.Collections.LowLevel.ILSupport, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Collections.LowLevel.ILSupport.dll</HintPath>
|
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Collections.LowLevel.ILSupport.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Unity.DataFlowGraph, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.DataFlowGraph.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.Deformations, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
<Reference Include="Unity.Deformations, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Deformations.dll</HintPath>
|
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Deformations.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
@ -487,9 +457,6 @@
|
||||||
<Reference Include="Unity.Entities.Hybrid, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
<Reference Include="Unity.Entities.Hybrid, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Entities.Hybrid.dll</HintPath>
|
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Entities.Hybrid.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Unity.InternalAPIEngineBridge.002, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.InternalAPIEngineBridge.002.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.Jobs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
<Reference Include="Unity.Jobs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Jobs.dll</HintPath>
|
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Jobs.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
@ -514,9 +481,6 @@
|
||||||
<Reference Include="Unity.Platforms.Common, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
<Reference Include="Unity.Platforms.Common, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Platforms.Common.dll</HintPath>
|
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Platforms.Common.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Unity.Postprocessing.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Postprocessing.Runtime.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.Properties, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
<Reference Include="Unity.Properties, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Properties.dll</HintPath>
|
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Properties.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using GamecraftModdingAPI;
|
using GamecraftModdingAPI;
|
||||||
using GamecraftModdingAPI.Engines;
|
using GamecraftModdingAPI.Engines;
|
||||||
|
using GamecraftModdingAPI.Players;
|
||||||
using GamecraftModdingAPI.Utility;
|
using GamecraftModdingAPI.Utility;
|
||||||
using RobocraftX.Character;
|
using RobocraftX.Character;
|
||||||
using RobocraftX.Character.Camera;
|
using RobocraftX.Character.Camera;
|
||||||
|
@ -31,7 +32,7 @@ namespace BuildingTools
|
||||||
};
|
};
|
||||||
|
|
||||||
private EntityManager _entityManager;
|
private EntityManager _entityManager;
|
||||||
private BlobAssetReference<Collider> _oldCollider;
|
private CollisionFilter _oldCollider;
|
||||||
private bool _enabled;
|
private bool _enabled;
|
||||||
|
|
||||||
private void Enable()
|
private void Enable()
|
||||||
|
@ -47,7 +48,7 @@ namespace BuildingTools
|
||||||
private void Disable()
|
private void Disable()
|
||||||
{
|
{
|
||||||
Logging.CommandLog("Disabling noclip");
|
Logging.CommandLog("Disabling noclip");
|
||||||
ChangeCollider(null, _oldCollider).Dispose(); //Dispose old (cloned) collider
|
ChangeCollider(null, _oldCollider); //Dispose old (cloned) collider
|
||||||
_enabled = false;
|
_enabled = false;
|
||||||
Logging.CommandLog("Noclip disabled");
|
Logging.CommandLog("Noclip disabled");
|
||||||
}
|
}
|
||||||
|
@ -66,7 +67,7 @@ namespace BuildingTools
|
||||||
EnsureFlying();
|
EnsureFlying();
|
||||||
if (!entitiesDB.Exists<LocalInputEntityStruct>(0U, CommonExclusiveGroups.GameStateGroup))
|
if (!entitiesDB.Exists<LocalInputEntityStruct>(0U, CommonExclusiveGroups.GameStateGroup))
|
||||||
{
|
{
|
||||||
Disable();
|
//Disable();
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,27 +75,44 @@ namespace BuildingTools
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlobAssetReference<Collider> ChangeCollider(CollisionFilter? newFilter, BlobAssetReference<Collider>? newCollider)
|
private CollisionFilter ChangeCollider(CollisionFilter? newFilter, CollisionFilter? newCollider)
|
||||||
{
|
{
|
||||||
foreach (var group in CharacterExclusiveGroups.AllCharacters)
|
foreach (var group in CharacterExclusiveGroups.AllCharacters)
|
||||||
{
|
{
|
||||||
|
/*if (!Player.Exists(PlayerType.Local))
|
||||||
|
continue;*/
|
||||||
if (!entitiesDB.Exists<UECSPhysicsEntityStruct>(new EGID(Player.LocalPlayer.Id, group)))
|
if (!entitiesDB.Exists<UECSPhysicsEntityStruct>(new EGID(Player.LocalPlayer.Id, group)))
|
||||||
continue;
|
continue;
|
||||||
ref var uecsEntity =
|
ref var uecsEntity =
|
||||||
ref entitiesDB.QueryEntity<UECSPhysicsEntityStruct>(new EGID(Player.LocalPlayer.Id, group));
|
ref entitiesDB.QueryEntity<UECSPhysicsEntityStruct>(new EGID(Player.LocalPlayer.Id, group));
|
||||||
|
Console.WriteLine("Found physics entity " + uecsEntity.ID);
|
||||||
var collider = _entityManager.GetComponentData<PhysicsCollider>(uecsEntity.uecsEntity);
|
var collider = _entityManager.GetComponentData<PhysicsCollider>(uecsEntity.uecsEntity);
|
||||||
var oldCollider = collider.Value;
|
//var collider = _entityManager.GetComponentData<CharacterEnvironmentCollision>(uecsEntity.uecsEntity);
|
||||||
|
//Console.WriteLine("Collider: " + collider.sphereCollider.Value.Filter.BelongsTo);
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
Console.WriteLine("Collider ptr: " + (long) collider.ColliderPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
var oldCollider = collider.Value.Value.Filter;
|
||||||
if (newFilter.HasValue)
|
if (newFilter.HasValue)
|
||||||
{
|
{
|
||||||
unsafe
|
unsafe
|
||||||
{
|
{
|
||||||
var colRef = ColliderUtilityUECS.ClonePhysicsCollider(collider.ColliderPtr, newFilter.Value);
|
//var colRef = ColliderUtilityUECS.ClonePhysicsCollider(collider.ColliderPtr, newFilter.Value);
|
||||||
collider.Value = colRef;
|
//collider.Value = colRef;
|
||||||
|
collider.Value.Value.Filter = newFilter.Value;
|
||||||
|
Console.WriteLine("New collider: " + (long) collider.ColliderPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (newCollider.HasValue)
|
else if (newCollider.HasValue)
|
||||||
collider.Value = newCollider.Value;
|
collider.Value.Value.Filter = newCollider.Value;
|
||||||
|
|
||||||
|
//Console.WriteLine("New collider: " + collider.sphereCollider.Value.Filter.BelongsTo);
|
||||||
_entityManager.SetComponentData(uecsEntity.uecsEntity, collider);
|
_entityManager.SetComponentData(uecsEntity.uecsEntity, collider);
|
||||||
|
Console.WriteLine("Resulting filter: " + _entityManager
|
||||||
|
.GetComponentData<PhysicsCollider>(uecsEntity.uecsEntity).Value.Value.Filter
|
||||||
|
.BelongsTo);
|
||||||
return oldCollider;
|
return oldCollider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue