Exemple #1
0
        public BlockTarget(IMySlimBlock block, ShipyardItem item)
        {
            Block = block;
            if (CubeGrid.Physics == null && Projector != null)
            {
                ProjectorDist = Vector3D.DistanceSquared(block.GetPosition(), Projector.GetPosition());
            }
            CenterDist = Vector3D.DistanceSquared(block.GetPosition(), block.CubeGrid.Center());

            ToolDist = new Dictionary <long, double>();
            foreach (IMyCubeBlock tool in item.Tools)
            {
                ToolDist.Add(tool.EntityId, Vector3D.DistanceSquared(block.GetPosition(), tool.GetPosition()));
            }
            var blockDef = (MyCubeBlockDefinition)block.BlockDefinition;

            //IntegrityPointsPerSec = MaxIntegrity / BuildTimeSeconds
            //this is much, much faster than pulling the objectbuilder and getting the data from there.
            BuildTime = blockDef.MaxIntegrity / blockDef.IntegrityPointsPerSec;
        }