From 86a81ee5d8aefcbebc90abf3bdb77ec6f0bfddfd Mon Sep 17 00:00:00 2001 From: Aleks976 Date: Sun, 15 May 2016 19:41:24 -0400 Subject: [PATCH] Fixed Lag when recoloring blocks --- Sources/Sandbox.Game/Game/Entities/Cube/MyCubeGrid.cs | 2 +- Sources/Sandbox.Game/Game/Entities/Cube/MySlimBlock.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Sandbox.Game/Game/Entities/Cube/MyCubeGrid.cs b/Sources/Sandbox.Game/Game/Entities/Cube/MyCubeGrid.cs index f82257645d..44041dd09a 100644 --- a/Sources/Sandbox.Game/Game/Entities/Cube/MyCubeGrid.cs +++ b/Sources/Sandbox.Game/Game/Entities/Cube/MyCubeGrid.cs @@ -4688,7 +4688,7 @@ public bool ChangeColor(MySlimBlock block, Vector3 newHSV) if (block.ColorMaskHSV == newHSV) return false; block.ColorMaskHSV = newHSV; - block.UpdateVisual(); + block.UpdateVisual(false); //Physics wasn't affected by color change return true; } finally diff --git a/Sources/Sandbox.Game/Game/Entities/Cube/MySlimBlock.cs b/Sources/Sandbox.Game/Game/Entities/Cube/MySlimBlock.cs index 8b01f25799..e08c3fcf0c 100644 --- a/Sources/Sandbox.Game/Game/Entities/Cube/MySlimBlock.cs +++ b/Sources/Sandbox.Game/Game/Entities/Cube/MySlimBlock.cs @@ -1312,7 +1312,7 @@ public void ApplyAccumulatedDamage(bool addDirtyParts = true, long attackerId = ProfilerShort.End(); } - public void UpdateVisual() + public void UpdateVisual(bool physicsChanged = true) { UpdateShowParts(); @@ -1338,7 +1338,7 @@ public void UpdateVisual() FatBlock = null; } CubeGrid.SetBlockDirty(this); - if (CubeGrid.Physics != null) + if (CubeGrid.Physics != null && physicsChanged) { CubeGrid.Physics.AddDirtyArea(Min, Max); }