public static float GridTargetValue(GridEntity grid) { float result = 0; if (grid.IsClosed()) { return(result); } result += GetTargetValueFromBlockList(grid.Antennas, 4, 2); result += GetTargetValueFromBlockList(grid.Beacons, 3, 2); result += GetTargetValueFromBlockList(grid.Containers, 0.5f, 2, true); result += GetTargetValueFromBlockList(grid.Controllers, 0.5f, 2); result += GetTargetValueFromBlockList(grid.Guns, 5, 4, true); result += GetTargetValueFromBlockList(grid.JumpDrives, 10, 2); result += GetTargetValueFromBlockList(grid.Mechanical, 1, 2); result += GetTargetValueFromBlockList(grid.NanoBots, 15, 2); result += GetTargetValueFromBlockList(grid.Production, 2, 2, true); result += GetTargetValueFromBlockList(grid.Power, 0.5f, 2, true); result += GetTargetValueFromBlockList(grid.Shields, 15, 2); result += GetTargetValueFromBlockList(grid.Thrusters, 1, 2); result += GetTargetValueFromBlockList(grid.Tools, 2, 2, true); result += GetTargetValueFromBlockList(grid.Turrets, 7.5f, 4, true); return(result); }
public static Vector2 GridPowerOutput(GridEntity grid) { var result = Vector2.Zero; if (grid.IsClosed()) { return(result); } foreach (var block in grid.Power) { if (block.IsClosed()) { continue; } var powerBlock = block.Block as IMyPowerProducer; if (powerBlock == null) { continue; } result.X += powerBlock.CurrentOutput; result.Y += powerBlock.MaxOutput; } return(result); }
public static float GridTargetValue(GridEntity grid) { float result = 0; if (grid.IsClosed()) { return(result); } result += GetTargetValueFromBlockList(grid.Antennas, 4, 2); result += GetTargetValueFromBlockList(grid.Beacons, 3, 2); result += GetTargetValueFromBlockList(grid.Containers, 0.5f, 2, true); result += GetTargetValueFromBlockList(grid.Controllers, 0.5f, 2); result += GetTargetValueFromBlockList(grid.Gravity, 2, 4, true); result += GetTargetValueFromBlockList(grid.Guns, 5, 4, true); result += GetTargetValueFromBlockList(grid.JumpDrives, 10, 2); result += GetTargetValueFromBlockList(grid.Mechanical, 1, 2); result += GetTargetValueFromBlockList(grid.Medical, 10, 2); result += GetTargetValueFromBlockList(grid.NanoBots, 15, 2); result += GetTargetValueFromBlockList(grid.Production, 2, 2, true); result += GetTargetValueFromBlockList(grid.Power, 0.5f, 2, true); result += GetTargetValueFromBlockList(grid.Shields, 15, 2); result += GetTargetValueFromBlockList(grid.Thrusters, 1, 2); result += GetTargetValueFromBlockList(grid.Tools, 2, 2, true); result += GetTargetValueFromBlockList(grid.Turrets, 7.5f, 4, true); //Factor Power //Factor Total Block Count //Factor Static/Dynamic //Factor Grid Box Size //Factor Cube Size return(result); }
public static bool GridShielded(GridEntity grid) { if (grid.IsClosed()) { return(false); } if (EntityShielded(grid.CubeGrid)) { return(true); } foreach (var shield in grid.Shields) { if (shield.IsClosed() || !shield.Working || !shield.Functional) { continue; } return(true); } return(false); }