Exemple #1
0
        // refresh structures decay
        private async void ServerTimerTickCallback()
        {
            if (isUpdatingNow)
            {
                Logger.Warning(
                    "Cannot process land claim reset decay system tick - not finished the previous update yet");
                return;
            }

            if (!StructureConstants.IsStructureDecayEnabledInEditor &&
                Api.IsEditor)
            {
                return;
            }

            // We will time-slice this update just in case there are too many areas.
            isUpdatingNow = true;

            try
            {
                TempList.AddRange(LandClaimSystem.ServerEnumerateAllAreas());

                foreach (var area in TempList)
                {
                    var worldObject = LandClaimArea.GetPrivateState(area)
                                      .ServerLandClaimWorldObject;
                    ServerRefreshLandClaimObject(worldObject);
                    await ServerCore.YieldIfOutOfTime();
                }
            }
            finally
            {
                isUpdatingNow = false;
                TempList.Clear();
            }
        }