public ShipyardItem(MyOrientedBoundingBoxD box, List <IMyCubeBlock> tools, ShipyardType yardType, IMyEntity yardEntity) { ShipyardBox = box; Tools = tools; YardType = yardType; YardEntity = yardEntity; }
public void Init(ShipyardType yardType) { if (YardType == yardType) { return; } Logging.Instance.WriteDebug("YardItem.Init: " + yardType); YardType = yardType; foreach (IMyCubeGrid grid in ContainsGrids) { ((MyCubeGrid)grid).OnGridSplit += OnGridSplit; } YardGrids = ContainsGrids.Where(x => !x.Closed && !x.MarkedForClose).ToList(); ContainsGrids.Clear(); IntersectsGrids.Clear(); Utilities.Invoke(() => { foreach (IMyCubeBlock tool in Tools) { var myFunctionalBlock = tool as IMyFunctionalBlock; if (myFunctionalBlock != null) { myFunctionalBlock.Enabled = true; //.RequestEnable(true); } } }); Communication.SendYardState(this); }
public ShipyardItem(MyOrientedBoundingBoxD box, IMyCubeBlock[] tools, ShipyardType yardType, IMyEntity yardEntity) { ShipyardBox = box; Tools = tools; YardType = yardType; YardEntity = yardEntity; StaticYard = tools[0].BlockDefinition.SubtypeId == "ShipyardCorner_Large"; }
public static void SendYardCommand(long yardId, ShipyardType type) { var data = new byte[sizeof(long) + 1]; BitConverter.GetBytes(yardId).CopyTo(data, 0); data[sizeof(long)] = (byte)type; SendMessageToServer(MessageTypeEnum.YardCommand, data); }
public void ProcessDisable() { if (!_shouldDisable.Item1) { return; } foreach (IMyCubeGrid grid in YardGrids) { ((MyCubeGrid)grid).OnGridSplit -= OnGridSplit; } YardGrids.Clear(); foreach (IMyCubeBlock tool in Tools) { BlocksToProcess[tool.EntityId] = new BlockTarget[3]; if (YardType == ShipyardType.Invalid) { Utilities.Invoke(() => { var comp = tool.GameLogic.GetAs <ShipyardCorner>(); comp.SetPowerUse(5); comp.SetMaxPower(5); comp.Shipyard = null; }); } } //TotalBlocks = 0; MissingComponentsDict.Clear(); ContainsGrids.Clear(); IntersectsGrids.Clear(); ProxDict.Clear(); TargetBlocks.Clear(); YardType = ShipyardType.Disabled; if (_shouldDisable.Item2 && MyAPIGateway.Multiplayer.IsServer) { Communication.SendYardState(this); } _shouldDisable.Item1 = false; _shouldDisable.Item2 = false; }