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;
        }
Exemple #2
0
        private void SpawnOrePieces(MyFixedPoint amountItems, MyFixedPoint maxAmountPerDrop, Vector3 hitPosition, MyObjectBuilder_PhysicalObject oreObjBuilder, MyVoxelMaterialDefinition voxelMaterial)
        {
            if(Sync.IsServer == false)
            {
                return;
            }

            ProfilerShort.Begin("SpawnOrePieces");
            var forward = Vector3.Normalize(m_sensor.FrontPoint - m_sensor.Center);
            //var pos = m_sensor.CutOutSphere.Center + forward * m_floatingObjectSpawnOffset;
            var pos = hitPosition - forward * m_floatingObjectSpawnRadius;
            BoundingSphere bsphere = new BoundingSphere(pos, m_floatingObjectSpawnRadius);

            while (amountItems > 0)
            {
                //new: MyFixedPoint dropAmount = amountItems;
                //original: MyFixedPoint dropAmount = MyFixedPoint.Min(amountItems, maxAmountPerDrop);
                MyFixedPoint dropAmount = MyFixedPoint.Min(amountItems, maxAmountPerDrop);
                amountItems -= dropAmount;
                var inventoryItem = new MyPhysicalInventoryItem(dropAmount, oreObjBuilder);
                var item = MyFloatingObjects.Spawn(inventoryItem, bsphere, null, voxelMaterial);
                item.Physics.LinearVelocity = MyUtils.GetRandomVector3HemisphereNormalized(forward) * MyUtils.GetRandomFloat(1.5f, 4);//original speed 5-8
                item.Physics.AngularVelocity = MyUtils.GetRandomVector3Normalized() * MyUtils.GetRandomFloat(4, 8);
            }
            ProfilerShort.End();
        }
		public override bool CanStack(MyObjectBuilder_PhysicalObject a)
		{
			return false;
		}
 public override bool CanStack(MyObjectBuilder_PhysicalObject a)
 {
     return(false);
 }
 public virtual bool CanStack(MyObjectBuilder_PhysicalObject a)
 {
     if (a == null) return false;
     return CanStack(a.TypeId, a.SubtypeId, a.Flags);
 }