private void BeginUpdate() { Operable = 0; anyOperablePistonStack = null; hasMismatchedStacks = false; hasMismatchedExtensions = false; }
private static bool AreMatchingStacks(PistonStack a, PistonStack b) { if (a.Total != b.Total) { return(false); } if (a.BaseGrid != b.BaseGrid) { return(false); } if (a.TopGrid != b.TopGrid) { return(false); } return(true); }
private void UpdateState(PistonStack pistonStack) { if (pistonStack.Operable < pistonStack.Total) { return; } Operable++; anyOperablePistonStack = anyOperablePistonStack ?? pistonStack; if (!AreMatchingStacks(anyOperablePistonStack, pistonStack)) { hasMismatchedStacks = true; } if (Math.Abs(anyOperablePistonStack.Extension - pistonStack.Extension) > 0.1f) { hasMismatchedExtensions = true; } }