示例#1
0
        public override void Init(MyObjectBuilder_EntityBase objectBuilder)
        {
            m_objectBuilder     = objectBuilder;
            Entity.NeedsUpdate |= MyEntityUpdateEnum.EACH_FRAME | MyEntityUpdateEnum.BEFORE_NEXT_FRAME;
            NeedsUpdate        |= MyEntityUpdateEnum.EACH_FRAME | MyEntityUpdateEnum.BEFORE_NEXT_FRAME;

            m_shieldType = getShieldType();

            IMyCubeBlock cubeBlock = Entity as IMyCubeBlock;


            cubeBlock.AddUpgradeValue("ShieldPoints", 1f);
            cubeBlock.AddUpgradeValue("ShieldRecharge", 1f);
            cubeBlock.AddUpgradeValue("PowerConsumption", 1f);

            Sandbox.ModAPI.IMyTerminalBlock terminalBlock = Entity as Sandbox.ModAPI.IMyTerminalBlock;

            terminalBlock.AppendingCustomInfo += UpdateBlockInfo;

            //debug
            if (!EnergyShieldsCore.shieldGenerators.ContainsKey(Entity.EntityId))
            {
                EnergyShieldsCore.shieldGenerators.TryAdd(Entity.EntityId, this);
            }
        }
        public override void Init(MyObjectBuilder_EntityBase objectBuilder)
        {
            base.Init(objectBuilder);
            this.objectBuilder = objectBuilder;

            Entity.NeedsUpdate |= MyEntityUpdateEnum.BEFORE_NEXT_FRAME | MyEntityUpdateEnum.EACH_FRAME | MyEntityUpdateEnum.EACH_100TH_FRAME;

            functionalBlock = Entity as Sandbox.ModAPI.IMyFunctionalBlock;
            cubeBlock       = Entity as IMyCubeBlock;
            terminalBlock   = Entity as Sandbox.ModAPI.IMyTerminalBlock;

            subtypeName = functionalBlock.BlockDefinition.SubtypeName;

            getAttractorWeaponInfo(subtypeName);
            initCharges();

            cubeBlock.AddUpgradeValue("PowerEfficiency", 1.0f);
            cubeBlock.OnUpgradeValuesChanged += onUpgradeValuesChanged;

            terminalBlock.AppendingCustomInfo += appendCustomInfo;

            IMyCubeBlock cube = Entity as IMyCubeBlock;

            lastShootTime = ((MyObjectBuilder_LargeGatlingTurret)cube.GetObjectBuilderCubeBlock()).GunBase.LastShootTime;
        }
        public override void Init(MyObjectBuilder_EntityBase objectBuilder)
        {
            m_objectBuilder = objectBuilder;

            NeedsUpdate |= MyEntityUpdateEnum.EACH_FRAME | MyEntityUpdateEnum.BEFORE_NEXT_FRAME;

            m_shieldType = getShieldType();

            IMyCubeBlock cubeBlock = Entity as IMyCubeBlock;


            cubeBlock.AddUpgradeValue("ShieldPoints", 1f);
            cubeBlock.AddUpgradeValue("ShieldRecharge", 1f);
            cubeBlock.AddUpgradeValue("PowerConsumption", 1f);

            Sandbox.ModAPI.IMyTerminalBlock terminalBlock = Entity as Sandbox.ModAPI.IMyTerminalBlock;

            terminalBlock.AppendingCustomInfo += UpdateBlockInfo;
        }
示例#4
0
        public override void Init(MyObjectBuilder_EntityBase objectBuilder)
        {
            base.Init(objectBuilder);

            m_gyro   = Entity as IMyGyro;
            m_parent = Entity as IMyCubeBlock;

            m_parent.AddUpgradeValue("GyroBoost", 0f);

            m_objectBuilder = objectBuilder;

            m_parent.OnUpgradeValuesChanged += OnUpgradeValuesChanged;
        }
        public override void Init(MyObjectBuilder_EntityBase objectBuilder)
        {
            base.Init(objectBuilder);

            m_objectBuilder = m_objectBuilder;

            Entity.NeedsUpdate |= MyEntityUpdateEnum.BEFORE_NEXT_FRAME | MyEntityUpdateEnum.EACH_FRAME;

            m_entityId = Entity.EntityId;

            m_functionalBlock = Entity as IMyFunctionalBlock;

            m_electricityDefinition = new MyDefinitionId(typeof(MyObjectBuilder_GasProperties), "Electricity");

            m_terminalBlock = Entity as IMyTerminalBlock;

            m_subtypeName = m_functionalBlock.BlockDefinition.SubtypeName;

            m_maxPower = getMaxPower(m_subtypeName);

            m_powerMultiplicator = getPowerMultiplicator(m_subtypeName);

            m_currentMaxPower = m_maxPower;

            m_maxRange = getMaxRange(m_subtypeName);

            m_maxRangeSquared = m_maxRange * m_maxRange;

            m_rayOffset = this.getRayOffset(m_subtypeName);

            m_info.rayOffset = m_rayOffset;

            m_info.functionalBlock = m_functionalBlock;

            m_info.subtypeName = m_subtypeName;

            m_cubeBlock = Entity as IMyCubeBlock;

            m_cubeBlock.AddUpgradeValue("OpticalPowerStrength", 1.0f);

            m_functionalBlock.CustomNameChanged += parseName;

            m_cubeBlock.OnUpgradeValuesChanged += onUpgradeValuesChanged;

            m_terminalBlock.AppendingCustomInfo += appendCustomInfo;
        }
        public override void Init(MyObjectBuilder_EntityBase objectBuilder)
        {
            base.Init(objectBuilder);
            this.objectBuilder = objectBuilder;

            Entity.NeedsUpdate |= MyEntityUpdateEnum.BEFORE_NEXT_FRAME | MyEntityUpdateEnum.EACH_FRAME;

            functionalBlock = Entity as Sandbox.ModAPI.IMyFunctionalBlock;
            cubeBlock       = Entity as IMyCubeBlock;
            terminalBlock   = Entity as Sandbox.ModAPI.IMyTerminalBlock;

            subtypeName = functionalBlock.BlockDefinition.SubtypeName;

            getPulseWeaponInfo(subtypeName);
            initCharges();

            terminalBlock.AppendingCustomInfo += appendCustomInfo;
            cubeBlock.AddUpgradeValue("PowerEfficiency", 1.0f);
        }