diff --git a/BuildingTools/BuildingTools.cs b/BuildingTools/BuildingTools.cs index fbf2ac5..5edf947 100644 --- a/BuildingTools/BuildingTools.cs +++ b/BuildingTools/BuildingTools.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using DataLoader; using GamecraftModdingAPI; using GamecraftModdingAPI.Blocks; using GamecraftModdingAPI.Commands; @@ -158,6 +159,14 @@ namespace BuildingTools GameEngineManager.AddGameEngine(noClip); CommandBuilder.Builder("noClip", "Allows you to go through blocks. Run again to disable.") .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((int) blockID).scalingPermission = + ScalingPermission.NonUniform; + Logging.CommandLog("Free scaling enabled for " + blockID + " until the game is restarted."); + }).Build(); } private string GetBlockInfo() diff --git a/BuildingTools/BuildingTools.csproj b/BuildingTools/BuildingTools.csproj index 08dc538..9eb0419 100644 --- a/BuildingTools/BuildingTools.csproj +++ b/BuildingTools/BuildingTools.csproj @@ -76,9 +76,6 @@ ..\..\ref\Gamecraft_Data\Managed\Facepunch.Steamworks.Win64.dll - - ..\..\ref\Gamecraft_Data\Managed\FMOD.dll - ..\..\ref\Gamecraft_Data\Managed\FullGame.dll @@ -250,7 +247,7 @@ ..\..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.Mockup.dll - + ..\..\GamecraftModdingAPI\GamecraftModdingAPI\bin\Debug\net472\GamecraftModdingAPI.dll @@ -403,9 +400,6 @@ ..\..\ref\Gamecraft_Data\Managed\RobocraftX.SaveGameDialog.dll - - ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Serializers.dll - ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Services.dll @@ -439,27 +433,6 @@ ..\..\ref\Gamecraft_Data\Managed\Unity.Addressables.dll - - ..\..\ref\Gamecraft_Data\Managed\Unity.Animation.dll - - - ..\..\ref\Gamecraft_Data\Managed\Unity.Animation.Curves.dll - - - ..\..\ref\Gamecraft_Data\Managed\Unity.Animation.Curves.Hybrid.dll - - - ..\..\ref\Gamecraft_Data\Managed\Unity.Animation.DefaultGraphPipeline.dll - - - ..\..\ref\Gamecraft_Data\Managed\Unity.Animation.DefaultGraphPipeline.Hybrid.dll - - - ..\..\ref\Gamecraft_Data\Managed\Unity.Animation.Graph.dll - - - ..\..\ref\Gamecraft_Data\Managed\Unity.Animation.Hybrid.dll - ..\..\ref\Gamecraft_Data\Managed\Unity.Build.SlimPlayerRuntime.dll @@ -475,9 +448,6 @@ ..\..\ref\Gamecraft_Data\Managed\Unity.Collections.LowLevel.ILSupport.dll - - ..\..\ref\Gamecraft_Data\Managed\Unity.DataFlowGraph.dll - ..\..\ref\Gamecraft_Data\Managed\Unity.Deformations.dll @@ -487,9 +457,6 @@ ..\..\ref\Gamecraft_Data\Managed\Unity.Entities.Hybrid.dll - - ..\..\ref\Gamecraft_Data\Managed\Unity.InternalAPIEngineBridge.002.dll - ..\..\ref\Gamecraft_Data\Managed\Unity.Jobs.dll @@ -514,9 +481,6 @@ ..\..\ref\Gamecraft_Data\Managed\Unity.Platforms.Common.dll - - ..\..\ref\Gamecraft_Data\Managed\Unity.Postprocessing.Runtime.dll - ..\..\ref\Gamecraft_Data\Managed\Unity.Properties.dll diff --git a/BuildingTools/NoClipCommand.cs b/BuildingTools/NoClipCommand.cs index 1acc234..f54f096 100644 --- a/BuildingTools/NoClipCommand.cs +++ b/BuildingTools/NoClipCommand.cs @@ -2,6 +2,7 @@ using System.Collections; using GamecraftModdingAPI; using GamecraftModdingAPI.Engines; +using GamecraftModdingAPI.Players; using GamecraftModdingAPI.Utility; using RobocraftX.Character; using RobocraftX.Character.Camera; @@ -31,7 +32,7 @@ namespace BuildingTools }; private EntityManager _entityManager; - private BlobAssetReference _oldCollider; + private CollisionFilter _oldCollider; private bool _enabled; private void Enable() @@ -47,7 +48,7 @@ namespace BuildingTools private void Disable() { Logging.CommandLog("Disabling noclip"); - ChangeCollider(null, _oldCollider).Dispose(); //Dispose old (cloned) collider + ChangeCollider(null, _oldCollider); //Dispose old (cloned) collider _enabled = false; Logging.CommandLog("Noclip disabled"); } @@ -66,7 +67,7 @@ namespace BuildingTools EnsureFlying(); if (!entitiesDB.Exists(0U, CommonExclusiveGroups.GameStateGroup)) { - Disable(); + //Disable(); yield break; } @@ -74,27 +75,44 @@ namespace BuildingTools } } - private BlobAssetReference ChangeCollider(CollisionFilter? newFilter, BlobAssetReference? newCollider) + private CollisionFilter ChangeCollider(CollisionFilter? newFilter, CollisionFilter? newCollider) { foreach (var group in CharacterExclusiveGroups.AllCharacters) { + /*if (!Player.Exists(PlayerType.Local)) + continue;*/ if (!entitiesDB.Exists(new EGID(Player.LocalPlayer.Id, group))) continue; ref var uecsEntity = ref entitiesDB.QueryEntity(new EGID(Player.LocalPlayer.Id, group)); + Console.WriteLine("Found physics entity " + uecsEntity.ID); var collider = _entityManager.GetComponentData(uecsEntity.uecsEntity); - var oldCollider = collider.Value; + //var collider = _entityManager.GetComponentData(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) { unsafe { - var colRef = ColliderUtilityUECS.ClonePhysicsCollider(collider.ColliderPtr, newFilter.Value); - collider.Value = colRef; + //var colRef = ColliderUtilityUECS.ClonePhysicsCollider(collider.ColliderPtr, newFilter.Value); + //collider.Value = colRef; + collider.Value.Value.Filter = newFilter.Value; + Console.WriteLine("New collider: " + (long) collider.ColliderPtr); } } 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); + Console.WriteLine("Resulting filter: " + _entityManager + .GetComponentData(uecsEntity.uecsEntity).Value.Value.Filter + .BelongsTo); return oldCollider; }