private static void DoLogging(EntityIdCooldownKey cooldownKey, MyCubeGrid grid) { RotorgunDetectorPlugin plugin = RotorgunDetectorPlugin.Instance; var cooldowns = plugin.LoggingCooldowns; if (!cooldowns.CheckCooldown(cooldownKey, "logging", out _)) { return; } cooldowns.StartCooldown(cooldownKey, "logging", plugin.LoggingCooldown); grid = grid.GetBiggestGridInGroup(); var gridOwnerList = grid.BigOwners; var ownerCnt = gridOwnerList.Count; var gridOwner = 0L; if (ownerCnt > 0 && gridOwnerList[0] != 0) { gridOwner = gridOwnerList[0]; } else if (ownerCnt > 1) { gridOwner = gridOwnerList[1]; } FILE_LOGGER.Warn("Possible Rotorgun found on grid " + grid.DisplayName + " owned by " + PlayerUtils.GetPlayerNameById(gridOwner)); }
private static bool IsBiggestGridInGroup(MyCubeGrid grid) { var biggestGrid = grid?.GetBiggestGridInGroup(); if (biggestGrid == null || biggestGrid != grid) { return(false); } return(true); }