Exemplo n.º 1
0
        public void AddEntity(IMyEntity ientity, bool blockManipulatedEntity = true)
        {
            MyEntity entity = ientity as MyEntity;

            if (entity == null)
            {
                return;
            }
            MyCubeBlock block;

            // this code checks if this entity can be used as component for building, we want add only those cubegrids to inventories
            MyCubeGrid grid = MyItemsCollector.TryGetAsComponent(entity, out block, blockManipulatedEntity);

            if (grid != null)
            {
                if (!AddGrid(grid))
                {
                    MyHud.Notifications.Add(MyNotificationSingletons.InventoryFull);
                }
            }
            else if (entity is MyFloatingObject)
            {
                var floating = entity as MyFloatingObject;
                var amount   = floating.Item.Amount;
                amount = MyFixedPoint.Min(amount, ComputeAmountThatFits(floating.Item.Content.GetObjectId()));
                if (amount == 0)
                {
                    MyHud.Notifications.Add(MyNotificationSingletons.InventoryFull);
                }
                else
                {
                    TakeFloatingObject(floating);
                }
            }
        }
Exemplo n.º 2
0
 protected MyBehaviorTreeState FindClosestPlaceAreaInRadius([BTParam] float radius, [BTParam] string typeName, [BTOut] ref MyBBMemoryTarget outTarget)
 {
     if (MyItemsCollector.FindClosestPlaceAreaInSphere(new BoundingSphereD(Bot.AgentEntity.PositionComp.GetPosition(), radius), typeName, ref outTarget))
     {
         return(MyBehaviorTreeState.SUCCESS);
     }
     return(MyBehaviorTreeState.FAILURE);
 }