/// <summary> /// Adds object to building queue /// </summary> /// <param name="objectToBuild">Object to build</param> public void AddToBuildingQueue(MyObjectToBuild objectToBuild) { if (!objectToBuild.BuildingSpecification.CanBuild(this)) { throw new Exception("You can't build this!"); } BuildingQueue.Add(objectToBuild); ChangeInventoryItemsAmount(true, 1f, objectToBuild); if (!IsBuilding) { StartBuilding(); } }
protected override void InitPrefab(string displayName, Vector3 relativePosition, Matrix localOrientation, MyMwcObjectBuilder_PrefabBase objectBuilder, MyPrefabConfiguration prefabConfig) { MyMwcObjectBuilder_PrefabFoundationFactory objectBuilderFF = objectBuilder as MyMwcObjectBuilder_PrefabFoundationFactory; IsBuilding = objectBuilderFF.IsBuilding; m_buildingTimeFromStart = objectBuilderFF.BuildingTimeFromStart; if (objectBuilderFF.BuildingObject != null) { BuildingObject = MyObjectToBuild.CreateFromObjectBuilder(objectBuilderFF.BuildingObject.ObjectBuilder, objectBuilderFF.BuildingObject.Amount); } if (objectBuilderFF.BuildingQueue != null) { foreach (MyMwcObjectBuilder_ObjectToBuild buildingQueue in objectBuilderFF.BuildingQueue) { BuildingQueue.Add(MyObjectToBuild.CreateFromObjectBuilder(buildingQueue.ObjectBuilder, buildingQueue.Amount)); } } }