Exemple #1
0
        private void SetupBlockAsRegularWeapon(IMyTerminalBlock block)
        {
            IWeaponProfile iWeapon = null;

            if (block as IMyLargeTurretBase != null)
            {
                Logger.MsgDebug(block.CustomName + " Is Regular Turret Weapon", DebugTypeEnum.Weapon);
                iWeapon = new TurretWeaponProfile(_remoteControl, block);
            }
            else if (block as IMyUserControllableGun != null)
            {
                Logger.MsgDebug(block.CustomName + " Is Regular Static Weapon", DebugTypeEnum.Weapon);
                iWeapon = new StaticWeaponProfile(_remoteControl, block);
            }
            else
            {
                return;
            }

            if (!iWeapon.IsValid)
            {
                Logger.MsgDebug(block.CustomName + " Is Not Valid", DebugTypeEnum.Weapon);
                return;
            }

            Logger.MsgDebug(block.CustomName + " Added To Weapon Roster", DebugTypeEnum.Weapon);             //
            iWeapon.AssignWeaponSystemReference(this);
            Weapons.Add(iWeapon);
        }
Exemple #2
0
        private void SetupBlockAsCoreWeapon(IMyTerminalBlock block)
        {
            bool isStatic = false;

            if (Utilities.AllWeaponCoreGuns.Contains(block.SlimBlock.BlockDefinition.Id))
            {
                Logger.MsgDebug(block.CustomName + " Is WeaponCore Static Weapon", DebugTypeEnum.Weapon);
                isStatic = true;
            }

            var weaponsInBlock = new Dictionary <string, int>();

            RAI_SessionCore.Instance.WeaponCore.GetBlockWeaponMap(block, weaponsInBlock);

            Logger.MsgDebug(weaponsInBlock.Keys.Count.ToString() + " Results From WeaponCore.GetBlockWeaponMap", DebugTypeEnum.Weapon);

            foreach (var weaponName in weaponsInBlock.Keys)
            {
                WeaponDefinition weaponDef = new WeaponDefinition();

                foreach (var definition in RAI_SessionCore.Instance.WeaponCore.WeaponDefinitions)
                {
                    if (definition.HardPoint.WeaponName == weaponName)
                    {
                        weaponDef = definition;
                        break;
                    }
                }

                IWeaponProfile iWeapon = null;

                if (isStatic)
                {
                    Logger.MsgDebug(block.CustomName + " Registered as WeaponCore Static", DebugTypeEnum.Weapon);
                    iWeapon = new WeaponCoreStaticProfile(_remoteControl, block, weaponDef, weaponsInBlock[weaponName]);
                }
                else
                {
                    Logger.MsgDebug(block.CustomName + " Registered as WeaponCore Turret", DebugTypeEnum.Weapon);
                    iWeapon = new WeaponCoreTurretProfile(_remoteControl, block, weaponDef, weaponsInBlock[weaponName]);
                }

                if (!iWeapon.IsValid || (iWeapon.IsStatic && !this.UseStaticGuns) || (iWeapon.IsTurret && !this.UseTurrets))
                {
                    Logger.MsgDebug(block.CustomName + " Was Not WeaponCore Valid", DebugTypeEnum.Weapon);
                    return;
                }

                Logger.MsgDebug(block.CustomName + " Added To Weapon Roster", DebugTypeEnum.Weapon);
                iWeapon.AssignWeaponSystemReference(this);
                Weapons.Add(iWeapon);
            }
        }