public override bool CanStack(MyObjectBuilder_PhysicalObject a) { MyObjectBuilder_BlockItem other = a as MyObjectBuilder_BlockItem; if (other == null) { return(false); } return(other.BlockDefId.TypeId == BlockDefId.TypeId && other.BlockDefId.SubtypeId == this.BlockDefId.SubtypeId && a.Flags == this.Flags); }
private bool AddBlock(Entities.Cube.MySlimBlock block) { if (block.FatBlock is IMyInventoryOwner) //we cannot store inventory in inventory now return false; MyObjectBuilder_BlockItem item = new MyObjectBuilder_BlockItem(); item.BlockDefId = block.BlockDefinition.Id; if (CanItemsBeAdded(1, item.BlockDefId)) { AddItems(1, item); return true; } return false; }
private bool AddBlocks(MyCubeBlockDefinition blockDef, MyFixedPoint amount) { MyObjectBuilder_BlockItem item = new MyObjectBuilder_BlockItem(); item.BlockDefId = blockDef.Id; if (CanItemsBeAdded(amount, item.BlockDefId)) { AddItems(amount, item); return true; } return false; }