Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Fix for lag when recoloring blocks #529

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Sandbox.Game/Game/Entities/Cube/MyCubeGrid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Sources/Sandbox.Game/Game/Entities/Cube/MySlimBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,7 @@ public void ApplyAccumulatedDamage(bool addDirtyParts = true, long attackerId =
ProfilerShort.End();
}

public void UpdateVisual()
public void UpdateVisual(bool physicsChanged = true)
{
UpdateShowParts();

Expand All @@ -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);
}
Expand Down