public static bool CanBuild(MyPrefabContainer prefabContainer, params object[] args) { MySmallShip smallShip = GetSmallShipFromArguments(args); return((MyFactions.GetFactionsRelation(smallShip, prefabContainer) == MyFactionRelationEnum.Friend) && prefabContainer.ContainsPrefab(PrefabTypesFlagEnum.FoundationFactory) && ControlIsInPlayerShip()); }
public MyGuiScreenEntityWithInventory(MyEntity entityWithInventory) : base(entityWithInventory, new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null, MyTextsWrapperEnum.EditInventory) { Debug.Assert(entityWithInventory is IMyInventory); EntityWithInventory = entityWithInventory as IMyInventory; if (entityWithInventory is MyPrefabHangar) { PrefabContainer = ((MyPrefabHangar)entityWithInventory).GetOwner(); } else { PrefabContainer = entityWithInventory as MyPrefabContainer; } m_itemsAdded = new List<MyInventoryItem>(); m_itemsRemoved = new List<MyInventoryItem>(); Init(); }
public MyPrefabBankNode(MyPrefabContainer owner) : base(owner) { }
public MyPrefabBase(MyPrefabContainer owner) { m_owner = owner; SnapPoints = new List<MyPrefabSnapPoint>(); m_kinematicParts = new List<MyPrefabKinematicPartBase>(); Save = false; m_sparksEffectUpdateEvent = sparksEffect_OnUpdate; m_sparksEffectDeleteEvent = sparksEffect_OnDelete; }
public MyPrefabScanner(MyPrefabContainer owner) : base(owner) { m_scannedEntities = new List<MyEntity>(); OnEntityScanned += m_owner.LaunchAlarm; }
/// <summary> /// Creates new foundation factory from player's inventory. When player has no foundation factory in inventory, then returns result false. /// </summary> /// <param name="result">Result of foundation factory creation</param> /// <returns>Instance of new foundation factory</returns> public static MyPrefabFoundationFactory TryCreateFoundationFactory(MyPlayer player, out bool result) { MyPrefabFoundationFactory foundationFactory = null; MyInventoryItem foundationFactoryItem = player.Ship.Inventory.GetInventoryItem(MyMwcObjectBuilderTypeEnum.PrefabFoundationFactory, (int)MyMwcObjectBuilder_PrefabFoundationFactory_TypesEnum.DEFAULT); if (foundationFactoryItem == null) { foundationFactoryItem = player.Ship.Inventory.GetInventoryItem(MyMwcObjectBuilderTypeEnum.FoundationFactory, null); } if (foundationFactoryItem == null) { result = false; } else { MyMwcObjectBuilder_PrefabFoundationFactory foundationFactoryBuilder = MyMwcObjectBuilder_Base.CreateNewObject(MyMwcObjectBuilderTypeEnum.PrefabFoundationFactory, (int)MyMwcObjectBuilder_PrefabFoundationFactory_TypesEnum.DEFAULT) as MyMwcObjectBuilder_PrefabFoundationFactory; MyMwcObjectBuilder_PrefabContainer prefabContainerBuilder = new MyMwcObjectBuilder_PrefabContainer( null, MyMwcObjectBuilder_PrefabContainer_TypesEnum.INSTANCE, new List<MyMwcObjectBuilder_PrefabBase>(), MyClientServer.LoggedPlayer.GetUserId(), player.Faction, new MyMwcObjectBuilder_Inventory(new List<MyMwcObjectBuilder_InventoryItem>(), 1000)); Matrix ffWorld = Matrix.Identity; ffWorld.Translation = player.Ship.WorldMatrix.Translation + player.Ship.WorldMatrix.Forward * 20; MyPrefabContainer prefabContainer = new MyPrefabContainer(); prefabContainer.Init(null, prefabContainerBuilder, ffWorld); MyEntities.Add(prefabContainer); MyPrefabConfiguration ffConfiguration = MyPrefabConstants.GetPrefabConfiguration(MyMwcObjectBuilderTypeEnum.PrefabFoundationFactory, (int)MyMwcObjectBuilder_PrefabFoundationFactory_TypesEnum.DEFAULT); foundationFactory = new MyPrefabFoundationFactory(prefabContainer); foundationFactory.Init(null, new Vector3(0f, 0f, 0f), Matrix.Identity, foundationFactoryBuilder, ffConfiguration); prefabContainer.AddPrefab(foundationFactory); player.Ship.Inventory.RemoveInventoryItemAmount(ref foundationFactoryItem, 1f); result = true; } return foundationFactory; }
private void Init(int entitiesCount) { m_activeContainer = MyEditor.Static.GetEditedPrefabContainer(); if (ActionEntities == null) ActionEntities = new List<MyEntity>(entitiesCount); }
public static bool CanBuild(MyPrefabContainer prefabContainer, params object[] args) { MySmallShip smallShip = GetSmallShipFromArguments(args); return (MyFactions.GetFactionsRelation(smallShip, prefabContainer) == MyFactionRelationEnum.Friend) && prefabContainer.ContainsPrefab(PrefabTypesFlagEnum.FoundationFactory) && ControlIsInPlayerShip(); }
public MyPrefabCamera(MyPrefabContainer owner) : base(owner) { }
public MyPrefabKinematicRotatingPart(MyPrefabContainer owner) : base(owner) { }
private static void SetContainerVisibleStatus(MyPrefabContainer container, bool visible) { if (visible) { MyScriptWrapper.UnhideEntity(container); } else { MyScriptWrapper.HideEntity(container); } }
protected static void HideContainer(MyPrefabContainer container) { SetContainerVisibleStatus(container, false); }
protected static void ShowContainer(MyPrefabContainer container) { SetContainerVisibleStatus(container, true); }
public MyPrefabKinematicPartBase(MyPrefabContainer owner) : base(owner) { Flags |= EntityFlags.NeedsId; }
public MyPrefabGenerator(MyPrefabContainer owner) : base(owner) { }
public MyPrefabLargeWeapon(MyPrefabContainer owner) : base(owner) { CheckExplosionObstacles = false; }
private static void UnpackMothership() { MyTrace.Send(TraceWindow.Saving, "Player unpacking mothership"); MyInventoryItem item = MySession.Static.Inventory.GetInventoryItem(MyMwcObjectBuilderTypeEnum.PrefabContainer, null); if (item != null) { //place largeship //MyMwcObjectBuilder_LargeShip largeShipObjectBuilder = (MyMwcObjectBuilder_LargeShip)inventoryItems[0].GetObjectBuilder(true); MyMwcObjectBuilder_PrefabContainer containerObjectBuilder = (MyMwcObjectBuilder_PrefabContainer)item.GetInventoryItemObjectBuilder(true); // We need to remove id's because mothership container could have same entity id in different sector containerObjectBuilder.RemapEntityIds(new MyEntityIdRemapContext()); MyPrefabContainer container = new MyPrefabContainer(); container.Init(null, containerObjectBuilder, FindMothershipPosition()); MyEntities.Add(container); //CreateFromObjectBuilderAndAdd(null, largeShipObjectBuilder, Matrix.CreateTranslation(MySession.PlayerShip.GetPosition() + new Vector3(100,100,0))); MySession.Static.Inventory.RemoveInventoryItem(item); container.Link(); MyTrace.Send(TraceWindow.Saving, "Player mothership found and unpacked"); } }
public MyPrefabSecurityControlHUB(MyPrefabContainer owner) : base(owner) { m_onEntityClosingHandler = OnEntityClosingHandler; }
public MyPrefabAlarm(MyPrefabContainer owner) : base(owner) { }
/// <summary> /// asteroid has to be either MyVoxelMap or MyStaticAsteroid. /// </summary> /// <param name="asteroid">Has to be either MyVoxelMap or MyStaticAsteroid!</param> public MyGuiScreenEditorPrefabContainer(MyPrefabContainer prefabContainer) : base(prefabContainer, new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null, MyTextsWrapperEnum.EditPrefabContainer) { Init(); }
/// <summary> /// Creates new instance of foundation factory prefab /// </summary> /// <param name="owner">Owner</param> public MyPrefabFoundationFactory(MyPrefabContainer owner) : base(owner) { Player = MySession.Static.Player; BuildObjects = new List<MyObjectToBuild>(); BuildingQueue = new List<MyObjectToBuild>(); BuildingObject = null; m_buildingTimeFromStart = 0; IsBuilding = false; }
public MyGuiControlPrefabContainerUse(IMyGuiControlsParent parent, MyPrefabContainer prefabContainer, MyTexture2D texture) : base(parent, new Vector2(0.452f, 0.127f), prefabContainer, texture) { }