Esempio n. 1
0
        public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
        {
            base.Init(objectBuilder, cubeGrid);

            BlockDefinition = (MyThrustDefinition)base.BlockDefinition;

            var builder = (MyObjectBuilder_Thrust)objectBuilder;

            ThrustColor = BlockDefinition.FlameIdleColor;

            ThrustOverride = builder.ThrustOverride;

            LoadDummies();

            m_light = MyLights.AddLight();
            m_light.ReflectorDirection = WorldMatrix.Forward;
            m_light.ReflectorUp = WorldMatrix.Up;
            m_light.ReflectorRange = 1;
            m_light.Color = ThrustColor;
            m_light.GlareMaterial = BlockDefinition.FlameGlareMaterial;
            m_light.GlareQuerySize = BlockDefinition.FlameGlareQuerySize;

            m_glareSize = BlockDefinition.FlameGlareSize;
            m_maxBillboardDistanceSquared = BlockDefinition.FlameVisibilityDistance*BlockDefinition.FlameVisibilityDistance;
            m_maxLightDistanceSquared = m_maxBillboardDistanceSquared / 100;

            m_light.Start(MyLight.LightTypeEnum.PointLight, 1);
            SyncObject = new MySyncThruster(this);

            UpdateDetailedInfo();

            FuelConverterDefinition = !MyFakes.ENABLE_HYDROGEN_FUEL ? new MyFuelConverterInfo { Efficiency = 1.0f } : BlockDefinition.FuelConverter;

            MyDefinitionId fuelId = new MyDefinitionId();
            if (!BlockDefinition.FuelConverter.FuelId.IsNull())
                fuelId = BlockDefinition.FuelConverter.FuelId;

            MyGasProperties fuelDef = null;
            if (MyFakes.ENABLE_HYDROGEN_FUEL)
                MyDefinitionManager.Static.TryGetDefinition(fuelId, out fuelDef);

            FuelDefinition = fuelDef ?? new MyGasProperties // Use electricity by default
            {
                Id = MyResourceDistributorComponent.ElectricityId,
                EnergyDensity = 1f,
            };

	        MyEntityThrustComponent entityThrustComponent;
	        if (!cubeGrid.Components.TryGet(out entityThrustComponent))
	        {
		        entityThrustComponent = new MyThrusterBlockThrustComponent();

                entityThrustComponent.Init();
		        cubeGrid.Components.Add<MyEntityThrustComponent>(entityThrustComponent);
	        }

            m_thrustComponent = entityThrustComponent;
        }
Esempio n. 2
0
        public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
        {
            base.Init(objectBuilder, cubeGrid);

            m_thrustDefinition = (MyThrustDefinition)BlockDefinition;

            var builder = (MyObjectBuilder_Thrust)objectBuilder;

            m_thrustColor = m_thrustDefinition.FlameIdleColor;

            ThrustOverride = builder.ThrustOverride;

            LoadDummies();

            m_light = MyLights.AddLight();
            m_light.ReflectorDirection = WorldMatrix.Forward;
            m_light.ReflectorUp = WorldMatrix.Up;
            m_light.ReflectorRange = 1;
            m_light.Color = m_thrustColor;
            m_light.GlareMaterial = m_thrustDefinition.FlameGlareMaterial;
            m_light.GlareQuerySize = m_thrustDefinition.FlameGlareQuerySize;

            m_glareSize = m_thrustDefinition.FlameGlareSize;
            m_maxBillboardDistanceSquared = m_thrustDefinition.FlameVisibilityDistance * m_thrustDefinition.FlameVisibilityDistance;
            m_maxLightDistanceSquared = m_maxBillboardDistanceSquared / 100;

            m_light.Start(MyLight.LightTypeEnum.PointLight, 1);
            SyncObject = new MySyncThruster(this);
        }