private void Smite(IMyPlayer player, string oreName)
        {
            var worldMatrix = player.Controller.ControlledEntity.GetHeadMatrix(true, true, true);
            var maxspeed    = MyDefinitionManager.Static.EnvironmentDefinition.SmallShipMaxSpeed * 1.25f;

            var meteorBuilder = new MyObjectBuilder_Meteor
            {
                Item = new MyObjectBuilder_InventoryItem {
                    Amount = 1, PhysicalContent = new MyObjectBuilder_Ore {
                        SubtypeName = oreName
                    }
                },
                PersistentFlags        = MyPersistentEntityFlags2.InScene, // Very important
                PositionAndOrientation = new MyPositionAndOrientation
                {
                    Position = (worldMatrix.Translation + worldMatrix.Up * -0.5f).ToSerializableVector3D(),
                    Forward  = worldMatrix.Forward.ToSerializableVector3(),
                    Up       = worldMatrix.Up.ToSerializableVector3(),
                },
                LinearVelocity = worldMatrix.Down * -maxspeed, // has to be faster than JetPack speed, otherwise it could be avoided.
                // Update 01.052 seemed to have flipped the direction. It's Up instead of Down???
                Integrity = 1
            };

            meteorBuilder.CreateAndSyncEntity();
        }
        private void ThrowMeteor(string oreName, MatrixD viewMatrix)
        {
            var meteorBuilder = new MyObjectBuilder_Meteor
            {
                Item = new MyObjectBuilder_InventoryItem
                {
                    Amount          = 10000,
                    PhysicalContent = new MyObjectBuilder_Ore {
                        SubtypeName = oreName
                    }
                },
                PersistentFlags        = MyPersistentEntityFlags2.InScene, // Very important
                PositionAndOrientation = new MyPositionAndOrientation
                {
                    Position = viewMatrix.Translation,
                    Forward  = (Vector3)viewMatrix.Forward,
                    Up       = (Vector3)viewMatrix.Up,
                },
                LinearVelocity = viewMatrix.Forward * 500,
                Integrity      = 100,
            };

            meteorBuilder.CreateAndSyncEntity();
        }
示例#3
0
 public Meteor(MyObjectBuilder_Meteor definition, Object backingObject)
     : base(definition, backingObject)
 {
     m_item = new InventoryItemEntity(definition.Item);
 }